QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294797#4824. Bracket-and-bar Sequencesucup-team570#AC ✓12ms3600kbC++2018.0kb2023-12-30 16:39:122023-12-30 16:39:12

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1
71
137

input:

decode
3
1
1
4
71
5
137

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

1

input:

decode
1
1
1

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

4
1
3

input:

decode
3
2
4
1
1
2
3

output:

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

result:

ok 3 lines

Test #4:

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

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:

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
...

input:

decode
1000
6
1005
6
1006
6
1007
6
1008
6
1009
6
1010
6
1011
6
1012
6
1013
6
1014
6
1015
6
1016
6
1017
6
1018
6
1019
6
1020
6
1021
6
1022
6
1023
6
1024
6
1025
6
1026
6
1027
6
1028
6
1029
6
1030
6
1031
6
1032
6
1033
6
1034
6
1035
6
1036
6
1037
6
1038
6
1039
6
1040
6
1041
6
1042
6
1043
6
1044
6
1045
6...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

7846
8173
4599
6552
3023
9134
8328
9847
5803
2552
3695
6182
9682
6892
4553
5077
4017
6863
4940
6376
4997
4171
8225
9453
8742
5817
2172
3673
8871
2900
7328
4514
7659
3513
5601
8374
9481
4101
8964
2418
3767
2606
6025
4822
4413
4403
7795
5150
3449
5416
8086
5884
6255
3403
2174
9429
7083
6153
5300
7055
...

input:

decode
1000
7
7846
7
8173
7
4599
7
6552
7
3023
7
9134
7
8328
8
9847
7
5803
7
2552
7
3695
7
6182
8
9682
7
6892
7
4553
7
5077
7
4017
7
6863
7
4940
7
6376
7
4997
7
4171
7
8225
7
9453
7
8742
7
5817
7
2172
7
3673
7
8871
7
2900
7
7328
7
4514
7
7659
7
3513
7
5601
7
8374
7
9481
7
4101
7
8964
7
2418
7
3767
7...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

4250
8856
3389
2474
5010
3005
7484
6471
2356
6959
2306
6767
9894
9587
5754
3834
3713
7742
9839
9973
7625
4593
8326
9093
7228
6082
5374
3310
3528
9465
6518
5216
2005
8921
8099
7112
4692
6728
2355
3925
2391
6652
3494
4419
8089
5596
5326
7066
3137
3242
6303
2350
3372
2013
4388
7439
8948
6830
2454
4485
...

input:

decode
1000
7
4250
7
8856
7
3389
7
2474
7
5010
7
3005
7
7484
7
6471
7
2356
7
6959
7
2306
7
6767
8
9894
8
9587
7
5754
7
3834
7
3713
7
7742
8
9839
8
9973
7
7625
7
4593
7
8326
7
9093
7
7228
7
6082
7
5374
7
3310
7
3528
7
9465
7
6518
7
5216
7
2005
7
8921
7
8099
7
7112
7
4692
7
6728
7
2355
7
3925
7
2391
7...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

8913
2132
5721
3619
7007
7878
5497
8358
9588
4504
9426
3380
5700
9033
6457
2988
4522
7068
7452
7777
5615
5701
3928
4133
2215
9507
2281
6498
3187
5099
4317
6176
3790
7213
5867
9875
6308
7070
7722
7750
4416
6123
8052
4585
9081
2680
5906
4199
4696
6038
8810
3672
5104
5280
3992
9456
5035
7279
7372
5974
...

input:

decode
1000
7
8913
7
2132
7
5721
7
3619
7
7007
7
7878
7
5497
7
8358
8
9588
7
4504
7
9426
7
3380
7
5700
7
9033
7
6457
7
2988
7
4522
7
7068
7
7452
7
7777
7
5615
7
5701
7
3928
7
4133
7
2215
7
9507
7
2281
7
6498
7
3187
7
5099
7
4317
7
6176
7
3790
7
7213
7
5867
8
9875
7
6308
7
7070
7
7722
7
7750
7
4416
7...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

