QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#293589#4824. Bracket-and-bar Sequencesucup-team267#AC ✓4ms3976kbC++202.2kb2023-12-29 13:51:022023-12-29 13:51:02

详细

Test #1:

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

input:

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

output:

1
55
76

input:

decode
3
1
1
4
55
5
76

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

1

input:

decode
1
1
1

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

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

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
15
17
19
20
21
26
27
28
29
31
32
33
30
34
35
36
37
14
16
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
15
17
19
20
21
26
27
28
29
31
32
33
30
34
35
36
37
14
16
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
15
4
17
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
14
4
16
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: 1ms
memory: 3740kb

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
933
935
937
938
939
944
945
946
947
949
950
951
948
952
953
954
955
932
934
936
940
956
957
958
941
942
943
959
960
961
962
963
964
965
967
968
969
966
970
971
972
973
275
277
279
281
285
287
289
...

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
933
6
935
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
932
6
934
6
936
6
940
6
956
...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

6082
6425
4376
2466
1290
7418
6557
374
1586
377
2518
5407
97
2500
4268
4890
3230
2537
4841
5577
4249
3373
6495
7602
7227
1808
539
2430
6691
1135
3146
4204
3761
2073
5254
6608
7709
3225
7349
903
2668
994
2918
4639
4081
3992
3855
4909
1891
5072
6314
1906
5377
1681
559
7571
5816
5355
4559
5776
7431
618...

input:

decode
1000
7
6082
7
6425
7
4376
7
2466
7
1290
7
7418
7
6557
8
374
7
1586
7
377
7
2518
7
5407
8
97
7
2500
7
4268
7
4890
7
3230
7
2537
7
4841
7
5577
7
4249
7
3373
7
6495
7
7602
7
7227
7
1808
7
539
7
2430
7
6691
7
1135
7
3146
7
4204
7
3761
7
2073
7
5254
7
6608
7
7709
7
3225
7
7349
7
903
7
2668
7
994
7...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

3913
6629
1829
954
4312
1257
5985
2085
871
2805
803
5704
474
64
1730
2771
2572
3807
356
607
3698
4352
6554
6881
2955
3443
5030
1745
2150
7690
2315
4432
235
7306
6327
5798
4596
5686
855
3023
888
5589
2026
4000
6318
5252
4983
5787
1365
1511
5429
868
1819
249
4069
5940
7336
2438
927
4141
5531
6496
310
...

input:

decode
1000
7
3913
7
6629
7
1829
7
954
7
4312
7
1257
7
5985
7
2085
7
871
7
2805
7
803
7
5704
8
474
8
64
7
1730
7
2771
7
2572
7
3807
8
356
8
607
7
3698
7
4352
7
6554
7
6881
7
2955
7
3443
7
5030
7
1745
7
2150
7
7690
7
2315
7
4432
7
235
7
7306
7
6327
7
5798
7
4596
7
5686
7
855
7
3023
7
888
7
5589
7
202...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

7298
455
1606
2319
3534
6106
5183
6586
72
4170
7564
1623
1532
7364
2212
1223
4220
5789
5953
3830
5278
1534
3044
3346
600
7720
754
2260
1415
4279
4015
5393
2724
2856
1866
413
5433
5803
3799
3728
3996
5331
6280
4344
6851
483
1914
3388
4604
3062
7283
2429
4299
4538
3193
7608
4499
3097
3590
2342
513
249...

input:

decode
1000
7
7298
7
455
7
1606
7
2319
7
3534
7
6106
7
5183
7
6586
8
72
7
4170
7
7564
7
1623
7
1532
7
7364
7
2212
7
1223
7
4220
7
5789
7
5953
7
3830
7
5278
7
1534
7
3044
7
3346
7
600
7
7720
7
754
7
2260
7
1415
7
4279
7
4015
7
5393
7
2724
7
2856
7
1866
8
413
7
5433
7
5803
7
3799
7
3728
7
3996
7
5331
...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

3120
1927
592
426
5248
2448
6013
6813
1689
6960
6892
1092
3731
1799
5809
2964
1113
5892
7102
595
3054
698
3262
93
5961
4248
1100
2440
1159
556
612
4446
7746
2171
139
2476
1374
4364
648
2563
5930
199
1993
5641
4099
7027
5823
6201
3364
6006
4451
4810
2224
3290
24
5530
4098
2079
202
1077
3931
1781
282
...

input:

