QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294725#4824. Bracket-and-bar Sequencesucup-team2052#AC ✓5ms3816kbC++143.3kb2023-12-30 16:10:552023-12-30 16:10:56

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1
55
66

input:

decode
3
1
1
4
55
5
66

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

1

input:

decode
1
1
1

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

3
1
2

input:

decode
3
2
3
1
1
2
2

output:

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

result:

ok 3 lines

Test #4:

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

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:

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

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

830
907
908
909
910
912
913
914
911
915
916
917
918
919
920
921
922
924
925
926
923
927
928
929
930
931
932
933
937
938
939
944
945
946
947
949
950
951
948
952
953
954
955
934
935
936
940
956
957
958
941
942
943
959
960
961
962
963
964
965
967
968
969
966
970
971
972
973
329
330
331
332
334
335
336
...

input:

decode
1000
6
830
6
907
6
908
6
909
6
910
6
912
6
913
6
914
6
911
6
915
6
916
6
917
6
918
6
919
6
920
6
921
6
922
6
924
6
925
6
926
6
923
6
927
6
928
6
929
6
930
6
931
6
932
6
933
6
937
6
938
6
939
6
944
6
945
6
946
6
947
6
949
6
950
6
951
6
948
6
952
6
953
6
954
6
955
6
934
6
935
6
936
6
940
6
956
...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

6082
6425
4351
2555
1290
7406
6556
324
1780
380
2461
5407
91
2604
4273
4890
3234
2689
4841
5577
4254
3373
6495
7602
7229
1891
503
2482
6699
1135
3142
4177
3761
1988
5254
6603
7709
3226
7349
905
2466
994
2886
4647
4079
3992
3855
4918
1662
5072
6314
1940
5380
1555
559
7575
5761
5355
4559
5853
7431
618...

input:

decode
1000
7
6082
7
6425
7
4351
7
2555
7
1290
7
7406
7
6556
8
324
7
1780
7
380
7
2461
7
5407
8
91
7
2604
7
4273
7
4890
7
3234
7
2689
7
4841
7
5577
7
4254
7
3373
7
6495
7
7602
7
7229
7
1891
7
503
7
2482
7
6699
7
1135
7
3142
7
4177
7
3761
7
1988
7
5254
7
6603
7
7709
7
3226
7
7349
7
905
7
2466
7
994
7...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

3913
6669
1627
954
4303
1257
6017
2266
871
2975
803
5620
486
60
1852
2873
2391
3803
315
607
3688
4368
6554
6881
2997
3443
5030
1587
2000
7690
2243
4430
233
7306
6327
5831
4596
5614
855
2773
888
5691
2092
4000
6318
5252
4983
5842
1365
1470
5429
868
1624
249
4069
6046
7336
2578
927
4141
5531
6496
292
...

input:

decode
1000
7
3913
7
6669
7
1627
7
954
7
4303
7
1257
7
6017
7
2266
7
871
7
2975
7
803
7
5620
8
486
8
60
7
1852
7
2873
7
2391
7
3803
8
315
8
607
7
3688
7
4368
7
6554
7
6881
7
2997
7
3443
7
5030
7
1587
7
2000
7
7690
7
2243
7
4430
7
233
7
7306
7
6327
7
5831
7
4596
7
5614
7
855
7
2773
7
888
7
5691
7
209...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

7298
406
1788
2079
3541
6106
5183
6586
64
4160
7574
1522
1753
7380
2338
1217
4185
5866
5921
3830
5278
1754
2836
3346
600
7720
754
2290
1415
4322
4015
5391
2732
3128
1920
400
5433
5748
3799
3728
3996
5331
6280
4344
6880
513
1944
3388
4604
2890
7283
2470
4313
4536
3193
7608
4499
2995
3590
2192
514
256...

input:

decode
1000
7
7298
7
406
7
1788
7
2079
7
3541
7
6106
7
5183
7
6586
8
64
7
4160
7
7574
7
1522
7
1753
7
7380
7
2338
7
1217
7
4185
7
5866
7
5921
7
3830
7
5278
7
1754
7
2836
7
3346
7
600
7
7720
7
754
7
2290
7
1415
7
4322
7
4015
7
5391
7
2732
7
3128
7
1920
8
400
7
5433
7
5748
7
3799
7
3728
7
3996
7
5331
...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

3064
1678
592
390
5248
2698
5931
6855
1559
6960
6892
1076
3731
1614
5820
3030
1113
5902
7091
595
2866
698
3262
99
5945
4199
1100
2602
1159
554
612
4446
7746
2003
139
2675
1374
4404
648
2642
6016
201
2197
5599
4099
7027
5845
6201
3364
5916
4451
4811
2230
3290
24
5530
4098
2318
202
1066
3931
1605
278
...

