QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#295025#4824. Bracket-and-bar Sequencesucup-team216#AC ✓3ms4160kbC++147.2kb2023-12-30 18:01:202023-12-30 18:01:21

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

0
23
202

input:

decode
3
1
0
4
23
5
202

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

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: 1ms
memory: 4016kb

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:

9
7
8
10
2
0
1
11
3
6
4
5
39
37
38
40
32
30
31
41
33
36
34
35
44
42
43
50
48
49
9
7
8
10
2
0
1
11
3
6
4
5
47
45
46
51
14
12
13
54
52
53
17
15
16
27
25
26
28
20
18
19
29
21
24
22
23
182
180
181
183
175
173
174
184
176
179
177
178
187
185
186
193
191
192
152
150
151
153
145
143
144
154
146
149
147
148...

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

266
85
83
84
86
78
76
77
87
79
82
80
81
127
125
126
128
120
118
119
129
121
124
122
123
132
130
131
138
136
137
97
95
96
98
90
88
89
99
91
94
92
93
135
133
134
139
102
100
101
142
140
141
105
103
104
115
113
114
116
108
106
107
117
109
112
110
111
1095
1093
1094
1096
1088
1086
1087
1097
1089
1092
10...

input:

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

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

2320
3428
1219
6425
4372
2819
3306
26214
5792
4953
6273
1679
26154
6558
1118
290
7251
6525
116
1539
1074
7142
3193
3175
2518
5643
5087
6291
3532
4282
6932
1009
7487
6002
584
3481
3026
7238
2742
3946
6275
4198
6787
220
796
988
7570
335
5439
615
2288
5714
1641
5568
5198
3137
1950
1590
1387
1946
2878
2...

input:

decode
1000
7
2320
7
3428
7
1219
7
6425
7
4372
7
2819
7
3306
8
26214
7
5792
7
4953
7
6273
7
1679
8
26154
7
6558
7
1118
7
290
7
7251
7
6525
7
116
7
1539
7
1074
7
7142
7
3193
7
3175
7
2518
7
5643
7
5087
7
6291
7
3532
7
4282
7
6932
7
1009
7
7487
7
6002
7
584
7
3481
7
3026
7
7238
7
2742
7
3946
7
6275
7
...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

876
3549
5377
3968
1148
4581
2091
6115
3893
6843
4127
1827
26391
26131
5626
6660
6332
7553
26210
26497
7702
1206
3299
3713
6982
7348
422
5314
5969
2990
6200
1262
4735
2754
3357
1889
191
1816
3929
6734
3939
1796
5936
991
2283
581
430
1912
4417
5462
1689
3890
5363
4694
784
2078
2733
6567
3997
844
1549...

input:

decode
1000
7
876
7
3549
7
5377
7
3968
7
1148
7
4581
7
2091
7
6115
7
3893
7
6843
7
4127
7
1827
8
26391
8
26131
7
5626
7
6660
7
6332
7
7553
8
26210
8
26497
7
7702
7
1206
7
3299
7
3713
7
6982
7
7348
7
422
7
5314
7
5969
7
2990
7
6200
7
1262
7
4735
7
2754
7
3357
7
1889
7
191
7
1816
7
3929
7
6734
7
3939
...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

2760
4991
5802
5868
7406
2341
506
3291
26123
1035
3139
5545
5741
2798
6128
4529
1005
1924
2115
7600
553
5744
6632
7099
5177
3045
4041
6087
4434
1167
761
1653
6720
6921
5704
26316
1693
1976
7538
7740
996
1578
2297
1224
3712
5124
5718
7163
151
6782
2553
6315
1185
1416
7192
3168
1344
6980
7439
6039
512...

input:

decode
1000
7
2760
7
4991
7
5802
7
5868
7
7406
7
2341
7
506
7
3291
8
26123
7
1035
7
3139
7
5545
7
5741
7
2798
7
6128
7
4529
7
1005
7
1924
7
2115
7
7600
7
553
7
5744
7
6632
7
7099
7
5177
7
3045
7
4041
7
6087
7
4434
7
1167
7
761
7
1653
7
6720
7
6921
7
5704
8
26316
7
1693
7
1976
7
7538
7
7740
7
996
7
1...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

6881
5392
5167
26329
535
6507
2140
3729
5343
3817
3767
4271
7746
5368
1868
7000
4320
2108
2651
26493
6656
5273
7279
26159
2154
1019
4256
6555
4514
5138
26502
1329
3011
5970
25955
6497
4458
1275
5287
6475
2093
25991
6218
1862
857
2629
1902
2223
7106
2119
1331
133
6184
7059
26117
1547
856
6167
25989
4...