decode
1000
7
3120
7
1927
7
592
8
426
7
5248
7
2448
7
6013
7
6813
7
1689
7
6960
7
6892
7
1092
7
3731
7
1799
7
5809
7
2964
7
1113
7
5892
7
7102
8
595
7
3054
7
698
7
3262
8
93
7
5961
7
4248
7
1100
7
2440
7
1159
7
556
8
612
7
4446
7
7746
7
2171
8
139
7
2476
7
1374
7
4364
7
648
7
2563
7
5930
8
199
7
199...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

7007
6719
937
3994
1048
3734
5059
2506
1142
1605
2199
2801
1143
1712
1597
3320
6964
2671
4814
2785
114
1602
6392
4308
132
2397
1852
3085
5784
3739
1705
7014
3263
6516
3703
5258
3070
858
3595
4429
623
933
3917
3815
6544
7107
4987
5709
312
6184
551
4004
1470
1045
5164
2543
931
5497
1553
4523
3961
6969...

input:

decode
1000
7
7007
7
6719
7
937
7
3994
7
1048
7
3734
7
5059
7
2506
7
1142
7
1605
7
2199
7
2801
7
1143
7
1712
7
1597
7
3320
7
6964
7
2671
7
4814
7
2785
8
114
7
1602
7
6392
7
4308
8
132
7
2397
7
1852
7
3085
7
5784
7
3739
7
1705
7
7014
7
3263
7
6516
7
3703
7
5258
7
3070
7
858
7
3595
7
4429
7
623
7
933
...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

4389
5102
488
1533
3312
3083
409
5015
3826
1970
3131
4962
3706
3098
204
3783
4790
2819
7490
7532
6486
6329
3839
5228
3648
268
237
7257
6522
7635
5834
3546
6692
4574
2709
1956
568
2317
4188
4302
3341
2662
3990
4494
1061
4520
5478
1378
4169
1307
2530
2760
1108
3529
676
7280
767
254
2810
6065
7217
3273...

input:

decode
1000
7
4389
7
5102
7
488
7
1533
7
3312
7
3083
7
409
7
5015
7
3826
7
1970
7
3131
7
4962
7
3706
7
3098
8
204
7
3783
7
4790
7
2819
7
7490
7
7532
7
6486
7
6329
7
3839
7
5228
7
3648
7
268
8
237
7
7257
7
6522
7
7635
7
5834
7
3546
7
6692
7
4574
7
2709
7
1956
7
568
7
2317
7
4188
7
4302
7
3341
7
2662
...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

4708
3298
4566
5060
1062
6598
2688
7098
3980
4490
4851
5529
1380
6517
113
6682
3876
4127
6132
5486
1737
329
1398
4361
6069
6536
6149
2478
5420
3442
4755
469
6234
6476
2903
774
4014
7713
5886
4734
1433
1710
5899
3699
3285
1504
2538
3453
2333
2821
3794
5343
6971
208
5832
3841
1719
5765
5806
1340
338
5...

input:

decode
1000
7
4708
7
3298
7
4566
7
5060
7
1062
7
6598
7
2688
7
7098
7
3980
7
4490
7
4851
7
5529
7
1380
7
6517
8
113
7
6682
7
3876
7
4127
7
6132
7
5486
7
1737
7
329
7
1398
7
4361
7
6069
7
6536
7
6149
7
2478
7
5420
7
3442
7
4755
7
469
7
6234
7
6476
7
2903
7
774
7
4014
7
7713
7
5886
7
4734
7
1433
7
171...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

3026
2021
7681
155
6324
7627
4276
5683
4459
4073
7732
1601
6094
3537
4626
3721
4902
6457
7700
2550
439
1363
1391
5884
652
2125
5958
763
2887
5974
2681
2415
1127
3013
4891
1635
2934
4951
717
1053
3342
4262
1711
6452
832
7149
1060
7023
4493
4056
176
264
319
6712
1915
712
4053
2002
1898
710
4096
5718
5...

input:

decode
1000
7
3026
7
2021
7
7681
8
155
7
6324
7
7627
7
4276
7
5683
7
4459
7
4073
7
7732
7
1601
7
6094
7
3537
7
4626
7
3721
7
4902
7
6457
7
7700
7
2550
7
439
7
1363
7
1391
7
5884
7
652
7
2125
7
5958
7
763
7
2887
7
5974
7
2681
7
2415
7
1127
7
3013
7
4891
7
1635
7
2934
7
4951
8
717
7
1053
7
3342
7
4262...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

