QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#308157#4824. Bracket-and-bar Sequencesucup-team2819AC ✓2ms4168kbC++141.5kb2024-01-19 17:04:352024-01-19 17:04:35

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1031147983159782228
96586612269316884
853055730550855728

input:

decode
3
1
1031147983159782228
4
96586612269316884
5
853055730550855728

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

1031147983159782228

input:

decode
1
1
1031147983159782228

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

557377288194476880
1031147983159782228
868897745157965328

input:

decode
3
2
557377288194476880
1
1031147983159782228
2
868897745157965328

output:

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

result:

ok 3 lines

Test #4:

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

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:

1031147983159782228
1005553579418650548
956497638914814828
868897745157965328
843303341416833648
794247400912997928
706647507156148428
557377288194476880
531782884453345200
482726943949509480
395127050192659980
245856831230988432
1031147983159782228
1027099468315743108
1019354483396711748
1005553579...

input:

decode
1000
3
1031147983159782228
3
1005553579418650548
3
956497638914814828
3
868897745157965328
3
843303341416833648
3
794247400912997928
3
706647507156148428
3
557377288194476880
3
531782884453345200
3
482726943949509480
3
395127050192659980
3
245856831230988432
4
1031147983159782228
4
1027099468...

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

580401420036387453
676707605394608133
673011135319615893
666955216260586053
653246068631904093
649549598556911853
643493679497882013
633833046713239173
614702115378890313
611005645303898073
604949726244868233
595289093460225393
580206676969915653
676362276119759883
675778355709561933
674824619039571...

input:

decode
1000
6
580401420036387453
6
676707605394608133
6
673011135319615893
6
666955216260586053
6
653246068631904093
6
649549598556911853
6
643493679497882013
6
633833046713239173
6
614702115378890313
6
611005645303898073
6
604949726244868233
6
595289093460225393
6
580206676969915653
6
6763622761197...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

448144989505640445
452394347438479065
774559310646356523
390976295238723165
924572510688340653
143468391770011737
418298537331348615
1026645370394220093
545092062188565105
953300620630867998
694735434360889953
516878273593935285
1029169614594759168
433374020269304265
767861079136108938
6857805495027...

input:

decode
1000
7
448144989505640445
7
452394347438479065
7
774559310646356523
7
390976295238723165
7
924572510688340653
7
143468391770011737
7
418298537331348615
8
1026645370394220093
7
545092062188565105
7
953300620630867998
7
694735434360889953
7
516878273593935285
8
1029169614594759168
7
43337402026...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

835576127988547443
225919123262619402
855086094497721843
967563984013505283
693719968699018908
925581121993586463
188906300223581787
393242171957736240
984686621765235318
196158578275934967
990648968559240633
472402579255383690
1024588610551891923
1030458305233922613
550217662254098325
6113026284802...

input:

decode
1000
7
835576127988547443
7
225919123262619402
7
855086094497721843
7
967563984013505283
7
693719968699018908
7
925581121993586463
7
188906300223581787
7
393242171957736240
7
984686621765235318
7
196158578275934967
7
990648968559240633
7
472402579255383690
8
1024588610551891923
8
103045830523...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

215469360084702192
993360856369312878
549263925584108340
791541800082674943
195861595099565472
400532500976036580
631755317291731188
405929076197779530
1030455685602879948
788719518100051518
56621683088415609
855188334607619538
554180269910530050
91209624453964374
244524840853911072
9281976343433601...

input:

decode
1000
7
215469360084702192
7
993360856369312878
7
549263925584108340
7
791541800082674943
7
195861595099565472
7
400532500976036580
7
631755317291731188
7
405929076197779530
8
1030455685602879948
7
788719518100051518
7
56621683088415609
7
855188334607619538
7
554180269910530050
7
9120962445396...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

361740296057855070
851484168414591783
984788861875133013
1026433239799743138
570648284295170508
158209571999497062
375384085290762750
150167603904096207
864088344830520468
172649676038589057
351987906923832990
928830209641254318
72828092330243349
856343359911489108
345084448586595150
232178453232994...

input:

decode
1000
7
361740296057855070
7
851484168414591783
7
984788861875133013
8
1026433239799743138
7
570648284295170508
7
158209571999497062
7
375384085290762750
7
150167603904096207
7
864088344830520468
7
172649676038589057
7
351987906923832990
7
928830209641254318
7
72828092330243349
7
8563433599114...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

