alexjercan/bugnet huggingface dataset:
Problem p00336 test case
Input:
abab
ab

Expected output:
3
Problem p00337 test case
Input:
5 5
0 0
1 1
3 0
3 2
0 2
1 2
2 3
2 4
3 4
1 5

Expected output:
11.4142
Problem p00338 test case
Input:
3 11
0 2 5
0 1 5
0 3 4
1 1
1 2
1 3
0 3 2
1 1
0 2 1
1 2
1 3

Expected output:
1 5
2 5
3 4
3 6
3 6
1 5
Problem p00339 test case
Input:
5 4
3 3
2 1
1 5
4 2
2 6
4 1
8 2
10 4
12 17

Expected output:
2
Problem p00340 test case
Input:
1 1 3 4

Expected output:
no
Problem p00341 test case
Input:
1 1 3 4 8 9 7 3 4 5 5 5

Expected output:
no
Problem p00342 test case
Input:
10
1 2 3 4 5 6 7 8 9 10

Expected output:
19.00000
Problem p00343 test case
Input:
5
1 2 3 4 5 6
1 3 5 6 8 4
1 2 3 4 5 8
1 2 4 5 10 11
1 2 3 6 9 11

Expected output:
yes
yes
no
yes
no
Problem p00344 test case
Input:
3
1 1 1

Expected output:
3
Problem p00345 test case
Input:
0.(3)

Expected output:
1/3
Problem p00346 test case
Input:
4 5
1 2 2
1 3 2
2 3 1
2 4 2
3 4 1

Expected output:
1
2
Problem p00347 test case
Input:
2 1
-2 1

Expected output:
1
Problem p00348 test case
Input:
6
1 3 6 5 8 2

Expected output:
10
Problem p00349 test case
Input:
3 3 3
2 1 S
1 2 E
2 2 E

Expected output:
3
1
2
Problem p00350 test case
Input:
13
aizualgorithm
9
comp 1 1 4 5
comp 2 6 1 5
set 9 12 b
comp 9 9 10 10
comp 5 8 1 4
set 1 10 z
set 11 13 x
comp 8 10 1 5
comp 1 5 1 5

Expected output:
s
t
e
t
s
e
Problem p00351 test case
Input:
0 2

Expected output:
0.00000000
Problem p00352 test case
Input:
1000 3000

Expected output:
2000
Problem p00353 test case
Input:
1000 3000 3000

Expected output:
2000
Problem p00354 test case
Input:
1

Expected output:
fri
Problem p00355 test case
Input:
5 7
3
1 4
4 5
7 10

Expected output:
0
Problem p00356 test case
Input:
4 4

Expected output:
5
Problem p00357 test case
Input:
4
20
5
10
1

Expected output:
no
Problem p00358 test case
Input:
5 3
0 1
1 2
3 3

Expected output:
2
Problem p00359 test case
Input:
5 4 4
0 3
1 1
2 2
2 3

Expected output:
2
Problem p00360 test case
Input:
pckoshien
3

Expected output:
ckopshien
Problem p00361 test case
Input:
6 7
0 2
2 1
1 0
2 3
4 3
4 5
5 4

Expected output:
2
Problem p00362 test case
Input:
6 3
0 1 1
0 2 1
0 3 1
2 4 1
2 5 1
3
send 1 4
add 2 2
send 1 4

Expected output:
3
1
Problem p00363 test case
Input:
3 3 B

Expected output:
+-+
|B|
+-+
Problem p00364 test case
Input:
3 10
6 4
4 2
3 2

Expected output:
6.666667
Problem p00365 test case
Input:
1999 9 9
2001 11 3

Expected output:
3
Problem p00366 test case
Input:
3
3
6
8

Expected output:
3
Problem p00367 test case
Input:
5
1 0 2 0 3 30 4 30 6 0 7 0
2 30 3 0 4 0 5 0 5 30 6 30
1 30 2 30 4 30 5 0 6 30 7 0
2 30 3 0 5 0 6 0 6 30 7 0
1 0 2 0 3 0 3 30 4 0 5 0

Expected output:
3
Problem p00368 test case
Input:
3 2
1 1 0
0 0 1

Expected output:
yes
Problem p00369 test case
Input:
11121314

Expected output:
3
Problem p00370 test case
Input:
0 0
4 0
4
1 1
2 1
3 3
1 2

Expected output:
4.472136
Problem p00371 test case
Input:
3 2 7
8
3
6
5
2 2
3 2
4 1
6 1
6 0

