alexjercan/bugnet huggingface dataset:
Problem p01216 test case
Input:
8 3
A 6 9000
a1
a2
a3
a4
a5
a6
B 6 8000
b1
b2
b3
b4
b5
b6
C 4 3000
c1
c2
c3
c4
2
a7 A 2000
b2 B 4000
3
a8 A 1500
c3 C 500
b1 B 1000
2
c2 C 2328
a3 A 2327
2
b5 B 2345
c5 C 4000
43
A 3 2500
a1
a2
a3
B 3 1500
b1
b2
b3
C 1 150
c1
2
a4 A 1500
b4 B 1000
2
a5 A 700
b5 B 800
0 0

Expected output:
a1
a2
a3
a8
b1
b2
b3
c2
c5

a1
a2
a4
b5
Problem p01217 test case
Input:
1
2
3
4
0

Expected output:
6
30
30
6
Problem p01218 test case
Input:
1 1
0 0 0
4 4
0 0 0
1 1 1
2 2 2
3 3 3
3 4
0 0 0
1 1 1
2 2 2
4 1
1 0 1
0 0 0
1 1 0
0 1 -1
5 2
0 0 100
0 0 99
1 0 99
1 0 98
1 0 -100
7 4
71 55 -77
-43 -49 50
73 -22 -89
32 99 -33
64 -22 -25
-76 -1 6
39 4 23
0 0

Expected output:
0
0
0
-1
200
197.671366737338417
Problem p01219 test case
Input:
2 2
6 3
Monday Tuesday Wednesday
8 4
Thursday Friday Saturday Sunday
2 2
7 3
Monday Tuesday Wednesday
9 4
Thursday Friday Saturday Sunday
0 0

Expected output:
Yes
No
Problem p01220 test case
Input:
1
2
3
4
5
6
0

Expected output:
0.433013
0.577350
0.433013
0.732051
0.776798
0.577350
Problem p01221 test case
Input:
14
VAR ga;
VAR gb;
IF(ga > gb) {
  VAR saa;
  VAR sab;
  IF(saa > ga) {
    saa = sab;
  }
}
WHILE(gb > ga) {
  VAR sba;
  sba = ga;
  ga = gb;
}
7
VAR thisisthelongest;
IF(thisisthelongest / 0) {
  VARone;
  one = thisisthelongest + 1234567890123456789012345;
}
VAR another;
32 = another;
0

Expected output:
73
59
Problem p01222 test case
Input:
1 1
4 10 0 0 10 0 10 10 0 10
-5 -20 30 15
135 45
0 -15 15 0
0 0

Expected output:
11.213
Problem p01223 test case
Input:
5
5
10 70 30 50 90
2
20 100
2
100 30
3
50 50 50
7
123 45 678 901 234 567 890

Expected output:
60 40
80 0
0 70
0 0
633 667
Problem p01224 test case
Input:
1
2
3
4
6
12
16
28
33550336
99999998
99999999
100000000
0

Expected output:
deficient number
deficient number
deficient number
deficient number
perfect number
abundant number
deficient number
perfect number
perfect number
deficient number
deficient number
abundant number
Problem p01225 test case
Input:
5
1 2 3 3 4 5 7 7 7
R R R R R R G G G
1 2 2 3 4 4 4 4 5
R R R R R R R R R
1 2 3 4 4 4 5 5 5
R R B R R R R R R
1 1 1 3 4 5 6 6 6
R R B G G G R R R
2 2 2 3 3 3 1 1 1
R G B R G B R G B

Expected output:
1
0
0
0
1
Problem p01226 test case
Input:
4
4 6
*.*..*
*.....
..-...
^.*#..
10
SRSSRRUSSR
2 2
<.
..
12
DDSRRSUUSLLS
3 5
>-#**
.-*#*
.-**#
15
SSSDRSSSDRSSSUU
5 5
v****
*****
*****
*****
*****
44
SSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD

Expected output:
*....*
......
..-...
..>#..

<.
..

^-#**
.-.#*
.-..#

.....
.***.
..*..
..*..
....v
Problem p01227 test case
Input:
6
5 2
10 30 40 70 100
7 3
3 6 10 17 21 26 28
1 1
100
2 1
0 1000000
3 5
30 70 150
6 4
0 10 20 30 40 50

Expected output:
60
13
0
1000000
0
20
Problem p01228 test case
Input:
5
2
01000100
00020202
2
0102
00000810
1
0200020008000200
5
0001
000001
0000000001
00000000000001
0000000000000000000001
1
000000

