QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294467#4824. Bracket-and-bar Sequencesucup-team1005#AC ✓3ms3928kbC++172.5kb2023-12-30 13:58:262023-12-30 13:58:26

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

0
54
65

input:

decode
3
1
0
4
54
5
65

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

2
0
1

input:

decode
3
2
2
1
0
2
1

output:

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

result:

ok 3 lines

Test #4:

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

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:

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

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

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

input:

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

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

6081
6424
4350
2554
1289
7405
6555
323
1779
379
2460
5406
90
2603
4272
4889
3233
2688
4840
5576
4253
3372
6494
7601
7228
1890
502
2481
6698
1134
3141
4176
3760
1987
5253
6602
7708
3225
7348
904
2465
993
2885
4646
4078
3991
3854
4917
1661
5071
6313
1939
5379
1554
558
7574
5760
5354
4558
5852
7430
618...

input:

decode
1000
7
6081
7
6424
7
4350
7
2554
7
1289
7
7405
7
6555
8
323
7
1779
7
379
7
2460
7
5406
8
90
7
2603
7
4272
7
4889
7
3233
7
2688
7
4840
7
5576
7
4253
7
3372
7
6494
7
7601
7
7228
7
1890
7
502
7
2481
7
6698
7
1134
7
3141
7
4176
7
3760
7
1987
7
5253
7
6602
7
7708
7
3225
7
7348
7
904
7
2465
7
993
7...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

3912
6668
1626
953
4302
1256
6016
2265
870
2974
802
5619
485
59
1851
2872
2390
3802
314
606
3687
4367
6553
6880
2996
3442
5029
1586
1999
7689
2242
4429
232
7305
6326
5830
4595
5613
854
2772
887
5690
2091
3999
6317
5251
4982
5841
1364
1469
5428
867
1623
248
4068
6045
7335
2577
926
4140
5530
6495
291
...

input:

decode
1000
7
3912
7
6668
7
1626
7
953
7
4302
7
1256
7
6016
7
2265
7
870
7
2974
7
802
7
5619
8
485
8
59
7
1851
7
2872
7
2390
7
3802
8
314
8
606
7
3687
7
4367
7
6553
7
6880
7
2996
7
3442
7
5029
7
1586
7
1999
7
7689
7
2242
7
4429
7
232
7
7305
7
6326
7
5830
7
4595
7
5613
7
854
7
2772
7
887
7
5690
7
209...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

7297
405
1787
2078
3540
6105
5182
6585
63
4159
7573
1521
1752
7379
2337
1216
4184
5865
5920
3829
5277
1753
2835
3345
599
7719
753
2289
1414
4321
4014
5390
2731
3127
1919
399
5432
5747
3798
3727
3995
5330
6279
4343
6879
512
1943
3387
4603
2889
7282
2469
4312
4535
3192
7607
4498
2994
3589
2191
513
256...

input:

decode
1000
7
7297
7
405
7
1787
7
2078
7
3540
7
6105
7
5182
7
6585
8
63
7
4159
7
7573
7
1521
7
1752
7
7379
7
2337
7
1216
7
4184
7
5865
7
5920
7
3829
7
5277
7
1753
7
2835
7
3345
7
599
7
7719
7
753
7
2289
7
1414
7
4321
7
4014
7
5390
7
2731
7
3127
7
1919
8
399
7
5432
7
5747
7
3798
7
3727
7
3995
7
5330
...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

3063
1677
591
389
5247
2697
5930
6854
1558
6959
6891
1075
3730
1613
5819
3029
1112
5901
7090
594
2865
697
3261
98
5944
4198
1099
2601
1158
553
611
4445
7745
2002
138
2674
1373
4403
647
2641
6015
200
2196
5598
4098
7026
5844
6200
3363
5915
4450
4810
2229
3289
23
5529
4097
2317
201
1065
3930
1604
277
...

input:

decode
1000
7
3063
7
1677
7
591
8
389
7
5247
7
2697
7
5930
7
6854
7
1558
7
6959
7
6891
7
1075
7
3730
7
1613
7
5819
7
3029
7
1112
7
5901
7
7090
8
594
7
2865
7
697
7
3261
8
98
7
5944
7
4198
7
1099
7
2601
7
1158
7
553
8
611
7
4445
7
7745
7
2002
8
138
7
2674
7
1373
7
4403
7
647
7
2641
7
6015
8
200
7
219...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