input:

decode
1000
7
6881
7
5392
7
5167
8
26329
7
535
7
6507
7
2140
7
3729
7
5343
7
3817
7
3767
7
4271
7
7746
7
5368
7
1868
7
7000
7
4320
7
2108
7
2651
8
26493
7
6656
7
5273
7
7279
8
26159
7
2154
7
1019
7
4256
7
6555
7
4514
7
5138
8
26502
7
1329
7
3011
7
5970
8
25955
7
6497
7
4458
7
1275
7
5287
7
6475
7
20...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

3835
3638
4014
987
4204
7518
606
6498
4291
5529
5961
6831
4292
5612
5540
7039
3809
6299
136
6774
26177
5805
3374
1171
25959
6254
5655
6854
1900
7511
5337
3846
7280
3231
7717
576
6779
3884
7452
1253
5220
4006
888
7557
3301
2681
434
1783
26243
2213
5132
995
5769
4206
493
6355
4008
1484
5524
1410
964
3...

input:

decode
1000
7
3835
7
3638
7
4014
7
987
7
4204
7
7518
7
606
7
6498
7
4291
7
5529
7
5961
7
6831
7
4292
7
5612
7
5540
7
7039
7
3809
7
6299
7
136
7
6774
8
26177
7
5805
7
3374
7
1171
8
25959
7
6254
7
5655
7
6854
7
1900
7
7511
7
5337
7
3846
7
7280
7
3231
7
7717
7
576
7
6779
7
3884
7
7452
7
1253
7
5220
7
4...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

1246
666
5151
5471
7027
6845
5069
412
7608
5689
6902
382
7730
6983
25996
7497
77
6966
3080
3070
3176
3360
7613
515
7647
4710
26060
2578
3251
2912
1879
7407
3478
1397
6540
5691
5195
6145
1049
1135
7080
6335
983
1342
4220
1365
1455
4460
1092
4382
6549
6648
4307
7421
5251
2550
4088
26014
6975
2365
2504...

input:

decode
1000
7
1246
7
666
7
5151
7
5471
7
7027
7
6845
7
5069
7
412
7
7608
7
5689
7
6902
7
382
7
7730
7
6983
8
25996
7
7497
7
77
7
6966
7
3080
7
3070
7
3176
7
3360
7
7613
7
515
7
7647
7
4710
8
26060
7
2578
7
3251
7
2912
7
1879
7
7407
7
3478
7
1397
7
6540
7
5691
7
5195
7
6145
7
1049
7
1135
7
7080
7
633...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

37
7072
1398
608
4233
3488
6503
2652
981
1347
310
1546
4449
3232
26179
3465
7590
817
2399
1449
5357
4940
4472
1245
2364
3254
2416
6509
1688
7346
20
5094
2199
3227
6646
4080
759
3036
1931
8
5485
5611
2144
7705
7054
5734
6501
7297
5871
7002
7536
1583
3858
26005
1891
7615
5349
1921
1988
4354
4878
562
3...

input:

decode
1000
7
37
7
7072
7
1398
7
608
7
4233
7
3488
7
6503
7
2652
7
981
7
1347
7
310
7
1546
7
4449
7
3232
8
26179
7
3465
7
7590
7
817
7
2399
7
1449
7
5357
7
4940
7
4472
7
1245
7
2364
7
3254
7
2416
7
6509
7
1688
7
7346
7
20
7
5094
7
2199
7
3227
7
6646
7
4080
7
759
7
3036
7
1931
7
8
7
5485
7
5611
7
214...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

6743
6210
2970
25975
2286
2949
1131
1815
1294
788
2997
5532
2334
7416
161
7738
297
3214
3029
6283
5048
4414
4465
1943
5279
6066
2139
4096
6754
2013
6575
6470
4283
6689
288
5557
6796
378
25380
4231
7082
1132
5339
3443
3913
2709
4208
3843
1351
746
25948
26036
4986
3640
5401
25372
756
6165
5708
4055
85...

input:

decode
1000
7
6743
7
6210
7
2970
8
25975
7
2286
7
2949
7
1131
7
1815
7
1294
7
788
7
2997
7
5532
7
2334
7
7416
7
161
7
7738
7
297
7
3214
7
3029
7
6283
7
5048
7
4414
7
4465
7
1943
7
5279
7
6066
7
2139
7
4096
7
6754
7
2013
7
6575
7
6470
7
4283
7
6689
7
288
7
5557
7
6796
7
378
8
25380
7
4231
7
7082
7
11...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

