QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#319661#4824. Bracket-and-bar Sequencesdaoquanglinh2007AC ✓5ms3904kbC++202.9kb2024-02-02 23:19:412024-02-02 23:19:42

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1
24
178

input:

decode
3
1
1
4
24
5
178

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

1

input:

decode
1
1
1

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

2
1
1

input:

decode
3
2
2
1
1
2
1

output:

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

result:

ok 3 lines

Test #4:

score: 100
Accepted
time: 1ms
memory: 3608kb

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:

12
8
9
10
3
1
2
11
4
7
5
6
55
49
50
51
33
31
32
52
34
37
35
36
53
38
39
44
42
43
12
8
9
10
3
1
2
11
4
7
5
6
54
40
41
45
15
13
14
48
46
47
18
16
17
30
26
27
28
21
19
20
29
22
25
23
24
273
265
266
267
234
232
233
268
235
238
236
237
269
239
240
245
243
244
155
151
152
153
146
144
145
154
147
150
148
1...

input:

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

output:

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

result:

ok 1000 lines

Test #5:

score: 100
Accepted
time: 1ms
memory: 3664kb

input:

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

output:

225
88
84
85
86
79
77
78
87
80
83
81
82
143
137
138
139
121
119
120
140
122
125
123
124
141
126
127
132
130
131
100
96
97
98
91
89
90
99
92
95
93
94
142
128
129
133
103
101
102
136
134
135
106
104
105
118
114
115
116
109
107
108
117
110
113
111
112
1427
1405
1406
1407
1292
1290
1291
1408
1293
1296
1...

input:

decode
1000
6
225
6
88
6
84
6
85
6
86
6
79
6
77
6
78
6
87
6
80
6
83
6
81
6
82
6
143
6
137
6
138
6
139
6
121
6
119
6
120
6
140
6
122
6
125
6
123
6
124
6
141
6
126
6
127
6
132
6
130
6
131
6
100
6
96
6
97
6
98
6
91
6
89
6
90
6
99
6
92
6
95
6
93
6
94
6
142
6
128
6
129
6
133
6
103
6
101
6
102
6
136
6
134...

output:

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

result:

ok 1000 lines

Test #6:

score: 100
Accepted
time: 1ms
memory: 3672kb

input:

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

output:

2321
3701
997
7144
4383
2820
3302
40861
6910
6519
5124
1638
42688
7189
1308
291
5855
5271
116
1540
920
5715
3194
3133
2519
4813
6588
7099
3377
4283
5536
880
6060
6999
595
3722
3027
5781
2743
3947
5126
4192
5443
256
797
1259
6143
336
4746
616
2289
4878
1612
6859
6685
3099
1951
1591
1143
1947
2879
223...

input:

decode
1000
7
2321
7
3701
7
997
7
7144
7
4383
7
2820
7
3302
8
40861
7
6910
7
6519
7
5124
7
1638
8
42688
7
7189
7
1308
7
291
7
5855
7
5271
7
116
7
1540
7
920
7
5715
7
3194
7
3133
7
2519
7
4813
7
6588
7
7099
7
3377
7
4283
7
5536
7
880
7
6060
7
6999
7
595
7
3722
7
3027
7
5781
7
2743
7
3947
7
5126
7
419...

output:

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

result:

ok 1000 lines

Test #7:

score: 100
Accepted
time: 1ms
memory: 3896kb

input:

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

output:

1189
3747
4678
3969
954
4540
2098
7037
3894
7284
4086
1828
42789
43168
4790
7223
5158
6126
40857
41029
6240
1339
3300
3476
5589
5914
423
4614
4962
2990
5091
1026
6451
2755
3867
1889
243
1817
3923
5392
3940
1807
6975
1262
2284
593
431
1912
4417
6795
1648
3891
4664
6415
785
2079
2734
7199
3998
844
155...

input:

decode
1000
7
1189
7
3747
7
4678
7
3969
7
954
7
4540
7
2098
7
7037
7
3894
7
7284
7
4086
7
1828
8
42789
8
43168
7
4790
7
7223
7
5158
7
6126
8
40857
8
41029
7
6240
7
1339
7
3300
7
3476
7
5589
7
5914
7
423
7
4614
7
4962
7
2990
7
5091
7
1026
7
6451
7
2755
7
3867
7
1889
7
243
7
1817
7
3923
7
5392
7
3940
...