7006
6756
936
3993
1046
3733
5058
2675
1141
1514
2006
2962
1142
1842
1522
3319
6963
2501
4813
2914
113
1781
6385
4337
131
2444
1912
2958
5805
3738
1566
7013
3262
6515
3702
5257
2913
857
3594
4420
622
931
3916
3814
6543
7112
4986
5730
292
6183
538
4003
1721
1045
5163
2401
930
5496
1498
4522
3970
6968...

input:

decode
1000
7
7006
7
6756
7
936
7
3993
7
1046
7
3733
7
5058
7
2675
7
1141
7
1514
7
2006
7
2962
7
1142
7
1842
7
1522
7
3319
7
6963
7
2501
7
4813
7
2914
8
113
7
1781
7
6385
7
4337
8
131
7
2444
7
1912
7
2958
7
5805
7
3738
7
1566
7
7013
7
3262
7
6515
7
3702
7
5257
7
2913
7
857
7
3594
7
4420
7
622
7
931
...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

4389
5105
527
1480
3311
2952
434
5014
3825
1971
3096
4968
3705
2997
199
3782
4789
3016
7489
7531
6485
6328
3838
5227
3647
267
236
7255
6521
7634
5833
3541
6644
4573
2598
1964
567
2352
4168
4265
3340
2393
3989
4493
1062
4519
5477
1377
4213
1306
2604
2839
1107
3525
675
7279
772
253
2989
6066
7216
3272...

input:

decode
1000
7
4389
7
5105
7
527
7
1480
7
3311
7
2952
7
434
7
5014
7
3825
7
1971
7
3096
7
4968
7
3705
7
2997
8
199
7
3782
7
4789
7
3016
7
7489
7
7531
7
6485
7
6328
7
3838
7
5227
7
3647
7
267
8
236
7
7255
7
6521
7
7634
7
5833
7
3541
7
6644
7
4573
7
2598
7
1964
7
567
7
2352
7
4168
7
4265
7
3340
7
2393
...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

4707
3297
4565
5059
1039
6597
2705
7088
3979
4489
4850
5528
1379
6516
112
6639
3875
4126
6133
5485
1582
355
1397
4394
6068
6535
6144
2698
5419
3441
4754
470
6233
6475
2840
764
4013
7713
5885
4733
1430
1841
5922
3690
3284
1738
2700
3452
2080
3028
3793
5342
6970
207
5809
3840
1574
5863
5783
1339
305
5...

input:

decode
1000
7
4707
7
3297
7
4565
7
5059
7
1039
7
6597
7
2705
7
7088
7
3979
7
4489
7
4850
7
5528
7
1379
7
6516
8
112
7
6639
7
3875
7
4126
7
6133
7
5485
7
1582
7
355
7
1397
7
4394
7
6068
7
6535
7
6144
7
2698
7
5419
7
3441
7
4754
7
470
7
6233
7
6475
7
2840
7
764
7
4013
7
7713
7
5885
7
4733
7
1430
7
184...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

2781
2200
7680
154
6323
7626
4285
5612
4458
4072
7731
1508
6093
3514
4625
3720
4901
6456
7699
2485
462
1362
1390
5861
651
2160
5929
770
2792
5983
2621
2660
1126
2742
4890
1531
2933
4970
714
1036
3341
4283
1569
6451
831
7148
1050
7022
4492
4055
175
263
350
6755
1671
711
4052
2307
1933
709
4095
5733
5...

input:

decode
1000
7
2781
7
2200
7
7680
8
154
7
6323
7
7626
7
4285
7
5612
7
4458
7
4072
7
7731
7
1508
7
6093
7
3514
7
4625
7
3720
7
4901
7
6456
7
7699
7
2485
7
462
7
1362
7
1390
7
5861
7
651
7
2160
7
5929
7
770
7
2792
7
5983
7
2621
7
2660
7
1126
7
2742
7
4890
7
1531
7
2933
7
4970
8
714
7
1036
7
3341
7
4283...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

12931
3994
7104
3714
28404
37683
36787
35861
10014
8644
42899
31877
24978
3309
28011
9592
1610
31884
12863
17395
32835
5393
22356
20218
23362
3361
2929
34213
21877
4632
26382
32619
24340
41560
39635
24432
28750
21275
14781
13452
7546
8703
28400
19540
3423
12335
5379
13549
25601
13696
503
10429
39049...