input:

decode
1000
7
3064
7
1678
7
592
8
390
7
5248
7
2698
7
5931
7
6855
7
1559
7
6960
7
6892
7
1076
7
3731
7
1614
7
5820
7
3030
7
1113
7
5902
7
7091
8
595
7
2866
7
698
7
3262
8
99
7
5945
7
4199
7
1100
7
2602
7
1159
7
554
8
612
7
4446
7
7746
7
2003
8
139
7
2675
7
1374
7
4404
7
648
7
2642
7
6016
8
201
7
219...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

7007
6757
937
3994
1047
3734
5059
2676
1142
1515
2007
2963
1143
1843
1523
3320
6964
2502
4814
2915
114
1782
6386
4338
132
2445
1913
2959
5806
3739
1567
7014
3263
6516
3703
5258
2914
858
3595
4421
623
932
3917
3815
6544
7113
4987
5731
293
6184
539
4004
1722
1046
5164
2402
931
5497
1499
4523
3971
6969...

input:

decode
1000
7
7007
7
6757
7
937
7
3994
7
1047
7
3734
7
5059
7
2676
7
1142
7
1515
7
2007
7
2963
7
1143
7
1843
7
1523
7
3320
7
6964
7
2502
7
4814
7
2915
8
114
7
1782
7
6386
7
4338
8
132
7
2445
7
1913
7
2959
7
5806
7
3739
7
1567
7
7014
7
3263
7
6516
7
3703
7
5258
7
2914
7
858
7
3595
7
4421
7
623
7
932
...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

4390
5106
528
1481
3312
2953
435
5015
3826
1972
3097
4969
3706
2998
200
3783
4790
3017
7490
7532
6486
6329
3839
5228
3648
268
237
7256
6522
7635
5834
3542
6645
4574
2599
1965
568
2353
4169
4266
3341
2394
3990
4494
1063
4520
5478
1378
4214
1307
2605
2840
1108
3526
676
7280
773
254
2990
6067
7217
3273...

input:

decode
1000
7
4390
7
5106
7
528
7
1481
7
3312
7
2953
7
435
7
5015
7
3826
7
1972
7
3097
7
4969
7
3706
7
2998
8
200
7
3783
7
4790
7
3017
7
7490
7
7532
7
6486
7
6329
7
3839
7
5228
7
3648
7
268
8
237
7
7256
7
6522
7
7635
7
5834
7
3542
7
6645
7
4574
7
2599
7
1965
7
568
7
2353
7
4169
7
4266
7
3341
7
2394
...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

4708
3298
4566
5060
1040
6598
2706
7089
3980
4490
4851
5529
1380
6517
113
6640
3876
4127
6134
5486
1583
356
1398
4395
6069
6536
6145
2699
5420
3442
4755
471
6234
6476
2841
765
4014
7714
5886
4734
1431
1842
5923
3691
3285
1739
2701
3453
2081
3029
3794
5343
6971
208
5810
3841
1575
5864
5784
1340
306
5...

input:

decode
1000
7
4708
7
3298
7
4566
7
5060
7
1040
7
6598
7
2706
7
7089
7
3980
7
4490
7
4851
7
5529
7
1380
7
6517
8
113
7
6640
7
3876
7
4127
7
6134
7
5486
7
1583
7
356
7
1398
7
4395
7
6069
7
6536
7
6145
7
2699
7
5420
7
3442
7
4755
7
471
7
6234
7
6476
7
2841
7
765
7
4014
7
7714
7
5886
7
4734
7
1431
7
184...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

2782
2201
7681
155
6324
7627
4286
5613
4459
4073
7732
1509
6094
3515
4626
3721
4902
6457
7700
2486
463
1363
1391
5862
652
2161
5930
771
2793
5984
2622
2661
1127
2743
4891
1532
2934
4971
715
1037
3342
4284
1570
6452
832
7149
1051
7023
4493
4056
176
264
351
6756
1672
712
4053
2308
1934
710
4096
5734
5...

input:

decode
1000
7
2782
7
2201
7
7681
8
155
7
6324
7
7627
7
4286
7
5613
7
4459
7
4073
7
7732
7
1509
7
6094
7
3515
7
4626
7
3721
7
4902
7
6457
7
7700
7
2486
7
463
7
1363
7
1391
7
5862
7
652
7
2161
7
5930
7
771
7
2793
7
5984
7
2622
7
2661
7
1127
7
2743
7
4891
7
1532
7
2934
7
4971
8
715
7
1037
7
3342
7
4284...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

