QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294830#4824. Bracket-and-bar Sequencesucup-team1123#AC ✓337ms3616kbC++236.1kb2023-12-30 16:51:422023-12-30 16:51:42

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1
1
208

input:

decode
3
1
1
4
1
5
208

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

1

input:

decode
1
1
1

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

1
1
2

input:

decode
3
2
1
1
1
2
2

output:

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

result:

ok 3 lines

Test #4:

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

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:

12
11
10
9
8
7
6
5
4
3
2
1
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
40
36
31
39
38
37
35
34
33
32
30
29
28
27
26
25
24
23
22
21
20
19
18
13
7
17
12
6
16
15
14
11
10
9
8
5
4
3
2
1
273
272
271
270
269
268
267
266
265
264
263
262
261
260
259
258
254
249
257
256
255
253
252
251
250
248
247
246
245
2...

input:

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

output:

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

result:

ok 1000 lines

Test #5:

score: 100
Accepted
time: 11ms
memory: 3580kb

input:

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

output:

709
813
807
800
780
774
767
759
738
732
725
717
708
812
811
810
806
805
804
803
799
798
797
796
795
779
778
777
773
766
758
772
771
770
765
764
763
762
757
756
755
754
753
737
736
735
731
730
729
728
724
716
707
723
715
706
722
721
720
714
713
712
711
705
704
703
702
701
700
699
698
697
696
695
694
...

input:

decode
1000
6
709
6
813
6
807
6
800
6
780
6
774
6
767
6
759
6
738
6
732
6
725
6
717
6
708
6
812
6
811
6
810
6
806
6
805
6
804
6
803
6
799
6
798
6
797
6
796
6
795
6
779
6
778
6
777
6
773
6
766
6
758
6
772
6
771
6
770
6
765
6
764
6
763
6
762
6
757
6
756
6
755
6
754
6
753
6
737
6
736
6
735
6
731
6
730
...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

2768
2806
5360
2390
6668
581
2540
42943
3722
6973
4749
3411
43106
2686
5306
4644
5126
969
4911
3149
4763
4510
2716
51
1480
3708
7074
4439
1168
6595
224
5500
1872
6038
4019
2260
164
4768
977
7066
4743
6920
3535
5097
5679
5715
450
4401
6084
4464
183
3651
3304
6081
7405
140
2853
3469
4089
955
807
2107
...

input:

decode
1000
7
2768
7
2806
7
5360
7
2390
7
6668
7
581
7
2540
8
42943
7
3722
7
6973
7
4749
7
3411
8
43106
7
2686
7
5306
7
4644
7
5126
7
969
7
4911
7
3149
7
4763
7
4510
7
2716
7
51
7
1480
7
3708
7
7074
7
4439
7
1168
7
6595
7
224
7
5500
7
1872
7
6038
7
4019
7
2260
7
164
7
4768
7
977
7
7066
7
4743
7
6920...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

5942
1187
6146
7078
4730
6676
880
2417
7227
961
7287
3011
42792
43201
3772
4108
5772
893
42947
42604
1945
5082
2564
77
2662
3297
3897
6225
6035
50
3103
4008
7543
1071
2964
1723
5378
3039
7213
4784
7165
1353
4890
5671
120
4034
4508
1135
6418
6281
3216
7233
6153
7532
5731
159
1002
3003
7122
5610
3246
...

input:

decode
1000
7
5942
7
1187
7
6146
7
7078
7
4730
7
6676
7
880
7
2417
7
7227
7
961
7
7287
7
3011
8
42792
8
43201
7
3772
7
4108
7
5772
7
893
8
42947
8
42604
7
1945
7
5082
7
2564
7
77
7
2662
7
3297
7
3897
7
6225
7
6035
7
50
7
3103
7
4008
7
7543
7
1071
7
2964
7
1723
7
5378
7
3039
7
7213
7
4784
7
7165
7
13...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

