QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294316#4824. Bracket-and-bar Sequencesucup-team1293#AC ✓5ms3568kbC++173.6kb2023-12-30 11:54:242023-12-30 11:54:24

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

0
10
191

input:

decode
3
1
0
4
10
5
191

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

1
0
0

input:

decode
3
2
1
1
0
2
0

output:

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

result:

ok 3 lines

Test #4:

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

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
9
10
7
4
0
1
8
5
6
2
3
54
52
53
50
45
41
42
51
46
47
43
44
48
37
39
34
30
31
26
16
17
14
4
0
1
15
5
6
2
3
49
38
40
35
27
20
21
36
32
33
28
18
19
29
24
25
22
11
7
8
23
12
13
9
10
272
270
271
268
261
257
258
269
262
263
259
260
266
253
255
246
242
243
227
217
218
215
205
201
202
216
206
207
203
204...

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

296
141
128
129
126
82
78
79
127
83
84
80
81
142
136
137
134
111
107
108
135
112
113
109
110
132
103
105
100
96
97
56
46
47
44
34
30
31
45
35
36
32
33
133
104
106
101
57
50
51
102
98
99
58
48
49
59
54
55
52
41
37
38
53
42
43
39
40
1418
1399
1401
1384
1316
1308
1310
1386
1318
1320
1312
1314
1373
1286...

input:

decode
1000
6
296
6
141
6
128
6
129
6
126
6
82
6
78
6
79
6
127
6
83
6
84
6
80
6
81
6
142
6
136
6
137
6
134
6
111
6
107
6
108
6
135
6
112
6
113
6
109
6
110
6
132
6
103
6
105
6
100
6
96
6
97
6
56
6
46
6
47
6
44
6
34
6
30
6
31
6
45
6
35
6
36
6
32
6
33
6
133
6
104
6
106
6
101
6
57
6
50
6
51
6
102
6
98
6...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

3247
3451
1616
6485
5856
1143
2781
42449
7019
7166
5015
3078
43058
6522
2909
460
4427
5023
52
2263
1723
3983
2706
1213
814
5557
6928
6811
2663
5976
4790
1742
4036
6843
278
3499
981
4211
1172
5682
4955
6191
4743
558
1855
2907
4054
601
5576
548
1965
5505
3152
6600
6754
1222
3323
3163
1513
3104
1355
20...

input:

decode
1000
7
3247
7
3451
7
1616
7
6485
7
5856
7
1143
7
2781
8
42449
7
7019
7
7166
7
5015
7
3078
8
43058
7
6522
7
2909
7
460
7
4427
7
5023
7
52
7
2263
7
1723
7
3983
7
2706
7
1213
7
814
7
5557
7
6928
7
6811
7
2663
7
5976
7
4790
7
1742
7
4036
7
6843
7
278
7
3499
7
981
7
4211
7
1172
7
5682
7
4955
7
619...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

2976
3472
5570
5628
1671
6074
2083
6848
5624
6408
5899
3356
42788
43212
5433
6336
4937
4150
42469
41582
4375
2826
2788
2549
4739
4475
383
5338
5286
998
5183
1638
7306
1342
3868
3041
561
3340
5659
4817
5721
3620
6963
2890
1952
280
627
3038
5865
7117
3068
5623
5492
7235
1858
3012
1180
6838
5708
1820
2...

input:

decode
1000
7
2976
7
3472
7
5570
7
5628
7
1671
7
6074
7
2083
7
6848
7
5624
7
6408
7
5899
7
3356
8
42788
8
43212
7
5433
7
6336
7
4937
7
4150
8
42469
8
41582
7
4375
7
2826
7
2788
7
2549
7
4739
7
4475
7
383
7
5338
7
5286
7
998
7
5183
7
1638
7
7306
7
1342
7
3868
7
3041
7
561
7
3340
7
5659
7
4817
7
5721
...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

