QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294383#4824. Bracket-and-bar Sequencesucup-team006#0 3ms3872kbC++202.7kb2023-12-30 13:15:462023-12-30 13:15:46

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

0
66
91

input:

decode
3
1
0
4
66
5
91

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

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: 3792kb

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
4
6
7
8
5
9
10
11
12
0
1
2
4
6
7
8
5
9
10
11
12
16
17
18
28
29
30
35
36
37
39
41
42
43
40
44
45
46
47
19
20
21
31
48
49
50
32
33
34
51
52
53
54
55
56
58
60
61
62
59
63
64
65
66
0
1
2
4
6
7
8
5
9
10
11
12
16
17
18
28
29
30
35
36
37
39
41
42
43
40
44
45
46
47
19
20
21
31
48
49
50
32
33
34
51
52
...

input:

decode
1000
3
0
3
1
3
2
3
4
3
6
3
7
3
8
3
5
3
9
3
10
3
11
3
12
4
0
4
1
4
2
4
4
4
6
4
7
4
8
4
5
4
9
4
10
4
11
4
12
4
16
4
17
4
18
4
28
4
29
4
30
4
35
4
36
4
37
4
39
4
41
4
42
4
43
4
40
4
44
4
45
4
46
4
47
4
19
4
20
4
21
4
31
4
48
4
49
4
50
4
32
4
33
4
34
4
51
4
52
4
53
4
54
4
55
4
56
4
58
4
60
4
61
4...

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

1544
1634
1635
1636
1638
1640
1641
1642
1639
1643
1644
1645
1646
1647
1648
1649
1651
1653
1654
1655
1652
1656
1657
1658
1659
1663
1664
1665
1675
1676
1677
1682
1683
1684
1686
1688
1689
1690
1687
1691
1692
1693
1694
1666
1667
1668
1678
1695
1696
1697
1679
1680
1681
1698
1699
1700
1701
1702
1703
1705
...

input:

decode
1000
6
1544
6
1634
6
1635
6
1636
6
1638
6
1640
6
1641
6
1642
6
1639
6
1643
6
1644
6
1645
6
1646
6
1647
6
1648
6
1649
6
1651
6
1653
6
1654
6
1655
6
1652
6
1656
6
1657
6
1658
6
1659
6
1663
6
1664
6
1665
6
1675
6
1676
6
1677
6
1682
6
1683
6
1684
6
1686
6
1688
6
1689
6
1690
6
1687
6
1691
6
1692
6...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

11942
12462
9505
5001
2143
14122
12613
510
3174
578
4899
11131
135
5054
9316
10407
7798
5159
10347
11329
9218
7989
12545
14412
13914
3353
894
4921
12855
1904
6328
9127
8510
3869
10887
12736
14534
7772
14059
1632
4904
1744
6030
10072
8939
8838
8619
10437
3021
10619
12270
3413
11051
2896
1165
14348
11...

input:

decode
1000
7
11942
7
12462
7
9505
7
5001
7
2143
7
14122
7
12613
8
510
7
3174
7
578
7
4899
7
11131
8
135
7
5054
7
9316
7
10407
7
7798
7
5159
7
10347
7
11329
7
9218
7
7989
7
12545
7
14412
7
13914
7
3353
7
894
7
4921
7
12855
7
1904
7
6328
7
9127
7
8510
7
3869
7
10887
7
12736
7
14534
7
7772
7
14059
7
1...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

8689
12817
2981
1693
9349
2107
11863
4207
1596
6125
1515
11383
877
85
3311
6017
4810
8555
500
1225
8390
9525
12608
13233
6150
8080
10566
2939
3887
14514
4180
9590
332
14005
12284
11640
10004
11377
1579
5893
1614
11468
3994
8847
12275
10884
10508
11652
2231
2740
11155
1593
2978
355
8929
11895
14045
5...

input:

decode
1000
7
8689
7
12817
7
2981
7
1693
7
9349
7
2107
7
11863
7
4207
7
1596
7
6125
7
1515
7
11383
8
877
8
85
7
3311
7
6017
7
4810
7
8555
8
500
8
1225
7
8390
7
9525
7
12608
7
13233
7
6150
7
8080
7
10566
7
2939
7
3887
7
14514
7
4180
7
9590
7
332
7
14005
7
12284
7
11640
7
10004
7
11377
7
1579
7
5893
7...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