1085
7326
3765
5550
954
2458
4230
2472
43200
5513
141
6149
3825
332
1402
6705
5488
708
2506
766
3966
3824
4696
4586
7069
30
7338
2410
6340
4423
5857
3367
5766
598
3694
42840
3166
2984
992
539
5704
3508
748
5419
78
6869
3610
4096
5381
3516
1455
4621
4602
4360
5705
21
4639
2843
670
3551
6868
1366
4222...

input:

decode
1000
7
1085
7
7326
7
3765
7
5550
7
954
7
2458
7
4230
7
2472
8
43200
7
5513
7
141
7
6149
7
3825
7
332
7
1402
7
6705
7
5488
7
708
7
2506
7
766
7
3966
7
3824
7
4696
7
4586
7
7069
7
30
7
7338
7
2410
7
6340
7
4423
7
5857
7
3367
7
5766
7
598
7
3694
8
42840
7
3166
7
2984
7
992
7
539
7
5704
7
3508
7
...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

2085
6103
7230
42930
3895
726
2211
631
6253
777
2010
6715
219
6165
1972
1254
6713
2816
1906
42680
4351
6354
4695
43031
1958
5463
6381
2691
6837
6437
42545
5285
16
6031
43182
1152
6459
4489
6833
2170
881
43061
3146
3030
5695
2103
1133
1850
4059
2599
5092
4936
3120
5332
43221
3251
5702
1415
43060
6846...

input:

decode
1000
7
2085
7
6103
7
7230
8
42930
7
3895
7
726
7
2211
7
631
7
6253
7
777
7
2010
7
6715
7
219
7
6165
7
1972
7
1254
7
6713
7
2816
7
1906
8
42680
7
4351
7
6354
7
4695
8
43031
7
1958
7
5463
7
6381
7
2691
7
6837
7
6437
8
42545
7
5285
7
16
7
6031
8
43182
7
1152
7
6459
7
4489
7
6833
7
2170
7
881
8
4...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

251
933
7097
5640
6729
2108
4511
1148
6426
6213
6028
2163
6374
3792
6126
4999
532
4186
4974
3242
43101
3808
2829
4174
43191
5140
3665
2291
2155
2069
6243
182
4662
2615
360
4018
3273
7264
637
4253
6896
7102
5927
586
2582
1645
4458
1303
42971
2094
6694
5622
3852
6730
4329
5536
7103
3283
6178
4549
5686...

input:

decode
1000
7
251
7
933
7
7097
7
5640
7
6729
7
2108
7
4511
7
1148
7
6426
7
6213
7
6028
7
2163
7
6374
7
3792
7
6126
7
4999
7
532
7
4186
7
4974
7
3242
8
43101
7
3808
7
2829
7
4174
8
43191
7
5140
7
3665
7
2291
7
2155
7
2069
7
6243
7
182
7
4662
7
2615
7
360
7
4018
7
3273
7
7264
7
637
7
4253
7
6896
7
710...

output:

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

result:

ok 1000 lines

Test #11:

score: 100
Accepted
time: 15ms
memory: 3524kb

input:

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

output:

4588
4117
6793
6272
5175
2861
6878
4081
773
3606
1098
4056
2038
2661
43084
1524
4966
2511
845
731
2756
2955
287
4067
2580
7490
43051
1535
2590
507
1725
949
2180
3908
2864
3621
7351
1383
5498
5431
4673
5768
5735
4685
6541
4006
3350
6444
4814
6600
2689
4593
6800
1266
6645
1464
7185
43034
2917
2655
162...

input:

decode
1000
7
4588
7
4117
7
6793
7
6272
7
5175
7
2861
7
6878
7
4081
7
773
7
3606
7
1098
7
4056
7
2038
7
2661
8
43084
7
1524
7
4966
7
2511
7
845
7
731
7
2756
7
2955
7
287
7
4067
7
2580
7
7490
8
43051
7
1535
7
2590
7
507
7
1725
7
949
7
2180
7
3908
7
2864
7
3621
7
7351
7
1383
7
5498
7
5431
7
4673
7
576...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