Expected output:
01020302
01000A10
02020802
Too complex.
00
Problem p01229 test case
Input:
7
1
2
2
1 2
3
4 1 4
3
4 0 4
5
4 1 4 0 4
5
4 1 4 1 4
5
4 2 4 0 4

Expected output:
2
2
8
4
7
12
11
Problem p01230 test case
Input:
2 1 1
1 2
2 1 2
1 2
3 1 2
1 2
8 8 5778
1 2
2 3
2 4
3 5
5 6
6 7
7 8
4 8
8 8 5777
1 2
2 3
2 4
3 5
5 6
6 7
7 8
4 8
0 0 0

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

Expected output:
5
infinity
infinity
2
infinity
1
Problem p01232 test case
Input:
2
3
R 1 =
L 2 + -
L 2 * /
6
a+b*c-d
(p-q)/q/d
a+b*c=d-e
t+t+t+t+t
s=s=s=s=s
(((((z)))))
3
R 3 = < >
L 3 & | ^
L 4 + - * /
1
a>b*c=d<e|f+g^h&i<j>k

Expected output:
((a+(b*c))-d)
(((p-q)/q)/d)
((a+(b*c))=(d-e))
((((t+t)+t)+t)+t)
(s=(s=(s=(s=s))))
z

(a>((b*c)=(d<((((e|(f+g))^h)&i)<(j>k)))))
Problem p01233 test case
Input:
4
0 1 3 2 0 1
1 1 2 2 9 9
0 0 1 4 5 5
0 0 1 4 5 10

Expected output:
0
1
2
3
Problem p01234 test case
Input:
2
150 1 50 30 50
100 1 20 30 40

Expected output:
Case 1:
Fire at 37.995392 degree(s).
Projectile destroyed in 2.290123 second(s).

Case 2:
Projectile reaches the land.
Problem p01235 test case
Input:
2
2 1 2 2
0 0 1 0
0 1 0 2
0

Expected output:
Case 1: 3.00000
Problem p01236 test case
Input:
5 5
#####
#####
#####
#####
#####
4 4
####
####
####
####
4 4
#...
....
....
...#
4 4
.#.#
#.#.
.#.#
#.#.
0 0

Expected output:
Case 1: 10
Case 2: 6
Case 3: 2
Case 4: Impossible
Problem p01237 test case
Input:
3 3 1
1 0 0
0 0 0 0
0 0 0 0 0
0 0 0 0
0 0 1
3 3 2
1 0 0
0 0 0 0
0 0 0 0 0
0 0 0 0
0 0 1
0 0 0

Expected output:
Case 1: 8
Case 2: 18
Problem p01238 test case
Input:
1
2
0

Expected output:
Case 1: 3 2
Case 2: 2 1
Problem p01239 test case
Input:
4
0 1 0 9
10 1 10 9
1 0 9 0
1 10 9 10
2
1.2 3.4 5.6 7.8
5.6 3.4 1.2 7.8
0

Expected output:
Case 1: 36.24264
Case 2: 16.84508
Problem p01240 test case
Input:
2
2 2
2 3
3 5
3 2
4 1 1
2 1 4

Expected output:
Case 1: 7
Case 2: 8
Problem p01241 test case
Input:
2 1
10 5
15 10
0 0

Expected output:
Case 1: 1
Case 2: 11
Case 3: 210
Problem p01242 test case
Input:
4 3
ooxx
ooxx
ooxx
4 1
null
4 4
aabb
aabb
ccdd
ccdd
0 0

Expected output:
Case 1:
o 0 0
x 2 0
Case 2:
l 2 0
n 0 0
u 1 0
Case 3:
a 0 0
b 2 0
c 0 2
d 2 2
Problem p01243 test case
Input:
5 4
0 0
4 0
4 4
2 2
0 4
8 80
45 41
70 31
86 61
72 64
80 79
40 80
8 94
28 22
0 0

Expected output:
case 1: 16.0
case 2: 3375.0
Problem p01244 test case
Input:
1
2
3
10
50
0

