QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#295006#4824. Bracket-and-bar Sequencesucup-team122#AC ✓8ms3892kbC++206.7kb2023-12-30 17:56:352023-12-30 17:56:37

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

encode
3
1
(|)
4
((((|)|)|)|)
5
(|(|))((|(|))|)

output:

0
0
207

input:

decode
3
1
0
4
0
5
207

output:

(|)
((((|)|)|)|)
(|(|))((|(|))|)

result:

ok 3 lines

Test #2:

score: 100
Accepted
time: 0ms
memory: 3816kb

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

encode
3
2
((|)|)
1
(|)
2
(|(|))

output:

0
0
1

input:

decode
3
2
0
1
0
2
1

output:

((|)|)
(|)
(|(|))

result:

ok 3 lines

Test #4:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

encode
1000
3
(|)(|)(|)
3
(|)(|(|))
3
(|)((|)|)
3
(|(|))(|)
3
(|(|)(|))
3
(|(|(|)))
3
(|((|)|))
3
((|)|)(|)
3
((|)|(|))
3
((|)(|)|)
3
((|(|))|)
3
(((|)|)|)
4
(|)(|)(|)(|)
4
(|)(|)(|(|))
4
(|)(|)((|)|)
4
(|)(|(|))(|)
4
(|)(|(|)(|))
4
(|)(|(|(|)))
4
(|)(|((|)|))
4
(|)((|)|)(|)
4
(|)((|)|(|))
4
(|)((|)...

output:

11
10
9
8
7
6
5
4
3
2
1
0
54
53
52
51
50
49
48
47
46
45
44
43
42
41
40
39
35
30
38
37
36
34
33
32
31
29
28
27
26
25
24
23
22
21
20
19
18
17
12
6
16
11
5
15
14
13
10
9
8
7
4
3
2
1
0
272
271
270
269
268
267
266
265
264
263
262
261
260
259
258
257
253
248
256
255
254
252
251
250
249
247
246
245
244
243...

input:

decode
1000
3
11
3
10
3
9
3
8
3
7
3
6
3
5
3
4
3
3
3
2
3
1
3
0
4
54
4
53
4
52
4
51
4
50
4
49
4
48
4
47
4
46
4
45
4
44
4
43
4
42
4
41
4
40
4
39
4
35
4
30
4
38
4
37
4
36
4
34
4
33
4
32
4
31
4
29
4
28
4
27
4
26
4
25
4
24
4
23
4
22
4
21
4
20
4
19
4
18
4
17
4
12
4
6
4
16
4
11
4
5
4
15
4
14
4
13
4
10
4
9
4...

output:

(|)(|)(|)
(|)(|(|))
(|)((|)|)
(|(|))(|)
(|(|)(|))
(|(|(|)))
(|((|)|))
((|)|)(|)
((|)|(|))
((|)(|)|)
((|(|))|)
(((|)|)|)
(|)(|)(|)(|)
(|)(|)(|(|))
(|)(|)((|)|)
(|)(|(|))(|)
(|)(|(|)(|))
(|)(|(|(|)))
(|)(|((|)|))
(|)((|)|)(|)
(|)((|)|(|))
(|)((|)(|)|)
(|)((|(|))|)
(|)(((|)|)|)
(|(|))(|)(|)
(|(|))(|(|)...

result:

ok 1000 lines

Test #5:

score: 100
Accepted
time: 2ms
memory: 3616kb

input:

encode
1000
6
(|((((|)|)|)|)(|))
6
(|((|)(|)(|)|(|)))
6
(|((|)(|(|))|(|)))
6
(|((|)((|)|)|(|)))
6
(|((|(|))(|)|(|)))
6
(|((|(|)(|))|(|)))
6
(|((|(|(|)))|(|)))
6
(|((|((|)|))|(|)))
6
(|(((|)|)(|)|(|)))
6
(|(((|)|(|))|(|)))
6
(|(((|)(|)|)|(|)))
6
(|(((|(|))|)|(|)))
6
(|((((|)|)|)|(|)))
6
(|((|)(|)(|)(...

output:

708
812
806
799
779
773
766
758
737
731
724
716
707
811
810
809
805
804
803
802
798
797
796
795
794
778
777
776
772
765
757
771
770
769
764
763
762
761
756
755
754
753
752
736
735
734
730
729
728
727
723
715
706
722
714
705
721
720
719
713
712
711
710
704
703
702
701
700
699
698
697
696
695
694
693
...

input:

decode
1000
6
708
6
812
6
806
6
799
6
779
6
773
6
766
6
758
6
737
6
731
6
724
6
716
6
707
6
811
6
810
6
809
6
805
6
804
6
803
6
802
6
798
6
797
6
796
6
795
6
794
6
778
6
777
6
776
6
772
6
765
6
757
6
771
6
770
6
769
6
764
6
763
6
762
6
761
6
756
6
755
6
754
6
753
6
752
6
736
6
735
6
734
6
730
6
729
...

output:

(|((((|)|)|)|)(|))
(|((|)(|)(|)|(|)))
(|((|)(|(|))|(|)))
(|((|)((|)|)|(|)))
(|((|(|))(|)|(|)))
(|((|(|)(|))|(|)))
(|((|(|(|)))|(|)))
(|((|((|)|))|(|)))
(|(((|)|)(|)|(|)))
(|(((|)|(|))|(|)))
(|(((|)(|)|)|(|)))
(|(((|(|))|)|(|)))
(|((((|)|)|)|(|)))
(|((|)(|)(|)(|)|))
(|((|)(|)(|(|))|))
(|((|)(|)((|)|)...

result:

ok 1000 lines

Test #6:

score: 100
Accepted
time: 3ms
memory: 3704kb

input:

encode
1000
7
((|)(|(|(|)(|)))|(|))
7
((|)(|(|)(|)(|))(|)|)
7
(|(|(|)((|)|))(|(|)))
7
((|(|))|(|))(|(|))(|)
7
(|)((|(|)((|)|)(|))|)
7
(((|(|)(|))|((|)|))|)
7
((|)((|(|))(|(|))|)|)
8
(|)(|)(|(|))((|((|)|))|)
7
((|)|)((|)|)(((|)|)|)
7
(|)((|)|)(((|)|(|))|)
7
(|((|)|(|)))(|(|)(|))
7
((|)|(|(|)((|)|))(|...

output:

2767
2805
5359
2389
6667
580
2539
42942
3721
6972
4748
3410
43105
2685
5305
4643
5125
968
4910
3148
4762
4509
2715
50
1479
3707
7073
4438
1167
6594
223
5499
1871
6037
4018
2259
163
4767
976
7065
4742
6919
3534
5096
5678
5714
449
4400
6083
4463
182
3650
3303
6080
7404
139
2852
3468
4088
954
806
2106
...

input:

decode
1000
7
2767
7
2805
7
5359
7
2389
7
6667
7
580
7
2539
8
42942
7
3721
7
6972
7
4748
7
3410
8
43105
7
2685
7
5305
7
4643
7
5125
7
968
7
4910
7
3148
7
4762
7
4509
7
2715
7
50
7
1479
7
3707
7
7073
7
4438
7
1167
7
6594
7
223
7
5499
7
1871
7
6037
7
4018
7
2259
7
163
7
4767
7
976
7
7065
7
4742
7
6919...

output:

((|)(|(|(|)(|)))|(|))
((|)(|(|)(|)(|))(|)|)
(|(|(|)((|)|))(|(|)))
((|(|))|(|))(|(|))(|)
(|)((|(|)((|)|)(|))|)
(((|(|)(|))|((|)|))|)
((|)((|(|))(|(|))|)|)
(|)(|)(|(|))((|((|)|))|)
((|)|)((|)|)(((|)|)|)
(|)((|)|)(((|)|(|))|)
(|((|)|(|)))(|(|)(|))
((|)|(|(|)((|)|))(|))
(|)(|)(|)((|)|(|))((|)|)
((|)((|)...

result:

ok 1000 lines

Test #7:

score: 100
Accepted
time: 3ms
memory: 3808kb

input:

encode
1000
7
(|(|)(|)(|(((|)|)|)))
7
(((|)|)((|)|)(|(|))|)
7
(|(|))((|)(|)|(|(|)))
7
(|)(|((|((|(|))|))|))
7
(|((|)|(|))(|((|)|)))
7
(|)((|(|)(|(|)))(|)|)
7
(((|)(|)(|)|)|(|(|)))
7
((|(|))|)((|)|)(|(|))
7
(|)(|(|((|)(|)|(|))))
7
(((|)(|)|)|(|))(|)(|)
7
(|)(|(|(|)((|)|))(|))
7
((|)(|)|(((|)|)|(|)))
...

output:

5941
1186
6145
7077
4729
6675
879
2416
7226
960
7286
3010
42791
43200
3771
4107
5771
892
42946
42603
1944
5081
2563
76
2661
3296
3896
6224
6034
49
3102
4007
7542
1070
2963
1722
5377
3038
7212
4783
7164
1352
4889
5670
119
4033
4507
1134
6417
6280
3215
7232
6152
7531
5730
158
1001
3002
7121
5609
3245
...

input:

decode
1000
7
5941
7
1186
7
6145
7
7077
7
4729
7
6675
7
879
7
2416
7
7226
7
960
7
7286
7
3010
8
42791
8
43200
7
3771
7
4107
7
5771
7
892
8
42946
8
42603
7
1944
7
5081
7
2563
7
76
7
2661
7
3296
7
3896
7
6224
7
6034
7
49
7
3102
7
4007
7
7542
7
1070
7
2963
7
1722
7
5377
7
3038
7
7212
7
4783
7
7164
7
13...

output:

(|(|)(|)(|(((|)|)|)))
(((|)|)((|)|)(|(|))|)
(|(|))((|)(|)|(|(|)))
(|)(|((|((|(|))|))|))
(|((|)|(|))(|((|)|)))
(|)((|(|)(|(|)))(|)|)
(((|)(|)(|)|)|(|(|)))
((|(|))|)((|)|)(|(|))
(|)(|(|((|)(|)|(|))))
(((|)(|)|)|(|))(|)(|)
(|)(|(|(|)((|)|))(|))
((|)(|)|(((|)|)|(|)))
(|)(|)(|(|(|(|))))(|)(|)
(|)(|)(|)(|...

result:

ok 1000 lines

Test #8:

score: 100
Accepted
time: 3ms
memory: 3820kb

input:

encode
1000
7
(((|)|(|)(|)(|)(|))|)
7
(|)(|(|(|)))((|(|))|)
7
((|)|)(|((|)|))(|(|))
7
(|(|(|)))((|(|(|)))|)
7
(((|)(|)|)|(|(|)))(|)
7
((|)((((|)|)|)|)|(|))
7
(|((|((|)|(|))(|))|))
7
((|)(((|)(|)(|)|)|)|)
8
(|)(|)(|)(|(|))((|)|(|))
7
(|(|(|))(|)((|(|))|))
7
((((|(|))|)(|)(|)|)|)
7
(|(|))((|)(|)|)((|)...

output:

1084
7325
3764
5549
953
2457
4229
2471
43199
5512
140
6148
3824
331
1401
6704
5487
707
2505
765
3965
3823
4695
4585
7068
29
7337
2409
6339
4422
5856
3366
5765
597
3693
42839
3165
2983
991
538
5703
3507
747
5418
77
6868
3609
4095
5380
3515
1454
4620
4601
4359
5704
20
4638
2842
669
3550
6867
1365
4221...

input:

decode
1000
7
1084
7
7325
7
3764
7
5549
7
953
7
2457
7
4229
7
2471
8
43199
7
5512
7
140
7
6148
7
3824
7
331
7
1401
7
6704
7
5487
7
707
7
2505
7
765
7
3965
7
3823
7
4695
7
4585
7
7068
7
29
7
7337
7
2409
7
6339
7
4422
7
5856
7
3366
7
5765
7
597
7
3693
8
42839
7
3165
7
2983
7
991
7
538
7
5703
7
3507
7
...

output:

(((|)|(|)(|)(|)(|))|)
(|)(|(|(|)))((|(|))|)
((|)|)(|((|)|))(|(|))
(|(|(|)))((|(|(|)))|)
(((|)(|)|)|(|(|)))(|)
((|)((((|)|)|)|)|(|))
(|((|((|)|(|))(|))|))
((|)(((|)(|)(|)|)|)|)
(|)(|)(|)(|(|))((|)|(|))
(|(|(|))(|)((|(|))|))
((((|(|))|)(|)(|)|)|)
(|(|))((|)(|)|)((|)|)
((|)|)(|)(((|)|(|))|)
((((|)|)|(|...

result:

ok 1000 lines

Test #9:

score: 100
Accepted
time: 3ms
memory: 3776kb

input:

encode
1000
7
((|(|)(|(|)))|)((|)|)
7
(|(|))((|(|(|(|))))|)
7
(|)(|(|((|)(|)|)))(|)
8
(|)(|)(|(|)(|))(|(|(|)))
7
(|((((|(|))|)|(|))|))
7
(((|(|))|)|)(|)((|)|)
7
((|(|))((|)|)|((|)|))
7
(((|(|))(|)|)(|)(|)|)
7
(|(|))(|(|)(|)(|)(|))
7
(((|)((|)|)|(|))(|)|)
7
((|(|)((|(|))|))(|)|)
7
(|)((|(|))(|)|((|)|...

output:

2084
6102
7229
42929
3894
725
2210
630
6252
776
2009
6714
218
6164
1971
1253
6712
2815
1905
42679
4350
6353
4694
43030
1957
5462
6380
2690
6836
6436
42544
5284
15
6030
43181
1151
6458
4488
6832
2169
880
43060
3145
3029
5694
2102
1132
1849
4058
2598
5091
4935
3119
5331
43220
3250
5701
1414
43059
6845...

input:

decode
1000
7
2084
7
6102
7
7229
8
42929
7
3894
7
725
7
2210
7
630
7
6252
7
776
7
2009
7
6714
7
218
7
6164
7
1971
7
1253
7
6712
7
2815
7
1905
8
42679
7
4350
7
6353
7
4694
8
43030
7
1957
7
5462
7
6380
7
2690
7
6836
7
6436
8
42544
7
5284
7
15
7
6030
8
43181
7
1151
7
6458
7
4488
7
6832
7
2169
7
880
8
4...

output:

((|(|)(|(|)))|)((|)|)
(|(|))((|(|(|(|))))|)
(|)(|(|((|)(|)|)))(|)
(|)(|)(|(|)(|))(|(|(|)))
(|((((|(|))|)|(|))|))
(((|(|))|)|)(|)((|)|)
((|(|))((|)|)|((|)|))
(((|(|))(|)|)(|)(|)|)
(|(|))(|(|)(|)(|)(|))
(((|)((|)|)|(|))(|)|)
((|(|)((|(|))|))(|)|)
(|)((|(|))(|)|((|)|))
((((|)(|)|)|)(|)|)(|)
(|(|))((|)|...

result:

ok 1000 lines

Test #10:

score: 100
Accepted
time: 3ms
memory: 3612kb

input:

encode
1000
7
((((|)|(|)(|))|)(|)|)
7
(((|)(|)|)(|)(|(|))|)
7
(|)(|((|(|)(|))(|)|))
7
(|(|)(((|)|)|(|))(|))
7
(|)((|(|))|(|(|(|))))
7
((|(|)(|)(|)(|))|)(|)
7
(|((|)(|(|)((|)|))|))
7
(((|)|(|))|)((|)|)(|)
7
(|)(((|(|))|(|))|(|))
7
(|(|))(|((|)|))(|(|))
7
(|(|)(|))(|(|((|)|)))
7
((|(|)(|))|(|))(|)(|)
...

output:

250
932
7096
5639
6728
2107
4510
1147
6425
6212
6027
2162
6373
3791
6125
4998
531
4185
4973
3241
43100
3807
2828
4173
43190
5139
3664
2290
2154
2068
6242
181
4661
2614
359
4017
3272
7263
636
4252
6895
7101
5926
585
2581
1644
4457
1302
42970
2093
6693
5621
3851
6729
4328
5535
7102
3282
6177
4548
5685...

input:

decode
1000
7
250
7
932
7
7096
7
5639
7
6728
7
2107
7
4510
7
1147
7
6425
7
6212
7
6027
7
2162
7
6373
7
3791
7
6125
7
4998
7
531
7
4185
7
4973
7
3241
8
43100
7
3807
7
2828
7
4173
8
43190
7
5139
7
3664
7
2290
7
2154
7
2068
7
6242
7
181
7
4661
7
2614
7
359
7
4017
7
3272
7
7263
7
636
7
4252
7
6895
7
710...

output:

((((|)|(|)(|))|)(|)|)
(((|)(|)|)(|)(|(|))|)
(|)(|((|(|)(|))(|)|))
(|(|)(((|)|)|(|))(|))
(|)((|(|))|(|(|(|))))
((|(|)(|)(|)(|))|)(|)
(|((|)(|(|)((|)|))|))
(((|)|(|))|)((|)|)(|)
(|)(((|(|))|(|))|(|))
(|(|))(|((|)|))(|(|))
(|(|)(|))(|(|((|)|)))
((|(|)(|))|(|))(|)(|)
(|)((((|)|)|(|))|(|))
((|)|)(|(|)(((...

result:

ok 1000 lines

Test #11:

score: 100
Accepted
time: 3ms
memory: 3624kb

input:

encode
1000
7
(|((|)(|)|(|))(|(|)))
7
(|(((|)|)(|((|)|))|))
7
(|)((|)((|)|)|)(|)(|)
7
(|(|))(|)(((|)(|)|)|)
7
(|(|(|((|)|(|)))))(|)
7
((|)(|(|))|(|))((|)|)
7
(|)((|)(|)|)(|(|))(|)
7
(|(((|)|(|(|)))|(|)))
7
(((|)((|)|)(|)|)|)(|)
7
((|)|)((((|)(|)|)|)|)
7
(((|)|(|)(|))|)((|)|)
7
(|(((|)(|)|)|(|(|))))
...

output:

4587
4116
6792
6271
5174
2860
6877
4080
772
3605
1097
4055
2037
2660
43083
1523
4965
2510
844
730
2755
2954
286
4066
2579
7489
43050
1534
2589
506
1724
948
2179
3907
2863
3620
7350
1382
5497
5430
4672
5767
5734
4684
6540
4005
3349
6443
4813
6599
2688
4592
6799
1265
6644
1463
7184
43033
2916
2654
162...

input:

decode
1000
7
4587
7
4116
7
6792
7
6271
7
5174
7
2860
7
6877
7
4080
7
772
7
3605
7
1097
7
4055
7
2037
7
2660
8
43083
7
1523
7
4965
7
2510
7
844
7
730
7
2755
7
2954
7
286
7
4066
7
2579
7
7489
8
43050
7
1534
7
2589
7
506
7
1724
7
948
7
2179
7
3907
7
2863
7
3620
7
7350
7
1382
7
5497
7
5430
7
4672
7
576...

output:

(|((|)(|)|(|))(|(|)))
(|(((|)|)(|((|)|))|))
(|)((|)((|)|)|)(|)(|)
(|(|))(|)(((|)(|)|)|)
(|(|(|((|)|(|)))))(|)
((|)(|(|))|(|))((|)|)
(|)((|)(|)|)(|(|))(|)
(|(((|)|(|(|)))|(|)))
(((|)((|)|)(|)|)|)(|)
((|)|)((((|)(|)|)|)|)
(((|)|(|)(|))|)((|)|)
(|(((|)(|)|)|(|(|))))
((|(|)((|)|))(|)|)(|)
((|)((|)|)(|)|...

result:

ok 1000 lines

Test #12:

score: 100
Accepted
time: 3ms
memory: 3616kb

input:

encode
1000
7
(|(|(|(|)(|)(|(|)))))
7
(|(|(|(|(|)))(|)))(|)
7
(|(((|)(|(|))|)|)(|))
7
(|((|)(|(|(|))(|))|))
7
(|)((|)(|)|(((|)|)|))
7
((|(|))(|)(|)(|)(|)|)
7
(((|(|))|)|)((|(|))|)
7
((|(|(|))((|)(|)|))|)
7
(|(|)(|(|(|))(|))(|))
7
(|((|)|(|)(|(|)))(|))
7
(|((|)|(|)(|)(|(|))))
7
((|)|((|)(|(|(|)))|))
...

output:

5251
5227
4031
4505
6851
2265
717
1907
5844
4709
4712
3251
6449
2613
43104
2180
12
5657
1954
3333
6187
7005
6330
4161
2643
2534
923
724
3266
3368
5153
7393
1459
2723
4591
7308
5860
47
378
5210
6321
3792
2270
1699
5379
3841
723
3386
5544
1254
1048
3482
857
43076
2151
527
6208
710
2283
6569
7455
3888
...

input:

decode
1000
7
5251
7
5227
7
4031
7
4505
7
6851
7
2265
7
717
7
1907
7
5844
7
4709
7
4712
7
3251
7
6449
7
2613
8
43104
7
2180
7
12
7
5657
7
1954
7
3333
7
6187
7
7005
7
6330
7
4161
7
2643
7
2534
7
923
7
724
7
3266
7
3368
7
5153
7
7393
7
1459
7
2723
7
4591
7
7308
7
5860
7
47
7
378
7
5210
7
6321
7
3792
7...

output:

(|(|(|(|)(|)(|(|)))))
(|(|(|(|(|)))(|)))(|)
(|(((|)(|(|))|)|)(|))
(|((|)(|(|(|))(|))|))
(|)((|)(|)|(((|)|)|))
((|(|))(|)(|)(|)(|)|)
(((|(|))|)|)((|(|))|)
((|(|(|))((|)(|)|))|)
(|(|)(|(|(|))(|))(|))
(|((|)|(|)(|(|)))(|))
(|((|)|(|)(|)(|(|))))
((|)|((|)(|(|(|)))|))
(|)(((|)(|(|(|)))|)|)
((|)((|)|(|((|...

result:

ok 1000 lines

Test #13:

score: 100
Accepted
time: 3ms
memory: 3568kb

input:

encode
1000
7
(|(|((|)|))(|))((|)|)
7
((|)(|)|)(|)(|(|(|)))
7
((((|(|))|(|(|)))|)|)
8
(|)(|)(|)(|(((|)|)|)(|))
7
((((((|)|)|)|)|)|(|))
7
(((|((|)|)((|)|))|)|)
7
(|(|((|)|))(|)((|)|))
7
((|)(|)|(|((|(|))|)))
7
(|(|(|(|)(|)(|)))(|))
7
(|(|)((|)|(((|)|)|)))
7
((((|((|)(|)|))|)|)|)
7
(|(|))(|(|)(|))(|(|...

output:

5126
3142
131
43126
11
450
5122
3039
5254
5723
90
6255
2497
2980
5333
345
4625
2802
184
4435
6562
6452
6362
943
6807
3569
2211
7185
4182
1805
2294
1746
6676
5817
4636
6235
2361
4004
42898
6854
4652
5124
6239
2475
7295
1520
6722
22
4656
5788
43135
43007
6986
933
6110
42905
5790
1424
3666
7396
5706
12...

input:

decode
1000
7
5126
7
3142
7
131
8
43126
7
11
7
450
7
5122
7
3039
7
5254
7
5723
7
90
7
6255
7
2497
7
2980
7
5333
7
345
7
4625
7
2802
7
184
7
4435
7
6562
7
6452
7
6362
7
943
7
6807
7
3569
7
2211
7
7185
7
4182
7
1805
7
2294
7
1746
7
6676
7
5817
7
4636
7
6235
7
2361
7
4004
8
42898
7
6854
7
4652
7
5124
7...

output:

(|(|((|)|))(|))((|)|)
((|)(|)|)(|)(|(|(|)))
((((|(|))|(|(|)))|)|)
(|)(|)(|)(|(((|)|)|)(|))
((((((|)|)|)|)|)|(|))
(((|((|)|)((|)|))|)|)
(|(|((|)|))(|)((|)|))
((|)(|)|(|((|(|))|)))
(|(|(|(|)(|)(|)))(|))
(|(|)((|)|(((|)|)|)))
((((|((|)(|)|))|)|)|)
(|(|))(|(|)(|))(|(|))
((|)(((|)|)|(|))|(|))
((|)(|)(|)|...

result:

ok 1000 lines

Test #14:

score: 100
Accepted
time: 3ms
memory: 3820kb

input:

encode
1000
8
(|(|((|)|)))(|(|)((|)|))
8
(|)(|(|)((|)(|)(|)|)(|))
8
(|)((|(|(|)(|))(|(|)))|)
8
(|)((|(((|)|)|))(|)|)(|)
8
(|((|)(|(|)(|(|)(|)))|))
8
(((|)|(|))(|((|)|(|)))|)
8
((|)(((|(|))(|)|)(|)|)|)
8
((|)((|)|)((|)(|)|)(|)|)
8
((|)|)(|(|(|)((|)|)(|)))
8
(|(|))(|((|)|(|((|)|))))
8
((((|)(|)(|)|(|)...

output:

29168
41220
37399
37006
25757
6723
14318
15369
21478
34917
1332
7763
23515
40720
25561
21394
41694
7709
30192
14789
11581
38805
32874
4028
31659
39762
37891
16299
454
40793
29789
17047
30047
100
11833
28460
24185
11371
23427
13866
35808
34838
25764
19903
39034
8222
38814
17302
25332
13427
42467
2062...

input:

decode
1000
8
29168
8
41220
8
37399
8
37006
8
25757
8
6723
8
14318
8
15369
8
21478
8
34917
8
1332
8
7763
8
23515
8
40720
8
25561
8
21394
8
41694
8
7709
8
30192
8
14789
8
11581
8
38805
8
32874
8
4028
8
31659
8
39762
8
37891
8
16299
8
454
8
40793
8
29789
8
17047
8
30047
8
100
8
11833
8
28460
8
24185
8...

output:

(|(|((|)|)))(|(|)((|)|))
(|)(|(|)((|)(|)(|)|)(|))
(|)((|(|(|)(|))(|(|)))|)
(|)((|(((|)|)|))(|)|)(|)
(|((|)(|(|)(|(|)(|)))|))
(((|)|(|))(|((|)|(|)))|)
((|)(((|(|))(|)|)(|)|)|)
((|)((|)|)((|)(|)|)(|)|)
((|)|)(|(|(|)((|)|)(|)))
(|(|))(|((|)|(|((|)|))))
((((|)(|)(|)|(|)(|))|)|)
(((|)|)|((|)(|)(|)|(|)))
...

result:

ok 1000 lines

Test #15:

score: 100
Accepted
time: 3ms
memory: 3544kb

input:

encode
1000
9
((|)((|((|)(|)|(|(|))))|)|)
9
((((|)(|(|))|(((|)|)|))|)|)
9
(|((|((|)(((|)|)|)|))|(|)))
9
(((((|)|)|)((|)(|)|)(|)|)|)
9
(|)(((|(|))(|(|))|)(|)|(|))
9
(|)(|((|)|)(|)(|)(|)((|)|))
9
((((|)(|(|))|)(|)|)(|(|))|)
9
(|(|))(((|)(|)|(|(|))(|))|)
9
(|(((|)|(|))|(|)((|)|))(|))
9
(((|(|)((|)(|)|)...

output:

86026
8515
139351
3560
207321
230824
8598
196556
135563
22066
139232
180687
21133
27246
132515
186909
164185
110237
233215
98936
149011
87033
208046
13485
220934
222558
45981
24739
205174
109116
6744
153490
142847
81288
245543
129904
205203
137822
195766
232374
174717
162874
80796
79119
52739
149913...

input:

decode
1000
9
86026
9
8515
9
139351
9
3560
9
207321
9
230824
9
8598
9
196556
9
135563
9
22066
9
139232
9
180687
9
21133
9
27246
9
132515
9
186909
9
164185
9
110237
9
233215
9
98936
9
149011
9
87033
9
208046
9
13485
9
220934
9
222558
9
45981
9
24739
9
205174
9
109116
9
6744
9
153490
9
142847
9
81288
...

output:

((|)((|((|)(|)|(|(|))))|)|)
((((|)(|(|))|(((|)|)|))|)|)
(|((|((|)(((|)|)|)|))|(|)))
(((((|)|)|)((|)(|)|)(|)|)|)
(|)(((|(|))(|(|))|)(|)|(|))
(|)(|((|)|)(|)(|)(|)((|)|))
((((|)(|(|))|)(|)|)(|(|))|)
(|(|))(((|)(|)|(|(|))(|))|)
(|(((|)|(|))|(|)((|)|))(|))
(((|(|)((|)(|)|)(|))|)(|)|)
(|((|((|(|))|)(|)(|)...

result:

ok 1000 lines

Test #16:

score: 100
Accepted
time: 4ms
memory: 3800kb

input:

encode
1000
10
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
10
((((((((((|)|)|)|)|)|)|)|)|)|)
10
(|(|(|(|(|(|(|(|(|(|))))))))))
10
((|)|)((|)|(((|)|)|)(|((|)|)))
10
(|)((|)|((|((|)(|((|)|))|))|))
10
(|)(((|)|)((|(|))((|)|)(|)|)|)
10
((|)(|((|)|))(|)((|(|))|(|))|)
10
(((((((|(|(|)))|)|)|)(|)|)|)|)
10
(((|)|((|)|))...

output:

1430714
0
1001833
715127
1291334
1226478
553654
215
230792
1148205
655691
593070
1005558
1213246
901030
930397
930211
1111092
648055
236633
1098395
574432
239621
418834
1406283
150916
173652
654712
121373
23378
540067
1373118
59408
964140
1216342
137798
616269
945286
1027297
1060902
992695
281947
66...

input:

decode
1000
10
1430714
10
0
10
1001833
10
715127
10
1291334
10
1226478
10
553654
10
215
10
230792
10
1148205
10
655691
10
593070
10
1005558
10
1213246
10
901030
10
930397
10
930211
10
1111092
10
648055
10
236633
10
1098395
10
574432
10
239621
10
418834
10
1406283
10
150916
10
173652
10
654712
10
121...

output:

(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
((((((((((|)|)|)|)|)|)|)|)|)|)
(|(|(|(|(|(|(|(|(|(|))))))))))
((|)|)((|)|(((|)|)|)(|((|)|)))
(|)((|)|((|((|)(|((|)|))|))|))
(|)(((|)|)((|(|))((|)|)(|)|)|)
((|)(|((|)|))(|)((|(|))|(|))|)
(((((((|(|(|)))|)|)|)(|)|)|)|)
(((|)|((|)|))|)(|)(|)((|)(|)|)
(|(|))(((|)|)(|)(|(|(...

result:

ok 1000 lines

Test #17:

score: 100
Accepted
time: 4ms
memory: 3824kb

input:

encode
1000
11
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
11
(((((((((((|)|)|)|)|)|)|)|)|)|)|)
11
(|(|(|(|(|(|(|(|(|(|(|)))))))))))
11
((|)|)((|(|))(|)(|)(|)|((|)(|)|))
11
(|((((|)|)|)|((|(|(((|)|)|)))|)))
11
((|)|(((|)|(|((|((|)|))|)(|)))|))
11
(((|)|)|)((|(|)(((|)|)|))(|(|))|)
11
((|)((|)|)|((|)((|)|)|(|(|...

output:

8414639
0
5940067
4214412
4509906
3743504
1749871
3230241
2658600
3792737
6467602
3944307
693965
7103073
2166194
5053715
6682433
7318757
3296250
7029308
6181589
1145474
1330982
6924981
5030430
488438
360465
115587
7882778
3814855
2566383
2080769
6054019
5657522
216855
8097571
3803377
7954832
8260575...

input:

decode
1000
11
8414639
11
0
11
5940067
11
4214412
11
4509906
11
3743504
11
1749871
11
3230241
11
2658600
11
3792737
11
6467602
11
3944307
11
693965
11
7103073
11
2166194
11
5053715
11
6682433
11
7318757
11
3296250
11
7029308
11
6181589
11
1145474
11
1330982
11
6924981
11
5030430
11
488438
11
360465
...

output:

(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
(((((((((((|)|)|)|)|)|)|)|)|)|)|)
(|(|(|(|(|(|(|(|(|(|(|)))))))))))
((|)|)((|(|))(|)(|)(|)|((|)(|)|))
(|((((|)|)|)|((|(|(((|)|)|)))|)))
((|)|(((|)|(|((|((|)|))|)(|)))|))
(((|)|)|)((|(|)(((|)|)|))(|(|))|)
((|)((|)|)|((|)((|)|)|(|(|(|)))))
((|(|)(|)(|))|((|(|))(|)|)(|...

result:

ok 1000 lines

Test #18:

score: 100
Accepted
time: 0ms
memory: 3568kb

input:

encode
1000
12
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
12
((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)
12
(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))
12
((|)|)((|)(|(|))(|(|))(|)((|)(|)|)|)
12
(((|(|((|)|))(|))(|)|)|)(((|)|)|(|))
12
((|)|)(|(|)((|(|((|)(|)|)))(|(|))|))
12
((|(|((|)|(|))(|)((|)|)(|)(|)(|)))|)
12
(|((|...

output:

50067107
0
35574762
25366000
4790575
25873295
13895458
30964728
22877411
25488356
4158573
39163880
40129681
45694167
8077843
44547150
49778975
27480969
3515474
34550471
13711498
18141627
35527105
41478873
3696490
18028877
16353161
12858168
3814356
24970768
40336706
11849041
43744608
23992958
4834422...

input:

decode
1000
12
50067107
12
0
12
35574762
12
25366000
12
4790575
12
25873295
12
13895458
12
30964728
12
22877411
12
25488356
12
4158573
12
39163880
12
40129681
12
45694167
12
8077843
12
44547150
12
49778975
12
27480969
12
3515474
12
34550471
12
13711498
12
18141627
12
35527105
12
41478873
12
3696490
...

output:

(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)
(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))
((|)|)((|)(|(|))(|(|))(|)((|)(|)|)|)
(((|(|((|)|))(|))(|)|)|)(((|)|)|(|))
((|)|)(|(|)((|(|((|)(|)|)))(|(|))|))
((|(|((|)|(|))(|)((|)|)(|)(|)(|)))|)
(|((|)((|)|(|(|))((|)|))|(|))(|)(|))
((|)...

result:

ok 1000 lines

Test #19:

score: 100
Accepted
time: 4ms
memory: 3772kb

input:

encode
1000
13
(((|)|(|((|)|)(|))(|)((|)|))(|((|)|))|)
13
(|((|)((|)|)((((|)|)((|)|)|)(|)|(|))|))
13
(|(|(|(|))(|)(|)(|(|((|)|)))(|(|))))(|)
13
((|(((|)|)(|(|))|((|)|(|))))((|(|))|)|)
13
(|)(((((|)|)|)(|)(|)(|(((|)|)|(|)))|)|)
13
((|((|)(|)(|)((|)|)|))|)(|)(|((|)(|)|))
13
(|(|)(|)((|(|(|(|)))(|))(|(...

output:

53626931
187458523
217663898
70282857
251826536
76740378
238880385
280531824
216530870
62436496
6653819
199414821
218322639
259880919
122963067
132317038
253220325
239624811
79252312
148418313
191682470
230280485
62107534
247094306
108812259
245603488
113334282
212257233
37291302
246459635
16555734
...

input:

decode
1000
13
53626931
13
187458523
13
217663898
13
70282857
13
251826536
13
76740378
13
238880385
13
280531824
13
216530870
13
62436496
13
6653819
13
199414821
13
218322639
13
259880919
13
122963067
13
132317038
13
253220325
13
239624811
13
79252312
13
148418313
13
191682470
13
230280485
13
621075...

output:

(((|)|(|((|)|)(|))(|)((|)|))(|((|)|))|)
(|((|)((|)|)((((|)|)((|)|)|)(|)|(|))|))
(|(|(|(|))(|)(|)(|(|((|)|)))(|(|))))(|)
((|(((|)|)(|(|))|((|)|(|))))((|(|))|)|)
(|)(((((|)|)|)(|)(|)(|(((|)|)|(|)))|)|)
((|((|)(|)(|)((|)|)|))|)(|)(|((|)(|)|))
(|(|)(|)((|(|(|(|)))(|))(|((|)|))|(|)))
(|)(|((|(|(|)(|)))|)...

result:

ok 1000 lines

Test #20:

score: 100
Accepted
time: 5ms
memory: 3556kb

input:

encode
1000
14
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
14
((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)
14
(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))
14
((|)|(|))(|((|)|))((|)((|)|(|)(|(|)))(|)|)
14
(|((|)|(|)((((|)|)|)(|)(|)|(|(((|)|)|)))))
14
(((|)|(|))|(|(|)(|))(|(|)))(|(((|)|(|))|))
14
(|)(|)(|(...

output:

1822766519
0
1308003241
910294071
1189013019
352244796
1812134744
315366299
234400626
454641456
1164876121
319635117
1349757399
67075710
1150325161
1264171267
1124254036
191454031
1278941079
1125136669
1688948477
861497415
1774808033
691230207
1732870524
1400434537
1220504761
821903686
553662866
114...

input:

decode
1000
14
1822766519
14
0
14
1308003241
14
910294071
14
1189013019
14
352244796
14
1812134744
14
315366299
14
234400626
14
454641456
14
1164876121
14
319635117
14
1349757399
14
67075710
14
1150325161
14
1264171267
14
1124254036
14
191454031
14
1278941079
14
1125136669
14
1688948477
14
861497415...

output:

(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)
(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))
((|)|(|))(|((|)|))((|)((|)|(|)(|(|)))(|)|)
(|((|)|(|)((((|)|)|)(|)(|)|(|(((|)|)|)))))
(((|)|(|))|(|(|)(|))(|(|)))(|(((|)|(|))|))
(|)(|)(|(|)(|(|))((|)(|)(|)|))(|((|)|))(|)...

result:

ok 1000 lines

Test #21:

score: 100
Accepted
time: 2ms
memory: 3776kb

input:

encode
1000
15
((|(|))|(|(|((|((|)(|)|)(|(|)))|)))((|)|(|)))
15
(|)(|)(|(|(|)(|((|)(|((|)|))|)(|)))((|)(|)|))
15
((|)|)((|)(|)(|(|(|)(|)(|))((|)|))(|)|(|(|)))
15
(|(|)((|)|(((|)|)(|)(|)(|)|(|)))((|)|))((|)|)
15
((|(|(|)((|)|)((|)|((|(|))(|)|))))|)(|(|))(|)
15
(|)((|)|(|(|)))(((|)((|)|)|)|(|(|)(|((|)...

output:

3988340013
11044472167
5727152081
8653511446
3379282603
10190085426
10150857694
6355225926
4149265500
2580566175
5825217397
1805153284
5905868874
6343072977
2361924640
3720784094
6660797907
3863519998
6718505473
1797998252
5798321903
9663760474
3005191793
3138079541
4990445870
1873095831
2209127602
...

input:

decode
1000
15
3988340013
15
11044472167
15
5727152081
15
8653511446
15
3379282603
15
10190085426
15
10150857694
15
6355225926
15
4149265500
15
2580566175
15
5825217397
15
1805153284
15
5905868874
15
6343072977
15
2361924640
15
3720784094
15
6660797907
15
3863519998
15
6718505473
15
1797998252
15
57...

output:

((|(|))|(|(|((|((|)(|)|)(|(|)))|)))((|)|(|)))
(|)(|)(|(|(|)(|((|)(|((|)|))|)(|)))((|)(|)|))
((|)|)((|)(|)(|(|(|)(|)(|))((|)|))(|)|(|(|)))
(|(|)((|)|(((|)|)(|)(|)(|)|(|)))((|)|))((|)|)
((|(|(|)((|)|)((|)|((|(|))(|)|))))|)(|(|))(|)
(|)((|)|(|(|)))(((|)((|)|)|)|(|(|)(|((|)|))))
(|)((|)|((|)((|(|)((|)(|...

result:

ok 1000 lines

Test #22:

score: 100
Accepted
time: 2ms
memory: 3808kb

input:

encode
1000
16
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
16
((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
16
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))))
16
((|)|(|(|)))(|)((|)(|(|(|(|))))((|)|(|))(|(|))|)
16
((((|)|)(|)|(|)(|)(|(|)((|)((|)|)|))(|))(|)|(|))
16
(|(|))(|((|)|(|((|)(|(|(|...

output:

68328754958
0
49382379192
33657730499
5132844146
56564711165
41750145863
9753219092
33605165631
15233671162
41435475436
51412826410
21062073062
298078344
68186152464
25503912949
18338063599
53425656430
62140328450
56028044162
26879600521
43563014750
19858527618
54090790797
20155113851
60641198991
41...

input:

decode
1000
16
68328754958
16
0
16
49382379192
16
33657730499
16
5132844146
16
56564711165
16
41750145863
16
9753219092
16
33605165631
16
15233671162
16
41435475436
16
51412826410
16
21062073062
16
298078344
16
68186152464
16
25503912949
16
18338063599
16
53425656430
16
62140328450
16
56028044162
16...

output:

(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))))
((|)|(|(|)))(|)((|)(|(|(|(|))))((|)|(|))(|(|))|)
((((|)|)(|)|(|)(|)(|(|)((|)((|)|)|))(|))(|)|(|))
(|(|))(|((|)|(|((|)(|(|(|)))|))((|)(|)|(|(|)))))
(|((|(...

result:

ok 1000 lines

Test #23:

score: 100
Accepted
time: 6ms
memory: 3560kb

input:

encode
1000
17
(((((|)(|(((|)|)|))|((|)|))(|(|(|))(|))|(|(|)))|)|)
17
((|((|((|((|)|))|(|)))|))|(|(((|)|)|)((|)|))((|)|))
17
((|)(|)|)(|)((|(|(|)((|(|))|))(|(|)((|)(|)|)))(|)|)
17
((((|)|)((|(|((|(((|)|)(|)|))|)(|(|)(|))(|)))|)|)|)
17
(((|)|)|(|(|((|(|(|(|))(|)(|)))((|)(|)|)|)((|)|))))
17
(|(|(((|)|...

output:

7085031833
105611360449
192887213570
30644102135
93266535752
290494472289
25815039573
248554528175
323667033552
291288697890
44714816052
78690920251
291196583435
198648779371
322283759926
399723811944
352225442800
219889242500
334116113027
304686759237
323667082538
49086247862
159245316544
802925430...

input:

decode
1000
17
7085031833
17
105611360449
17
192887213570
17
30644102135
17
93266535752
17
290494472289
17
25815039573
17
248554528175
17
323667033552
17
291288697890
17
44714816052
17
78690920251
17
291196583435
17
198648779371
17
322283759926
17
399723811944
17
352225442800
17
219889242500
17
3341...

output:

(((((|)(|(((|)|)|))|((|)|))(|(|(|))(|))|(|(|)))|)|)
((|((|((|((|)|))|(|)))|))|(|(((|)|)|)((|)|))((|)|))
((|)(|)|)(|)((|(|(|)((|(|))|))(|(|)((|)(|)|)))(|)|)
((((|)|)((|(|((|(((|)|)(|)|))|)(|(|)(|))(|)))|)|)|)
(((|)|)|(|(|((|(|(|(|))(|)(|)))((|)(|)|)|)((|)|))))
(|(|(((|)|)(|)|(|(|((|)|(|))(|)(|(|)))))...

result:

ok 1000 lines

Test #24:

score: 100
Accepted
time: 3ms
memory: 3576kb

input:

encode
1000
18
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
18
((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
18
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))))))
18
((|)|((|(|))|(|)))(((|)|)((|)|)|)((|)|)(|(|))((|)|)(|)
18
((|)((|)|(|((|)|))((|(|))((|)(((|)|)|((|)|))|(|))|))|...

output:

2619631042664
0
1903451601372
1242015339803
1058673873501
584373466441
2044775228939
184151003633
1456468015079
1413729558570
2099218863509
2020735446422
1755384196141
2149670997501
1776551588181
1034970352023
181143508113
1711042696219
841098644142
2009271904409
2315779745035
1214492171032
19341238...

input:

decode
1000
18
2619631042664
18
0
18
1903451601372
18
1242015339803
18
1058673873501
18
584373466441
18
2044775228939
18
184151003633
18
1456468015079
18
1413729558570
18
2099218863509
18
2020735446422
18
1755384196141
18
2149670997501
18
1776551588181
18
1034970352023
18
181143508113
18
17110426962...

output:

(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))))))
((|)|((|(|))|(|)))(((|)|)((|)|)|)((|)|)(|(|))((|)|)(|)
((|)((|)|(|((|)|))((|(|))((|)(((|)|)|((|)|))|(|))|))|)
(((|)|)|(|(|(|(|)(((((|)|...

result:

ok 1000 lines

Test #25:

score: 100
Accepted
time: 6ms
memory: 3612kb

input:

encode
1000
19
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
19
(((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
19
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|)))))))))))))))))))
19
((|)|((|(|))|)((|)|(|)))(|)(|(((|)(|)(|)|(|(|))(|))|))(|)
19
(|((((|)(|)|)|)((|(((|)|)(|)|))|)|((|)|)(...

output:

16332922290299
0
11894060137054
7773311196834
8990321826133
11032458717571
11787652730268
1138791010588
9871155979679
10457745130071
6332508432036
5534519430265
14872388159831
4298158292538
372763879259
2344944937781
1585041779414
14982891085981
9153914256963
14224376823210
3146323946488
78642678277...

input:

decode
1000
19
16332922290299
19
0
19
11894060137054
19
7773311196834
19
8990321826133
19
11032458717571
19
11787652730268
19
1138791010588
19
9871155979679
19
10457745130071
19
6332508432036
19
5534519430265
19
14872388159831
19
4298158292538
19
372763879259
19
2344944937781
19
1585041779414
19
149...

output:

(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
(((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|)))))))))))))))))))
((|)|((|(|))|)((|)|(|)))(|)(|(((|)(|)(|)|(|(|))(|))|))(|)
(|((((|)(|)|)|)((|(((|)|)(|)|))|)|((|)|)((|)|(|)))(|)(|))
(|((|)|))(...

result:

ok 1000 lines

Test #26:

score: 100
Accepted
time: 3ms
memory: 3852kb

input:

encode
1000
20
(|(|(|)))(|((|)|(((|(|(|)))|(|(|))(|(|)))(|)|)(|(|))(|)))(|)
20
((|)|)((((|)|(|))|((|((|)(|)|))(((|)|)(|)(((|(|))|)|)|)|))|)
20
(((((|)|)((((|)|)|)|((((|(|)(|(|)))|)|(|))|))(|)|(|(|)))|)|)
20
(((|((|)|(|))((((|(|)((|(|))(|)((|(|))|)|))|)|)|(|))(|))|)|)
20
((|)((|)(((|(|(|((|)|))))|)|)...

output:

78176670308879
52443623071174
2595785509238
10870888327695
40958486957410
51904523860441
75844195367659
1482165854133
12343111632632
52255622391212
11648251860982
25844126769363
75240252453525
60961939846530
83878324948605
69397056964183
98886531593608
44677948905714
83480291002136
37668019357545
10...

input:

decode
1000
20
78176670308879
20
52443623071174
20
2595785509238
20
10870888327695
20
40958486957410
20
51904523860441
20
75844195367659
20
1482165854133
20
12343111632632
20
52255622391212
20
11648251860982
20
25844126769363
20
75240252453525
20
60961939846530
20
83878324948605
20
69397056964183
20...

output:

(|(|(|)))(|((|)|(((|(|(|)))|(|(|))(|(|)))(|)|)(|(|))(|)))(|)
((|)|)((((|)|(|))|((|((|)(|)|))(((|)|)(|)(((|(|))|)|)|)|))|)
(((((|)|)((((|)|)|)|((((|(|)(|(|)))|)|(|))|))(|)|(|(|)))|)|)
(((|((|)|(|))((((|(|)((|(|))(|)((|(|))|)|))|)|)|(|))(|))|)|)
((|)((|)(((|(|(|((|)|))))|)|)|(|((|)(|)|((|)|))))|(|(|))...

result:

ok 1000 lines

Test #27:

score: 100
Accepted
time: 7ms
memory: 3844kb

input:

encode
1000
21
(((|((|(|)(|)(|(|)(|))(|))|))(|(|))|)(|(|))|(((|)|)|(|((|)|))))
21
((|)(|)(|)|(|((|(|)(|((|)|))(|)(|))(|(|)(|)(((|)|(|))(|)|))|)))
21
((|(|(|))(|)((|)|(|)))(|)|(((|)|)|(|(|(|)(|)(((|)(|)|)|)))))(|)
21
(|((|)(|(|))((|)|)(|)(|)((((|)|)|(|)(|))|)|))((|(|((|)|)))(|)|)
21
(|)((|)(|)|(|((((...

output:

64783573423364
289588588756515
208768022229155
415875186690146
586522612655225
38377040511392
244091633545555
397732492933726
146860214358354
564858639663205
408873935244792
558669159679400
344659184676859
100617712588577
124551622226664
427101915541648
630255283135699
626206869407313
36560260728530...

input:

decode
1000
21
64783573423364
21
289588588756515
21
208768022229155
21
415875186690146
21
586522612655225
21
38377040511392
21
244091633545555
21
397732492933726
21
146860214358354
21
564858639663205
21
408873935244792
21
558669159679400
21
344659184676859
21
100617712588577
21
124551622226664
21
42...

output:

(((|((|(|)(|)(|(|)(|))(|))|))(|(|))|)(|(|))|(((|)|)|(|((|)|))))
((|)(|)(|)|(|((|(|)(|((|)|))(|)(|))(|(|)(|)(((|)|(|))(|)|))|)))
((|(|(|))(|)((|)|(|)))(|)|(((|)|)|(|(|(|)(|)(((|)(|)|)|)))))(|)
(|((|)(|(|))((|)|)(|)(|)((((|)|)|(|)(|))|)|))((|(|((|)|)))(|)|)
(|)((|)(|)|(|(((((|)|(|))|)|)|((|)|(|))(|)((...

result:

ok 1000 lines

Test #28:

score: 100
Accepted
time: 7ms
memory: 3840kb

input:

encode
1000
22
(|((|)|(|(|(((|)(|)(|)|)((|)(((|)|)|)|)(|)|)))(|(|)))(|(((|)|)|)))
22
((|(|(|)))|(|)(|)((|)|))(((|)|)(|((((|)|)|)|))|(|))((((|)(|)|)|)|)
22
((|(|((|(|))|)))(|(|(|)((|((|((((|)|)|(|))|(|)(|)))|)(|))|)))(|)|)
22
((|)(|((|(|(|(|(|)(|(|)))))(|)(|))(((|)|)|(|))(|((|)|)(|))|))(|)|)
22
(((|)...

output:

2691764364151599
1339734237384440
1226277258391286
1706169198226549
619614399678813
1309252305099402
639831781849814
2992123222168517
571986581967739
3124244931137264
631588188787865
3728697603062125
1176958612626771
3267443288065676
1226597060786976
1231396311596756
3508925849758980
297560511427946...

input:

decode
1000
22
2691764364151599
22
1339734237384440
22
1226277258391286
22
1706169198226549
22
619614399678813
22
1309252305099402
22
639831781849814
22
2992123222168517
22
571986581967739
22
3124244931137264
22
631588188787865
22
3728697603062125
22
1176958612626771
22
3267443288065676
22
122659706...

output:

(|((|)|(|(|(((|)(|)(|)|)((|)(((|)|)|)|)(|)|)))(|(|)))(|(((|)|)|)))
((|(|(|)))|(|)(|)((|)|))(((|)|)(|((((|)|)|)|))|(|))((((|)(|)|)|)|)
((|(|((|(|))|)))(|(|(|)((|((|((((|)|)|(|))|(|)(|)))|)(|))|)))(|)|)
((|)(|((|(|(|(|(|)(|(|)))))(|)(|))(((|)|)|(|))(|((|)|)(|))|))(|)|)
(((|)(((|(|))|)|)|((|)|))|(((|)(...

result:

ok 1000 lines

Test #29:

score: 100
Accepted
time: 8ms
memory: 3628kb

input:

encode
1000
23
((|)((|)|)(|((|(|(|(|(|))((|)((|)((|)|(|))(|((|(|))(|)|))|)|))))|))|)
23
(|(|)((|)|(|)))(|((|(|(((|((|)|)(|))|)|)))|)((|(|))(|)|(|(|)(|)(|))))
23
(|(|))((((|)|)(|)|(((|(|))|)(|)|))(|((|(|)(|))(|)|(|((|)|)(|))(|)))|)
23
(((|((|)((|(|))(|)|(|))|))((|)|(|(|)(|(|)((|)|(|)))))((|)|(|)(|))|...

output:

10630538792047512
20212866465027295
20955927662322287
2698159523668406
1833432678008545
7395260010233421
4704105548371558
7379755491898460
1820332778552317
11051710396773862
11893885837794979
4190315643048270
5533248592416611
16613792329771153
16812383067091321
20434209097937834
8736569156081587
109...

input:

decode
1000
23
10630538792047512
23
20212866465027295
23
20955927662322287
23
2698159523668406
23
1833432678008545
23
7395260010233421
23
4704105548371558
23
7379755491898460
23
1820332778552317
23
11051710396773862
23
11893885837794979
23
4190315643048270
23
5533248592416611
23
16613792329771153
23...

output:

((|)((|)|)(|((|(|(|(|(|))((|)((|)((|)|(|))(|((|(|))(|)|))|)|))))|))|)
(|(|)((|)|(|)))(|((|(|(((|((|)|)(|))|)|)))|)((|(|))(|)|(|(|)(|)(|))))
(|(|))((((|)|)(|)|(((|(|))|)(|)|))(|((|(|)(|))(|)|(|((|)|)(|))(|)))|)
(((|((|)((|(|))(|)|(|))|))((|)|(|(|)(|(|)((|)|(|)))))((|)|(|)(|))|)|)
((((|)|((|)(|(|))|)(...

result:

ok 1000 lines

Test #30:

score: 100
Accepted
time: 8ms
memory: 3852kb

input:

encode
1000
24
(|((((|)|)|)|)(|)(((|)|((|)(|(|))|))|(|))((|(|)(|))|(|(((|)|)|))((|)|)))
24
(|)(|(|)(|((|(|))|))(|)(|((|)((|)|)((|)|)|(((|)|)|)))(|((|)|(|(|))(|))))
24
(|(|((((|)|)(|)(|)((|(|))(|)|)|(|))|((((|(|(|))(|))|)|)|))(|(|)))(|)(|))
24
(|((|(|))|(((|)(|)|)|((|(|(|)((|(|))(|)(|)|(|))))|)((|)((...

output:

91181433699101186
157012261507079231
111793635919452313
102716790227361227
25424313490873259
71283900059309032
105210110089454457
113587515146313287
27122749131024178
102437747336111583
23912104370522122
56111953137597506
36331847882642981
86672630066076105
28150241690042335
98767143027438421
469124...

input:

decode
1000
24
91181433699101186
24
157012261507079231
24
111793635919452313
24
102716790227361227
24
25424313490873259
24
71283900059309032
24
105210110089454457
24
113587515146313287
24
27122749131024178
24
102437747336111583
24
23912104370522122
24
56111953137597506
24
36331847882642981
24
866726...

output:

(|((((|)|)|)|)(|)(((|)|((|)(|(|))|))|(|))((|(|)(|))|(|(((|)|)|))((|)|)))
(|)(|(|)(|((|(|))|))(|)(|((|)((|)|)((|)|)|(((|)|)|)))(|((|)|(|(|))(|))))
(|(|((((|)|)(|)(|)((|(|))(|)|)|(|))|((((|(|(|))(|))|)|)|))(|(|)))(|)(|))
(|((|(|))|(((|)(|)|)|((|(|(|)((|(|))(|)(|)|(|))))|)((|)((|)|)|)(|))(|)))
(((|)(((...

result:

ok 1000 lines

Test #31:

score: 100
Accepted
time: 8ms
memory: 3636kb

input:

encode
1000
25
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
25
(((((((((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
25
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|)))))))))))))))))))))))))
25
((|)|((((|(|((|)|(|)(|))))|)|)(((|)(|)((|)|)|(|)...

output:

1031147983159782227
0
757943959758769327
484298145910396275
173420909508003563
363972400169796461
964560541701013778
847394004052494478
75772233627392117
922747598342092285
712937363790487769
825292947614670480
107791392673206102
515990919034874235
355157687699412605
478702292574195293
2994840127390...

input:

decode
1000
25
1031147983159782227
25
0
25
757943959758769327
25
484298145910396275
25
173420909508003563
25
363972400169796461
25
964560541701013778
25
847394004052494478
25
75772233627392117
25
922747598342092285
25
712937363790487769
25
825292947614670480
25
107791392673206102
25
5159909190348742...

output:

(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
(((((((((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|)))))))))))))))))))))))))
((|)|((((|(|((|)|(|)(|))))|)|)(((|)(|)((|)|)|(|))(|(|))(|)|)|))(((|)|(|)...

result:

ok 1000 lines

Test #32:

score: 100
Accepted
time: 7ms
memory: 3892kb

input:

encode
1000
25
(|)(((|(|(|(|))))|(|((|)(|)|)(|(|(|(|(|))))))(|))|(|((|)|)(|((|)|)((|)|))))
25
((|)(|(|((((|)|)|)|((|)|)(|))((((|(|))|)|)((|)|)|)(|(|(|)))))|(|(|)(|(|))))
22
(|(|(|(|((((|)|)|)(((|(((|)|)|))|(((|)|)|)(|))(|(|(|(|))))|)|)))))
24
((|(|))|(|(((|)(|)|(|))(((|)(|)|)(((|)|)(|)|((|)(|)|))(|)...

output:

888966543391789355
443599023590113681
2953038136549413
60762631220716602
62076443535058215
21568267217445236
270680990364538
62511025415314
44483622319720
17522918942417705
12686348072394060
100256162076160343
842118366109734493
23085576100733040
12527590447926195
121271559013694640
2
29990063811661...

input:

decode
1000
25
888966543391789355
25
443599023590113681
22
2953038136549413
24
60762631220716602
24
62076443535058215
23
21568267217445236
21
270680990364538
20
62511025415314
20
44483622319720
23
17522918942417705
23
12686348072394060
24
100256162076160343
25
842118366109734493
25
23085576100733040...

output:

(|)(((|(|(|(|))))|(|((|)(|)|)(|(|(|(|(|))))))(|))|(|((|)|)(|((|)|)((|)|))))
((|)(|(|((((|)|)|)|((|)|)(|))((((|(|))|)|)((|)|)|)(|(|(|)))))|(|(|)(|(|))))
(|(|(|(|((((|)|)|)(((|(((|)|)|))|(((|)|)|)(|))(|(|(|(|))))|)|)))))
((|(|))|(|(((|)(|)|(|))(((|)(|)|)(((|)|)(|)|((|)(|)|))(|)|)|))((|)|(|)))
((|)((((...

result:

ok 1000 lines