5252
5228
4032
4506
6852
2266
718
1908
5845
4710
4713
3252
6450
2614
43105
2181
13
5658
1955
3334
6188
7006
6331
4162
2644
2535
924
725
3267
3369
5154
7394
1460
2724
4592
7309
5861
48
379
5211
6322
3793
2271
1700
5380
3842
724
3387
5545
1255
1049
3483
858
43077
2152
528
6209
711
2284
6570
7456
3889
...

input:

decode
1000
7
5252
7
5228
7
4032
7
4506
7
6852
7
2266
7
718
7
1908
7
5845
7
4710
7
4713
7
3252
7
6450
7
2614
8
43105
7
2181
7
13
7
5658
7
1955
7
3334
7
6188
7
7006
7
6331
7
4162
7
2644
7
2535
7
924
7
725
7
3267
7
3369
7
5154
7
7394
7
1460
7
2724
7
4592
7
7309
7
5861
7
48
7
379
7
5211
7
6322
7
3793
7...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

5127
3143
132
43127
12
451
5123
3040
5255
5724
91
6256
2498
2981
5334
346
4626
2803
185
4436
6563
6453
6363
944
6808
3570
2212
7186
4183
1806
2295
1747
6677
5818
4637
6236
2362
4005
42899
6855
4653
5125
6240
2476
7296
1521
6723
23
4657
5789
43136
43008
6987
934
6111
42906
5791
1425
3667
7397
5707
12...

input:

decode
1000
7
5127
7
3143
7
132
8
43127
7
12
7
451
7
5123
7
3040
7
5255
7
5724
7
91
7
6256
7
2498
7
2981
7
5334
7
346
7
4626
7
2803
7
185
7
4436
7
6563
7
6453
7
6363
7
944
7
6808
7
3570
7
2212
7
7186
7
4183
7
1806
7
2295
7
1747
7
6677
7
5818
7
4637
7
6236
7
2362
7
4005
8
42899
7
6855
7
4653
7
5125
7...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

29169
41221
37400
37007
25758
6724
14319
15370
21479
34918
1333
7764
23516
40721
25562
21395
41695
7710
30193
14790
11582
38806
32875
4029
31660
39763
37892
16300
455
40794
29790
17048
30048
101
11834
28461
24186
11372
23428
13867
35809
34839
25765
19904
39035
8223
38815
17303
25333
13428
42468
2062...

input:

decode
1000
8
29169
8
41221
8
37400
8
37007
8
25758
8
6724
8
14319
8
15370
8
21479
8
34918
8
1333
8
7764
8
23516
8
40721
8
25562
8
21395
8
41695
8
7710
8
30193
8
14790
8
11582
8
38806
8
32875
8
4029
8
31660
8
39763
8
37892
8
16300
8
455
8
40794
8
29790
8
17048
8
30048
8
101
8
11834
8
28461
8
24186
8...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

86027
8516
139352
3561
207322
230825
8599
196557
135564
22067
139233
180688
21134
27247
132516
186910
164186
110238
233216
98937
149012
87034
208047
13486
220935
222559
45982
24740
205175
109117
6745
153491
142848
81289
245544
129905
205204
137823
195767
232375
174718
162875
80797
79120
52740
149914...

input:

decode
1000
9
86027
9
8516
9
139352
9
3561
9
207322
9
230825
9
8599
9
196557
9
135564
9
22067
9
139233
9
180688
9
21134
9
27247
9
132516
9
186910
9
164186
9
110238
9
233216
9
98937
9
149012
9
87034
9
208047
9
13486
9
220935
9
222559
9
45982
9
24740
9
205175
9
109117
9
6745
9
153491
9
142848
9
81289
...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

1430715
1
1001834
715128
1291335
1226479
553655
216
230793
1148206
655692
593071
1005559
1213247
901031
930398
930212
1111093
648056
236634
1098396
574433
239622
418835
1406284
150917
173653
654713
121374
23379
540068
1373119
59409
964141
1216343
137799
616270
945287
1027298
1060903
992696
281948
66...