Expected output:
yes
no
yes
no
yes
Problem p00372 test case
Input:
7 8
0 1
1 2
1 3
2 3
0 4
4 5
4 6
5 6

Expected output:
6
Problem p00373 test case
Input:
5 5 3 3
AF??z
W?p88
???Hk
pU?m?
F???c
F??
p?8
?H?

Expected output:
4
Problem p00374 test case
Input:
18 8 3 6
4
3
3
3
3
2
2
2
1
1
1
1
1
2
2
3
3
3
1
1
1
1
1
1
1
1

Expected output:
3
Problem p00375 test case
Input:
68

Expected output:
19
Problem p00376 test case
Input:
20 30

Expected output:
10
Problem p00377 test case
Input:
5 4
5 5 6 5

Expected output:
4
Problem p00378 test case
Input:
180 100 2400

Expected output:
460
Problem p00379 test case
Input:
16 2 1000

Expected output:
3
Problem p00380 test case
Input:
6
9 7 5 6 3 1
3
1 6
2 5
3 4

Expected output:
2
Problem p00381 test case
Input:
6
abbaba
baabab

Expected output:
5
Problem p00382 test case
Input:
3
3 8 10 1
4 7 1 2 15
3 11 8 19

Expected output:
45
Problem p00383 test case
Input:
5 4
0 0
1 0
1 1
0 1
2 2

Expected output:
0
Problem p00384 test case
Input:
7
6
1
-1
4
3
3
1
1 2
2 3
3 4
3 5
5 6
5 7

Expected output:
10
Problem p00385 test case
Input:
5 3 1
1 -2 0
2 3

Expected output:
-3
Problem p00386 test case
Input:
5 4
1 2 3
2 3 4
2 4 2
4 5 3
1 3 4
1 4 5
1 2 3
2 4 5

Expected output:
4
5
4
3
Problem p00387 test case
Input:
3 5

Expected output:
2
Problem p00388 test case
Input:
100 2 4

Expected output:
2
Problem p00389 test case
Input:
4 2

Expected output:
3
Problem p00390 test case
Input:
5
1 0 0 1 0
2 3 5 1 2

Expected output:
3
Problem p00391 test case
Input:
5 4
0 2 2 1 1
1 1 1 3

Expected output:
1
Problem p00392 test case
Input:
5
6 4 2 3 7

Expected output:
1
Problem p00393 test case
Input:
4 3

Expected output:
3
Problem p00394 test case
Input:
3 2 2
3 2 1
1 2 3
1 2

Expected output:
26
Problem p00395 test case
Input:
12 5
.....S......
.abcdefghij.
.0123456789.
.ABCDEFGHIJ.
.....T......
0 1 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

Expected output:
26 2
Problem p00396 test case
Input:
4
24 99
15 68
12 90
95 79

Expected output:
0
Problem p00397 test case
Input:
3 3
1 2 3

Expected output:
2
Problem p00398 test case
Input:
3
1 2
3 4
10 1

Expected output:
9
Problem p00399 test case
Input:
4 2 1 1

Expected output:
8
Problem p00400 test case
Input:
67

Expected output:
1
Problem p00401 test case
Input:
54

Expected output:
32
Problem p00402 test case
Input:
3
4 0 1

Expected output:
2
Problem p00403 test case
Input:
4
1 2 -3 -1

Expected output:
3
Problem p00404 test case
Input:
0 0

Expected output:
1
Problem p00405 test case
Input:
3
3 5 2

Expected output:
7
Problem p00406 test case
Input:
2 10
3 0
6 1

Expected output:
6
Problem p00407 test case
Input:
6
0 0
4 0
6 3
5 5
1 5
0 3
5
2 2
6 6
3 1
5 1
-1 -1

Expected output:
1
0
1
0
0
Problem p00408 test case
Input:
3
1 2
1 3

Expected output:
2
Problem p00409 test case
Input:
6 5
ababac
6 b
3 c
4 a
5 b
6 c

Expected output:
2
6
6
6
3
Problem p00410 test case
Input:
5 4
2
1
3
6
4
1 2
2 3
2 4
4 5

Expected output:
14
Problem p00411 test case
Input:
180 120 90

Expected output:
60.0
Problem p00412 test case
Input:
2 7
1 999
1 1000
0 2
1 1001
1 1002
0 1
0 1

Expected output:
1000
999
1002
Problem p00413 test case
Input:
0 0 4 5
2 2 3 6

Expected output:
26
Problem p00414 test case
Input:
3 2
ooo