1451
7046
6870
5149
4286
3253
208
2737
43112
2949
1379
6893
7106
1319
5138
6102
1712
3035
3298
4131
187
7108
4767
4016
6655
973
5949
5298
5787
2918
1844
3114
6441
6365
5595
42877
3070
3754
4110
4345
2903
3171
2020
2847
2519
7430
5509
3977
361
4871
786
6815
1693
1561
4244
1199
1547
4881
4268
5196
692...

input:

decode
1000
7
1451
7
7046
7
6870
7
5149
7
4286
7
3253
7
208
7
2737
8
43112
7
2949
7
1379
7
6893
7
7106
7
1319
7
5138
7
6102
7
1712
7
3035
7
3298
7
4131
7
187
7
7108
7
4767
7
4016
7
6655
7
973
7
5949
7
5298
7
5787
7
2918
7
1844
7
3114
7
6441
7
6365
7
5595
8
42877
7
3070
7
3754
7
4110
7
4345
7
2903
7
...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

4793
5370
6642
42268
223
6818
3293
3389
5586
2495
2439
6232
4351
5588
2142
4737
6302
3668
1064
41602
4758
6679
4182
43049
3273
1722
6010
6834
6314
6934
41585
1570
912
5202
42569
6479
5881
2846
6773
4901
3032
42613
7539
3684
1903
1417
2119
1971
3960
3308
1526
104
5120
3950
43216
2331
1902
6842
42578
...

input:

decode
1000
7
4793
7
5370
7
6642
8
42268
7
223
7
6818
7
3293
7
3389
7
5586
7
2495
7
2439
7
6232
7
4351
7
5588
7
2142
7
4737
7
6302
7
3668
7
1064
8
41602
7
4758
7
6679
7
4182
8
43049
7
3273
7
1722
7
6010
7
6834
7
6314
7
6934
8
41585
7
1570
7
912
7
5202
8
42569
7
6479
7
5881
7
2846
7
6773
7
4901
7
303...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

2423
3461
5696
2898
6014
4157
537
6509
5988
6869
5111
6406
5989
5459
7392
3894
2444
4953
96
6415
42946
6876
3505
1662
42611
6780
5475
4873
3037
4094
5462
2420
4183
2767
4378
255
4842
5613
4272
1637
6727
5699
3001
4101
2814
1283
629
2222
42912
2030
6936
2892
7471
6022
262
4904
5728
2313
7448
1592
356...

input:

decode
1000
7
2423
7
3461
7
5696
7
2898
7
6014
7
4157
7
537
7
6509
7
5988
7
6869
7
5111
7
6406
7
5989
7
5459
7
7392
7
3894
7
2444
7
4953
7
96
7
6415
8
42946
7
6876
7
3505
7
1662
8
42611
7
6780
7
5475
7
4873
7
3037
7
4094
7
5462
7
2420
7
4183
7
2767
7
4378
7
255
7
4842
7
5613
7
4272
7
1637
7
6727
7
5...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

1627
509
7427
7107
3881
4875
7460
394
4154
5397
4804
410
4355
4882
42624
4026
79
6434
1405
1261
2678
3866
4125
235
4420
7238
42593
831
2818
897
2122
4293
2664
1499
5004
5421
6709
5180
2865
1663
3966
4967
2899
1549
6019
1536
2252
5874
2958
5804
5035
6352
6224
4511
6670
785
5935
42525
6461
3852
818
41...

input:

decode
1000
7
1627
7
509
7
7427
7
7107
7
3881
7
4875
7
7460
7
394
7
4154
7
5397
7
4804
7
410
7
4355
7
4882
8
42624
7
4026
7
79
7
6434
7
1405
7
1261
7
2678
7
3866
7
4125
7
235
7
4420
7
7238
8
42593
7
831
7
2818
7
897
7
2122
7
4293
7
2664
7
1499
7
5004
7
5421
7
6709
7
5180
7
2865
7
1663
7
3966
7
4967
...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