input:

decode
1000
10
1430715
10
1
10
1001834
10
715128
10
1291335
10
1226479
10
553655
10
216
10
230793
10
1148206
10
655692
10
593071
10
1005559
10
1213247
10
901031
10
930398
10
930212
10
1111093
10
648056
10
236634
10
1098396
10
574433
10
239622
10
418835
10
1406284
10
150917
10
173653
10
654713
10
121...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

8414640
1
5940068
4214413
4509907
3743505
1749872
3230242
2658601
3792738
6467603
3944308
693966
7103074
2166195
5053716
6682434
7318758
3296251
7029309
6181590
1145475
1330983
6924982
5030431
488439
360466
115588
7882779
3814856
2566384
2080770
6054020
5657523
216856
8097572
3803378
7954833
8260576...

input:

decode
1000
11
8414640
11
1
11
5940068
11
4214413
11
4509907
11
3743505
11
1749872
11
3230242
11
2658601
11
3792738
11
6467603
11
3944308
11
693966
11
7103074
11
2166195
11
5053716
11
6682434
11
7318758
11
3296251
11
7029309
11
6181590
11
1145475
11
1330983
11
6924982
11
5030431
11
488439
11
360466
...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

50067108
1
35574763
25366001
4790576
25873296
13895459
30964729
22877412
25488357
4158574
39163881
40129682
45694168
8077844
44547151
49778976
27480970
3515475
34550472
13711499
18141628
35527106
41478874
3696491
18028878
16353162
12858169
3814357
24970769
40336707
11849042
43744609
23992959
4834422...

input:

decode
1000
12
50067108
12
1
12
35574763
12
25366001
12
4790576
12
25873296
12
13895459
12
30964729
12
22877412
12
25488357
12
4158574
12
39163881
12
40129682
12
45694168
12
8077844
12
44547151
12
49778976
12
27480970
12
3515475
12
34550472
12
13711499
12
18141628
12
35527106
12
41478874
12
3696491
...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

53626932
187458524
217663899
70282858
251826537
76740379
238880386
280531825
216530871
62436497
6653820
199414822
218322640
259880920
122963068
132317039
253220326
239624812
79252313
148418314
191682471
230280486
62107535
247094307
108812260
245603489
113334283
212257234
37291303
246459636
16555735
...

input:

decode
1000
13
53626932
13
187458524
13
217663899
13
70282858
13
251826537
13
76740379
13
238880386
13
280531825
13
216530871
13
62436497
13
6653820
13
199414822
13
218322640
13
259880920
13
122963068
13
132317039
13
253220326
13
239624812
13
79252313
13
148418314
13
191682471
13
230280486
13
621075...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

1822766520
1
1308003242
910294072
1189013020
352244797
1812134745
315366300
234400627
454641457
1164876122
319635118
1349757400
67075711
1150325162
1264171268
1124254037
191454032
1278941080
1125136670
1688948478
861497416
1774808034
691230208
1732870525
1400434538
1220504762
821903687
553662867
114...

input:

decode
1000
14
1822766520
14
1
14
1308003242
14
910294072
14
1189013020
14
352244797
14
1812134745
14
315366300
14
234400627
14
454641457
14
1164876122
14
319635118
14
1349757400
14
67075711
14
1150325162
14
1264171268
14
1124254037
14
191454032
14
1278941080
14
1125136670
14
1688948478
14
861497416...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

3988340014
11044472168
5727152082
8653511447
3379282604
10190085427
10150857695
6355225927
4149265501
2580566176
5825217398
1805153285
5905868875
6343072978
2361924641
3720784095
6660797908
3863519999
6718505474
1797998253
5798321904
9663760475
3005191794
3138079542
4990445871
1873095832
2209127603
...

input:

decode
1000
15
3988340014
15
11044472168
15
5727152082
15
8653511447
15
3379282604
15
10190085427
15
10150857695
15
6355225927
15
4149265501
15
2580566176
15
5825217398
15
1805153285
15
5905868875
15
6343072978
15
2361924641
15
3720784095
15
6660797908
15
3863519999
15
6718505474
15
1797998253
15
57...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

68328754959
1
49382379193
33657730500
5132844147
56564711166
41750145864
9753219093
33605165632
15233671163
41435475437
51412826411
21062073063
298078345
68186152465
25503912950
18338063600
53425656431
62140328451
56028044163
26879600522
43563014751
19858527619
54090790798
20155113852
60641198992
41...

input:

decode
1000
16
68328754959
16
1
16
49382379193
16
33657730500
16
5132844147
16
56564711166
16
41750145864
16
9753219093
16
33605165632
16
15233671163
16
41435475437
16
51412826411
16
21062073063
16
298078345
16
68186152465
16
25503912950
16
18338063600
16
53425656431
16
62140328451
16
56028044163
16...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

7085031834
105611360450
192887213571
30644102136
93266535753
290494472290
25815039574
248554528176
323667033553
291288697891
44714816053
78690920252
291196583436
198648779372
322283759927
399723811945
352225442801
219889242501
334116113028
304686759238
323667082539
49086247863
159245316545
802925430...

input:

decode
1000
17
7085031834
17
105611360450
17
192887213571
17
30644102136
17
93266535753
17
290494472290
17
25815039574
17
248554528176
17
323667033553
17
291288697891
17
44714816053
17
78690920252
17
291196583436
17
198648779372
17
322283759927
17
399723811945
17
352225442801
17
219889242501
17
3341...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

2619631042665
1
1903451601373
1242015339804
1058673873502
584373466442
2044775228940
184151003634
1456468015080
1413729558571
2099218863510
2020735446423
1755384196142
2149670997502
1776551588182
1034970352024
181143508114
1711042696220
841098644143
2009271904410
2315779745036
1214492171033
19341238...

input:

decode
1000
18
2619631042665
18
1
18
1903451601373
18
1242015339804
18
1058673873502
18
584373466442
18
2044775228940
18
184151003634
18
1456468015080
18
1413729558571
18
2099218863510
18
2020735446423
18
1755384196142
18
2149670997502
18
1776551588182
18
1034970352024
18
181143508114
18
17110426962...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

16332922290300
1
11894060137055
7773311196835
8990321826134
11032458717572
11787652730269
1138791010589
9871155979680
10457745130072
6332508432037
5534519430266
14872388159832
4298158292539
372763879260
2344944937782
1585041779415
14982891085982
9153914256964
14224376823211
3146323946489
78642678277...

input:

decode
1000
19
16332922290300
19
1
19
11894060137055
19
7773311196835
19
8990321826134
19
11032458717572
19
11787652730269
19
1138791010589
19
9871155979680
19
10457745130072
19
6332508432037
19
5534519430266
19
14872388159832
19
4298158292539
19
372763879260
19
2344944937782
19
1585041779415
19
149...

output:

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

result:

ok 1000 lines

Test #26:

score: 100
Accepted
time: 215ms
memory: 3612kb

input:

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

output:

78176670308880
52443623071175
2595785509239
10870888327696
40958486957411
51904523860442
75844195367660
1482165854134
12343111632633
52255622391213
11648251860983
25844126769364
75240252453526
60961939846531
83878324948606
69397056964184
98886531593609
44677948905715
83480291002137
37668019357546
10...

input:

decode
1000
20
78176670308880
20
52443623071175
20
2595785509239
20
10870888327696
20
40958486957411
20
51904523860442
20
75844195367660
20
1482165854134
20
12343111632633
20
52255622391213
20
11648251860983
20
25844126769364
20
75240252453526
20
60961939846531
20
83878324948606
20
69397056964184
20...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

64783573423365
289588588756516
208768022229156
415875186690147
586522612655226
38377040511393
244091633545556
397732492933727
146860214358355
564858639663206
408873935244793
558669159679401
344659184676860
100617712588578
124551622226665
427101915541649
630255283135700
626206869407314
36560260728530...