Expected output:
1.000000
1.500000
1.500000
2.000000
2.583333
Problem p01245 test case
Input:
7 8
0 2 3
2 3 -20
3 4 3
4 1 -5
1 5 1
5 4 5
1 3 2
3 6 -2
0 6 30
7 8
0 2 3
2 3 -20
3 4 3
4 1 -5
1 5 1
5 4 5
1 3 2
3 6 -2
0 6 20
4 4
0 1 -10
1 2 -50
2 1 51
1 3 1
0 3 20
11 14
0 1 -49
1 2 1
2 3 40
3 1 -40
1 4 -9
4 5 40
5 1 -30
1 6 -19
6 7 40
7 1 -20
1 8 -30
8 9 40
9 1 -9
1 10 1
0 10 50
3 4
0 1 -49
1 2 10
2 0 50
2 1 10
0 1 50
0 0

Expected output:
Case 1: 25
Case 2: GAME OVER
Case 3: 11
Case 4: 31
Case 5: 1
Problem p01246 test case
Input:
8
1 0
2 0
3 1
3 2
2 3
1 3
0 2
0 1
1 2 3 4 5 6 7 8
8
1 0
2 0
3 1
3 2
2 3
1 3
0 2
0 1
4 3 2 1 8 7 6 5
4
0 0
1 0
1 1
0 1
1 2 3 4
0

Expected output:
Case 1: 10.00000
Case 2: No area
Case 3: Infinity
Problem p01247 test case
Input:
3
0.7 0.1 0.2
0.1 0.8 0.1
0.0 0.0 1.0
4 3 2
8
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
2 2 2 2 2 2 2 2
2
1 0
1 0
2 2
0

Expected output:
Case 1: -1.89723999
Case 2: -8.14438201
Case 3: -INFINITY
Problem p01248 test case
Input:
4 10
8
6
9
1
4 7
1
2
3
4
0 0

Expected output:
Case 1: 4
Case 2: 1
Problem p01249 test case
Input:
3
billion 9
million 6
thousand 3
billionmillionthousand
3
oku 8
sen 3
man 4
okusenman
2
nico 2
video 4
niconicovideo
6
abcd 1
efgh 2
abcde 4
fgh 6
y 8
yy 10
abcdefgh
0

Expected output:
Case 1: 14
Case 2: 9
Case 3: 10
Case 4: 2
Problem p01250 test case
Input:
0.15
0.05
0.0

Expected output:
3/1
19/6
Problem p01251 test case
Input:
3 3 3
1 0 1 2
1 2 2 2
2 2 2 1
0 0 1 0 1 1
3 3 4
1 0 1 2
1 2 2 2
2 2 2 1
2 1 1 1
0 0 1 0 1 1
3 3 0
0 0 1 0 1 1
0 0 0

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

Expected output:
0.000
0.000
0.000
5.657
6.406
4.992
Problem p01253 test case
Input:
6 1
RBRBRB
10 1
RBBBRBBBBB
10 2
RBBBRBBBBB
10 10
RBBBBBBBBB
0 0

Expected output:
0.50000000
0.33333333
0.22222222
0.10025221
Problem p01254 test case
Input:
4
1 4
4
1 2
2 3
3 4
4 1
0

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

Expected output:
1
2
3
Problem p01256 test case
Input:
7 6
#######
#.._..#
#.*.*.#
#.@.*.#
#_..._#
#######
10 13
##########
####___###
####...###
####...###
#####.####
#.....#..#
#.#*.*.*.#
#...###..#
###.#.#.##
###.#.#.##
###.....##
###..@..##
##########
0 0

Expected output:
15
118
Problem p01257 test case
Input:
6 330
1 5 10 50 100 500
7 127
1 2 4 8 16 32 64
2 10000
1000 2000
0 0

Expected output:
2
1
4
Problem p01258 test case
Input:
2
4
6
8
10
52
0

Expected output:
0.0000000000
0.6666666667
1.3333333333
1.9238095238
2.5523809524
15.4435236099
Problem p01259 test case
Input:
4
3 1 2 3
1 1 0 1
2 0 2 2
3 1 2 3
5
3 3 3 0 0
3 3 3 0 0
3 3 0 4 4
0 0 4 4 4
0 0 4 4 4
0

Expected output:
1 0 0 0
0 0 0 0
0 0 0 0
0 0 0 2

0 0 0 0 0
0 3 0 0 0
0 0 0 0 0
0 0 0 4 0
0 0 0 0 0
Problem p01260 test case
Input:
6
1 GB
3 GBGBBB
9 BBBGBBBGGG
9 GGBGBBGBBB
7 GBGGGGBGGG
3 BBBBBGBBBB

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

Expected output:
010
011
Problem p01262 test case
Input:
5 2 1
0.1 0.2 0.3 0.4 0.5
6 2 2
0.1 0.2 0.3 0.4 0.5 0.6
0 0 0