118
3936
1510
534
6241
3859
4959
1070
2893
1580
696
2330
5846
2768
42953
2656
4059
1799
3705
2235
5436
7176
5838
2840
3730
2760
3228
6476
3089
4471
11
7418
1924
2743
4632
5938
1840
975
2138
17
7718
5457
3839
4376
3947
7136
5019
4308
5184
6457
4112
3175
2502
42621
2125
4115
5446
3093
3317
5749
7143
1...

input:

decode
1000
7
118
7
3936
7
1510
7
534
7
6241
7
3859
7
4959
7
1070
7
2893
7
1580
7
696
7
2330
7
5846
7
2768
8
42953
7
2656
7
4059
7
1799
7
3705
7
2235
7
5436
7
7176
7
5838
7
2840
7
3730
7
2760
7
3228
7
6476
7
3089
7
4471
7
11
7
7418
7
1924
7
2743
7
4632
7
5938
7
1840
7
975
7
2138
7
17
7
7718
7
5457
7...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

4808
6961
956
42556
1951
941
2917
3339
1482
1860
907
6875
3262
4589
351
4357
445
2797
1008
4892
7042
5867
5845
2141
6743
6567
3289
6154
4667
2055
4972
6787
5986
4819
450
6604
4689
585
40544
6243
3970
3550
5458
3438
5714
1021
6018
2405
1579
1775
42518
42548
7495
3763
5422
40549
1790
7435
5521
6178
19...

input:

decode
1000
7
4808
7
6961
7
956
8
42556
7
1951
7
941
7
2917
7
3339
7
1482
7
1860
7
907
7
6875
7
3262
7
4589
7
351
7
4357
7
445
7
2797
7
1008
7
4892
7
7042
7
5867
7
5845
7
2141
7
6743
7
6567
7
3289
7
6154
7
4667
7
2055
7
4972
7
6787
7
5986
7
4819
7
450
7
6604
7
4689
7
585
8
40544
7
6243
7
3970
7
3550...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

28162
33916
32056
37069
2753
13912
14852
20607
29787
29732
5329
11917
8727
36604
3852
38609
39710
11793
37678
25725
19904
34126
19294
23394
9669
36683
41130
17586
22277
31576
1573
21042
19190
5940
5678
8918
2554
22603
40710
27939
32451
29622
2796
24502
37301
37776
34160
28520
8281
36100
42815
30855
...

input:

decode
1000
8
28162
8
33916
8
32056
8
37069
8
2753
8
13912
8
14852
8
20607
8
29787
8
29732
8
5329
8
11917
8
8727
8
36604
8
3852
8
38609
8
39710
8
11793
8
37678
8
25725
8
19904
8
34126
8
19294
8
23394
8
9669
8
36683
8
41130
8
17586
8
22277
8
31576
8
1573
8
21042
8
19190
8
5940
8
5678
8
8918
8
2554
8
...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

80316
28523
10310
39722
193008
196600
74130
170877
45739
71063
10752
164307
35351
109203
43891
55494
151451
231701
232473
105897
18469
150504
182408
215602
242883
192459
65623
231011
189038
69423
72295
47699
7438
93702
246063
5850
207914
87325
170411
183854
145933
2428
151847
161773
200457
157225
19...

input:

decode
1000
9
80316
9
28523
9
10310
9
39722
9
193008
9
196600
9
74130
9
170877
9
45739
9
71063
9
10752
9
164307
9
35351
9
109203
9
43891
9
55494
9
151451
9
231701
9
232473
9
105897
9
18469
9
150504
9
182408
9
215602
9
242883
9
192459
9
65623
9
231011
9
189038
9
69423
9
72295
9
47699
9
7438
9
93702
9...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