7295
3442
2200
9868
5592
6840
7510
9061
3289
9096
8507
2809
7754
3362
7075
7251
2885
7390
8618
9959
3940
2870
4107
9703
7457
4542
2817
6832
2931
2768
9979
4633
9517
3537
9621
6850
3146
5184
2820
6870
7429
9711
6383
6740
4446
8554
7090
7928
4163
7505
4653
4925
6461
4047
9563
6328
4442
6418
9714
2794
...

input:

decode
1000
7
7295
7
3442
7
2200
8
9868
7
5592
7
6840
7
7510
7
9061
7
3289
7
9096
7
8507
7
2809
7
7754
7
3362
7
7075
7
7251
7
2885
7
7390
7
8618
8
9959
7
3940
7
2870
7
4107
8
9703
7
7457
7
4542
7
2817
7
6832
7
2931
7
2768
8
9979
7
4633
7
9517
7
3537
8
9621
7
6850
7
3146
7
5184
7
2820
7
6870
7
7429
8...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

9176
8971
2461
4405
2714
7639
5396
6898
2914
3273
3546
6954
2915
5748
3375
4077
9099
3770
4910
6023
9684
5719
8157
5109
9614
3657
5859
6977
7062
7643
3297
9186
4108
8263
7732
5602
6046
2336
7377
5212
2587
2459
4261
7761
8316
8707
5331
6772
9814
7914
2762
4424
5666
2711
5466
3702
2458
6271
3347
5267
...

input:

decode
1000
7
9176
7
8971
7
2461
7
4405
7
2714
7
7639
7
5396
7
6898
7
2914
7
3273
7
3546
7
6954
7
2915
7
5748
7
3375
7
4077
7
9099
7
3770
7
4910
7
6023
8
9684
7
5719
7
8157
7
5109
8
9614
7
3657
7
5859
7
6977
7
7062
7
7643
7
3297
7
9186
7
4108
7
8263
7
7732
7
5602
7
6046
7
2336
7
7377
7
5212
7
2587
7...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

5131
5525
2736
3253
4062
6975
2653
5356
7776
5919
7310
5251
7629
7283
9716
7687
4888
7177
9262
9304
8208
8104
7801
5548
7595
2039
9758
8783
8282
9358
7100
7019
8420
5318
6939
5912
2183
6520
4510
4564
4115
3761
4380
5029
2730
5228
6235
3153
4958
3049
6856
3823
2879
7005
2840
8804
2375
9771
7168
7854
...

input:

decode
1000
7
5131
7
5525
7
2736
7
3253
7
4062
7
6975
7
2653
7
5356
7
7776
7
5919
7
7310
7
5251
7
7629
7
7283
8
9716
7
7687
7
4888
7
7177
7
9262
7
9304
7
8208
7
8104
7
7801
7
5548
7
7595
7
2039
8
9758
7
8783
7
8282
7
9358
7
7100
7
7019
7
8420
7
5318
7
6939
7
5912
7
2183
7
6520
7
4510
7
4564
7
4115
7...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

4765
4052
5310
5397
2731
8370
6936
8616
4300
5026
5038
6327
3151
8264
9683
8412
7823
4463
7892
6243
3328
2521
3185
5130
7856
8307
8003
6852
6286
6066
4811
2138
7964
8218
3878
2292
4315
9501
7165
4784
3203
5747
7398
7626
4041
5683
6864
6072
3628
7196
7716
6139
9143
9732
7098
7785
3320
7044
7073
3070
...

input:

decode
1000
7
4765
7
4052
7
5310
7
5397
7
2731
7
8370
7
6936
7
8616
7
4300
7
5026
7
5038
7
6327
7
3151
7
8264
8
9683
7
8412
7
7823
7
4463
7
7892
7
6243
7
3328
7
2521
7
3185
7
5130
7
7856
7
8307
7
8003
7
6852
7
6286
7
6066
7
4811
7
2138
7
7964
7
8218
7
3878
7
2292
7
4315
7
9501
7
7165
7
4784
7
3203
7...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