Expected output:
0.01
0.00
Problem p01263 test case
Input:
2 2
1 1
1 1
4
A 10
B 20
C 30
D 40
4
1 1 3 A A A
1 2 2 B C
2 1 1 D
2 2 3 A A B
2 2
1 2
2 1
3
Scroll 50
Bastard 100
Heal100 10
3
1 1 1 Scroll
2 1 1 Bastard
2 2 1 Heal100
0 0

Expected output:
90
200
Problem p01264 test case
Input:
1 1 1
10 15 5
15 10 100
0 0 0

Expected output:
8.000
409.479
861.420
Problem p01265 test case
Input:
6 23
#######################
#%.^.^#################
#^^^^^######^^^^^^^^^^#
#^^^...^^^^...^^*^^..*#
#^^^^^^^^^^^^^^^^^^^^^#
#######################
5 16
################
#^^^^^^^^^^^^^^#
#*..^^^.%.^^..*#
#^^#####^^^^^^^#
################
0 0

Expected output:
1 44
2 28
Problem p01266 test case
Input:
4 2
2 0 0 1
0 4 1 0
4 6 0 -1
6 2 -1 0
4 6
2 0 0 1
0 4 1 0
4 6 0 -1
6 2 -1 0
0 0

Expected output:
6.00000000
4.24264069
Problem p01267 test case
Input:
1 5 7 11 10
10
2 5 7 11 10
2 4
2 1 1 256 0
128 255
2 0 0 1 0
1234 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 1 10000 0
1 0
2 1 1 10000 0
2 1
0 0 0 0 0

Expected output:
0
3
255
-1
198
199
10000
-1
Problem p01268 test case
Input:
0 55
0 1
0 2
0 3
10 1
10 2
10 3
10 4
10 5
10 6
11 1
11 2
11 3
100000 100
-1 -1

Expected output:
42
4
5
6
22
24
26
28
30
30
26
30
32
200274
Problem p01269 test case
Input:
3 2 10
1 2 8 6
2 3 10 3
3 2 10
1 2 3 8
2 3 7 7
3 3 10
1 3 17 6
1 2 2 4
2 3 9 13
4 4 5
1 3 9 3
1 4 7 25
2 3 8 2
2 4 9 3
0 0 0

Expected output:
3
0
4
8
Problem p01270 test case
Input:
6
W 0 2
W 1 2
D 0
W 2 4
R 3
R 1
1
R 1000000000
0

Expected output:
1
2

-1
Problem p01271 test case
Input:
5 5
%#... ...#%
.#.#. .#.#.
.#.#. .#.#.
.#.#. .#.#.
...#L R#...
3 2
.L. .R#
%.. .%.
4 1
L.%. %..R
0 0

Expected output:
Yes
Yes
No
Problem p01272 test case
Input:
3 1
0 0
10 0
5 10
3 1
0 0
10 0
0 10
4 1
0 0
10 0
10 10
0 10
0 0

Expected output:
22.6524758425
23.8994949366
32.0000000000
Problem p01273 test case
Input:
3 2
1 1 2
2 2 3
3 2
2 3 2
1 2 1
0 0

Expected output:
3
1
Problem p01274 test case
Input:
3
8000 15000 30000
3
Flare 45 Single 8000
Meteor 62 All 6000
Ultimate 80 All 9999
0

Expected output:
232
Problem p01275 test case
Input:
4
1357 4680
6
777777 003330
0

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

Expected output:
15
9
21
Problem p01277 test case
Input:
4
0 1
1 0
0 0
1 1

Expected output:
Yes
Problem p01278 test case
Input:
3 3
0 0
8 0
0 8
2 2
4 2
2 4
0 0

Expected output:
9.0
11.5
11.5
Problem p01279 test case
Input:
2 2
10 20 1
0 10 1
0 10
10 0
0 0

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

Expected output:
5
Problem p01281 test case
Input:
3 4
4 4
0 0

Expected output:
4
2
Problem p01282 test case
Input:
3 1
3 2
3 3
4 2
10 5
1000 500
0 0

Expected output:
0
2
4
2
90
570682
Problem p01283 test case
Input:
5
5 4 3 2 1
5
7 7 7 7 7
10
186 8 42 24 154 40 10 56 122 72
0

Expected output:
0 1 1
0 0 0
8 7 14
Problem p01284 test case
Input:
2
1 23
3
1 1
2 1
3 1
0