input:

decode
1000
8
12931
8
3994
8
7104
8
3714
8
28404
8
37683
8
36787
8
35861
8
10014
8
8644
8
42899
8
31877
8
24978
8
3309
8
28011
8
9592
8
1610
8
31884
8
12863
8
17395
8
32835
8
5393
8
22356
8
20218
8
23362
8
3361
8
2929
8
34213
8
21877
8
4632
8
26382
8
32619
8
24340
8
41560
8
39635
8
24432
8
28750
8
2...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

210634
244688
161512
241249
34741
23648
221020
50618
146533
224651
161377
61613
240999
184551
148221
131856
86941
80433
16356
204363
162600
90861
42036
84384
14997
30198
181427
93038
39080
176138
224445
143317
165981
179111
542
168216
21606
138781
50866
25167
95728
155349
88981
74730
102398
79411
14...

input:

decode
1000
9
210634
9
244688
9
161512
9
241249
9
34741
9
23648
9
221020
9
50618
9
146533
9
224651
9
161377
9
61613
9
240999
9
184551
9
148221
9
131856
9
86941
9
80433
9
16356
9
204363
9
162600
9
90861
9
42036
9
84384
9
14997
9
30198
9
181427
9
93038
9
39080
9
176138
9
224445
9
143317
9
165981
9
179...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

0
1430714
893207
320097
177012
213806
1195235
1426833
464985
283919
1011588
592321
478076
239545
479990
354728
356250
751024
999985
1095848
765098
1054918
1297071
1316664
30319
616470
684203
1011765
1384370
1400913
489818
129725
737895
818294
194873
1410017
367456
887695
868709
345190
519109
1050310...

input:

decode
1000
10
0
10
1430714
10
893207
10
320097
10
177012
10
213806
10
1195235
10
1426833
10
464985
10
283919
10
1011588
10
592321
10
478076
10
239545
10
479990
10
354728
10
356250
10
751024
10
999985
10
1095848
10
765098
10
1054918
10
1297071
10
1316664
10
30319
10
616470
10
684203
10
1011765
10
13...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

0
8414639
5275832
1866159
5452873
6047274
2221907
6211080
6319059
5999921
2669650
3964885
6668005
501292
6324993
3812149
3331572
1295316
6370719
1399646
4644989
8129911
2438517
1500139
3107234
3064908
8109226
8391039
916224
3480872
6561868
3024235
4854914
5354928
8397717
762375
5996029
478875
208478...

input:

decode
1000
11
0
11
8414639
11
5275832
11
1866159
11
5452873
11
6047274
11
2221907
11
6211080
11
6319059
11
5999921
11
2669650
11
3964885
11
6668005
11
501292
11
6324993
11
3812149
11
3331572
11
1295316
11
6370719
11
1399646
11
4644989
11
8129911
11
2438517
11
1500139
11
3107234
11
3064908
11
810922...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

0
50067107
31501460
11037429
18632680
10623713
46838236
29767479
35225304
10204295
48137981
27061940
11432556
5844453
37242841
6106602
280581
32577964
24204493
22630124
39944074
24887921
31485281
8640231
24087862
24590949
14031165
47025657
49574762
10576430
9788534
39982049
7822137
34924595
2231055
...

input:

decode
1000
12
0
12
50067107
12
31501460
12
11037429
12
18632680
12
10623713
12
46838236
12
29767479
12
35225304
12
10204295
12
48137981
12
27061940
12
11432556
12
5844453
12
37242841
12
6106602
12
280581
12
32577964
12
24204493
12
22630124
12
39944074
12
24887921
12
31485281
12
8640231
12
24087862
...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

269990978
200309031
139120189
269836565
49016278
106754197
159487061
16633324
188263658
220834470
96045834
70895247
78621977
15271452
253862952
98589052
49667611
159193845
106052353
80006406
170822801
165789827
145031302
52997221
255139435
57212700
258535972
124101590
237250077
52151346
272749338
16...

input:

decode
1000
13
269990978
13
200309031
13
139120189
13
269836565
13
49016278
13
106754197
13
159487061
13
16633324
13
188263658
13
220834470
13
96045834
13
70895247
13
78621977
13
15271452
13
253862952
13
98589052
13
49667611
13
159193845
13
106052353
13
80006406
13
170822801
13
165789827
13
14503130...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