Expected output:
21
Problem p00415 test case
Input:
7 3
1 4 1 4 2 1 3

Expected output:
4423
Problem p00416 test case
Input:
6
2 2 3 2 2 2

Expected output:
1
Problem p00417 test case
Input:
3 2 100000007

Expected output:
2
Problem p00418 test case
Input:
3 2
5 1
10 4
6 2
2 1 3
3 2 1

Expected output:
45
Problem p00419 test case
Input:
4
aedb
aeb
ebCd
cdE

Expected output:
1
Problem p00420 test case
Input:
6 5 8
1 3
2 5
3 4
2 4
2 5
1 1 5 1
1 1 5 2
1 1 5 3
1 1 5 4
1 1 5 5
1 1 5 6
2 3 4 2
1 1 1 1

Expected output:
3
2
4
5
1
6
4
3
Problem p00421 test case
Input:
1 1

Expected output:
8
Problem p00423 test case
Input:
3
9 1
5 4
0 8
3
9 1
5 4
1 0
3
9 1
5 5
1 8
0

Expected output:
19 8
20 0
15 14
Problem p00424 test case
Input:
3
A a
0 5
5 4
10
A
B
C
0
1
4
5
a
b
A
3
A a
0 5
5 4
10
A
B
C
0
1
4
5
a
b
A
0

Expected output:
aBC5144aba
aBC5144aba
Problem p00425 test case
Input:
5
North
North
East
South
West
8
West
North
Left
South
Right
North
Left
East
0

Expected output:
21
34
Problem p00426 test case
Input:
3 10
0
1 1
2 2 3
4 20
2 1 2
1 3
1 4
2 5
2 1 2
0
0
3 3
0
1 1
2 2 3
0 0

Expected output:
9
3
0
-1
Problem p00427 test case
Input:
2 1 0 5
3 1 1 3
2 2 1 3
0 0 0 0

Expected output:
0.50000
0.833
1.000
Problem p00428 test case
Input:
4 6
1 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
4 6
1 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
0 0

Expected output:
1 3 2 5 4 6
1 3 2 5 4 6
Problem p00429 test case
Input:
5
11
5
11
0

Expected output:
13112221
13112221
Problem p00430 test case
Input:
5
5
0

Expected output:
5
4 1
3 2
3 1 1
2 2 1
2 1 1 1
1 1 1 1 1
5
4 1
3 2
3 1 1
2 2 1
2 1 1 1
1 1 1 1 1
Problem p00431 test case
Input:
7
1 3
3 4
1 4
2 7
5 7
6 7
1 7
6
1 2
2 3
3 4
4 5
1 5
2 6
7
1 3
2 4
3 5
4 6
6 7
2 6
4 7
0

Expected output:
5
6
4
Problem p00432 test case
Input:
5 1
0 0 3 2
1 1 2 5
0 4 6 5
3 3 5 6
5 0 7 6
5 2
0 0 3 2
1 1 2 5
0 4 6 5
3 3 5 6
5 0 7 6
2 2
0 0 8 9
0 0 9 8
3 2
2 2 8 8
3 0 4 9
5 0 7 9
0 0

Expected output:
29
29
38
80
36
45
36
Problem p00433 test case
Input:
100 80 70 60
80 70 80 90

Expected output:
320
Problem p00434 test case
Input:
3
1
4
5
7
9
6
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

Expected output:
2
8
Problem p00435 test case
Input:
MRL

Expected output:
JOI
Problem p00436 test case
Input:
2
2
1
0

Expected output:
2
4
3
1
Problem p00437 test case
Input:
2 2 2
4
2 4 5 0
2 3 6 0
1 4 5 0
2 3 5 1
0 0 0

Expected output:
2
1
1
0
1
0
Problem p00438 test case
Input:
5 4
3
2 2
2 3
4 2
5 4
3
2 2
2 3
4 2
0 0

Expected output:
5
5
Problem p00439 test case
Input:
5 3
2
5
-4
10
3
0 0

Expected output:
11
Problem p00440 test case
Input:
7 5
6
2
4
7
1
7 5
6
2
0
4
7
0 0

Expected output:
2
4
Problem p00441 test case
Input:
10
9 4
4 3
1 1
4 2
2 4
5 8
4 0
5 3
0 5
5 2
10
9 4
4 3
1 1
4 2
2 4
5 8
4 0
5 3
0 5
5 2
0

Expected output:
10
10
Problem p00442 test case
Input:
4
5
1 2
3 1
3 2
3 4
4 1