Expected output:
2
Problem p01285 test case
Input:
2
-35 -35 100 100
-49 49 2000 -2000
4
0 0 0 3
0 0 3 0
0 3 3 3
3 0 3 3
4
0 3 -4 6
3 0 6 -4
2 3 6 6
-1 2 -4 6
0

Expected output:
Many
1.5000 1.5000
1.000 1.000
Problem p01286 test case
Input:
2 1 1 1 1 1 1
1 1
1 1
1 1
1 1 1 1 0 0 0
1 1
1 1
1 1
1 0 1 0 1 0 1
0
1 1 0 1 0 1 0
0
0
1 1 0 1 0 1 0
1 1
0
-1 -1 -1 -1 -1 -1 -1

Expected output:
2
1
1
0
1
Problem p01287 test case
Input:
blue blue blue blue blue blue blue blue
red blue blue blue blue blue blue blue
red red blue blue blue blue blue blue

Expected output:
1
1
3
Problem p01288 test case
Input:
6 3
1
1
2
3
3
Q 5
M 3
Q 5
0 0

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

Expected output:
8.50000000
Problem p01290 test case
Input:
2 2
QE
EA
3 1
QAE
3 1
AQE
5 5
..E..
.###.
A###Q
.###.
..E..
5 1
A.E.Q
5 5
A....
####.
..E..
.####
....Q
0 0

Expected output:
Queen can not escape and Army can not catch Queen.
Army can catch Queen.
Queen can escape.
Queen can not escape and Army can not catch Queen.
Army can catch Queen.
Army can catch Queen.
Problem p01291 test case
Input:
5 2
4
1 1
1 2
2 2
2 1
4
3 3
3 4
4 4
4 3
0 0

Expected output:
3.41421356
Problem p01292 test case
Input:
50 100
2
50 50 0
51 51 50
2
0 0 0
1 1 50
0
0 0

Expected output:
50
Problem p01293 test case
Input:
H
4C 8H QS 5D JD KS 8S AH 6H 7H 3S 7S 6D
TC JC JS KD AC QC QD 2H QH 3H 3C 7C 4D
6C 9C AS TD 5H 6S 5S KH TH AD 9S 8D 2D
8C 5C 2S 7D KC 4S TS JH 4H 9H 2C 9D 3D
D
8D 9D 9S QS 4H 5H JD JS 9H 6S TH 6H QH
QD 9C 5S 7S 7H AC 2D KD 6C 3D 8C TC 7C
5D QC 3S 4S 3H 3C 6D KS JC AS 5C 8H TS
4D 4C 8S 2S 2H KC TD JH 2C AH 7D AD KH
#

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

Expected output:
Yes
No
Problem p01295 test case
Input:
4 5
6 7
0 0

Expected output:
45678
6789101
Problem p01296 test case
Input:
4
0 0 x
2 0 x
0 1 x
2 1 x
4
1 0 x
0 1 x
2 1 x
1 2 x
4
0 0 x
2 0 y
0 1 y
1 2 x
0

Expected output:
Yes
No
Yes
Problem p01297 test case
Input:
100 100 1 1
50 0 50 100 50
640 480 1 1
0 0 640 480 100
0 0 0 0

Expected output:
No
Yes
Problem p01298 test case
Input:
1 100
0 86400 1
1 100
43200 86400 1
0 0

Expected output:
1.000000
0.997685
Problem p01299 test case
Input:
3
0 0 100 100
60 100 50
100 100 10
80 80 50
4
0 0 100 100
50 50 50
150 50 50
50 150 50
150 150 50
0

Expected output:
2
0
Problem p01300 test case
Input:
17819
1111
11011
1234567891011121314151617181920
0

Expected output:
1
4
4
38
Problem p01301 test case
Input:
3 3 3 5
3 2 2
***
.*.

.*.
...

3 2 1
***
**.

3 1 3
..*

.**

**.

3 2 2
..*
...

***
..*

3 1 3
.**

.**

***

3 3 3 2
3 3 3
***
***
***

***
*.*
***

***
***
***

1 1 1
*

3 2 1 2
3 1 1
***

2 2 1
**
*.

0 0 0 0

Expected output:
Yes
Yes
No
Problem p01302 test case
Input:
5
0 1
0 0
5 0
1 1
5 2
0 2
7
9999 9998
0 0
2 0
3 1
1 1
10000 9999
2 2
0 2
0

Expected output:
2.00
2.2500000
Problem p01303 test case
Input:
2
1 3 20 10
4
21 13
1 15
10 10
25 10
1 3 20 10
4
21 13
1 15
10 10
25 10

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