1430714
146280
0
1005563
1081258
1093849
662083
154321
1378231
1009726
381565
853475
894479
1054407
880727
959526
953443
610189
528502
353523
304465
639572
415054
175731
1327246
817387
752906
381534
176929
224358
1221466
1099919
719246
276294
1076013
156995
1179739
45114
87818
956795
869293
365179
3...

input:

decode
1000
10
1430714
10
146280
10
0
10
1005563
10
1081258
10
1093849
10
662083
10
154321
10
1378231
10
1009726
10
381565
10
853475
10
894479
10
1054407
10
880727
10
959526
10
953443
10
610189
10
528502
10
353523
10
304465
10
639572
10
415054
10
175731
10
1327246
10
817387
10
752906
10
381534
10
17...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

8414639
836970
0
5939788
361033
2182767
5647202
3283024
3001029
2239564
5261887
4406553
3188026
7386194
2068232
4291318
6750085
6340071
3912431
6140741
2829037
1238918
8270240
7934354
5085207
5194918
1244692
882858
6011969
4911583
1995054
7246155
1574588
23712
833801
6254387
2266759
8036009
7763705
...

input:

decode
1000
11
8414639
11
836970
11
0
11
5939788
11
361033
11
2182767
11
5647202
11
3283024
11
3001029
11
2239564
11
5261887
11
4406553
11
3188026
11
7386194
11
2068232
11
4291318
11
6750085
11
6340071
11
3912431
11
6140741
11
2829037
11
1238918
11
8270240
11
7934354
11
5085207
11
5194918
11
1244692...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

50067107
4868985
0
35222092
30507445
34473578
4716267
15965219
17605450
49153828
7046911
10445808
33151772
38335214
12230666
38836835
48779682
2059198
27087194
25451869
11358223
27263265
51197
45183920
27723337
27009805
33004531
4654689
4835577
41016377
34278889
11480195
36191742
18087589
44723422
2...

input:

decode
1000
12
50067107
12
4868985
12
0
12
35222092
12
30507445
12
34473578
12
4716267
12
15965219
12
17605450
12
49153828
12
7046911
12
10445808
12
33151772
12
38335214
12
12230666
12
38836835
12
48779682
12
2059198
12
27087194
12
25451869
12
11358223
12
27263265
12
51197
12
45183920
12
27723337
12...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

84179919
20421944
146370613
84208222
218964969
258800326
100828909
262540637
8556164
74203080
189035724
201741702
195230556
297204762
133849307
188012885
216452055
100538356
256435956
197133993
57110266
62878047
154952201
260158379
117066958
208232488
90910737
169056437
103805971
267629523
83446407
...

input:

decode
1000
13
84179919
13
20421944
13
146370613
13
84208222
13
218964969
13
258800326
13
100828909
13
262540637
13
8556164
13
74203080
13
189035724
13
201741702
13
195230556
13
297204762
13
133849307
13
188012885
13
216452055
13
100538356
13
256435956
13
197133993
13
57110266
13
62878047
13
1549522...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

1822766519
171209157
0
1608617568
107947136
1100176512
1786201753
390438317
1009099074
629498656
324962333
395213819
914355722
395168551
91526176
1108620238
592806909
1432475609
294881467
957747381
1737799191
1170169752
1717578792
1118978863
1333297860
359167571
1745071845
452510227
788859220
131183...

input:

decode
1000
14
1822766519
14
171209157
14
0
14
1608617568
14
107947136
14
1100176512
14
1786201753
14
390438317
14
1009099074
14
629498656
14
324962333
14
395213819
14
914355722
14
395168551
14
91526176
14
1108620238
14
592806909
14
1432475609
14
294881467
14
957747381
14
1737799191
14
1170169752
14...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

3789123594
10118865115
7761338057
6324681013
8774792547
9887068040
8398620625
6608015979
3381842560
887873511
9871030783
1587660135
172720081
698713120
2656288003
4366765064
4458132453
3974537420
6281462018
1646539579
9872205567
8304990631
3813119429
6147929659
7418061423
3680699104
3973640223
59533...