Expected output:
3
4
1
2
0
Problem p00443 test case
Input:
1
6 9 0 0
4
3 2 0 4
1 3 0 0
4 4 2 1
2 2 0 0
0

Expected output:
5
40
Problem p00444 test case
Input:
380
1
0

Expected output:
4
15
Problem p00445 test case
Input:
JOIJOI
JOIOIOIOI
JOIOIJOINXNXJIOIOIOJ

Expected output:
2
0
1
3
2
3
Problem p00446 test case
Input:
5
1
7
9
6
10
10
8
7
14
18
4
11
3
17
5
19
0

Expected output:
3
0
2
0
Problem p00447 test case
Input:
5
8 5
6 4
4 3
7 10
0 10
10
10 5
2 7
9 7
8 10
10 2
1 2
8 1
6 7
6 0
0 9
5
904207 809784
845370 244806
499091 59863
638406 182509
435076 362268
10
757559 866424
114810 239537
519926 989458
461089 424480
674361 448440
81851 150384
459107 795405
299682 6700
254125 362183
50795 541942
0

Expected output:
2 -3
-384281 179674
Problem p00448 test case
Input:
2 5
0 1 0 1 0
1 0 0 0 1
3 6
1 0 0 0 1 0
1 1 1 0 1 0
1 0 1 1 0 1
0 0

Expected output:
9
15
Problem p00449 test case
Input:
3 8
1 3 1 10
0 2 3
1 2 3 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 343750
1 1 3 3343
1 1 4 347392
1 1 5 5497
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 5 843468
1 4 5 15934
0 2 1
0 4 1
0 3 2
0 4 2
0 4 3
0 5 3
0 0

Expected output:
-1
15
12
5955
21431
9298
16392
24774
8840
Problem p00450 test case
Input:
8
1
0
1
1
0
0
0
0
8
1
0
1
1
0
0
0
1
0

Expected output:
6
2
Problem p00451 test case
Input:
ABRACADABRA
ECADADABRBCRDARA
UPWJCIRUCAXIIRGL
SBQNYBSBZDFNEV

Expected output:
5
0
Problem p00452 test case
Input:
4 50
3
14
15
9
3 21
16
11
2
0 0

Expected output:
48
20
Problem p00453 test case
Input:
5 1
2 1 3 2 2
1 3 2
1 1 7
1 2 1
1 4 4
5 0
2 1 3 2 2
1 3 2
1 1 7
1 2 1
1 4 4
0 0

Expected output:
17
40
Problem p00454 test case
Input:
15 6
10
1 4 5 6
2 1 4 5
1 0 5 1
6 1 7 5
7 5 9 6
7 0 9 2
9 1 10 5
11 0 14 1
12 1 13 5
11 5 14 6
0 0

Expected output:
5
Problem p00455 test case
Input:
9 0 0 18 0 0
9 0 1 18 0 0
12 14 52 12 15 30

Expected output:
9 0 0
8 59 59
0 0 38
Problem p00456 test case
Input:
23
23
20
15
15
14
13
9
7
6
25
19
17
17
16
13
12
11
9
5

Expected output:
66 61
Problem p00457 test case
Input:
12
3
2
1
1
2
3
2
2
2
1
1
3
12
3
2
1
1
2
3
2
1
3
2
1
3
0

Expected output:
3
12
Problem p00458 test case
Input:
3
3
1 1 0
1 0 1
1 1 0
5
3
1 1 1 0 1
1 1 0 0 0
1 0 0 0 1
0
0

Expected output:
5
5
Problem p00459 test case
Input:
9
1
3 7 4
3 5
12
3
3 8 5
3 8
2 5
6 10
0

Expected output:
2
3
Problem p00460 test case
Input:
3 9 45
3 100 50
5 50 685
0 0 0

Expected output:
1
7
74501
Problem p00461 test case
Input:
1
13
OOIOIOIOIIOII
2
13
OOIOIOIOIIOII
0

Expected output:
4
2
Problem p00462 test case
Input:
8
3
2
3
1
4
6
20
4
4
12
8
16
7
7
11
8
0

Expected output:
3
3
Problem p00463 test case
Input:
4 5 7 2
20
80
100
50
1 1
2 6
2 3
1 5
3 1
2 2 5 1
10
20
1 1
1 3
0 0 0 0

Expected output:
100
10
Problem p00464 test case
Input:
3 4 3
1 0 1 1
0 1 0 0
1 0 1 0
0 0 0