Expected output:
6
Miserable Hokusai!
5
155117520
Problem p01305 test case
Input:
2
1 3 5 7 9 11 13 15 17
2 4 6 8 10 12 14 16 18
1 5 7 9 11 13 15 17 18
2 3 4 6 8 10 12 14 16

Expected output:
0.30891 0.69109
0.92747 0.07253
Problem p01306 test case
Input:
7
12.3 kilo meters
0.45 mega watts
0.000000000000000000000001 yotta grams
1000000000000000000000000 yocto seconds
42 amperes
0.42 joules
1234.56789012345678901234567890 hecto pascals

Expected output:
1.23 * 10^4 meters
4.5 * 10^5 watts
1 * 10^0 grams
1.000000000000000000000000 * 10^0 seconds
4.2 * 10^1 amperes
4.2 * 10^-1 joules
1.23456789012345678901234567890 * 10^5 pascals
Problem p01307 test case
Input:
3
1234
5555
9

Expected output:
Audrey wins.
Fabre wins.
Audrey wins.
Problem p01308 test case
Input:
4
6 4
C E D# F G A
C E F G
6 4
C E D# F G A
C D# F G
3 6
C D D
D# B D B D# C#
8 8
C B B B B B F F
C B B B B B B B

Expected output:
Yes
No
Yes
No
Problem p01309 test case
Input:
4
3 3 5
0 0
10 0
40 40
40 90
4 5 10
100 100
50 100
50 150
100 50
100 150
4 60 10
100 100
90 100
110 100
100 90
100 110
4 60 10
100 100
80 100
110 100
100 80
100 110

Expected output:
9
0
60
You're always welcome!
Problem p01310 test case
Input:
4
3 2 1
20 1
10 2
5 7 3
70 1
60 4
50 2
40 4
30 1
20 3
10 2
1 0 1
4 2 1
10 1
10 3

Expected output:
1
0
1
1
0
1
1
2
0
1
0
1
2
Problem p01311 test case
Input:
2
4 6
1 2
1 2 N
2 3 N
3 4 N
4 1 N
1 4 L
4 0 L
4 6
1 2
1 2 N
2 3 N
3 4 N
4 1 N
1 4 L
4 0 N

Expected output:
1
3
Problem p01312 test case
Input:
2
0 0
0 0
15:00:00
18:00:00
1
4 0 7199 1125 7199 1125 8324 0 8324
0 0
0 0
15:00:00
18:00:00
1
4 0 7201 1125 7201 1125 8326 0 8326

Expected output:
1
17 59 59.076923
0
15 00 00.000000
Problem p01313 test case
Input:
4
1 1
1 3
1 4
2 2

Expected output:
1 5
2 7
7 119
No cats.
13 53
18 63
33 88
35 91
Problem p01314 test case
Input:
9
500
0

Expected output:
2
3
Problem p01315 test case
Input:
5
apple 1 1 1 1 1 1 1 10 1
banana 1 2 2 2 2 2 1 10 1
carrot 1 2 2 2 2 2 1 10 2
durian 1 3 3 3 3 3 1 10 1
eggplant 1 3 3 3 3 3 1 100 1
4
enoki 1 3 3 3 3 3 1 10 1
tomato 1 3 3 3 3 3 1 10 1
potato 1 3 3 3 3 3 1 10 1
onion 1 3 3 3 3 3 1 10 1
3
a 10 1 1 1 1 1 1 10 1
b 10 2 2 2 2 2 2 10 1
c 10 2 2 2 2 2 2 10 1
0

Expected output:
eggplant
apple
carrot
banana
durian
#
enoki
onion
potato
tomato
#
b
c
a
#
Problem p01316 test case
Input:
2 7
4
2
1
0
-1
-2
-4
131
137
2 7
4
2
1
0
-1
-2
-4
131
123
10 7
-4
-2
-1
0
1
2
4
132
134
135
134
132
128
124
122
121
122
5 1
255
0
0
0
0
0
4 1
0
255
0
255
0
0 0

Expected output:
2
8
0
325125
65026
Problem p01317 test case
Input:
3 3
1 2 5 L
1 2 7 S
2 3 11 S
3
1 2 3
5 5
1 2 15 L
2 3 10 L
4 5 7 L
1 3 30 S
3 4 100 S
5
1 3 5 4 1
0 0