13337
3995
7111
3715
28405
37720
36788
35830
9422
9537
42900
31746
25054
3310
28010
8594
1793
31767
13006
17117
32789
5394
22359
20181
23363
3362
2788
34214
21878
4634
26383
32771
24308
41507
39636
24555
28801
21279
14221
14126
7536
9655
28401
19541
3424
11238
5377
13738
25602
13201
480
10232
39056
...

input:

decode
1000
8
13337
8
3995
8
7111
8
3715
8
28405
8
37720
8
36788
8
35830
8
9422
8
9537
8
42900
8
31746
8
25054
8
3310
8
28010
8
8594
8
1793
8
31767
8
13006
8
17117
8
32789
8
5394
8
22359
8
20181
8
23363
8
3362
8
2788
8
34214
8
21878
8
4634
8
26383
8
32771
8
24308
8
41507
8
39636
8
24555
8
28801
8
21...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

210637
244799
161513
241058
34743
23379
220600
57986
146468
224652
161368
68695
241228
182074
148222
131857
93003
78876
16043
204364
162601
90418
42037
77947
14243
30206
180644
85504
39081
176139
224443
144152
165972
178021
493
168217
21602
137360
58470
25164
102031
155350
93174
75775
96481
82432
14...

input:

decode
1000
9
210637
9
244799
9
161513
9
241058
9
34743
9
23379
9
220600
9
57986
9
146468
9
224652
9
161368
9
68695
9
241228
9
182074
9
148222
9
131857
9
93003
9
78876
9
16043
9
204364
9
162601
9
90418
9
42037
9
77947
9
14243
9
30206
9
180644
9
85504
9
39081
9
176139
9
224443
9
144152
9
165972
9
178...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

1
1430715
893208
306947
177013
213602
1194938
1426834
431720
320684
1011723
610674
500079
239546
492106
375491
386096
751461
1000763
1093205
764969
1056473
1297060
1316660
30320
597434
683045
1011784
1384361
1400199
481383
129725
737986
824295
195398
1410018
355935
887696
868818
362715
529575
104449...

input:

decode
1000
10
1
10
1430715
10
893208
10
306947
10
177013
10
213602
10
1194938
10
1426834
10
431720
10
320684
10
1011723
10
610674
10
500079
10
239546
10
492106
10
375491
10
386096
10
751461
10
1000763
10
1093205
10
764969
10
1056473
10
1297060
10
1316660
10
30320
10
597434
10
683045
10
1011784
10
1...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

1
8414640
5275833
1811941
5451708
6047275
2192760
6259599
6311344
5999598
2843508
3964897
6670838
504869
6324273
3812188
3331465
1295317
6377783
1399613
4660179
8129912
2286964
1575146
3248551
3017260
8111757
8391040
916225
3621579
6572652
2907975
4873863
5354929
8397713
762425
5995911
480438
208479...

input:

decode
1000
11
1
11
8414640
11
5275833
11
1811941
11
5451708
11
6047275
11
2192760
11
6259599
11
6311344
11
5999598
11
2843508
11
3964897
11
6670838
11
504869
11
6324273
11
3812188
11
3331465
11
1295317
11
6377783
11
1399613
11
4660179
11
8129912
11
2286964
11
1575146
11
3248551
11
3017260
11
811175...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

1
50067108
31501461
10799390
18422777
9971506
46834281
29627188
35227444
9115896
48097838
27060119
12371571
5844454
37320586
6069989
313632
32561525
24225982
22652255
39882541
24884782
31485178
8865821
24019992
24590950
14001309
47025658
49574495
9876792
11160303
40141852
7822925
34961948
2351377
21...

input:

decode
1000
12
1
12
50067108
12
31501461
12
10799390
12
18422777
12
9971506
12
46834281
12
29627188
12
35227444
12
9115896
12
48097838
12
27060119
12
12371571
12
5844454
12
37320586
12
6069989
12
313632
12
32561525
12
24225982
12
22652255
12
39882541
12
24884782
12
31485178
12
8865821
12
24019992
12...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

270329819
200300515
139120709
270677717
48970805
102420048
159487847
17395225
188265046
220291867
94067624
74765763
83827390
14527180
253883788
100717126
49670122
159193846
103142404
80978566
171204662
165787415
144942349
56174239
255139425
64358313
258541268
126986627
235768895
54340621
272887831
1...

input:

decode
1000
13
270329819
13
200300515
13
139120709
13
270677717
13
48970805
13
102420048
13
159487847
13
17395225
13
188265046
13
220291867
13
94067624
13
74765763
13
83827390
13
14527180
13
253883788
13
100717126
13
49670122
13
159193846
13
103142404
13
80978566
13
171204662
13
165787415
13
1449423...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