input:

decode
1000
15
3789123594
15
10118865115
15
7761338057
15
6324681013
15
8774792547
15
9887068040
15
8398620625
15
6608015979
15
3381842560
15
887873511
15
9871030783
15
1587660135
15
172720081
15
698713120
15
2656288003
15
4366765064
15
4458132453
15
3974537420
15
6281462018
15
1646539579
15
9872205...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

68328754958
6255989101
0
60478100142
23958332792
46109795702
1436941454
18055261043
54735636478
45202813380
62591215558
12746535230
5589343996
24381237614
68287737169
20647404232
28060043866
35607015285
52338311280
47152817448
57381262207
3311845750
52993783483
13010030100
33187065275
59129371048
24...

input:

decode
1000
16
68328754958
16
6255989101
16
0
16
60478100142
16
23958332792
16
46109795702
16
1436941454
16
18055261043
16
54735636478
16
45202813380
16
62591215558
16
12746535230
16
5589343996
16
24381237614
16
68287737169
16
20647404232
16
28060043866
16
35607015285
16
52338311280
16
47152817448
1...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

41224991010
140215847331
375189180647
51550353897
98846549727
65871897147
140246985711
245921493054
232402169449
894523186
203080977870
240932908606
1603906547
102798240651
83678946932
416682189214
378247626090
392383253337
133450031469
400060546301
252830741675
137489142937
258890260299
60134834831...

input:

decode
1000
17
41224991010
17
140215847331
17
375189180647
17
51550353897
17
98846549727
17
65871897147
17
140246985711
17
245921493054
17
232402169449
17
894523186
17
203080977870
17
240932908606
17
1603906547
17
102798240651
17
83678946932
17
416682189214
17
378247626090
17
392383253337
17
1334500...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

2619631042664
235187249458
0
2599575165917
771337495318
608945964535
1303981548304
2067564877977
1284793753731
818703356571
1557431939313
1636024845372
481003928745
2235987951477
18156841224
2085698479618
315273970733
102122593494
2084618532769
496660447211
1933714052045
625291771361
84459455415
206...

input:

decode
1000
18
2619631042664
18
235187249458
18
0
18
2599575165917
18
771337495318
18
608945964535
18
1303981548304
18
2067564877977
18
1284793753731
18
818703356571
18
1557431939313
18
1636024845372
18
481003928745
18
2235987951477
18
18156841224
18
2085698479618
18
315273970733
18
102122593494
18
...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

16332922290299
1454386602648
0
15145610277093
4858479324518
10891654267446
397885357876
6992243496516
5026087423692
13875465425411
8928048093366
6482669428928
13567121476156
2243842350045
3657282871791
7316209997544
2094277262327
13247941141530
5046194030257
11711533366464
4420664593975
973748919227...

input:

decode
1000
19
16332922290299
19
1454386602648
19
0
19
15145610277093
19
4858479324518
19
10891654267446
19
397885357876
19
6992243496516
19
5026087423692
19
13875465425411
19
8928048093366
19
6482669428928
19
13567121476156
19
2243842350045
19
3657282871791
19
7316209997544
19
2094277262327
19
1324...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

81556378027369
68967094676996
9905584440408
9595458484922
53109626609025
88555294117560
57378367123905
56857728099112
88110392817048
68942255749360
50718210944174
55169175790287
5140337992534
55143890430073
89917904972982
67061655948456
88937883031400
39328105480430
96295679704437
61818763221195
100...

input:

decode
1000
20
81556378027369
20
68967094676996
20
9905584440408
20
9595458484922
20
53109626609025
20
88555294117560
20
57378367123905
20
56857728099112
20
88110392817048
20
68942255749360
20
50718210944174
20
55169175790287
20
5140337992534
20
55143890430073
20
89917904972982
20
67061655948456
20
...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