13996
684
3200
3980
8186
11967
10811
12650
89
9101
14347
2826
3132
14093
4298
2013
9136
11678
11737
8584
10921
3133
5977
7960
1217
14554
1398
4238
2292
9369
8863
11080
5843
6314
3383
678
11159
11537
8551
8467
8842
10985
12226
9498
13232
904
3417
8013
10012
6034
13980
4908
9360
9926
7723
14418
9884
6...

input:

decode
1000
7
13996
7
684
7
3200
7
3980
7
8186
7
11967
7
10811
7
12650
8
89
7
9101
7
14347
7
2826
7
3132
7
14093
7
4298
7
2013
7
9136
7
11678
7
11737
7
8584
7
10921
7
3133
7
5977
7
7960
7
1217
7
14554
7
1398
7
4238
7
2292
7
9369
7
8863
7
11080
7
5843
7
6314
7
3383
8
678
7
11159
7
11537
7
8551
7
8467...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

6244
3044
1209
667
10880
5168
11756
13207
2900
13537
13457
1834
8470
2967
11628
6192
1875
11718
13707
1212
6010
1330
7862
143
11788
9151
1858
5051
1930
948
1230
9822
14582
3891
221
5144
2240
9561
1268
5108
11862
295
4122
11361
8961
13617
11655
12142
7979
11732
9827
10309
4166
7892
33
11271
8960
4271...

input:

decode
1000
7
6244
7
3044
7
1209
8
667
7
10880
7
5168
7
11756
7
13207
7
2900
7
13537
7
13457
7
1834
7
8470
7
2967
7
11628
7
6192
7
1875
7
11718
7
13707
8
1212
7
6010
7
1330
7
7862
8
143
7
11788
7
9151
7
1858
7
5051
7
1930
7
948
8
1230
7
9822
7
14582
7
3891
8
221
7
5144
7
2240
7
9561
7
1268
7
5108
7
...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

13596
12995
1675
8840
1801
8473
10605
5145
1911
2819
3895
6113
1912
3293
2827
7932
13542
4943
10318
6062
194
3194
12369
9387
213
4881
3376
6109
11613
8479
2909
13603
7863
12568
8405
10891
6061
1582
8252
9581
1242
1664
8693
8568
12597
13748
10512
11518
477
12115
933
8851
3099
1800
10782
4835
1663
112...

input:

decode
1000
7
13596
7
12995
7
1675
7
8840
7
1801
7
8473
7
10605
7
5145
7
1911
7
2819
7
3895
7
6113
7
1912
7
3293
7
2827
7
7932
7
13542
7
4943
7
10318
7
6062
8
194
7
3194
7
12369
7
9387
8
213
7
4881
7
3376
7
6109
7
11613
7
8479
7
2909
7
13603
7
7863
7
12568
7
8405
7
10891
7
6061
7
1582
7
8252
7
9581
...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

9547
10669
919
2752
7924
6100
716
10550
8580
3447
6280
10493
8443
6151
294
8534
10284
6170
14219
14272
12536
12287
8596
10859
8316
375
342
13946
12574
14455
11643
8187
12789
9972
5048
3439
1175
4314
9119
9309
7955
4813
8836
9879
1818
9906
11215
2245
9167
2169
5055
5981
1867
8171
1307
13977
1432
360
...

input:

decode
1000
7
9547
7
10669
7
919
7
2752
7
7924
7
6100
7
716
7
10550
7
8580
7
3447
7
6280
7
10493
7
8443
7
6151
8
294
7
8534
7
10284
7
6170
7
14219
7
14272
7
12536
7
12287
7
8596
7
10859
7
8316
7
375
8
342
7
13946
7
12574
7
14455
7
11643
7
8187
7
12789
7
9972
7
5048
7
3439
7
1175
7
4314
7
9119
7
9309...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

10188
7909
9963
10607
1793
12730
5177
13705
8826
9874
10357
11270
2247
12569
193
12783
8641
8999
12028
11224
2934
552
2274
9552
11922
12589
12039
5170
11145
8079
10247
859
12177
12525
5982
1423
8862
14542
11699
10224
2690
3292
11748
8393
7887
3117
5172
8091
3982
6191
8546
10998
13549
302
11617
8604
...

input:

decode
1000
7
10188
7
7909
7
9963
7
10607
7
1793
7
12730
7
5177
7
13705
7
8826
7
9874
7
10357
7
11270
7
2247
7
12569
8
193
7
12783
7
8641
7
8999
7
12028
7
11224
7
2934
7
552
7
2274
7
9552
7
11922
7
12589
7
12039
7
5170
7
11145
7
8079
7
10247
7
859
7
12177
7
12525
7
5982
7
1423
7
8862
7
14542
7
11699...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

5920
4127
14504
246
12281
14441
9330
11376
9841
8933
14567
2813
11954
8157
10036
8459
10420
12496
14524
4926
746
2228
2261
11673
1273
4084
11755
1430
5931
11830
5086
5128
1895
5854
10408
2872
6081
10495
1351
1790
7956
9328
2912
12491
1546
13821
1805
13613
9878
8915
268
370
547
12994
3037
1345
8912
4...

input:

decode
1000
7
5920
7
4127
7
14504
8
246
7
12281
7
14441
7
9330
7
11376
7
9841
7
8933
7
14567
7
2813
7
11954
7
8157
7
10036
7
8459
7
10420
7
12496
7
14524
7
4926
7
746
7
2228
7
2261
7
11673
7
1273
7
4084
7
11755
7
1430
7
5931
7
11830
7
5086
7
5128
7
1895
7
5854
7
10408
7
2872
7
6081
7
10495
8
1351
7
...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

29381
8841
13740
8453
69915
84743
82775
81193
20753
18516
94748
75374
63611
7922
69335
19895
2964
75382
29295
41864
76706
11083
58106
54701
59710
7977
6077
78551
57334
10056
67226
76342
62243
92545
89643
62343
70570
56525
34527
30012
14301
18587
69910
53829
8051
26216
11051
30132
65741
30381
895
212...

input:

decode
1000
8
29381
8
8841
8
13740
8
8453
8
69915
8
84743
8
82775
8
81193
8
20753
8
18516
8
94748
8
75374
8
63611
8
7922
8
69335
8
19895
8
2964
8
75382
8
29295
8
41864
8
76706
8
11083
8
58106
8
54701
8
59710
8
7977
8
6077
8
78551
8
57334
8
10056
8
67226
8
76342
8
62243
8
92545
8
89643
8
62343
8
7057...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

555598
633892
469038
626622
79622
60486
583974
123891
443516
598163
468851
157447
626314
510008
446135
400053
240898
213835
40651
543381
470893
245873
93224
219518
34774
72897
505290
249375
88871
496620
597706
430233
478467
501432
937
481833
56956
415168
124238
65184
280067
459934
243472
191425
2895...

input:

decode
1000
9
555598
9
633892
9
469038
9
626622
9
79622
9
60486
9
583974
9
123891
9
443516
9
598163
9
468851
9
157447
9
626314
9
510008
9
446135
9
400053
9
240898
9
213835
9
40651
9
543381
9
470893
9
245873
9
93224
9
219518
9
34774
9
72897
9
505290
9
249375
9
88871
9
496620
9
597706
9
430233
9
47846...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

0
4341762
3135557
900145
498212
562904
3729448
4335810
1405550
815918
3379304
1991274
1518198
623578
1520666
1051212
1053642
2703249
3345607
3529452
2742603
3457486
4070789
4105879
73246
2036489
2561419
3379517
4242053
4276550
1534511
396812
2675670
2889871
525993
4305183
1076332
3124296
3072022
103...

input:

decode
1000
10
0
10
4341762
10
3135557
10
900145
10
498212
10
562904
10
3729448
10
4335810
10
1405550
10
815918
10
3379304
10
1991274
10
1518198
10
623578
10
1520666
10
1051212
10
1053642
10
2703249
10
3345607
10
3529452
10
2742603
10
3457486
10
4070789
10
4105879
10
73246
10
2036489
10
2561419
10
3...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

0
30056444
21829603
6131890
22178715
23651043
7481869
23999181
24229767
23549057
9867061
17734875
24956036
1554988
24241774
17408344
13608826
4068013
24319905
4272547
19461886
29335125
8428547
5161974
12016183
11185011
29295648
30015243
3175623
13932180
24716088
11108258
20199770
21985521
30028178
2...

input:

decode
1000
11
0
11
30056444
11
21829603
11
6131890
11
22178715
11
23651043
11
7481869
11
23999181
11
24229767
11
23549057
11
9867061
11
17734875
11
24956036
11
1554988
11
24241774
11
17408344
11
13608826
11
4068013
11
24319905
11
4272547
11
19461886
11
29335125
11
8428547
11
5161974
11
12016183
11
...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