1
1822766520
1153083941
416203337
1172744872
651855578
17933673
1507767180
794593344
1373881834
1073805075
1507004490
837758885
1510085041
1218853308
655792811
1041828900
767981261
1099614193
832614556
92413880
531385632
24526670
627650272
171043772
1009823072
404430309
1313263861
1457296232
1202848...

input:

decode
1000
14
1
14
1822766520
14
1153083941
14
416203337
14
1172744872
14
651855578
14
17933673
14
1507767180
14
794593344
14
1373881834
14
1073805075
14
1507004490
14
837758885
14
1510085041
14
1218853308
14
655792811
14
1041828900
14
767981261
14
1099614193
14
832614556
14
92413880
14
531385632
1...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

8082098440
178097427
2301778502
4901098159
4418465606
492205332
1282199890
4213888917
9530899868
10562798362
1967388972
10829580464
7721534752
7493408417
8171328125
9765714173
6362675014
9060919359
4916018541
10774851806
1974665656
1585522692
8373555536
4844357489
2735622238
8781294933
9067626348
56...

input:

decode
1000
15
8082098440
15
178097427
15
2301778502
15
4901098159
15
4418465606
15
492205332
15
1282199890
15
4213888917
15
9530899868
15
10562798362
15
1967388972
15
10829580464
15
7721534752
15
7493408417
15
8171328125
15
9765714173
15
6362675014
15
9060919359
15
4916018541
15
10774851806
15
1974...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

1
68328754959
43397658006
17087763642
56264796897
13473673829
46634918178
62821881327
19001957225
16781235530
26875722683
38561268808
64093974690
54937582816
50399338
58561162405
50905575891
31186282953
8055790560
13772309599
25676839113
45811172775
29288584121
37494919160
35561028607
3874936263
453...

input:

decode
1000
16
1
16
68328754959
16
43397658006
16
17087763642
16
56264796897
16
13473673829
16
46634918178
16
62821881327
16
19001957225
16
16781235530
16
26875722683
16
38561268808
16
64093974690
16
54937582816
16
50399338
16
58561162405
16
50905575891
16
31186282953
16
8055790560
16
13772309599
16...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

419824929786
323375443742
92492117175
413292265787
307967330928
257010586294
321512819667
164413840070
182805381457
271985015055
224407956044
173808597378
271777737182
302576187893
233656818032
15157076703
71525864364
75306922871
228615777740
112819859259
158247868964
331936702731
139617202181
40158...

input:

decode
1000
17
419824929786
17
323375443742
17
92492117175
17
413292265787
17
307967330928
17
257010586294
17
321512819667
17
164413840070
17
182805381457
17
271985015055
17
224407956044
17
173808597378
17
271777737182
17
302576187893
17
233656818032
17
15157076703
17
71525864364
17
75306922871
17
2...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

1
2619631042665
1668912304993
744835969452
2245522394442
1911862868920
1212496575182
975463476688
1239427352805
1532876957758
991857075630
824809794363
1483145945416
472198549674
1687602938010
786190349131
2569506815718
1704671272957
786337547683
1468190803101
380105378362
1890100075176
163522231574...

input:

decode
1000
18
1
18
2619631042665
18
1668912304993
18
744835969452
18
2245522394442
18
1911862868920
18
1212496575182
18
975463476688
18
1239427352805
18
1532876957758
18
991857075630
18
824809794363
18
1483145945416
18
472198549674
18
1687602938010
18
786190349131
18
2569506815718
18
1704671272957
...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

1
16332922290300
10418692103368
4963550636751
9874095784301
3894828232494
10352353487918
14713028264305
9712545635974
5688534527095
7274918188851
12958861706524
1160436026761
15267981361518
12423689556183
13382277000180
15736659473549
1279164093572
9592789100008
2493005637798
14599028558818
60234072...

input:

decode
1000
19
1
19
16332922290300
19
10418692103368
19
4963550636751
19
9874095784301
19
3894828232494
19
10352353487918
19
14713028264305
19
9712545635974
19
5688534527095
19
7274918188851
19
12958861706524
19
1160436026761
19
15267981361518
19
12423689556183
19
13382277000180
19
15736659473549
19...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