33900
22316
23994
29045
3208
19584
18168
18552
30539
29126
16407
9538
6995
28342
2365
31623
26646
9530
33880
39057
11245
22977
5010
41481
4444
28419
28122
12905
42361
21523
1326
11113
6364
15645
14384
6286
3677
42043
35748
34684
24440
29161
3213
40985
28653
33522
22959
35339
7644
35431
26433
31189
2...

input:

decode
1000
8
33900
8
22316
8
23994
8
29045
8
3208
8
19584
8
18168
8
18552
8
30539
8
29126
8
16407
8
9538
8
6995
8
28342
8
2365
8
31623
8
26646
8
9530
8
33880
8
39057
8
11245
8
22977
8
5010
8
41481
8
4444
8
28419
8
28122
8
12905
8
42361
8
21523
8
1326
8
11113
8
6364
8
15645
8
14384
8
6286
8
3677
8
4...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

100751
92433
12261
96657
133728
125933
116284
166248
41297
118944
12374
179511
96357
56588
42451
22913
205334
200365
157404
102197
18728
212410
136984
203593
156559
129137
52794
212046
141216
46603
119987
38065
14530
51755
146623
15794
162383
33438
166602
127410
214318
3785
208934
196715
224711
1985...

input:

decode
1000
9
100751
9
92433
9
12261
9
96657
9
133728
9
125933
9
116284
9
166248
9
41297
9
118944
9
12374
9
179511
9
96357
9
56588
9
42451
9
22913
9
205334
9
200365
9
157404
9
102197
9
18728
9
212410
9
136984
9
203593
9
156559
9
129137
9
52794
9
212046
9
141216
9
46603
9
119987
9
38065
9
14530
9
517...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

836969
537507
0
989552
736520
798764
596547
542078
1148747
956652
253481
1285734
1160600
786388
1163224
1033732
1034749
152371
281193
348490
127094
324028
678091
467718
819961
1297661
1373618
253613
513411
555675
1181472
719246
1402855
200009
757463
526146
1077665
43241
27359
1024950
1203040
297796
...

input:

decode
1000
10
836969
10
537507
10
0
10
989552
10
736520
10
798764
10
596547
10
542078
10
1148747
10
956652
10
253481
10
1285734
10
1160600
10
786388
10
1163224
10
1033732
10
1034749
10
152371
10
281193
10
348490
10
127094
10
324028
10
678091
10
467718
10
819961
10
1297661
10
1373618
10
253613
10
51...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

4868984
3138807
0
5773495
320794
1515641
6192661
1871157
1914334
1489781
6748746
7971789
2349087
5231504
1916076
7968332
7441691
4703732
2019638
4586088
974055
3023845
6451134
5654112
7185396
7065932
2998401
3163046
4078711
7503148
2143141
7095929
1169111
80662
3123470
4157181
1488965
5193579
482153...

input:

decode
1000
11
4868984
11
3138807
11
0
11
5773495
11
320794
11
1515641
11
6192661
11
1871157
11
1914334
11
1489781
11
6748746
11
7971789
11
2349087
11
5231504
11
1916076
11
7968332
11
7441691
11
4703732
11
2019638
11
4586088
11
974055
11
3023845
11
6451134
11
5654112
11
7185396
11
7065932
11
2998401...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

28710464
18565647
0
34281132
42302589
33827189
15611013
7583483
9689078
34740276
17483882
4245980
35619698
25400692
10862327
25547240
28822418
1928879
48084603
47170899
13261239
49539024
30965
33028459
47886848
48525935
37721429
15702427
18103830
35087285
32762283
13296985
26661567
9371624
30171209
...

input:

decode
1000
12
28710464
12
18565647
12
0
12
34281132
12
42302589
12
33827189
12
15611013
12
7583483
12
9689078
12
34740276
12
17483882
12
4245980
12
35619698
12
25400692
12
10862327
12
25547240
12
28822418
12
1928879
12
48084603
12
47170899
12
13261239
12
49539024
12
30965
12
33028459
12
47886848
12...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

135548164
20453040
277952849
135086935
161594103
248052623
28310311
183164447
7880096
60353923
237330607
211213679
219487497
181437341
123452753
241289947
160836857
28119610
249591312
222894023
36681136
27615339
287153535
199496987
124535762
195870293
119038373
268644016
77391791
198660810
137865337...

input:

decode
1000
13
135548164
13
20453040
13
277952849
13
135086935
13
161594103
13
248052623
13
28310311
13
183164447
13
7880096
13
60353923
13
237330607
13
211213679
13
219487497
13
181437341
13
123452753
13
241289947
13
160836857
13
28119610
13
249591312
13
222894023
13
36681136
13
27615339
13
2871535...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

1030725076
669682579
0
1291742760
54457618
1504945962
1043632814
517673230
1660152189
407776802
252959156
518231748
1720798122
520674278
117404183
1490100826
223276061
1677089540
282814413
1716574405
1093317657
1378655498
1050402003
1475979376
894983985
159125619
1274092296
320084592
502210186
82475...

input:

decode
1000
14
1030725076
14
669682579
14
0
14
1291742760
14
54457618
14
1504945962
14
1043632814
14
517673230
14
1660152189
14
407776802
14
252959156
14
518231748
14
1720798122
14
520674278
14
117404183
14
1490100826
14
223276061
14
1677089540
14
282814413
14
1716574405
14
1093317657
14
1378655498
...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

2166150274
6127573537
7431140340
9931769300
9738579686
6562153251
5568429354
9391134686
4334267477
3510517491
7558388001
4128173114
670562189
778055074
2191830583
4735475303
1347484410
3295367513
9963548588
3939259921
7560357088
5987409832
2457105929
10090081669
7972332123
2871995750
3305823470
1099...

input:

decode
1000
15
2166150274
15
6127573537
15
7431140340
15
9931769300
15
9738579686
15
6562153251
15
5568429354
15
9391134686
15
4334267477
15
3510517491
15
7558388001
15
4128173114
15
670562189
15
778055074
15
2191830583
15
4735475303
15
1347484410
15
3295367513
15
9963548588
15
3939259921
15
7560357...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

38239661634
24931096953
0
49487903177
20782054182
43165223278
3593563242
31868581852
50916989511
48360926249
59081156500
7060228380
21005737138
19019805450
38274170041
26490717657
14507467119
64167160869
34241715942
43466461735
58255644431
4286371900
62225343957
5231299120
66717392816
41117219885
29...

input:

decode
1000
16
38239661634
16
24931096953
16
0
16
49487903177
16
20782054182
16
43165223278
16
3593563242
16
31868581852
16
50916989511
16
48360926249
16
59081156500
16
7060228380
16
21005737138
16
19019805450
16
38274170041
16
26490717657
16
14507467119
16
64167160869
16
34241715942
16
43466461735
...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

152555201731
97647227320
299461566140
156920229138
81322188793
64745421605
96161724355
358231412949
377833859847
3509076490
414357470502
373992926530
3634178790
71455532653
34686611614
244201601274
271274527386
285062355595
40623872258
309391390109
350926318815
106429304933
337976757145
141016954124...

input:

decode
1000
17
152555201731
17
97647227320
17
299461566140
17
156920229138
17
81322188793
17
64745421605
17
96161724355
17
358231412949
17
377833859847
17
3509076490
17
414357470502
17
373992926530
17
3634178790
17
71455532653
17
34686611614
17
244201601274
17
271274527386
17
285062355595
17
4062387...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

1454386602647
950718737672
0
1967920979310
1006513598292
501514955524
2457946800237
2209095570668
2489654627445
332427934945
2185788175886
2029055107016
276708893954
1698353828634
31006430788
2018924621200
975270150179
72464272682
2010097683299
221314660203
1405644159304
446324275519
36694119002
214...

input:

decode
1000
18
1454386602647
18
950718737672
18
0
18
1967920979310
18
1006513598292
18
501514955524
18
2457946800237
18
2209095570668
18
2489654627445
18
332427934945
18
2185788175886
18
2029055107016
18
276708893954
18
1698353828634
18
31006430788
18
2018924621200
18
975270150179
18
72464272682
18
...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

9037529094572
5914230186932
0
12607612418342
2377682300819
11145726846177
393305484772
7205312282845
2204936682829
13255786246336
15018599821951
4213372427541
9991284202431
5318990506990
3658910285594
4837360214578
5584427703589
10074642283593
2075608997837
8455918510464
7057020624269
13487322200800...

input:

decode
1000
19
9037529094572
19
5914230186932
19
0
19
12607612418342
19
2377682300819
19
11145726846177
19
393305484772
19
7205312282845
19
2204936682829
19
13255786246336
19
15018599821951
19
4213372427541
19
9991284202431
19
5318990506990
19
3658910285594
19
4837360214578
19
5584427703589
19
10074...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