output:

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

result:

ok 1000 lines

Test #8:

score: 100
Accepted
time: 1ms
memory: 3900kb

input:

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

output:

2776
6532
6914
4909
5979
2342
500
3294
42670
1276
3165
6837
6889
2798
5044
4505
876
1924
2116
6173
553
6892
5336
5672
6653
3039
4042
5028
4435
1325
762
1618
7253
7310
4890
42764
1652
2001
6111
6271
1267
1579
2298
1347
3475
7514
4882
5729
152
5436
2554
7107
976
1167
5765
3127
1100
5588
6012
5005
6611...

input:

decode
1000
7
2776
7
6532
7
6914
7
4909
7
5979
7
2342
7
500
7
3294
8
42670
7
1276
7
3165
7
6837
7
6889
7
2798
7
5044
7
4505
7
876
7
1924
7
2116
7
6173
7
553
7
6892
7
5336
7
5672
7
6653
7
3039
7
4042
7
5028
7
4435
7
1325
7
762
7
1618
7
7253
7
7310
7
4890
8
42764
7
1652
7
2001
7
6111
7
6271
7
1267
7
1...

output:

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

result:

ok 1000 lines

Test #9:

score: 100
Accepted
time: 1ms
memory: 3656kb

input:

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

output:

5502
4693
6643
40916
536
7171
2126
3811
4659
3573
3523
4269
6277
4671
1869
5593
4329
2109
2627
41025
5352
6749
5810
42691
2134
890
4257
7187
4598
6622
41034
1093
3012
4960
40732
7168
4474
1362
6774
5241
2100
40768
7630
1856
868
2714
1903
2217
5679
2120
1081
128
5075
5632
43162
1548
867
7053
40766
42...

input:

decode
1000
7
5502
7
4693
7
6643
8
40916
7
536
7
7171
7
2126
7
3811
7
4659
7
3573
7
3523
7
4269
7
6277
7
4671
7
1869
7
5593
7
4329
7
2109
7
2627
8
41025
7
5352
7
6749
7
5810
8
42691
7
2134
7
890
7
4257
7
7187
7
4598
7
6622
8
41034
7
1093
7
3012
7
4960
8
40732
7
7168
7
4474
7
1362
7
6774
7
5241
7
210...

output:

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

result:

ok 1000 lines

Test #10:

score: 100
Accepted
time: 1ms
memory: 3660kb

input:

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

output:

3591
3780
4008
1258
4205
6106
607
7169
4292
6826
4952
7280
4293
4783
7557
5612
3565
5140
130
7261
42707
6916
3662
967
40747
7086
4826
5482
1900
6084
4638
3602
5811
3232
6250
577
5434
3885
6024
1020
6696
4002
1201
6130
3313
2709
435
1786
42736
2225
6618
1266
7572
4207
505
5164
4017
1485
7551
1177
139...

input:

decode
1000
7
3591
7
3780
7
4008
7
1258
7
4205
7
6106
7
607
7
7169
7
4292
7
6826
7
4952
7
7280
7
4293
7
4783
7
7557
7
5612
7
3565
7
5140
7
130
7
7261
8
42707
7
6916
7
3662
7
967
8
40747
7
7086
7
4826
7
5482
7
1900
7
6084
7
4638
7
3602
7
5811
7
3232
7
6250
7
577
7
5434
7
3885
7
6024
7
1020
7
6696
7
4...

output:

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

result:

ok 1000 lines

Test #11:

score: 100
Accepted
time: 1ms
memory: 3900kb

input:

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

output:

1015
637
7523
6804
5600
5478
7495
413
6191
4860
5516
383
6261
5590
40773
6070
78
7325
3139
3071
3177
3869
6180
516
6220
6431
40830
2574
3252
2915
1880
5980
3348
1153
5281
4862
6671
5061
1283
946
5653
5161
1254
1098
4221
1121
1458
4471
1296
4376
5285
7219
4308
5991
6727
2551
4059
40791
7339
2445
2505...

input:

decode
1000
7
1015
7
637
7
7523
7
6804
7
5600
7
5478
7
7495
7
413
7
6191
7
4860
7
5516
7
383
7
6261
7
5590
8
40773
7
6070
7
78
7
7325
7
3139
7
3071
7
3177
7
3869
7
6180
7
516
7
6220
7
6431
8
40830
7
2574
7
3252
7
2915
7
1880
7
5980
7
3348
7
1153
7
5281
7
4862
7
6671
7
5061
7
1283
7
946
7
5653
7
5161...

output:

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

result:

ok 1000 lines

Test #12:

score: 100
Accepted
time: 1ms
memory: 3828kb

input:

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

output:

49
5638
1154
608
4234
3874
5259
2628
1251
1103
322
1547
4450
3233
42709
3336
6163
818
2433
1450
4651
6506
4466
1352
2417
3255
2376
7172
1647
5912
21
7504
2200
3221
5345
4056
760
3031
1932
9
7718
4782
2169
6242
5627
6882
5257
5870
4912
7343
6109
1584
3625
40782
1892
6181
4644
1922
1977
4355
6469
563
...

input:

decode
1000
7
49
7
5638
7
1154
7
608
7
4234
7
3874
7
5259
7
2628
7
1251
7
1103
7
322
7
1547
7
4450
7
3233
8
42709
7
3336
7
6163
7
818
7
2433
7
1450
7
4651
7
6506
7
4466
7
1352
7
2417
7
3255
7
2376
7
7172
7
1647
7
5912
7
21
7
7504
7
2200
7
3221
7
5345
7
4056
7
760
7
3031
7
1932
7
9
7
7718
7
4782
7
21...

output:

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

result:

ok 1000 lines

Test #13:

score: 100
Accepted
time: 1ms
memory: 3904kb

input:

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

output:

5396
7064
2971
40745
2287
2944
1313
1816
1052
789
2998
6828
2335
5995
162
6269
298
3226
3041
5129
6564
4415
4460
1944
6755
7024
2125
4132
5403
2014
5294
7158
4284
5374
289
6847
5445
379
35124
4232
5655
1412
4640
3714
3925
2668
4209
3599
1106
747
40725
40813
7468
3865
4704
35121
756
7625
4874
4114
86...

input:

decode
1000
7
5396
7
7064
7
2971
8
40745
7
2287
7
2944
7
1313
7
1816
7
1052
7
789
7
2998
7
6828
7
2335
7
5995
7
162
7
6269
7
298
7
3226
7
3041
7
5129
7
6564
7
4415
7
4460
7
1944
7
6755
7
7024
7
2125
7
4132
7
5403
7
2014
7
5294
7
7158
7
4284
7
5374
7
289
7
6847
7
5445
7
379
8
35124
7
4232
7
5655
7
14...

output:

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

result:

ok 1000 lines

Test #14:

score: 100
Accepted
time: 1ms
memory: 3668kb

input:

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

output:

27690
22589
23958
37266
3209
18550
18126
21034
25974
25251
16414
9541
5566
36605
2445
38000
35637
9531
38867
30789
11161
22940
7476
33100
4445
36682
41645
12921
33983
21568
1092
11245
7644
15646
14385
5132
3450
33708
42515
28124
24493
25286
3225
32609
36927
38733
22930
28539
6217
39362
42803
26639
1...

input:

decode
1000
8
27690
8
22589
8
23958
8
37266
8
3209
8
18550
8
18126
8
21034
8
25974
8
25251
8
16414
8
9541
8
5566
8
36605
8
2445
8
38000
8
35637
8
9531
8
38867
8
30789
8
11161
8
22940
8
7476
8
33100
8
4445
8
36682
8
41645
8
12921
8
33983
8
21568
8
1092
8
11245
8
7644
8
15646
8
14385
8
5132
8
3450
8
3...

output:

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

result:

ok 1000 lines

Test #15:

score: 100
Accepted
time: 1ms
memory: 3700kb

input:

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

output:

100752
92434
12262
97541
133479
127901
107827
144303
32919
110617
12400
149815
95397
56640
34073
22914
163116
241208
235831
111888
20204
167249
136985
223463
244310
128918
52794
242308
139782
46916
111379
30128
14962
51756
245937
15788
209599
38687
144616
125953
168513
3534
165223
158330
230649
1593...