3910
6392
9441
9652
8096
9372
4557
6725
4639
4393
9497
3271
7866
7010
4724
7735
5089
8187
9472
3709
2664
3135
3178
7163
2823
5955
7455
2374
3877
7465
6929
6824
2892
3899
5078
3280
6591
5240
9994
2722
4117
4551
3300
8300
2317
8751
2729
9195
5032
4357
9658
9788
2538
8968
3437
9991
4355
6388
5881
2237
...

input:

decode
1000
7
3910
7
6392
7
9441
8
9652
7
8096
7
9372
7
4557
7
6725
7
4639
7
4393
7
9497
7
3271
7
7866
7
7010
7
4724
7
7735
7
5089
7
8187
7
9472
7
3709
7
2664
7
3135
7
3178
7
7163
7
2823
7
5955
7
7455
7
2374
7
3877
7
7465
7
6929
7
6824
7
2892
7
3899
7
5078
7
3280
7
6591
7
5240
8
9994
7
2722
7
4117
7...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

19770
12167
16374
15390
29507
49211
46388
45801
31393
17899
52369
36704
28625
11811
29172
31185
11093
36722
19697
40589
39790
14012
23442
39545
24508
11912
14331
43696
43528
12484
25946
39775
24960
50758
47724
25063
29810
42693
20235
35698
17147
17976
29504
33061
13803
35189
14007
37383
28922
37350
...

input:

decode
1000
8
19770
8
12167
8
16374
8
15390
8
29507
8
49211
8
46388
8
45801
8
31393
8
17899
8
52369
8
36704
8
28625
8
11811
8
29172
8
31185
8
11093
8
36722
8
19697
8
40589
8
39790
8
14012
8
23442
8
39545
8
24508
8
11912
8
14331
8
43696
8
43528
8
12484
8
25946
8
39775
8
24960
8
50758
8
47724
8
25063
...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

263167
297093
164467
296428
87929
70232
287412
103309
158022
289347
164412
108058
293563
211823
163558
134083
117525
183330
64215
256899
165635
224195
94812
214970
78972
76941
204471
222740
93890
192904
289766
153172
167833
201995
53755
171389
86472
154980
103729
68678
121014
150028
200291
208900
23...

input:

decode
1000
9
263167
9
297093
9
164467
9
296428
9
87929
9
70232
9
287412
9
103309
9
158022
9
289347
9
164412
9
108058
9
293563
9
211823
9
163558
9
134083
9
117525
9
183330
9
64215
9
256899
9
165635
9
224195
9
94812
9
214970
9
78972
9
76941
9
204471
9
222740
9
93890
9
192904
9
289766
9
153172
9
16783...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

299463
1730177
836970
1014810
440207
525410
1492808
1728470
1221325
585549
1085459
1319868
656383
539200
651256
606707
612038
753241
1090238
1290756
762539
1206911
1615991
1566614
324043
1357083
1282903
1086179
1682240
1712948
1195224
378703
1437491
804896
487108
1701293
1117396
854098
824584
599008...

input:

decode
1000
10
299463
10
1730177
10
836970
10
1014810
10
440207
10
525410
10
1492808
10
1728470
10
1221325
10
585549
10
1085459
10
1319868
10
656383
10
539200
10
651256
10
606707
10
612038
10
753241
10
1090238
10
1290756
10
762539
10
1206911
10
1615991
10
1566614
10
324043
10
1357083
10
1282903
10
1...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

1730178
10144817
4868985
5939341
5250948
6434041
6565646
7039934
7257562
6374740
3775293
6179864
8164173
2704580
7231829
4274174
3955068
2989472
7446231
3143488
4607722
9858618
6868797
3218378
3929055
7533865
9801207
10125164
2314416
6161765
7874000
7497229
4682882
4999235
10118481
2188118
6366592
2...