12932
3995
7105
3715
28405
37684
36788
35862
10015
8645
42900
31878
24979
3310
28012
9593
1611
31885
12864
17396
32836
5394
22357
20219
23363
3362
2930
34214
21878
4633
26383
32620
24341
41561
39636
24433
28751
21276
14782
13453
7547
8704
28401
19541
3424
12336
5380
13550
25602
13697
504
10430
39050...

input:

decode
1000
8
12932
8
3995
8
7105
8
3715
8
28405
8
37684
8
36788
8
35862
8
10015
8
8645
8
42900
8
31878
8
24979
8
3310
8
28012
8
9593
8
1611
8
31885
8
12864
8
17396
8
32836
8
5394
8
22357
8
20219
8
23363
8
3362
8
2930
8
34214
8
21878
8
4633
8
26383
8
32620
8
24341
8
41561
8
39636
8
24433
8
28751
8
2...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

210635
244689
161513
241250
34742
23649
221021
50619
146534
224652
161378
61614
241000
184552
148222
131857
86942
80434
16357
204364
162601
90862
42037
84385
14998
30199
181428
93039
39081
176139
224446
143318
165982
179112
543
168217
21607
138782
50867
25168
95729
155350
88982
74731
102399
79412
14...

input:

decode
1000
9
210635
9
244689
9
161513
9
241250
9
34742
9
23649
9
221021
9
50619
9
146534
9
224652
9
161378
9
61614
9
241000
9
184552
9
148222
9
131857
9
86942
9
80434
9
16357
9
204364
9
162601
9
90862
9
42037
9
84385
9
14998
9
30199
9
181428
9
93039
9
39081
9
176139
9
224446
9
143318
9
165982
9
179...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

1
1430715
893208
320098
177013
213807
1195236
1426834
464986
283920
1011589
592322
478077
239546
479991
354729
356251
751025
999986
1095849
765099
1054919
1297072
1316665
30320
616471
684204
1011766
1384371
1400914
489819
129726
737896
818295
194874
1410018
367457
887696
868710
345191
519110
1050311...

input:

decode
1000
10
1
10
1430715
10
893208
10
320098
10
177013
10
213807
10
1195236
10
1426834
10
464986
10
283920
10
1011589
10
592322
10
478077
10
239546
10
479991
10
354729
10
356251
10
751025
10
999986
10
1095849
10
765099
10
1054919
10
1297072
10
1316665
10
30320
10
616471
10
684204
10
1011766
10
13...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

1
8414640
5275833
1866160
5452874
6047275
2221908
6211081
6319060
5999922
2669651
3964886
6668006
501293
6324994
3812150
3331573
1295317
6370720
1399647
4644990
8129912
2438518
1500140
3107235
3064909
8109227
8391040
916225
3480873
6561869
3024236
4854915
5354929
8397718
762376
5996030
478876
208479...

input:

decode
1000
11
1
11
8414640
11
5275833
11
1866160
11
5452874
11
6047275
11
2221908
11
6211081
11
6319060
11
5999922
11
2669651
11
3964886
11
6668006
11
501293
11
6324994
11
3812150
11
3331573
11
1295317
11
6370720
11
1399647
11
4644990
11
8129912
11
2438518
11
1500140
11
3107235
11
3064909
11
810922...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

1
50067108
31501461
11037430
18632681
10623714
46838237
29767480
35225305
10204296
48137982
27061941
11432557
5844454
37242842
6106603
280582
32577965
24204494
22630125
39944075
24887922
31485282
8640232
24087863
24590950
14031166
47025658
49574763
10576431
9788535
39982050
7822138
34924596
2231056
...

input:

decode
1000
12
1
12
50067108
12
31501461
12
11037430
12
18632681
12
10623714
12
46838237
12
29767480
12
35225305
12
10204296
12
48137982
12
27061941
12
11432557
12
5844454
12
37242842
12
6106603
12
280582
12
32577965
12
24204494
12
22630125
12
39944075
12
24887922
12
31485282
12
8640232
12
24087863
...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

269990979
200309032
139120190
269836566
49016279
106754198
159487062
16633325
188263659
220834471
96045835
70895248
78621978
15271453
253862953
98589053
49667612
159193846
106052354
80006407
170822802
165789828
145031303
52997222
255139436
57212701
258535973
124101591
237250078
52151347
272749339
16...

input:

decode
1000
13
269990979
13
200309032
13
139120190
13
269836566
13
49016279
13
106754198
13
159487062
13
16633325
13
188263659
13
220834471
13
96045835
13
70895248
13
78621978
13
15271453
13
253862953
13
98589053
13
49667612
13
159193846
13
106052354
13
80006407
13
170822802
13
165789828
13
14503130...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

1
1822766520
1153083941
428255424
1172740330
645762444
17524354
1507767001
813851283
1377841335
1073601191
1507009123
837208228
1510366881
1218827452
637615338
1044158207
805341692
1099639145
833345064
92508413
517542507
24483534
615985935
170306552
1009805429
418277198
1313251691
1453424896
1201638...

input:

decode
1000
14
1
14
1822766520
14
1153083941
14
428255424
14
1172740330
14
645762444
14
17524354
14
1507767001
14
813851283
14
1377841335
14
1073601191
14
1507009123
14
837208228
14
1510366881
14
1218827452
14
637615338
14
1044158207
14
805341692
14
1099639145
14
833345064
14
92508413
14
517542507
1...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

8092184024
177065669
2361709387
4622918312
4573098156
479549341
1282405454
4128078862
9531489219
10562798318
2192698262
10829579557
7721533356
7494773185
8172636079
9761985231
6395237320
9056043762
4666822580
10774851802
2194648222
1587177514
8394220411
4880617102
2669136096
8822739372
9067840485
56...

input:

decode
1000
15
8092184024
15
177065669
15
2361709387
15
4622918312
15
4573098156
15
479549341
15
1282405454
15
4128078862
15
9531489219
15
10562798318
15
2192698262
15
10829579557
15
7721533356
15
7494773185
15
8172636079
15
9761985231
15
6395237320
15
9056043762
15
4666822580
15
10774851802
15
2194...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

1
68328754959
43397658006
17534029528
56265748470
12299130273
46634923766
62822072891
18870527602
16862254474
27363353882
38364411986
64093974672
54952784249
58647863
58566490933
51084150066
31186498862
8034179776
12450466905
26255008939
45811172775
30783218231
37494915935
35556547997
3877243602
452...

input:

decode
1000
16
1
16
68328754959
16
43397658006
16
17534029528
16
56265748470
16
12299130273
16
46634923766
16
62822072891
16
18870527602
16
16862254474
16
27363353882
16
38364411986
16
64093974672
16
54952784249
16
58647863
16
58566490933
16
51084150066
16
31186498862
16
8034179776
16
12450466905
16...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

419811153649
323883424890
98142722619
413311262603
309325296839
256984357403
322177240349
159979253428
177893179922
271985015293
224407956044
175340015522
271783649164
302576152883
233655973449
15424664432
69923268607
82926731952
228534039887
113967961683
153084921993
332934180497
139946191720
40159...

input:

decode
1000
17
419811153649
17
323883424890
17
98142722619
17
413311262603
17
309325296839
17
256984357403
17
322177240349
17
159979253428
17
177893179922
17
271985015293
17
224407956044
17
175340015522
17
271783649164
17
302576152883
17
233655973449
17
15424664432
17
69923268607
17
82926731952
17
2...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

1
2619631042665
1668912304993
749999300615
2245495394376
1920064646967
1212497035200
995952969675
1239428496053
1536689687435
958793028792
805109359455
1487077890126
447401725033
1687720299176
792333162794
2568873413062
1704671272957
789724668483
1468190879686
379314507201
1890099148151
163526876337...

input:

decode
1000
18
1
18
2619631042665
18
1668912304993
18
749999300615
18
2245495394376
18
1920064646967
18
1212497035200
18
995952969675
18
1239428496053
18
1536689687435
18
958793028792
18
805109359455
18
1487077890126
18
447401725033
18
1687720299176
18
792333162794
18
2568873413062
18
1704671272957
...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

1
16332922290300
10418692103368
5018482420379
9907701273587
3662036750303
10352353487876
14736263794350
9741577362616
5700342894732
7354569729045
13025789685952
1170275465283
15271121686461
12448344888782
13391017509134
15741497157292
1279174334378
9612385553153
2492922626342
14588685651683
59102347...

input:

decode
1000
19
1
19
16332922290300
19
10418692103368
19
5018482420379
19
9907701273587
19
3662036750303
19
10352353487876
19
14736263794350
19
9741577362616
19
5700342894732
19
7354569729045
19
13025789685952
19
1170275465283
19
15271121686461
19
12448344888782
19
13391017509134
19
15741497157292
19...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