Expected output:
18
269
Problem p01318 test case
Input:
6
-2 -2 1 1
2 2 2 0
5 7 1 1
8 0 3 1
13 4 1 1
16 1 1 2
3
0 0 2 1
10 0 2 1
0 10 2 1
3
0 0 2 1
10 0 2 1
0 6 2 1
3
0 0 2 1
10 0 2 1
0 4 2 1
1
0 0 1 1
0

Expected output:
4
2
3
3
1
Problem p01319 test case
Input:
1 1 100
50 200 20 40 0
1
2 4 100
7 4 1 4 1
19 5 1 4 0
5
3
7
9
1 2 3
1 1 1 1 0
1
3
1 2 10
5 10 1 1 1
2
3
0 0 0

Expected output:
110
46.6666666667
5
41.6666666667
Problem p01320 test case
Input:
4 4 1
1 0
0 1
-1 0
0 -1
5 6 2
1 1
4 4
2 -4
-4 2
1 5
0 0 0

Expected output:
1.000000000
6.797434948
Problem p01321 test case
Input:
3
49 50 87 78 41
27 61 100 45 84
28 88 40 95 66
2
100 100 100 100 100
0 0 0 0 0
1
89 90 85 93 82
0

Expected output:
317 305
500 0
439 439
Problem p01322 test case
Input:
3 3
*******1 100
******22 1000
11111112 1000000
01203291
02382022
11111111
10 10
****3228 149416
****3992 198635
****4286 77783
****4843 225244
***49835 231046
***59393 379996
*5763748 437345
*6726222 58054
*8117882 16375
*9244339 537727
77885716
96726222
26971031
66652868
89599648
37772338
64679621
65479161
92959393
57855682
0 0

Expected output:
1200
438050
Problem p01323 test case
Input:
3
......
......
......
......
......
......
......
......
.RGB..
RGOP..
RGBPB.
RGBPP.
GBRGYP
GBRRYP
BGGRBB
BPRGYY
GGPRRY
BYPPRB
YGGGPB
GYYYPR
YRBRBR
YBRBRB
BRBRBR
BRBRBR
......
......
......
......
......
......
......
......
......
......
..OO..
..OO..

Expected output:
3
18
0
Problem p01324 test case
Input:
3
1 km = 10^3 m
1 m = 10^2 cm
1 km = 10^5 cm
7
1 kilometre = 10^3 metre
1 megametre = 10^3 kilometre
1 metre = 10^-6 megametre
1 terametre = 10^3 gigametre
1 petametre = 10^3 terametre
1 gigametre = 10^-6 petametre
1 metre = 10^-15 petametre
4
1 a = 10^2 b
1 a = 10^3 c
1 b = 10^2 c
1 c = 10^1 d
4
1 acm = 10^2 icpc
1 icpc = 10^3 utpc
1 utpc = 10^4 topcoder
1 topcoder = 10^-1 acm
0

Expected output:
Yes
Yes
No
No
Problem p01325 test case
Input:
2
1 2
2 1
3
2 1 2
2 1 2
10
0 1 1 2 5 5 5 8 8 9
0 1 3 3 3 6 6 6 7 9
0

Expected output:
Yes
No
Yes
Problem p01326 test case
Input:
1
xxxxxxxx
3
11100000
10x00000
10111111
3
11100000
10000000
10111111
4
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
0

Expected output:
128
1
0
778240
Problem p01328 test case
Input:
N M
x

Expected output:
2
20
Problem p01329 test case
Input:
7 6
......
.####.
.####.
...S#.
...##.
...##.
.....G
3
LD
DD
LLL
7 8
S#......
.#.####.
.#.#G.#.
.#.##.#.
.#....#.
.######.
........
8
DDDD
DDDU
UUUU
UUUD
RRRR
RRRL
LLLL
LLLR
3 8
########
S......G
########
2
U
D
6 10
..........
.S........
..........
..........
........G.
..........
0
6 7
.......
...#...
...#.S.
...###.
.G.....
.......
2
LL
DD
0 0

Expected output:
13
60
7
10
-1
Problem p01330 test case
Input:
2 3
1 2 1
2 3
1 2 6
0 0

Expected output:
1
1
Problem p01331 test case
Input:
4 4 1
2 2 3 3
1 4 1
1 2 1 3
5 5 2
2 2 3 4
3 3 5 3
5 5 3
4 4 5 5
2 2 3 3
3 3 4 4
100000 100000 1
2 2 99999 99999
1 1 0
0 0 0