80558373285208134
194533122128252082
970885717787174118
803594717598980973
929861699436198213
364841819156271435
671497965224371743
219965444313487257
892982149059409863
860784382547596788
842169302722774608
368890334000310555
883321516274767023
551698819173154020
853055730550855728
7307482439798832...

input:

decode
1000
7
80558373285208134
7
194533122128252082
7
970885717787174118
7
803594717598980973
7
929861699436198213
7
364841819156271435
7
671497965224371743
7
219965444313487257
7
892982149059409863
7
860784382547596788
7
842169302722774608
7
368890334000310555
7
883321516274767023
7
55169881917315...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

679034952517843743
613188945283646163
936959154232712988
865608223917444393
753625860332389353
456442862282518185
944601899041846653
609075293474220018
172113121103032977
533558413027184850
216166547171175762
604847486134970538
355434759297097605
431755092658398450
1028949788826198693
27800970061407...

input:

decode
1000
7
679034952517843743
7
613188945283646163
7
936959154232712988
7
865608223917444393
7
753625860332389353
7
456442862282518185
7
944601899041846653
7
609075293474220018
7
172113121103032977
7
533558413027184850
7
216166547171175762
7
604847486134970538
7
355434759297097605
7
4317550926583...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

763767426810137583
760611029076465393
601533906423955188
670933405898107908
943074184974460608
381120656465944695
157857714187871742
339497296038531210
827148010711064253
692326816706936463
692586238794177318
500568403731910455
896932823550344118
427812335330020995
1029160864814960793
37178985532566...

input:

decode
1000
7
763767426810137583
7
760611029076465393
7
601533906423955188
7
670933405898107908
7
943074184974460608
7
381120656465944695
7
157857714187871742
7
339497296038531210
7
827148010711064253
7
692326816706936463
7
692586238794177318
7
500568403731910455
7
896932823550344118
7
4278123353300...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

744501782483302593
482577338364969915
55278769074699474
1029515409351455823
11773582190396268
116579278019729487
744344667738149073
475238321656572975
763945836954319083
814030239091454883
40600793541955764
864190584940418163
409550821309461675
469648819284003510
771945026289292458
92241114248908269...

input:

decode
1000
7
744501782483302593
7
482577338364969915
7
55278769074699474
8
1029515409351455823
7
11773582190396268
7
116579278019729487
7
744344667738149073
7
475238321656572975
7
763945836954319083
7
814030239091454883
7
40600793541955764
7
864190584940418163
7
409550821309461675
7
469648819284003...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

745056554454683913
996709377538414203
921798744730986828
910999046661950238
671681681724465618
217375207898805747
403538594661390360
430373899062660900
550960918652471100
860346617548364073
69028401521516529
237007665839302827
613740199849263513
988140002675277003
666500063733348183
5492613059530656...

input:

decode
1000
8
745056554454683913
8
996709377538414203
8
921798744730986828
8
910999046661950238
8
671681681724465618
8
217375207898805747
8
403538594661390360
8
430373899062660900
8
550960918652471100
8
860346617548364073
8
69028401521516529
8
237007665839302827
8
613740199849263513
8
98814000267527...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

412744098699114375
66515157712555959
628353076198080103
33008667324857826
892061227123616703
979193050932027798
66864210607576614
847997135321155863
610926825246359298
137390283932448892
627847116012402268
790438571050858458
132731956674410277
157393389850290162
597304051528283958
815241463533591858...

input:

decode
1000
9
412744098699114375
9
66515157712555959
9
628353076198080103
9
33008667324857826
9
892061227123616703
9
979193050932027798
9
66864210607576614
9
847997135321155863
9
610926825246359298
9
137390283932448892
9
627847116012402268
9
790438571050858458
9
132731956674410277
9
1573933898502901...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

1031147983159782228
85389582279456
757946765328693543
543949198254918950
946464968462801598
903955061610861028
442947083216609955
1524229489603185
206460107364854539
848991271510705968
508412640665840810
468372404369315457
760253084818920999
895465902443604673
686462449161887653
703264638897962718
7...

input:

decode
1000
10
1031147983159782228
10
85389582279456
10
757946765328693543
10
543949198254918950
10
946464968462801598
10
903955061610861028
10
442947083216609955
10
1524229489603185
10
206460107364854539
10
848991271510705968
10
508412640665840810
10
468372404369315457
10
760253084818920999
10
8954...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

1031147983159782228
21581982334368
757944601746779763
541182429404018361
579934246205950083
490613788746822108
243164751362736690
432227493949353361
365245898891872062
496620341853409461
815726480719191809
513148110934194180
113537172618126634
887535800340592714
303313542210002395
652515559421302689...

input:

decode
1000
11
1031147983159782228
11
21581982334368
11
757944601746779763
11
541182429404018361
11
579934246205950083
11
490613788746822108
11
243164751362736690
11
432227493949353361
11
365245898891872062
11
496620341853409461
11
815726480719191809
11
513148110934194180
11
113537172618126634
11
88...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

1031147983159782228
5131585473525
757944102807554363
543007666645932298
124758078710405025
551766813207349446
320188181499272311
665634695223168756
497820221490739317
544903814640486261
109226633265431373
825475307606203665
841952958640876745
951064358157000485
194959283601319537
930083663649706536
...

input:

decode
1000
12
1031147983159782228
12
5131585473525
12
757944102807554363
12
543007666645932298
12
124758078710405025
12
551766813207349446
12
320188181499272311
12
665634695223168756
12
497820221490739317
12
544903814640486261
12
109226633265431373
12
825475307606203665
12
841952958640876745
12
951...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

208605827436419074
666050619846839194
766416419785647090
266172121885009711
874086548180008197
291050343370841052
833536671325496074
969685992517594963
763122959990137876
236105595817032604
32730676928339679
703159661706670016
768202692637774455
902743211016713831
448000147008611023
4766898133374307...

input:

decode
1000
13
208605827436419074
13
666050619846839194
13
766416419785647090
13
266172121885009711
13
874086548180008197
13
291050343370841052
13
833536671325496074
13
969685992517594963
13
763122959990137876
13
236105595817032604
13
32730676928339679
13
703159661706670016
13
768202692637774455
13
...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

1031147983159782228
237739812414
757943966268204231
530488577041749921
690930854236721447
219271898849543471
1026124461536454228
199289040768924711
152606050146163049
280343566508925926
678227353924831988
201933165635768520
779785234286004082
50316316386458523
670712078305426342
733584086174763681
6...

input:

decode
1000
14
1031147983159782228
14
237739812414
14
757943966268204231
14
530488577041749921
14
690930854236721447
14
219271898849543471
14
1026124461536454228
14
199289040768924711
14
152606050146163049
14
280343566508925926
14
678227353924831988
14
201933165635768520
14
779785234286004082
14
503...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

388085794953876353
1024764776196180647
543279120992635193
813993373860716719
334328832660698389
950494855670594913
947298868608100711
605078014224890492
403471622322878404
256415201836466400
551436492203051209
185569763697060867
558561798831357716
604111030886683465
234857187459226294
36511881172215...

input:

decode
1000
15
388085794953876353
15
1024764776196180647
15
543279120992635193
15
813993373860716719
15
334328832660698389
15
950494855670594913
15
947298868608100711
15
605078014224890492
15
403471622322878404
15
256415201836466400
15
551436492203051209
15
185569763697060867
15
558561798831357716
1...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

1031147983159782228
8130728463
757943960016726115
519930785229484673
88074521487183997
860334911373336659
644489146992899986
161586252082823595
519257670970339809
242542852955022159
639840812605603483
786711405075120156
335627955246694875
6871921293674120
1029278432278412914
400334198256353540
29348...

input:

decode
1000
16
1031147983159782228
16
8130728463
16
757943960016726115
16
519930785229484673
16
88074521487183997
16
860334911373336659
16
644489146992899986
16
161586252082823595
16
519257670970339809
16
242542852955022159
16
639840812605603483
16
786711405075120156
16
335627955246694875
16
6871921...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

21767763583501150
271178616237773430
482288762069304787
83835512345755302
238829125917654061
720357463072563154
71764414080129271
618049269316292653
799523570002394532
722291468456522941
120055565142832235
204823706702159353
721999335118184534
496724445373495622
795947236129749873
979843462322251054...

input:

decode
1000
17
21767763583501150
17
271178616237773430
17
482288762069304787
17
83835512345755302
17
238829125917654061
17
720357463072563154
17
71764414080129271
17
618049269316292653
17
799523570002394532
17
722291468456522941
17
120055565142832235
17
204823706702159353
17
721999335118184534
17
49...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

1031147983159782228
191809332
757943959767277110
498133639527829543
427784563910622797
239048106709033386
811830635785664441
79970904163606084
581766960668879457
563803348576758782
832325970868945644
802524461284204327
699357358506040547
851316099849417569
707189700070809941
418595054971552951
78771...

input:

decode
1000
18
1031147983159782228
18
191809332
18
757943959767277110
18
498133639527829543
18
427784563910622797
18
239048106709033386
18
811830635785664441
18
79970904163606084
18
581766960668879457
18
563803348576758782
18
832325970868945644
18
802524461284204327
18
699357358506040547
18
85131609...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