69329793414554
67201150639334
36714439589951
36290825309388
99097444865982
70530760516297
92018454528184
94551918864253
80898003281726
67236743078985
99378988655258
93431107967040
1806149992468
91543435470633
65583789080033
69382517372745
59930816214400
39944886569615
65945537310787
82520385126875
5...

input:

decode
1000
20
69329793414554
20
67201150639334
20
36714439589951
20
36290825309388
20
99097444865982
20
70530760516297
20
92018454528184
20
94551918864253
20
80898003281726
20
67236743078985
20
99378988655258
20
93431107967040
20
1806149992468
20
91543435470633
20
65583789080033
20
69382517372745
2...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

158483939340497
130259737234072
618252879588853
531590609519052
389549990570899
160076700692335
256492287816246
20267773758582
496901709602763
387153563929222
488849361764528
398449431147317
425567560125542
594235735054135
181104370932463
77300700473389
357345632419163
349037757803141
37806668084710...

input:

decode
1000
21
158483939340497
21
130259737234072
21
618252879588853
21
531590609519052
21
389549990570899
21
160076700692335
21
256492287816246
21
20267773758582
21
496901709602763
21
387153563929222
21
488849361764528
21
398449431147317
21
425567560125542
21
594235735054135
21
181104370932463
21
7...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

551034810660180
3079767243039661
1689456903748005
1619005184202245
900423021519531
3003155288345768
3942626740108500
64527288669537
3050531557724454
3360342821057203
3590629668328035
2481162647335213
1663137945137922
3246278448590042
1805451438218542
3309254894606109
2421320975281549
290861174535027...

input:

decode
1000
22
551034810660180
22
3079767243039661
22
1689456903748005
22
1619005184202245
22
900423021519531
22
3003155288345768
22
3942626740108500
22
64527288669537
22
3050531557724454
22
3360342821057203
22
3590629668328035
22
2481162647335213
22
1663137945137922
22
3246278448590042
22
180545143...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

10029884789432455
18419092523028280
16116342341792057
9460021683809939
7315651513286081
25019065312180427
8531818117047867
11387520144356779
5932044341048745
20874410725753126
17752872100047758
5388912824879932
10376820681536490
1182976202946714
2829626602415211
1879909079371777
8109079773944800
218...

input:

decode
1000
23
10029884789432455
23
18419092523028280
23
16116342341792057
23
9460021683809939
23
7315651513286081
23
25019065312180427
23
8531818117047867
23
11387520144356779
23
5932044341048745
23
20874410725753126
23
17752872100047758
23
5388912824879932
23
10376820681536490
23
1182976202946714
...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

18227600953151532
76971056683359213
23113519601820878
4788806922771933
124294106543524147
47277734452066382
151561933768630660
153698784510847399
74309054919270308
129622185198416256
140558534907537831
39078387194068946
147386050330502760
104690946931393803
48438583859676246
141625323799434739
37218...

input:

decode
1000
24
18227600953151532
24
76971056683359213
24
23113519601820878
24
4788806922771933
24
124294106543524147
24
47277734452066382
24
151561933768630660
24
153698784510847399
24
74309054919270308
24
129622185198416256
24
140558534907537831
24
39078387194068946
24
147386050330502760
24
1046909...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

562436470466082605
369779305096781525
0
888369220571809904
372601106139315163
450707567933205894
484378710893431649
647651325343861594
219133132906880344
612225027939426323
19506440922102461
968306844240063573
293945076127281987
164358106715969832
918854294200628280
712873243880669282
76089610488143...

input:

decode
1000
25
562436470466082605
25
369779305096781525
25
0
25
888369220571809904
25
372601106139315163
25
450707567933205894
25
484378710893431649
25
647651325343861594
25
219133132906880344
25
612225027939426323
25
19506440922102461
25
968306844240063573
25
293945076127281987
25
16435810671596983...

output:

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

result:

ok 1000 lines

Test #32:

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

input:

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

output:

512499995522282371
263072549583751365
1094620414720
30202625959226595
42496048337430476
15688901594260573
243120793247022
15971575819184
20716786025404
230478815263717
4134085180983346
21831493048901706
695334694479155152
308110040520754478
19366464442634358
120216632680422197
2
2912569696159232
212...

input:

decode
1000
25
512499995522282371
25
263072549583751365
22
1094620414720
24
30202625959226595
24
42496048337430476
23
15688901594260573
21
243120793247022
20
15971575819184
20
20716786025404
23
230478815263717
23
4134085180983346
24
21831493048901706
25
695334694479155152
25
308110040520754478
23
19...

output:

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

result:

ok 1000 lines