0
210731010
153753678
42462163
80487798
41505454
202207343
145952082
163961941
39798826
205231609
134883832
47364796
23110107
169279587
23775907
810286
156212296
126246024
121921791
175795732
127831616
153707424
34997647
126004348
127039918
57153142
202693039
209600376
41402278
38621291
175861853
28...

input:

decode
1000
12
0
12
210731010
12
153753678
12
42462163
12
80487798
12
41505454
12
202207343
12
145952082
12
163961941
12
39798826
12
205231609
12
134883832
12
47364796
12
23110107
12
169279587
12
23775907
12
810286
12
156212296
12
126246024
12
121921791
12
175795732
12
127831616
12
153707424
12
3499...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

1369493140
1121498783
880537347
1369187851
207487211
538368762
943560892
72414081
1088906198
1193050423
469764773
339238626
384704020
63026883
1294572481
496135781
209802387
942978243
536208928
388322887
989973218
967141920
897322010
251728397
1301253596
266971360
1311086601
700970421
1237737539
247...

input:

decode
1000
13
1369493140
13
1121498783
13
880537347
13
1369187851
13
207487211
13
538368762
13
943560892
13
72414081
13
1088906198
13
1193050423
13
469764773
13
339238626
13
384704020
13
63026883
13
1294572481
13
496135781
13
209802387
13
942978243
13
536208928
13
388322887
13
989973218
13
96714192...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

0
10678370306
7845517399
2403100627
7906014611
3896108302
78062040
9140211196
5239751476
8671099905
7325277939
9137869822
6270390518
9146479708
8054461140
3876556560
7142431759
5205437508
7619155896
6248766969
461093298
2988551383
126830882
3660867483
988639310
6952914721
2367473179
8453258581
89084...

input:

decode
1000
14
0
14
10678370306
14
7845517399
14
2403100627
14
7906014611
14
3896108302
14
78062040
14
9140211196
14
5239751476
14
8671099905
14
7325277939
14
9137869822
14
6270390518
14
9146479708
14
8054461140
14
3876556560
14
7142431759
14
5205437508
14
7619155896
14
6248766969
14
461093298
14
29...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

61318042101
1025665950
14904624420
36552354829
33578199129
2732482845
8324878626
30274502786
67496216350
74515830029
13999026747
75487017201
59525723825
58381132980
61651378847
68947894434
51634874122
65046846154
36748562254
75256974860
14004676352
9481047329
62500376828
37514349330
17456345216
6407...

input:

decode
1000
15
61318042101
15
1025665950
15
14904624420
15
36552354829
15
33578199129
15
2732482845
15
8324878626
15
30274502786
15
67496216350
15
74515830029
15
13999026747
15
75487017201
15
59525723825
15
58381132980
15
61651378847
15
68947894434
15
51634874122
15
65046846154
15
36748562254
15
752...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

0
558403682306
412333840480
138757452693
477223097909
95548522142
428797460542
528889043229
151049343265
128361770362
241929941156
368922338177
537182237150
469105127578
271322553
490070175084
451854554793
327830980698
61063368376
96134091892
224817117146
422881396684
277470937051
363469967380
35205...

input:

decode
1000
16
0
16
558403682306
16
412333840480
16
138757452693
16
477223097909
16
95548522142
16
428797460542
16
528889043229
16
151049343265
16
128361770362
16
241929941156
16
368922338177
16
537182237150
16
469105127578
16
271322553
16
490070175084
16
451854554793
16
327830980698
16
61063368376
...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

4063431063270
3342032699713
897464910215
4014138886860
3268060788874
2936213566351
3333460681927
1641799952218
1963625019000
3033682236282
2600695467267
1804085420792
3032656648992
3227700498462
2666691435242
121189323046
644890654761
736396796368
2627564974663
1081895569588
1546785753469
3386825895...

input:

decode
1000
17
4063431063270
17
3342032699713
17
897464910215
17
4014138886860
17
3268060788874
17
2936213566351
17
3333460681927
17
1641799952218
17
1963625019000
17
3033682236282
17
2600695467267
17
1804085420792
17
3032656648992
17
3227700498462
17
2666691435242
17
121189323046
17
644890654761
17...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