Expected output:
1 5
Problem p00465 test case
Input:
5
2 2 1 2
9 5
1 17
3 2 2 1
6 1 20
8 18 3
8
5 4 1 3
5 5 4 5 5
8 2 1 9 7
1 1 3 5 1
7 2 7 1 3
6 5 6 2
2 3 5 8 2 7
1 6 9 4 5 1
2 4 5 4 2 2
5 4 2 5 3 3
7 1 5 1 5 6
6
3 3 2 2
2 9 2
9 1 9
2 9 2
2 2 1 1
1 3
5 7
0

Expected output:
15
4
9
Problem p00466 test case
Input:
9850
1050
800
420
380
600
820
2400
1800
980
0

Expected output:
600
Problem p00467 test case
Input:
10 5
0
0
5
6
-3
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
1
5
2
4
6
5
5
4
1
6
0 0

Expected output:
5
6
Problem p00468 test case
Input:
6
5
1 2
1 3
3 4
2 3
4 5
6
5
2 3
3 4
4 5
5 6
2 5
0
0

Expected output:
3
0
Problem p00469 test case
Input:
4
2
1
2
12
1
6
3
72
2
12
7
2
1
0
0

Expected output:
7
68
Problem p00470 test case
Input:
3 4
15 15
0 0

Expected output:
5
43688
Problem p00471 test case
Input:
3 2
1 0 1
1 0 2
3 3
1 1 1
1 0 1
1 1 2
0 0

Expected output:
2
6
Problem p00472 test case
Input:
7 5
2
1
1
3
2
1
2
-1
3
2
-3

Expected output:
18
Problem p00473 test case
Input:
6
1
8
12
6
2

Expected output:
7
Problem p00474 test case
Input:
4 6
4
2
3
5

Expected output:
8
Problem p00475 test case
Input:
5
0 0
1 0
-1 -2
0 1
-1 1

Expected output:
3
Problem p00476 test case
Input:
10 10
4 2
2 5
6 1
7 3
6 4
9 6
0 8
4 1
9 4

Expected output:
10
Problem p00477 test case
Input:
31
34
7
151

Expected output:
3
43
Problem p00478 test case
Input:
ABCD
3
ABCDXXXXXX
YYYYABCDXX
DCBAZZZZZZ

Expected output:
2
Problem p00479 test case
Input:
11
4
5 2
9 7
4 4
3 9

Expected output:
2
3
1
3
Problem p00480 test case
Input:
11
8 3 2 4 8 7 2 4 0 8 8

Expected output:
10
Problem p00481 test case
Input:
3 3 1
S..
...
..1

Expected output:
4
Problem p00482 test case
Input:
2 3
??O
IIJ

Expected output:
4
Problem p00483 test case
Input:
4 7
4
JIOJOIJ
IOJOIJO
JOIJOOI
OOJJIJO
3 5 4 7
2 2 3 6
2 2 2 2
1 1 4 7

Expected output:
1 3 2
3 5 2
0 1 0
10 11 7
Problem p00484 test case
Input:
7 4
14 1
13 2
12 3
14 2
8 2
16 3
11 2

Expected output:
60
Problem p00485 test case
Input:
3 3 1
1 2 1
2 3 1
3 1 1
1

Expected output:
2
Problem p00486 test case
Input:
5 4
3
1 1
3 4
5 3

Expected output:
10
3 3
Problem p00487 test case
Input:
6
12 8
5 9
2 4
10 12
6 7
13 9

Expected output:
3
Problem p00488 test case
Input:
800
700
900
198
330

Expected output:
848
Problem p00489 test case
Input:
4
1 2 0 1
1 3 2 1
1 4 2 2
2 3 1 1
2 4 3 0
3 4 1 3

Expected output:
2
1
4
2
Problem p00490 test case
Input:
3
12 2
200
50
300
100

Expected output:
37
Problem p00491 test case
Input:
5 3
3 1
1 1
4 2

Expected output:
6
Problem p00492 test case
Input:
8 4
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 0
1 0 1 0 1 1 1 1
0 1 1 0 1 0 1 0

Expected output:
64
Problem p00493 test case
Input:
100
200
5

Expected output:
13
Problem p00494 test case
Input:
OJJOOIIOJOI

Expected output:
2
Problem p00495 test case
Input:
5 4
1 2 3 4 5
3 1 4 1

Expected output:
2
Problem p00496 test case
Input:
5 20 14
8 9
2 4
7 13
6 3
5 8

Expected output:
16
Problem p00497 test case
Input:
5 2
2 2 1
2 1 3