input:

decode
1000
11
1730178
11
10144817
11
4868985
11
5939341
11
5250948
11
6434041
11
6565646
11
7039934
11
7257562
11
6374740
11
3775293
11
6179864
11
8164173
11
2704580
11
7231829
11
4274174
11
3955068
11
2989472
11
7446231
11
3143488
11
4607722
11
9858618
11
6868797
11
3218378
11
3929055
11
7533865
1...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

10144818
60211925
28710465
35178372
45135030
34467916
54970671
31620686
37434020
34722211
57681707
26081214
20293119
14646030
41526408
15105187
10423543
31084936
43345888
24481540
48537958
49107170
28716481
18776685
40968926
47991580
40472611
55172227
59425940
35118125
19918799
48804669
17704708
368...

input:

decode
1000
12
10144818
12
60211925
12
28710465
12
35178372
12
45135030
12
34467916
12
54970671
12
31620686
12
37434020
12
34722211
12
57681707
12
26081214
12
20293119
12
14646030
12
41526408
12
15105187
12
10423543
12
31084936
12
43345888
12
24481540
12
48537958
12
49107170
12
28716481
12
18776685
...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

336997091
195021828
147077227
324175519
109659576
265113699
153795292
72472169
170436187
237815972
254451849
121936349
125634224
91816435
313124503
232446288
109703575
153277652
266050032
212813193
181174023
159973668
234222563
112402156
317705920
117374992
318450460
141748293
281815917
114582577
34...

input:

decode
1000
13
336997091
13
195021828
13
147077227
13
324175519
13
109659576
13
265113699
13
153795292
13
72472169
13
170436187
13
237815972
13
254451849
13
121936349
13
125634224
13
91816435
13
313124503
13
232446288
13
109703575
13
153277652
13
266050032
13
212813193
13
181174023
13
159973668
13
2...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

361042498
2183809017
1030725077
1272411866
1078646865
1458782678
373485182
1860692875
1737339823
1544815107
1092306716
1860323211
881725726
1867247743
1173430751
811147521
1090508649
1729984473
1008011529
898028136
429695663
1285719106
397578239
1535917132
463941591
964351109
712999873
1362567283
17...

input:

decode
1000
14
361042498
14
2183809017
14
1030725077
14
1272411866
14
1078646865
14
1458782678
14
373485182
14
1860692875
14
1737339823
14
1544815107
14
1092306716
14
1860323211
14
881725726
14
1867247743
14
1173430751
14
811147521
14
1090508649
14
1729984473
14
1008011529
14
898028136
14
429695663
...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

8585194422
2289370412
7640158322
5239840051
10309539477
3104661400
3170578453
4985103453
11688787335
12339973150
7468983121
13011582382
7408749004
7277938655
8693235076
11862918482
6660728060
11237979213
5267378100
12958441562
7471322372
3854995288
9340985104
10393903619
8409826838
10462905599
11335...

input:

decode
1000
15
8585194422
15
2289370412
15
7640158322
15
5239840051
15
10309539477
15
3104661400
15
3170578453
15
4985103453
15
11688787335
15
12339973150
15
7468983121
15
13011582382
15
7408749004
15
7277938655
15
8693235076
15
11862918482
15
6660728060
15
11237979213
15
5267378100
15
12958441562
1...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

13308564682
81637319640
38239661635
47436957612
69791618656
25151961516
44066085271
79244889307
47646541931
51358399631
30885080970
36117107942
74489974214
66507322167
13451178472
71659420893
55917963766
32495406411
19745869151
25488145375
60482061264
43565890672
64875148000
34835735512
67487864749
...

input:

decode
1000
16
13308564682
16
81637319640
16
38239661635
16
47436957612
16
69791618656
16
25151961516
16
44066085271
16
79244889307
16
47646541931
16
51358399631
16
30885080970
16
36117107942
16
74489974214
16
66507322167
16
13451178472
16
71659420893
16
55917963766
16
32495406411
16
19745869151
16
...

output:

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

result:

ok 1000 lines

Test #23:

score: 100
Accepted
time: 6ms
memory: 3528kb

input:

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

output:

501176345398
365865272021
311363865790
498038130544
322842288768
230393779834
361451647191
188779466940
195726255524
241267195599
423082883461
393266190315
241162515826
308540414777
217928376998
94751177733
151640315221
281146206954
212815127882
170498594562
186938788159
390492790084
362751619373
47...

input:

decode
1000
17
501176345398
17
365865272021
17
311363865790
17
498038130544
17
322842288768
17
230393779834
17
361451647191
17
188779466940
17
195726255524
17
241267195599
17
423082883461
17
393266190315
17
241162515826
17
308540414777
17
217928376998
17
94751177733
17
151640315221
17
281146206954
1...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

503667864976
3123298907640
1454386602648
1813137231039
2737027224654
1994569673981
1241518935526
2361845301534
1287377064632
1576853235189
1159514126291
1097711331966
1502156241002
973569261388
1495090366578
2171710565896
3089208274089
1529471542534
2140902652420
1368188798261
874729841992
191865218...

input:

decode
1000
18
503667864976
18
3123298907640
18
1454386602648
18
1813137231039
18
2737027224654
18
1994569673981
18
1241518935526
18
2361845301534
18
1287377064632
18
1576853235189
18
1159514126291
18
1097711331966
18
1502156241002
18
973569261388
18
1495090366578
18
2171710565896
18
3089208274089
1...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

3123298907641
19456221197940
9037529094573
11282892698476
9889025497029
6359454656025
9010515901532
18607233100891
9936800642893
7041176814038
15592721879651
15384241791278
5117546505248
17931371663562
13769123534982
16643934262826
18644157372836
4464795132189
9819841733170
5540710154786
18154578040...

input:

decode
1000
19
3123298907641
19
19456221197940
19
9037529094573
19
11282892698476
19
9889025497029
19
6359454656025
19
9010515901532
19
18607233100891
19
9936800642893
19
7041176814038
19
15592721879651
19
15384241791278
19
5117546505248
19
17931371663562
19
13769123534982
19
16643934262826
19
18644...

output:

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

result:

ok 1000 lines

Test #26:

score: 100
Accepted
time: 9ms
memory: 3528kb

input:

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

output:

38779260861731
69273749479350
121120802539919
120083337598969
96221009756559
69712574488228
47546523367058
98338044354922
87009099772301
69372945285592
98804775288359
97759595662286
55947414005365
47394095145827
37242712456193
38983663038912
23113413233526
105681481541769
37652317757585
762631536417...

input:

decode
1000
20
38779260861731
20
69273749479350
20
121120802539919
20
120083337598969
20
96221009756559
20
69712574488228
20
47546523367058
20
98338044354922
20
87009099772301
20
69372945285592
20
98804775288359
20
97759595662286
20
55947414005365
20
47394095145827
20
37242712456193
20
3898366303891...

output:

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

result:

ok 1000 lines

Test #27:

score: 100
Accepted
time: 8ms
memory: 3556kb

input:

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

output:

579355637484657
500620795700236
540964317246489
280041458423404
178807048847050
587087066895255
673679290806941
376762422128970
476781870281307
196395719583901
263293774492613
203790884439684
419430001474307
617911139161813
654033893696346
367362435807088
132575645133150
135394178219877
416559978706...

input:

decode
1000
21
579355637484657
21
500620795700236
21
540964317246489
21
280041458423404
21
178807048847050
21
587087066895255
21
673679290806941
21
376762422128970
21
476781870281307
21
196395719583901
21
263293774492613
21
203790884439684
21
419430001474307
21
617911139161813
21
654033893696346
21
...