0
29909606989826
22169947150441
8408270685424
26268599533481
23998931000808
17746450664482
11678976300091
18035386853959
20455172739957
11476710518831
9218941073494
19923619140161
4847049967516
22277106004695
8897486017146
29490124577122
22391499050677
8883810414181
19709996666342
3739924029969
2378...

input:

decode
1000
18
0
18
29909606989826
18
22169947150441
18
8408270685424
18
26268599533481
18
23998931000808
18
17746450664482
18
11678976300091
18
18035386853959
18
20455172739957
18
11476710518831
18
9218941073494
18
19923619140161
18
4847049967516
18
22277106004695
18
8897486017146
18
29490124577122...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

0
220510631755772
163707301861311
67327122636664
156321293183988
47119487158177
163157170063414
202878773386205
153198099747417
78699369250995
110157186572721
184498350657765
14847979832684
211321082572302
180404834776231
187432061606897
215241411095523
18297817520199
151313795233171
29008164542520
...

input:

decode
1000
19
0
19
220510631755772
19
163707301861311
19
67327122636664
19
156321293183988
19
47119487158177
19
163157170063414
19
202878773386205
19
153198099747417
19
78699369250995
19
110157186572721
19
184498350657765
19
14847979832684
19
211321082572302
19
180404834776231
19
187432061606897
19...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

341232379404092
309449180635907
1627777552296148
1622735513971368
1014568831382387
348162891888803
801471690061758
823429062948006
534159251000184
309680819302358
1019733097620851
826451883742322
1197800434012468
808328776995647
257746720435267
345992109832051
66914585998825
1415495184457863
2627143...

input:

decode
1000
20
341232379404092
20
309449180635907
20
1627777552296148
20
1622735513971368
20
1014568831382387
20
348162891888803
20
801471690061758
20
823429062948006
20
534159251000184
20
309680819302358
20
1019733097620851
20
826451883742322
20
1197800434012468
20
808328776995647
20
25774672043526...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

10058183140904670
9764067799975917
7522773938205980
4605745542759001
811277528339238
10098021965256879
10599056929886887
9134856437627226
3750506389478471
732144365414942
3606420805135279
1026701430511266
2091665333190824
6140202325334581
10454858348401045
8289387780380939
73433177018079
19051163340...

input:

decode
1000
21
10058183140904670
21
9764067799975917
21
7522773938205980
21
4605745542759001
21
811277528339238
21
10098021965256879
21
10599056929886887
21
9134856437627226
21
3750506389478471
21
732144365414942
21
3606420805135279
21
1026701430511266
21
2091665333190824
21
6140202325334581
21
1045...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

63477165576582292
26676425266791320
81452693706808705
79350486909223066
74151823271740546
24664226384722775
56615279262200971
66498271440168507
25832437093163820
34502765644100248
41319566816180133
7459571101943855
80900683491447947
31166774464129240
84344857128006475
32447201966271441
5090285854149...

input:

decode
1000
22
63477165576582292
22
26676425266791320
22
81452693706808705
22
79350486909223066
22
74151823271740546
22
24664226384722775
22
56615279262200971
22
66498271440168507
22
25832437093163820
22
34502765644100248
22
41319566816180133
22
7459571101943855
22
80900683491447947
22
3116677446412...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

588684161511409993
169514218052293362
113631442536676657
668399065997623105
586085457525961469
433543657076939269
658616113382670205
631081621465875456
557341871760564314
244378239175392709
144331921958175787
551258169581549139
603124334690404023
514325757361467361
456929514828323101
446470331505063...

input:

decode
1000
23
588684161511409993
23
169514218052293362
23
113631442536676657
23
668399065997623105
23
586085457525961469
23
433543657076939269
23
658616113382670205
23
631081621465875456
23
557341871760564314
23
244378239175392709
23
144331921958175787
23
551258169581549139
23
603124334690404023
23...

output:

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

result:

ok 1000 lines

Test #30:

score: 0
Wrong Answer on the first run

input:

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

output:

3449926635955791897
440424444632457633
3623817844178379423
3830067038193530503
1529196493297351070
4313261333722585472
3123994152622217984
3079157386699454037
4828387218032660152
1745757725737861247
2178162884266288022
4206858993334326585
2558767297719683087
917344413595033715
4347507691883967881
23...

input:


output:


result:

wrong answer Integer parameter [name=x_i] equals to 3449926635955791897, violates the range [0, 2*10^18] (test case 1)