Expected output:
12
Problem p00498 test case
Input:
6 6 2 3
1 2 5
2 3 4
2 4 6
3 5 9
4 5 3
5 6 7
1
6
3 4
5 2
1 4

Expected output:
7
5
0
Problem p00499 test case
Input:
20
25
30
6
8

Expected output:
15
Problem p00500 test case
Input:
5
100 99 98
100 97 92
63 89 63
99 99 99
89 97 98

Expected output:
0
92
215
198
89
Problem p00501 test case
Input:
4
bar
abracadabra
bear
bar
baraxbara

Expected output:
3
Problem p00502 test case
Input:
3 4
31
27
35
20 25 30
23 29 90
21 35 60
28 33 40

Expected output:
80
Problem p00503 test case
Input:
3 2
30 50 0 50 70 100
10 20 20 70 90 60
40 60 20 90 90 70

Expected output:
49000
Problem p00504 test case
Input:
5 4 2
...#
.#.#
.#73
8##.
....

Expected output:
11
Problem p00505 test case
Input:
3 4 5
2 1 2
6 3 4
1 1 1
1 2 3

Expected output:
3 1 1 1
Problem p00506 test case
Input:
2
75 125

Expected output:
1
5
25
Problem p00507 test case
Input:
3
2
7
5

Expected output:
52
Problem p00508 test case
Input:
2
0 0
1 1

Expected output:
2
Problem p00509 test case
Input:
1 0

Expected output:
101
Problem p00510 test case
Input:
3
2
2 3
2 3
4 1

Expected output:
3
Problem p00511 test case
Input:
1
+
1
=

Expected output:
2
Problem p00512 test case
Input:
5
A 20
B 20
A 20
AB 10
Z 10

Expected output:
A 40
B 20
Z 10
AB 10
Problem p00513 test case
Input:
10
4
7
9
10
12
13
16
17
19
20

Expected output:
2
Problem p00514 test case
Input:
2 0 3

Expected output:
4
Problem p00515 test case
Input:
10
65
100
30
95

Expected output:
68
Problem p00516 test case
Input:
4 3
5
3
1
4
4
3
2

Expected output:
2
Problem p00517 test case
Input:
4 3 3
1 1
3 3
4 1

Expected output:
5
Problem p00518 test case
Input:
2
OI

Expected output:
7
Problem p00519 test case
Input:
6 6
400 2
200 1
600 3
1000 1
300 5
700 4
1 2
2 3
3 6
4 6
1 5
2 4

Expected output:
700
Problem p00520 test case
Input:
5
1 0 1 1 2
0 2 6 3 4

Expected output:
20
Problem p00521 test case
Input:
3 5
JOIJO
IJOOO
IIJIJ
JO
IJ

Expected output:
3
Problem p00522 test case
Input:
4 3
180
160
170
190
2 100
3 120
4 250

Expected output:
480
Problem p00523 test case
Input:
6
1
5
4
5
2
4

Expected output:
6
Problem p00524 test case
Input:
5 5 0
50
100
25
30
10
1 2 10
2 5 50
2 4 20
4 3 1
5 4 20

Expected output:
110
Problem p00525 test case
Input:
10 10 5
6 0 6 7
0 6 7 6
2 3 9 3
2 3 2 10
1 9 8 9

Expected output:
4
Problem p00526 test case
Input:
10
1 1 0 0 1 0 1 1 1 0

Expected output:
7
Problem p00527 test case
Input:
5 5
OIOOI
OOIOI

Expected output:
7
Problem p00528 test case
Input:
3 2 1
1 2

Expected output:
4
Problem p00529 test case
Input:
6
JOIIOI

Expected output:
2
Problem p00530 test case
Input:
5
10
3
6
8
1

Expected output:
0
Problem p00531 test case
Input:
9
100
20
3
10

Expected output:
90
Problem p00532 test case
Input:
3
4
1 2 3 2
1 1 2
3 2 2
1 1 3
2 2 2

Expected output:
3
4
5
Problem p00533 test case
Input:
3 4
c..c
..c.
....

Expected output:
0 1 2 0
-1 -1 0 1
-1 -1 -1 -1
Problem p00534 test case
Input:
3 5
10
25
15
50
30
15
40
30

Expected output:
1125
Problem p00535 test case
Input:
5 6
......
.939..
.3428.
.9393.
......

Expected output:
3
Problem p00536 test case
Input:
6 15
50 900
30 200
40 100
80 600
60 100
70 700