225922199543891
270248599125480
333407351658196
380951576779049
532625631784187
204477970066537
271477972841033
34157068118500
548552798474200
600275318928828
508146343499865
519732336026605
596948424264883
356189779213453
129795090255033
111997396903754
626388867166554
579941829297306
1362108760659...

input:

decode
1000
21
225922199543891
21
270248599125480
21
333407351658196
21
380951576779049
21
532625631784187
21
204477970066537
21
271477972841033
21
34157068118500
21
548552798474200
21
600275318928828
21
508146343499865
21
519732336026605
21
596948424264883
21
356189779213453
21
129795090255033
21
1...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

665763867075439
3419554452889562
1473681417590648
1480147187009242
893474327036074
3968752439080076
2133951285410401
116170762089771
3824479617498981
2396580664647673
2262472920286332
3276789029381751
1493062704429577
3775483993892456
1041040734247695
3967808253298153
3404824174880799
37274309004482...

input:

decode
1000
22
665763867075439
22
3419554452889562
22
1473681417590648
22
1480147187009242
22
893474327036074
22
3968752439080076
22
2133951285410401
22
116170762089771
22
3824479617498981
22
2396580664647673
22
2262472920286332
22
3276789029381751
22
1493062704429577
22
3775483993892456
22
10410407...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

9689337224027932
16408040206625663
17421226913060736
3372789388954582
5051368695572729
12208094413397299
3700524904476375
6564527584306860
8981462066041799
25135730767340375
16868135248297185
8455794843951330
7090873750136519
1673098567507953
7544267438149665
4698277506074652
3131026502145229
212097...

input:

decode
1000
23
9689337224027932
23
16408040206625663
23
17421226913060736
23
3372789388954582
23
5051368695572729
23
12208094413397299
23
3700524904476375
23
6564527584306860
23
8981462066041799
23
25135730767340375
23
16868135248297185
23
8455794843951330
23
7090873750136519
23
1673098567507953
23
...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

62772015726837548
122923696546214399
46924850592091069
8144948687987783
100861557625720585
66683771323194858
76327660466777353
78972181590704166
40214342385425555
135675542117851980
132201509598862233
56485415137810614
88140262662251813
110583791272000983
54697006297585542
131496932963670063
6737571...

input:

decode
1000
24
62772015726837548
24
122923696546214399
24
46924850592091069
24
8144948687987783
24
100861557625720585
24
66683771323194858
24
76327660466777353
24
78972181590704166
24
40214342385425555
24
135675542117851980
24
132201509598862233
24
56485415137810614
24
88140262662251813
24
110583791...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

1031147983159782227
88665775500777258
0
588805317786907804
119660812464882796
266250387108833245
720230887924859813
699997442668004398
337807512868850948
1001266406828120662
47485603164955975
503249891393960421
200397909136582460
240370973720968262
573110546701357665
677831896005820680
8994160288001...

input:

decode
1000
25
1031147983159782227
25
88665775500777258
25
0
25
588805317786907804
25
119660812464882796
25
266250387108833245
25
720230887924859813
25
699997442668004398
25
337807512868850948
25
1001266406828120662
25
47485603164955975
25
503249891393960421
25
200397909136582460
25
2403709737209682...

output:

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

result:

ok 1000 lines

Test #32:

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

input:

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

output:

745484788201881836
355777857537957649
734847700248
52293649377741546
64891955085061313
20610072848982711
181008088596859
15433360578450
36856274344256
58309053253057
5999774362767718
26756789772206238
674293656331383182
420937379096567683
22211757483004581
128105155586573676
2
2599101018874446
23238...

input:

decode
1000
25
745484788201881836
25
355777857537957649
22
734847700248
24
52293649377741546
24
64891955085061313
23
20610072848982711
21
181008088596859
20
15433360578450
20
36856274344256
23
58309053253057
23
5999774362767718
24
26756789772206238
25
674293656331383182
25
420937379096567683
23
2221...

output:

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

result:

ok 1000 lines