22195157284650
21462829435458
101723183902124
101117870180277
51653646650903
22969080268179
44059758461559
46602988676325
33683293964836
21503800134431
52206413614634
46850461191614
64184710433506
44757875428607
17001911709608
22706288238815
4956790569594
86243879294509
17359537465079
35160576276443...

input:

decode
1000
20
22195157284650
20
21462829435458
20
101723183902124
20
101117870180277
20
51653646650903
20
22969080268179
20
44059758461559
20
46602988676325
20
33683293964836
20
21503800134431
20
52206413614634
20
46850461191614
20
64184710433506
20
44757875428607
20
17001911709608
20
2270628823881...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

502568872555294
472046902328852
321083988150785
235744400145621
45119153313840
506778027741691
546862727835255
420850004351844
199960215536239
42744434536136
192771237931252
52864232321024
119813978326815
293591801938662
535402257460043
375292913262876
5451256182613
13699888918447
445513545050074
27...

input:

decode
1000
21
502568872555294
21
472046902328852
21
321083988150785
21
235744400145621
21
45119153313840
21
506778027741691
21
546862727835255
21
420850004351844
21
199960215536239
21
42744434536136
21
192771237931252
21
52864232321024
21
119813978326815
21
293591801938662
21
535402257460043
21
375...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

2433738710328367
1211756963233145
3574530317210754
3455828645648369
3086893636043338
1141268946266951
2066470302207074
2544117389382407
1189412383096077
1485969203452045
1736145679119130
314646738100201
3547542264402564
1370686723608653
3684824289289200
1434587244939290
255884209285791
1052953596968...

input:

decode
1000
22
2433738710328367
22
1211756963233145
22
3574530317210754
22
3455828645648369
22
3086893636043338
22
1141268946266951
22
2066470302207074
22
2544117389382407
22
1189412383096077
22
1485969203452045
22
1736145679119130
22
314646738100201
22
3547542264402564
22
1370686723608653
22
368482...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

21675676980786521
6561306621795351
4620791153543322
25144895891388583
21515528382983533
13524923440238617
24471217760896888
23296540163613273
19698013876058521
9079881188263807
5802184934222252
19233963353403775
22362849830488452
17108841203968076
14721539750010602
14204925852222612
2374697220219187...

input:

decode
1000
23
21675676980786521
23
6561306621795351
23
4620791153543322
23
25144895891388583
23
21515528382983533
23
13524923440238617
23
24471217760896888
23
23296540163613273
23
19698013876058521
23
9079881188263807
23
5802184934222252
23
19233963353403775
23
22362849830488452
23
1710884120396807...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

94123191168254923
13958391357165731
98777867254954678
106244507481590979
49852745865314890
132719637352802872
79065054776822805
77186419616400933
149882133661073122
55163233982010006
66391141857850528
126445011988489388
72695960165063945
31877420968675907
134168735913133086
67626350243024078
1246184...

input:

decode
1000
24
94123191168254923
24
13958391357165731
24
98777867254954678
24
106244507481590979
24
49852745865314890
24
132719637352802872
24
79065054776822805
24
77186419616400933
24
149882133661073122
24
55163233982010006
24
66391141857850528
24
126445011988489388
24
72695960165063945
24
31877420...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

1
1031147983159782228
661368678063000703
415013079686875292
1008375080151263519
932939384967040354
110141670767591226
185811317001139498
778691621054093514
63472807152594116
652647943943841291
485315246362571920
867601059486599225
734060417907103478
441492489619770619
233532094521308271
284865510535...

input:

decode
1000
25
1
25
1031147983159782228
25
661368678063000703
25
415013079686875292
25
1008375080151263519
25
932939384967040354
25
110141670767591226
25
185811317001139498
25
778691621054093514
25
63472807152594116
25
652647943943841291
25
485315246362571920
25
867601059486599225
25
734060417907103...

output:

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

result:

ok 1000 lines

Test #32:

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

input:

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

output:

126586312008122050
818392171263777465
2591223969435142
118150165245761751
129646985245510382
2027983451949436
551074767640812
63456658205455
75218615836570
16620504011304272
18233214384236723
97584588933173943
216046458097799004
853759941647907315
7582538715095459
45814239197191720
1
105184705563720...

input:

decode
1000
25
126586312008122050
25
818392171263777465
22
2591223969435142
24
118150165245761751
24
129646985245510382
23
2027983451949436
21
551074767640812
20
63456658205455
20
75218615836570
23
16620504011304272
23
18233214384236723
24
97584588933173943
25
216046458097799004
25
85375994164790731...

output:

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

result:

ok 1000 lines