Expected output:
1200
Problem p00537 test case
Input:
4 4
1 3 2 4
120 90 100
110 50 80
250 70 130

Expected output:
550
Problem p00538 test case
Input:
5
2
8
1
10
9

Expected output:
18
Problem p00539 test case
Input:
5 5 2
2 3 1
3 1 2
2 4 3
1 2 4
2 5 5

Expected output:
14
Problem p00540 test case
Input:
7 3
5 2
5 5
8 6
6
2
8
9

Expected output:
8
Problem p00541 test case
Input:
5 5 3 2
2 2
4 3

Expected output:
4
Problem p00542 test case
Input:
100
34
76
42
10
0

Expected output:
228
Problem p00543 test case
Input:
6 4
3
2
8
3
1
5

Expected output:
2
3
1
8
5
3
Problem p00544 test case
Input:
4 5
WRWRW
BWRWB
WRWRW
RWBWR

Expected output:
11
Problem p00545 test case
Input:
5 5 3
-8 1
-4 2
-2 2
4 2
10 1
1
3
5

Expected output:
-6
-6
15
Problem p00546 test case
Input:
13 21 1 1
1000 6000
7
1 2
3 7
2 4
5 8
8 9
2 5
3 4
4 7
9 10
10 11
5 9
7 12
3 6
4 5
1 3
11 12
6 7
8 11
6 13
7 8
12 13

Expected output:
11000
Problem p00547 test case
Input:
5 5
..483
.59.9
3.866
79...
4.8..

Expected output:
20
Problem p00548 test case
Input:
6 3 6
1
2
3
1
2
1

Expected output:
21
Problem p00549 test case
Input:
5
JOIOI

Expected output:
6
Problem p00550 test case
Input:
5 6 5
1 2
1 3
4 2
3 2
2 5
5 3
5
2
4
1
3

Expected output:
0
2
2
4
4
Problem p00551 test case
Input:
12 1
EENWSEEESWWS

Expected output:
3
Problem p00552 test case
Input:
10 2
12 1 3
2 2 2

Expected output:
3
3
5
5
5
5
5
5
2
2
Problem p00553 test case
Input:
-10
20
5
10
3

Expected output:
120
Problem p00554 test case
Input:
4 5
1 7
6 2
3 5
4 4
0 8

Expected output:
4
Problem p00555 test case
Input:
3 5 2
...#.
#...#
....#

Expected output:
12
Problem p00556 test case
Input:
7 2
1
2
2
2
1
2
1

Expected output:
2
Problem p00557 test case
Input:
3 3
2 9 4
7 5 3
6 1 8

Expected output:
4
Problem p00558 test case
Input:
8 10 4
0
1
1
2
1
1
2
0
1 2 1
1 3 1
2 3 3
2 4 5
3 4 1
4 5 1
5 6 1
5 8 1
1 7 2
7 8 2

Expected output:
9
Problem p00559 test case
Input:
3 5 1 2
0
4
1
8
1 2 2
1 1 -2
2 3 5
1 2 -1
1 3 5

Expected output:
-5
-7
-13
-13
-18
Problem p00560 test case
Input:
10 3 5
10 3 5
30
1
6
10

Expected output:
8
Problem p00561 test case
Input:
4 4
1 12 6 11
11 10 2 14
10 1 9 20
4 17 19 10

Expected output:
11
Problem p00562 test case
Input:
6 5
1 3 6
3
1 1
0 4
6 5

Expected output:
26
Problem p00563 test case
Input:
5 3
1 2 3 3 2

Expected output:
2
1
1
Problem p00570 test case
Input:
3 2
1
3
6

Expected output:
4
Problem p00571 test case
Input:
3
2 3
11 2
4 5

Expected output:
6
Problem p00572 test case
Input:
3 4
RGWR
GRGG
RGWW

Expected output:
3
Problem p00573 test case
Input:
6 6
1 6
1 4
1 2 1
2 3 1
3 5 1
2 4 3
4 5 2
5 6 1

Expected output:
2
Problem p00574 test case
Input:
3 5
12345678
000
0??
1?0
?11
???

Expected output:
1
10
12
12
36
Problem p00575 test case
Input:
3 0 10

Expected output:
4
Problem p00576 test case
Input:
3
2 3 6
2
1 3

Expected output:
2
3
7
Problem p00577 test case
Input:
5
OXXOX

Expected output:
2
Problem p00578 test case
Input:
6
0 1 2 1 3 2

Expected output:
2
Problem p00579 test case
Input:
4 1
1 2 3 8
2 4