input:

decode
1000
9
100752
9
92434
9
12262
9
97541
9
133479
9
127901
9
107827
9
144303
9
32919
9
110617
9
12400
9
149815
9
95397
9
56640
9
34073
9
22914
9
163116
9
241208
9
235831
9
111888
9
20204
9
167249
9
136985
9
223463
9
244310
9
128918
9
52794
9
242308
9
139782
9
46916
9
111379
9
30128
9
14962
9
517...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

1430715
537508
1
840903
736521
794232
678213
540651
1393262
831300
252127
999010
923209
787864
924663
859467
860459
234182
274708
348490
125702
324029
628933
467689
1143557
1005683
1077609
252215
513437
560075
1289130
727479
1106846
160003
757638
527622
1255356
34618
36015
854406
946200
297797
25350...

input:

decode
1000
10
1430715
10
537508
10
1
10
840903
10
736521
10
794232
10
678213
10
540651
10
1393262
10
831300
10
252127
10
999010
10
923209
10
787864
10
924663
10
859467
10
860459
10
234182
10
274708
10
348490
10
125702
10
324029
10
628933
10
467689
10
1143557
10
1005683
10
1077609
10
252215
10
51343...

output:

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

result:

ok 1000 lines

Test #17:

score: 100
Accepted
time: 1ms
memory: 3904kb

input:

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

output:

8414640
3138808
1
4907727
320795
1515600
5088592
1871158
1916946
1489775
5367799
6190265
2323951
6885818
1914649
6138752
7726385
4654147
2019675
4580303
1219554
3023846
8350235
8023667
5603180
5529423
2994622
3154668
4078982
5795437
2146526
7596893
927875
80418
3123240
4158722
1488728
7951846
673214...

input:

decode
1000
11
8414640
11
3138808
11
1
11
4907727
11
320795
11
1515600
11
5088592
11
1871158
11
1916946
11
1489775
11
5367799
11
6190265
11
2323951
11
6885818
11
1914649
11
6138752
11
7726385
11
4654147
11
2019675
11
4580303
11
1219554
11
3023846
11
8350235
11
8023667
11
5603180
11
5529423
11
299462...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

50067108
18565648
1
29251755
32887057
28703249
15673303
7757073
9405103
49460609
17483883
4258954
29504258
25400695
10862083
25555502
46412254
1928879
37274350
36145569
13261240
39019110
26390
41952984
37089835
37727147
30534508
15710692
18104478
42727394
28379587
13296986
26614086
9246683
40392648
...

input:

decode
1000
12
50067108
12
18565648
12
1
12
29251755
12
32887057
12
28703249
12
15673303
12
7757073
12
9405103
12
49460609
12
17483883
12
4258954
12
29504258
12
25400695
12
10862083
12
25555502
12
46412254
12
1928879
12
37274350
12
36145569
12
13261240
12
39019110
12
26390
12
41952984
12
37089835
12...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

125797981
22214955
212503640
125523199
161909271
267718018
39697912
243070374
6147300
60345300
188059736
175482387
179316439
295513447
139705248
190071358
160836818
39463420
268105425
180959254
30060050
27838972
221253240
251781029
134149263
169644666
119016428
205648923
77393088
251361007
127266997...

input:

decode
1000
13
125797981
13
22214955
13
212503640
13
125523199
13
161909271
13
267718018
13
39697912
13
243070374
13
6147300
13
60345300
13
188059736
13
175482387
13
179316439
13
295513447
13
139705248
13
190071358
13
160836818
13
39463420
13
268105425
13
180959254
13
30060050
13
27838972
13
2212532...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

1822766520
669682580
1
1550263055
54458884
1169941995
1781152967
517635410
1262281599
407770442
196201428
517975727
1307692819
520677009
117182425
1162171290
259845193
1673328859
216039342
1318809179
1704294318
1106523868
1689778184
1154964780
889003671
158870303
1733850412
319818405
505368299
83297...

input:

decode
1000
14
1822766520
14
669682580
14
1
14
1550263055
14
54458884
14
1169941995
14
1781152967
14
517635410
14
1262281599
14
407770442
14
196201428
14
517975727
14
1307692819
14
520677009
14
117182425
14
1162171290
14
259845193
14
1673328859
14
216039342
14
1318809179
14
1704294318
14
1106523868
...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

2156629325
8660932574
6311031650
7565308224
10032143227
8854793025
5559006756
7233409283
4333929042
3510564695
9310915776
4196720697
670262297
817312811
2191830583
4967118729
1744445660
3268915856
7548636426
3950654706
9312095250
5956803055
2457071333
7651476509
6533646116
2872095326
3275215163
8562...

input:

decode
1000
15
2156629325
15
8660932574
15
6311031650
15
7565308224
15
10032143227
15
8854793025
15
5559006756
15
7233409283
15
4333929042
15
3510564695
15
9310915776
15
4196720697
15
670262297
15
817312811
15
2191830583
15
4967118729
15
1744445660
15
3268915856
15
7548636426
15
3950654706
15
931209...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

68328754959
24931096954
1
58198555815
20377326195
37264353279
3651391509
29469223480
58641203217
39743265633
66289707735
6096942291
21005728993
18822104563
68177705088
26489072413
14508597505
49066573718
34236650826
37565404172
60964276061
4286371656
62282253626
5232516134
51195496358
54704233523
29...

input:

decode
1000
16
68328754959
16
24931096954
16
1
16
58198555815
16
20377326195
16
37264353279
16
3651391509
16
29469223480
16
58641203217
16
39743265633
16
66289707735
16
6096942291
16
21005728993
16
18822104563
16
68177705088
16
26489072413
16
14508597505
16
49066573718
16
34236650826
16
37565404172
...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

152527396610
97647219352
356711019914
155798750781
81311346682
48867383656
96156496203
274136773341
286141274132
3509127509
317882561845
282949572712
3692187945
71455247539
34674646403
411956007780
347161062963
398227128618
54462903413
401834703195
270067882622
106421335757
263688515048
141288117175...

input:

decode
1000
17
152527396610
17
97647219352
17
356711019914
17
155798750781
17
81311346682
17
48867383656
17
96156496203
17
274136773341
17
286141274132
17
3509127509
17
317882561845
17
282949572712
17
3692187945
17
71455247539
17
34674646403
17
411956007780
17
347161062963
17
398227128618
17
5446290...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

2619631042665
950718737673
1
2609787851727
1006298306032
501531285401
1854800946722
2320566190682
1870902852924
367052625663
1679730230904
1598964265757
234464908170
2156988768338
28548678631
2261399979684
966019858824
72569413923
2257880441678
221314556703
1392253337045
446319892895
37124844225
230...

input:

decode
1000
18
2619631042665
18
950718737673
18
1
18
2609787851727
18
1006298306032
18
501531285401
18
1854800946722
18
2320566190682
18
1870902852924
18
367052625663
18
1679730230904
18
1598964265757
18
234464908170
18
2156988768338
18
28548678631
18
2261399979684
18
966019858824
18
72569413923
18
...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

16332922290300
5914230186933
1
15606878499872
2376447528682
9259100205791
296841359017
7497422615735
2319217345625
14282448074759
11264622726320
4213406655240
13145088735920
5371556625803
3658910285595
4941292204675
5584418865610
13215690610014
2278308655843
8459132575568
6593851743522
1036390970294...

input:

decode
1000
19
16332922290300
19
5914230186933
19
1
19
15606878499872
19
2376447528682
19
9259100205791
19
296841359017
19
7497422615735
19
2319217345625
19
14282448074759
19
11264622726320
19
4213406655240
19
13145088735920
19
5371556625803
19
3658910285595
19
4941292204675
19
5584418865610
19
1321...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

85054607004520
57050932272787
36719604445020
36351473463396
75255361961728
85402996424838
69219977796245
70554010192263
88618606659840
57086530076726
75526344709510
69997644875682
2194252353645
68769978552636
83673249684704
57606791067571
80726514095428
43689104949718
95758083591759
63817872188717
9...

input:

decode
1000
20
85054607004520
20
57050932272787
20
36719604445020
20
36351473463396
20
75255361961728
20
85402996424838
20
69219977796245
20
70554010192263
20
88618606659840
20
57086530076726
20
75526344709510
20
69997644875682
20
2194252353645
20
68769978552636
20
83673249684704
20
57606791067571
2...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

157902876224466
131101993796866
467598184457756
406998575445603
513782624981182
159968047645064
289942146231246
20258708271622
552541861352442
597423314918877
550090557997150
521652120579187
601878389053437
442706841538629
181109144786931
61308711077943
623511058489445
496415152186185
38192288254183...

input:

decode
1000
21
157902876224466
21
131101993796866
21
467598184457756
21
406998575445603
21
513782624981182
21
159968047645064
21
289942146231246
21
20258708271622
21
552541861352442
21
597423314918877
21
550090557997150
21
521652120579187
21
601878389053437
21
442706841538629
21
181109144786931
21
6...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

417026252452951
3462625837833634
1768456654487346
1742573599733493
900423010720744
3983258681437778
2990308471172796
55775003502404
3848552034509063
2566242374924744
2692674549694501
3259826223033997
1760298501041614
3876600638721280
1658957802187884
3999101877631620
3215841546183780
382831057432764...

input:

decode
1000
22
417026252452951
22
3462625837833634
22
1768456654487346
22
1742573599733493
22
900423010720744
22
3983258681437778
22
2990308471172796
22
55775003502404
22
3848552034509063
22
2566242374924744
22
2692674549694501
22
3259826223033997
22
1760298501041614
22
3876600638721280
22
165895780...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

10895509901142503
14855560512762651
13919181329651411
9521269125685668
7315973397998625
18952993112314043
8537342699144158
10475224079508180
5916637657191114
25271343585780839
14550224767104637
5388914963305082
9976018615085072
1204273401652575
3386195908511008
1882235542644959
8246291263556067
2261...

input:

decode
1000
23
10895509901142503
23
14855560512762651
23
13919181329651411
23
9521269125685668
23
7315973397998625
23
18952993112314043
23
8537342699144158
23
10475224079508180
23
5916637657191114
23
25271343585780839
23
14550224767104637
23
5388914963305082
23
9976018615085072
23
1204273401652575
2...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

24161072969217892
78589899653027083
23007595472975177
4764965451870420
97592919206297653
48151506238975137
113027405378955998
114420477779559318
68253135860357084
140396962899355627
143873083688601029
38973023838341724
109870719070708243
88833740154317236
47610238291889780
144224803552994521
3727108...

input:

decode
1000
24
24161072969217892
24
78589899653027083
24
23007595472975177
24
4764965451870420
24
97592919206297653
24
48151506238975137
24
113027405378955998
24
114420477779559318
24
68253135860357084
24
140396962899355627
24
143873083688601029
24
38973023838341724
24
109870719070708243
24
88833740...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

1031147983159782228
369779305096781526
1
668328811608419158
372601097836575712
416673021055181910
484911907957825299
559097698917782814
219133132502029719
1005296894828578929
21873687330222954
722446226743541690
293928036771209589
164358932826314630
685145952359069425
584591724980876706
871971682932...

input:

decode
1000
25
1031147983159782228
25
369779305096781526
25
1
25
668328811608419158
25
372601097836575712
25
416673021055181910
25
484911907957825299
25
559097698917782814
25
219133132502029719
25
1005296894828578929
25
21873687330222954
25
722446226743541690
25
293928036771209589
25
164358932826314...

output:

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

result:

ok 1000 lines

Test #32:

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

input:

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

output:

512499982454000178
263074722392996621
1041603212775
30064761479352415
42494886545995016
20611602427849972
243120793247023
12170627779350
20716733023965
230479174430913
4113868528588793
16495589069020797
575773462077915377
308649024084531111
21835566844179340
137508978174630994
3
2351781955935855
212...

input:

decode
1000
25
512499982454000178
25
263074722392996621
22
1041603212775
24
30064761479352415
24
42494886545995016
23
20611602427849972
21
243120793247023
20
12170627779350
20
20716733023965
23
230479174430913
23
4113868528588793
24
16495589069020797
25
575773462077915377
25
308649024084531111
23
21...

output:

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

result:

ok 1000 lines