Expected output:
12
1
26
18
615667476
1
Problem p01332 test case
Input:
4
0 0
100 0
100 100
0 100
4
0 0
100 0
100 100
0 100
4
0 0
100 0
100 100
0 100
3
0 0
100 0
0 100
3
0 0
100 0
0 100
3
0 0
100 0
0 100
5
0 0
200 0
200 200
100 100
0 200
5
0 0
200 0
100 100
200 200
0 200
4
0 0
200 0
200 200
0 200
0
0
0

Expected output:
1000000.0000
250000.0000
5333333.3333
Problem p01333 test case
Input:
500 1000
100 10000
400 700
600 5000
10000 10000
0 0

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

Expected output:
1
2
1
2
3
Problem p01335 test case
Input:
3
0 1 0 1 0 0 0 0 0 1 0 0 0
1 0 0 0 0 0 1 0 0 1 0 0 2
0 1 1 0 1 1 1 0 0 0 0 5 5
3 1 1 1 0 1 0 0 1 0 3 0 2
1 1 2 4 5 10 20 50 100
7H 6H 2H 5H 3H
9S 9C 9H 8H 8D
KS KH QH JD TS
10
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
1 2 3 4 5 6 7 8 9
AS 3D 2C 5D 6H
6S 6C 7D 8H 9C
TS TD QC JD JC
KD KH KC AD 2C
3D 4H 6D 5H 7C
2S KS QS AS JS
TS TD JD JC TH
8H 8D TC 8C 8S
4S 5S 3S 7S 6S
KD QD JD TD AD

Expected output:
25
0
14

0
5
10
15
20
25
30
35
40
45
Problem p01336 test case
Input:
3 10
Dobkeradops
7 5 23 10
PataPata
1 1 2 1
dop
5 3 11 14
2 300
Bydo System Alpha
7 11 4 7
Green Inferno
300 300 300 300

Expected output:
29
462
Problem p01337 test case
Input:
2
1 3 3 1
-10 0 0 0

Expected output:
0 3
0 0
Problem p01338 test case
Input:
5

1 1 0 3 3
1 1 0 3 3
0 0 0 0 0
2 2 0 4 4
2 2 0 4 4

1 1 1 0 0
1 1 1 1 0
1 0 1 1 0
0 0 1 1 1
1 1 1 1 1

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

4 3 4 3 4
3 4 3 4 3
4 3 4 3 4
3 4 3 4 3
4 3 4 3 4

2 2 2 2 2
0 0 0 2 0
2 2 0 2 0
2 2 0 2 0
0 0 0 2 0

Expected output:
1280
1420
0
1920
1020
Problem p01339 test case
Input:
5 4
2 3
3 4
4 3
5 4

Expected output:
10
Problem p01340 test case
Input:
2 3
Uo.
.oo

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

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

Expected output:
6
Problem p01343 test case
Input:
2 1
0 0 1 0
1 1 0 1

Expected output:
5.2793638507
Problem p01344 test case
Input:
6
4 3 3
10 17
15 14
10 15
11 12
16 18
15 22

Expected output:
3
Problem p01345 test case
Input:
4
0 0
10 10
10 -10
-10 -10
-10 10

Expected output:
Yes
Problem p01346 test case
Input:
3 3 2 1
1 1 4

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

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

Expected output:
6
Problem p01349 test case
Input:
4 6 3
......
...Y..
...Y..
RRYRYY

Expected output:
YES
Problem p01350 test case
Input:
5
100.1 90.1
0 0
0 10
5 5
10 0
10 10

Expected output:
10
Problem p01351 test case
Input:
6 6 2 2 2 4

Expected output:
8
Problem p01352 test case
Input:
4 10
1 0 1
1 0 2
3 1 2
2 0 1
1 2 3
3 0 1
1 0 1
2 0 2
1 1 3
3 0 2

Expected output:
YES
NO
YES
Problem p01353 test case
Input:
2
10 3 1 2
2 4 1 3
2 2 1 1

Expected output:
4
Problem p01354 test case
Input:
2 3
0.900 0.500 0.100
0.500 0.500 0.500

Expected output:
0.372500000000
Problem p01355 test case
Input:
2 1
10 0 10
20 0 10

Expected output:
2
Problem p01356 test case
Input:
6 200 2 3 4 5

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

Expected output:
YES
NO
YES
Problem p01358 test case
Input:
3 2 2 10
1 2 3
4 5 6
7 8 9
1 2 3
6 5 4
7 8 9
11
4
7
5
10
9
2
1
3
8

Expected output:
USAGI