Expected output:
9
Problem p00580 test case
Input:
4
2 1 1 1

Expected output:
4
Problem p00581 test case
Input:
3 4
JOIJ
JIOO
IIII

Expected output:
3
Problem p00582 test case
Input:
3 4
10 20
5 1
3 5
4
6
10
4

Expected output:
2
Problem p00583 test case
Input:
5
RRGYY

Expected output:
2
Problem p00584 test case
Input:
3
0 0
0 4
4 0
2 1
2 5
-1 1

Expected output:
15
Problem p00585 test case
Input:
5 4
1 2
2 3
3 4
3 5
1 2 1 2 4

Expected output:
2
0
1
1
1
Problem p00586 test case
Input:
1 2
10 5
100 20

Expected output:
3
15
120
Problem p00587 test case
Input:
i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)

Expected output:
((,),)
((,(,)),(,))
Problem p00588 test case
Input:
2
2
YNNNNYYY
4
NYNNYYNNNYNYYNNN

Expected output:
6
9
Problem p00589 test case
Input:
666660666
44444416003334446633111
20202202000333003330333

Expected output:
No
I'm fine.
aaba  f ff
Problem p00590 test case
Input:
1
4
7
51

Expected output:
0
2
2
6
Problem p00591 test case
Input:
3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0

Expected output:
7
7
Problem p00592 test case
Input:
1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0

Expected output:
120
180
Problem p00593 test case
Input:
3
4
0

Expected output:
Case 1:
  1  2  6
  3  5  7
  4  8  9
Case 2:
  1  2  6  7
  3  5  8 13
  4  9 12 14
 10 11 15 16
Problem p00594 test case
Input:
8
3 1 2 3 3 1 5 3
7
5 2 5 3 4 5 5
0

Expected output:
NO COLOR
5
Problem p00595 test case
Input:
57 38
60 84

Expected output:
19
12
Problem p00596 test case
Input:
6
13 23 14 24 15 25
10
00 01 11 02 12 22 03 13 23 33

Expected output:
Yes
No
Problem p00597 test case
Input:
1
4

Expected output:
1
8
Problem p00598 test case
Input:
A 3
1 3 -1
B 4
3 1 5 7
D 1
5
R 0
cAiBdD
C 3
1 2 3
A 4
2 10 8 3
B 3
2 4 8
R 0
(As(AiB))uC

Expected output:
7
1 2 3 10
Problem p00599 test case
Input:
4
-5.000000 0.000000
5.000000 0.000000
9.635255 14.265848
-0.364745 14.265848
3
-1.000000 0.000000
0.000000 0.000000
0.000000 1.000000

Expected output:
0 150
-1 -1
Problem p00600 test case
Input:
3 5
12 8 25 19 23
9 13 16 0 17
20 14 16 10 22
17 27 18 16
9 7 0
19 5
21
0 0

Expected output:
38
Problem p00601 test case
Input:
5 4
0 1
0 4
1 2
3 4
5 4
0 1
0 4
1 2
3 4
0 0

Expected output:
2
2
Problem p00602 test case
Input:
5 5
50 1
13 13

Expected output:
2
50
8
Problem p00603 test case
Input:
9 1
3
9 4
1 2 3 4

Expected output:
3
0
Problem p00604 test case
Input:
3
10 20 30
7
56 26 62 43 25 80 7

Expected output:
100
873
Problem p00605 test case
Input:
2 3
5 4 5
1 2 3
3 2 1
3 5
1 2 3 4 5
0 1 0 1 2
0 1 1 2 2
1 0 3 1 1
0 0

Expected output:
Yes
No
Problem p00606 test case
Input:
1
E A C
1
E B C
2
E A B
0

Expected output:
0.00000000
0.25000000
0.06250000
Problem p00607 test case
Input:
hyo
ni
END_OF_TEXT
f
d
f
f
k
p
p
e
y
a
k
y
y
n
y
-

Expected output:
honihoni
honi
Problem p00608 test case
Input:
5 5
4=..2
+#=#+
.-2=.
=#*#=
.-.=3
6
7 3 1 4 / 8
1 6
8..3=2
2
2 +
0 0

Expected output:
Yes
No
Problem p00609 test case
Input:
2 2 1
0 0
0 4
2 2
2 8
0 0 0

Expected output:
2
Problem p00610 test case
Input:
2 1
2 3
6 4
0 0

Expected output:
..
..

No

..EEEE
..E..E
EEE..E
E..EEE
E..E..
EEEE..