0
1822766519
1153083940
428255423
1172740329
645762443
17524353
1507767000
813851282
1377841334
1073601190
1507009122
837208227
1510366880
1218827451
637615337
1044158206
805341691
1099639144
833345063
92508412
517542506
24483533
615985934
170306551
1009805428
418277197
1313251690
1453424895
1201638...

input:

decode
1000
14
0
14
1822766519
14
1153083940
14
428255423
14
1172740329
14
645762443
14
17524353
14
1507767000
14
813851282
14
1377841334
14
1073601190
14
1507009122
14
837208227
14
1510366880
14
1218827451
14
637615337
14
1044158206
14
805341691
14
1099639144
14
833345063
14
92508412
14
517542506
1...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

8092184023
177065668
2361709386
4622918311
4573098155
479549340
1282405453
4128078861
9531489218
10562798317
2192698261
10829579556
7721533355
7494773184
8172636078
9761985230
6395237319
9056043761
4666822579
10774851801
2194648221
1587177513
8394220410
4880617101
2669136095
8822739371
9067840484
56...

input:

decode
1000
15
8092184023
15
177065668
15
2361709386
15
4622918311
15
4573098155
15
479549340
15
1282405453
15
4128078861
15
9531489218
15
10562798317
15
2192698261
15
10829579556
15
7721533355
15
7494773184
15
8172636078
15
9761985230
15
6395237319
15
9056043761
15
4666822579
15
10774851801
15
2194...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

0
68328754958
43397658005
17534029527
56265748469
12299130272
46634923765
62822072890
18870527601
16862254473
27363353881
38364411985
64093974671
54952784248
58647862
58566490932
51084150065
31186498861
8034179775
12450466904
26255008938
45811172774
30783218230
37494915934
35556547996
3877243601
452...

input:

decode
1000
16
0
16
68328754958
16
43397658005
16
17534029527
16
56265748469
16
12299130272
16
46634923765
16
62822072890
16
18870527601
16
16862254473
16
27363353881
16
38364411985
16
64093974671
16
54952784248
16
58647862
16
58566490932
16
51084150065
16
31186498861
16
8034179775
16
12450466904
16...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

419811153648
323883424889
98142722618
413311262602
309325296838
256984357402
322177240348
159979253427
177893179921
271985015292
224407956043
175340015521
271783649163
302576152882
233655973448
15424664431
69923268606
82926731951
228534039886
113967961682
153084921992
332934180496
139946191719
40159...

input:

decode
1000
17
419811153648
17
323883424889
17
98142722618
17
413311262602
17
309325296838
17
256984357402
17
322177240348
17
159979253427
17
177893179921
17
271985015292
17
224407956043
17
175340015521
17
271783649163
17
302576152882
17
233655973448
17
15424664431
17
69923268606
17
82926731951
17
2...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

0
2619631042664
1668912304992
749999300614
2245495394375
1920064646966
1212497035199
995952969674
1239428496052
1536689687434
958793028791
805109359454
1487077890125
447401725032
1687720299175
792333162793
2568873413061
1704671272956
789724668482
1468190879685
379314507200
1890099148150
163526876337...

input:

decode
1000
18
0
18
2619631042664
18
1668912304992
18
749999300614
18
2245495394375
18
1920064646966
18
1212497035199
18
995952969674
18
1239428496052
18
1536689687434
18
958793028791
18
805109359454
18
1487077890125
18
447401725032
18
1687720299175
18
792333162793
18
2568873413061
18
1704671272956
...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

0
16332922290299
10418692103367
5018482420378
9907701273586
3662036750302
10352353487875
14736263794349
9741577362615
5700342894731
7354569729044
13025789685951
1170275465282
15271121686460
12448344888781
13391017509133
15741497157291
1279174334377
9612385553152
2492922626341
14588685651682
59102347...

input:

decode
1000
19
0
19
16332922290299
19
10418692103367
19
5018482420378
19
9907701273586
19
3662036750302
19
10352353487875
19
14736263794349
19
9741577362615
19
5700342894731
19
7354569729044
19
13025789685951
19
1170275465282
19
15271121686460
19
12448344888781
19
13391017509133
19
15741497157291
19...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

22195157284649
21462829435457
101723183902123
101117870180276
51653646650902
22969080268178
44059758461558
46602988676324
33683293964835
21503800134430
52206413614633
46850461191613
64184710433505
44757875428606
17001911709607
22706288238814
4956790569593
86243879294508
17359537465078
35160576276442...