1031147983159782228
24828804
757943959760178216
498231403140055917
574267661765607517
703060045610367591
751232306257617635
77971419324563203
631111510359998492
668036767107786451
408701516483989210
359098444794392780
942123240082864022
280647273347471599
26973348495001413
155881628978801478
1069288...

input:

decode
1000
19
1031147983159782228
19
24828804
19
757943959760178216
19
498231403140055917
19
574267661765607517
19
703060045610367591
19
751232306257617635
19
77971419324563203
19
631111510359998492
19
668036767107786451
19
408701516483989210
19
359098444794392780
19
942123240082864022
19
280647273...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

792864901319706963
533768474680388029
28941678331274228
115436420326918705
420228086696816285
528456559191715458
770149831604811050
17068075927971000
130816327422928252
531792639235721021
123556585984315222
267447832815760628
764215080572836346
620655504630461561
849244967413885884
70497936332017345...

input:

decode
1000
20
792864901319706963
20
533768474680388029
20
28941678331274228
20
115436420326918705
20
420228086696816285
20
528456559191715458
20
770149831604811050
20
17068075927971000
20
130816327422928252
20
531792639235721021
20
123556585984315222
20
267447832815760628
20
764215080572836346
20
6...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

108229063649574891
469732450753531215
341002527091943841
672300742626277776
943424722907587610
65103811741046573
396904696382560409
643312304491760030
240122249635604285
909082808647036797
661062818051388085
899273307036466736
556362416982160858
166584721043635677
205001837555968029
6900048825581268...

input:

decode
1000
21
108229063649574891
21
469732450753531215
21
341002527091943841
21
672300742626277776
21
943424722907587610
21
65103811741046573
21
396904696382560409
21
643312304491760030
21
240122249635604285
21
909082808647036797
21
661062818051388085
21
899273307036466736
21
556362416982160858
21
...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

688712609622958862
345293557153862268
316483674833578755
438373377516633764
161294007582829138
337681588040745866
166582872659178024
764983987452271388
149182852621636265
798191187269192190
164429961067727056
950855279348002075
303730443101428125
834261842858944874
316562698869370011
317828381342699...

input:

decode
1000
22
688712609622958862
22
345293557153862268
22
316483674833578755
22
438373377516633764
22
161294007582829138
22
337681588040745866
22
166582872659178024
22
764983987452271388
22
149182852621636265
22
798191187269192190
22
164429961067727056
22
950855279348002075
22
303730443101428125
22...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

430690863761596460
815800458838504726
845438197201259016
110670622475471286
75525443608076055
300501512430968128
191835049894503440
299870867082855193
74990698654946989
447664491721660264
481214781905591095
171137173619788580
225096028080378305
671467072029565075
679373877672615506
82467541216343703...

input:

decode
1000
23
430690863761596460
23
815800458838504726
23
845438197201259016
23
110670622475471286
23
75525443608076055
23
300501512430968128
23
191835049894503440
23
299870867082855193
23
74990698654946989
23
447664491721660264
23
481214781905591095
23
171137173619788580
23
225096028080378305
23
6...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

580358756166286934
998061558473494117
711370619116748733
653815850697580431
162655383671728388
454151176584986196
669659884904387830
722809122219653201
173473332105994487
652055578683413666
153021631061647003
357872534155365411
231902892162804892
551537276413359806
180040740557312904
628725533990776...

input:

decode
1000
24
580358756166286934
24
998061558473494117
24
711370619116748733
24
653815850697580431
24
162655383671728388
24
454151176584986196
24
669659884904387830
24
722809122219653201
24
173473332105994487
24
652055578683413666
24
153021631061647003
24
357872534155365411
24
231902892162804892
24...

output:

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

result:

ok 1000 lines

Test #31:

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

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: 2ms
memory: 3956kb

input:

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

output:

888966543391789356
443599023590113682
755108759002377907
387297235293868418
395594945290289795
869856719797109397
439884654237538098
636787074698071907
455355188188624167
707741810521912047
513040572746960894
638209786904813856
842118366109734494
23085576100733041
506661571893096574
7715747052172185...

input:

decode
1000
25
888966543391789356
25
443599023590113682
22
755108759002377907
24
387297235293868418
24
395594945290289795
23
869856719797109397
21
439884654237538098
20
636787074698071907
20
455355188188624167
23
707741810521912047
23
513040572746960894
24
638209786904813856
25
842118366109734494
25...

output:

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

result:

ok 1000 lines