output:

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

result:

ok 1000 lines

Test #28:

score: 100
Accepted
time: 9ms
memory: 3560kb

input:

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

output:

2313265485895671
3113011410755595
4302787678335849
4200920363634414
3406133549612780
3231845911702234
3910919798168833
2203709881290786
3286636639702103
1754990417861149
3788156276840213
1089752415185503
4294786883395704
1713419344991155
4346717807517405
3551221652935058
1212181009027856
16053358484...

input:

decode
1000
22
2313265485895671
22
3113011410755595
22
4302787678335849
22
4200920363634414
22
3406133549612780
22
3231845911702234
22
3910919798168833
22
2203709881290786
22
3286636639702103
22
1754990417861149
22
3788156276840213
22
1089752415185503
22
4294786883395704
22
1713419344991155
22
43467...

output:

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

result:

ok 1000 lines

Test #29:

score: 100
Accepted
time: 10ms
memory: 3484kb

input:

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

output:

26662710035698344
10065399646789184
9460824089649095
29906711402950332
26310019785626236
25317774385017845
28618810182843679
27473970270700605
22008278530758103
21086438303888332
18596396167552771
20584372031336300
28281291776191968
15864844085097912
14762291638628179
12792124351764730
2763415968390...

input:

decode
1000
23
26662710035698344
23
10065399646789184
23
9460824089649095
23
29906711402950332
23
26310019785626236
23
25317774385017845
23
28618810182843679
23
27473970270700605
23
22008278530758103
23
21086438303888332
23
18596396167552771
23
20584372031336300
23
28281291776191968
23
1586484408509...

output:

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

result:

ok 1000 lines

Test #30:

score: 100
Accepted
time: 10ms
memory: 3488kb

input:

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

output:

94035953965559937
38278541972798009
86327895508111934
93889469999540948
134168201280819352
163123470948478026
78600489479628454
76368132930008508
187366789929262313
68379540406760756
149598597627429211
143778012245598981
127559577840629196
106366568285175342
165887024639232860
72442698238280702
1388...

input:

decode
1000
24
94035953965559937
24
38278541972798009
24
86327895508111934
24
93889469999540948
24
134168201280819352
24
163123470948478026
24
78600489479628454
24
76368132930008508
24
187366789929262313
24
68379540406760756
24
149598597627429211
24
143778012245598981
24
127559577840629196
24
106366...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

192657165369301081
1223805148529083308
562436470466082606
708231554404487577
1200078052342826012
1103245300406968598
265250029538576939
378894575123898371
835834813309267749
309452290460799566
569448225950072069
480045847792594349
1059295796461293191
723866188425312303
966099683838944268
75257381303...

input:

decode
1000
25
192657165369301081
25
1223805148529083308
25
562436470466082606
25
708231554404487577
25
1200078052342826012
25
1103245300406968598
25
265250029538576939
25
378894575123898371
25
835834813309267749
25
309452290460799566
25
569448225950072069
25
480045847792594349
25
105929579646129319...

output:

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

result:

ok 1000 lines

Test #32:

score: 100
Accepted
time: 8ms
memory: 3484kb

input:

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

output:

306031547027515738
959082491590119158
2223412441620852
121037235204185084
153974580426641086
7441993621867953
668983152554241
63505523795597
80289592655147
14423369496914042
18052443992484770
97915645848578228
385005627280466605
1054672771458100915
17475087012355519
64984934229542029
2
1603771093007...

input:

decode
1000
25
306031547027515738
25
959082491590119158
22
2223412441620852
24
121037235204185084
24
153974580426641086
23
7441993621867953
21
668983152554241
20
63505523795597
20
80289592655147
23
14423369496914042
23
18052443992484770
24
97915645848578228
25
385005627280466605
25
10546727714581009...

output:

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

result:

ok 1000 lines