22978752340203
21354489883920
101729615007521
101117880300334
51704897402442
22489351071016
46213947416073
47062369432577
32859785996835
21435416003980
52206839596107
45924766821421
64194384863742
45227429799953
17692041982457
23602484024696
5055277570600
86243659581920
18348001411033
35695557249299...

input:

decode
1000
20
22978752340203
20
21354489883920
20
101729615007521
20
101117880300334
20
51704897402442
20
22489351071016
20
46213947416073
20
47062369432577
20
32859785996835
20
21435416003980
20
52206839596107
20
45924766821421
20
64194384863742
20
45227429799953
20
17692041982457
20
2360248402469...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

503334628547457
475190613568285
321195105898997
240154457581651
46576603747916
505299356498528
546775712648822
420643035593200
199091292637108
41590297145638
193796964530136
52855979487525
104722002173505
296501860049810
535402257432522
375859298042332
5375143831022
13699590462232
445544139682677
28...

input:

decode
1000
21
503334628547457
21
475190613568285
21
321195105898997
21
240154457581651
21
46576603747916
21
505299356498528
21
546775712648822
21
420643035593200
21
199091292637108
21
41590297145638
21
193796964530136
21
52855979487525
21
104722002173505
21
296501860049810
21
535402257432522
21
375...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

2436884625079380
1207049889966796
3576701246466658
3455829549237138
3088738290273552
1103079317457966
2066422491690006
2546603049472525
1159706681136291
1506107089595676
1702578492059872
314646737778536
3549288191971042
1382749143198440
3697731999590570
1412858097788319
256756408804698
1061928449628...

input:

decode
1000
22
2436884625079380
22
1207049889966796
22
3576701246466658
22
3455829549237138
22
3088738290273552
22
1103079317457966
22
2066422491690006
22
2546603049472525
22
1159706681136291
22
1506107089595676
22
1702578492059872
22
314646737778536
22
3549288191971042
22
1382749143198440
22
369773...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

21670559195699369
6759136742813952
5193426379334257
25145317862297754
21515518236098561
13524358613573225
24472850642221891
23384553065561946
19700151732901275
8968875847363880
5754319529873416
19154380119178622
22332957682640723
17109129335837241
14707283993179461
14204670501097222
2374651379150860...

input:

decode
1000
23
21670559195699369
23
6759136742813952
23
5193426379334257
23
25145317862297754
23
21515518236098561
23
13524358613573225
23
24472850642221891
23
23384553065561946
23
19700151732901275
23
8968875847363880
23
5754319529873416
23
19154380119178622
23
22332957682640723
23
1710912933583724...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

93673491794096685
13954868744339021
98686787312225413
106243383435424121
49388356494361235
132729715179061612
79095255513551038
77202311906542941
149882088798934241
55222749428186122
64879907124773243
126528049115760490
72917207552011449
30063387727318174
134169200768671281
67016530151648220
1247762...

input:

decode
1000
24
93673491794096685
24
13954868744339021
24
98686787312225413
24
106243383435424121
24
49388356494361235
24
132729715179061612
24
79095255513551038
24
77202311906542941
24
149882088798934241
24
55222749428186122
24
64879907124773243
24
126528049115760490
24
72917207552011449
24
30063387...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

1
1031147983159782228
661368678063000703
423852752036139621
1008375080724984608
935061227912001961
110128449381792149
209373574423334591
775758596791869279
62111278220247577
652580329958754734
485315245779254389
867601598682305444
734060304217813585
437526511967617758
240718783230950489
276917872862...

input:

decode
1000
25
1
25
1031147983159782228
25
661368678063000703
25
423852752036139621
25
1008375080724984608
25
935061227912001961
25
110128449381792149
25
209373574423334591
25
775758596791869279
25
62111278220247577
25
652580329958754734
25
485315245779254389
25
867601598682305444
25
734060304217813...

output:

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

result:

ok 1000 lines

Test #32:

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

input:

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

output:

126489705338193015
820495362218715688
2591222832596032
118054940736171074
129878584905270100
2028060766895883
551074991112624
63457944252640
75777406248689
16620504012744853
18233717486434069
97566586778208777
231696400824580635
853449987365291073
7518680453491560
46246047421140664
1
108520866551324...

input:

decode
1000
25
126489705338193015
25
820495362218715688
22
2591222832596032
24
118054940736171074
24
129878584905270100
23
2028060766895883
21
551074991112624
20
63457944252640
20
75777406248689
23
16620504012744853
23
18233717486434069
24
97566586778208777
25
231696400824580635
25
85344998736529107...

output:

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

result:

ok 1000 lines