input:

decode
1000
20
22195157284649
20
21462829435457
20
101723183902123
20
101117870180276
20
51653646650902
20
22969080268178
20
44059758461558
20
46602988676324
20
33683293964835
20
21503800134430
20
52206413614633
20
46850461191613
20
64184710433505
20
44757875428606
20
17001911709607
20
2270628823881...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

502568872555293
472046902328851
321083988150784
235744400145620
45119153313839
506778027741690
546862727835254
420850004351843
199960215536238
42744434536135
192771237931251
52864232321023
119813978326814
293591801938661
535402257460042
375292913262875
5451256182612
13699888918446
445513545050073
27...

input:

decode
1000
21
502568872555293
21
472046902328851
21
321083988150784
21
235744400145620
21
45119153313839
21
506778027741690
21
546862727835254
21
420850004351843
21
199960215536238
21
42744434536135
21
192771237931251
21
52864232321023
21
119813978326814
21
293591801938661
21
535402257460042
21
375...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

2433738710328366
1211756963233144
3574530317210753
3455828645648368
3086893636043337
1141268946266950
2066470302207073
2544117389382406
1189412383096076
1485969203452044
1736145679119129
314646738100200
3547542264402563
1370686723608652
3684824289289199
1434587244939289
255884209285790
1052953596968...

input:

decode
1000
22
2433738710328366
22
1211756963233144
22
3574530317210753
22
3455828645648368
22
3086893636043337
22
1141268946266950
22
2066470302207073
22
2544117389382406
22
1189412383096076
22
1485969203452044
22
1736145679119129
22
314646738100200
22
3547542264402563
22
1370686723608652
22
368482...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

21675676980786520
6561306621795350
4620791153543321
25144895891388582
21515528382983532
13524923440238616
24471217760896887
23296540163613272
19698013876058520
9079881188263806
5802184934222251
19233963353403774
22362849830488451
17108841203968075
14721539750010601
14204925852222611
2374697220219187...

input:

decode
1000
23
21675676980786520
23
6561306621795350
23
4620791153543321
23
25144895891388582
23
21515528382983532
23
13524923440238616
23
24471217760896887
23
23296540163613272
23
19698013876058520
23
9079881188263806
23
5802184934222251
23
19233963353403774
23
22362849830488451
23
1710884120396807...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

94123191168254922
13958391357165730
98777867254954677
106244507481590978
49852745865314889
132719637352802871
79065054776822804
77186419616400932
149882133661073121
55163233982010005
66391141857850527
126445011988489387
72695960165063944
31877420968675906
134168735913133085
67626350243024077
1246184...

input:

decode
1000
24
94123191168254922
24
13958391357165730
24
98777867254954677
24
106244507481590978
24
49852745865314889
24
132719637352802871
24
79065054776822804
24
77186419616400932
24
149882133661073121
24
55163233982010005
24
66391141857850527
24
126445011988489387
24
72695960165063944
24
31877420...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

0
1031147983159782227
661368678063000702
415013079686875291
1008375080151263518
932939384967040353
110141670767591225
185811317001139497
778691621054093513
63472807152594115
652647943943841290
485315246362571919
867601059486599224
734060417907103477
441492489619770618
233532094521308270
284865510535...

input:

decode
1000
25
0
25
1031147983159782227
25
661368678063000702
25
415013079686875291
25
1008375080151263518
25
932939384967040353
25
110141670767591225
25
185811317001139497
25
778691621054093513
25
63472807152594115
25
652647943943841290
25
485315246362571919
25
867601059486599224
25
734060417907103...

output:

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

result:

ok 1000 lines

Test #32:

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

input:

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

output:

126586312008122049
818392171263777464
2591223969435141
118150165245761750
129646985245510381
2027983451949435
551074767640811
63456658205454
75218615836569
16620504011304271
18233214384236722
97584588933173942
216046458097799003
853759941647907314
7582538715095458
45814239197191719
0
105184705563720...

input:

decode
1000
25
126586312008122049
25
818392171263777464
22
2591223969435141
24
118150165245761750
24
129646985245510381
23
2027983451949435
21
551074767640811
20
63456658205454
20
75218615836569
23
16620504011304271
23
18233214384236722
24
97584588933173942
25
216046458097799003
25
85375994164790731...

output:

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

result:

ok 1000 lines