input:

decode
1000
21
64783573423365
21
289588588756516
21
208768022229156
21
415875186690147
21
586522612655226
21
38377040511393
21
244091633545556
21
397732492933727
21
146860214358355
21
564858639663206
21
408873935244793
21
558669159679401
21
344659184676860
21
100617712588578
21
124551622226665
21
42...

output:

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

result:

ok 1000 lines

Test #28:

score: 100
Accepted
time: 235ms
memory: 3508kb

input:

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

output:

2691764364151600
1339734237384441
1226277258391287
1706169198226550
619614399678814
1309252305099403
639831781849815
2992123222168518
571986581967740
3124244931137265
631588188787866
3728697603062126
1176958612626772
3267443288065677
1226597060786977
1231396311596757
3508925849758981
297560511427946...

input:

decode
1000
22
2691764364151600
22
1339734237384441
22
1226277258391287
22
1706169198226550
22
619614399678814
22
1309252305099403
22
639831781849815
22
2992123222168518
22
571986581967740
22
3124244931137265
22
631588188787866
22
3728697603062126
22
1176958612626772
22
3267443288065677
22
122659706...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

10630538792047513
20212866465027296
20955927662322288
2698159523668407
1833432678008546
7395260010233422
4704105548371559
7379755491898461
1820332778552318
11051710396773863
11893885837794980
4190315643048271
5533248592416612
16613792329771154
16812383067091322
20434209097937835
8736569156081588
109...

input:

decode
1000
23
10630538792047513
23
20212866465027296
23
20955927662322288
23
2698159523668407
23
1833432678008546
23
7395260010233422
23
4704105548371559
23
7379755491898461
23
1820332778552318
23
11051710396773863
23
11893885837794980
23
4190315643048271
23
5533248592416612
23
16613792329771154
23...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

91181433699101187
157012261507079232
111793635919452314
102716790227361228
25424313490873260
71283900059309033
105210110089454458
113587515146313288
27122749131024179
102437747336111584
23912104370522123
56111953137597507
36331847882642982
86672630066076106
28150241690042336
98767143027438422
469124...

input:

decode
1000
24
91181433699101187
24
157012261507079232
24
111793635919452314
24
102716790227361228
24
25424313490873260
24
71283900059309033
24
105210110089454458
24
113587515146313288
24
27122749131024179
24
102437747336111584
24
23912104370522123
24
56111953137597507
24
36331847882642982
24
866726...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

1031147983159782228
1
757943959758769328
484298145910396276
173420909508003564
363972400169796462
964560541701013779
847394004052494479
75772233627392118
922747598342092286
712937363790487770
825292947614670481
107791392673206103
515990919034874236
355157687699412606
478702292574195294
2994840127390...

input:

decode
1000
25
1031147983159782228
25
1
25
757943959758769328
25
484298145910396276
25
173420909508003564
25
363972400169796462
25
964560541701013779
25
847394004052494479
25
75772233627392118
25
922747598342092286
25
712937363790487770
25
825292947614670481
25
107791392673206103
25
5159909190348742...

output:

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

result:

ok 1000 lines

Test #32:

score: 100
Accepted
time: 244ms
memory: 3616kb

input:

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

output:

888966543391789356
443599023590113682
2953038136549414
60762631220716603
62076443535058216
21568267217445237
270680990364539
62511025415315
44483622319721
17522918942417706
12686348072394061
100256162076160344
842118366109734494
23085576100733041
12527590447926196
121271559013694641
3
29990063811661...

input:

decode
1000
25
888966543391789356
25
443599023590113682
22
2953038136549414
24
60762631220716603
24
62076443535058216
23
21568267217445237
21
270680990364539
20
62511025415315
20
44483622319721
23
17522918942417706
23
12686348072394061
24
100256162076160344
25
842118366109734494
25
23085576100733041...

output:

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

result:

ok 1000 lines