alexjercan/bugnet huggingface dataset:
Problem p02992 test case
Input:
3 2

Expected output:
5
Problem p02993 test case
Input:
3776

Expected output:
Bad
Problem p02994 test case
Input:
5 2

Expected output:
18
Problem p02995 test case
Input:
4 9 2 3

Expected output:
2
Problem p02996 test case
Input:
5
2 4
1 9
1 8
4 9
3 12

Expected output:
Yes
Problem p02997 test case
Input:
5 3

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

Expected output:
1
Problem p02999 test case
Input:
3 5

Expected output:
0
Problem p03000 test case
Input:
3 6
3 4 5

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

Expected output:
3.000000 0
Problem p03002 test case
Input:
4 10
6 1 2 7

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

Expected output:
3
Problem p03004 test case
Input:
2
0 3 D
3 0 L

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

Expected output:
1
Problem p03006 test case
Input:
2
1 1
2 2

Expected output:
1
Problem p03007 test case
Input:
3
1 -1 2

Expected output:
4
-1 1
2 -2
Problem p03008 test case
Input:
23
1 1 1
2 1 1

Expected output:
46
Problem p03009 test case
Input:
2 2 1

Expected output:
6
Problem p03010 test case
Input:
3

Expected output:
0 6 15
6 0 21
15 21 0
Problem p03011 test case
Input:
1 3 4

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

Expected output:
0
Problem p03013 test case
Input:
6 1
3

Expected output:
4
Problem p03014 test case
Input:
4 6
#..#..
.....#
....#.
#.#...

Expected output:
8
Problem p03016 test case
Input:
5 3 4 10007

Expected output:
5563
Problem p03017 test case
Input:
7 1 3 6 7
.#..#..

Expected output:
Yes
Problem p03018 test case
Input:
ABCABC

Expected output:
3
Problem p03019 test case
Input:
2 100
85 2 3
60 1 1

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

Expected output:
8
Problem p03021 test case
Input:
7
0010101
1 2
2 3
1 4
4 5
1 6
6 7

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

Expected output:
0
4
4
4
Problem p03023 test case
Input:
3

Expected output:
180
Problem p03024 test case
Input:
oxoxoxoxoxoxox

Expected output:
YES
Problem p03025 test case
Input:
1 25 25 50

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

Expected output:
10
1 2 3 4 5
Problem p03027 test case
Input:
2
7 2 4
12345 67890 2019

Expected output:
9009
916936
Problem p03028 test case
Input:
3
0
10

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

Expected output:
3
Problem p03030 test case
Input:
6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40

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

Expected output:
1
Problem p03032 test case
Input:
6 4
-10 8 2 1 2 6

Expected output:
14
Problem p03033 test case
Input:
4 6
1 3 2
7 13 10
18 20 13
3 4 2
0
1
2
3
5
8

Expected output:
2
2
10
-1
13
-1
Problem p03034 test case
Input:
5
0 2 5 1 0

Expected output:
3
Problem p03035 test case
Input:
30 100

Expected output:
100
Problem p03036 test case
Input:
2 10 20

Expected output:
30
50
90
170
330
650
1290
2570
5130
10250
Problem p03037 test case
Input:
4 2
1 3
2 4

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

Expected output:
14
Problem p03039 test case
Input:
2 2 2

Expected output:
8
Problem p03040 test case
Input:
4
1 4 2
2
1 1 -8
2

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

Expected output:
aBC
Problem p03042 test case
Input:
1905

Expected output:
YYMM
Problem p03043 test case
Input:
3 10

Expected output:
0.145833333333
Problem p03044 test case
Input:
3
1 2 2
2 3 1

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

Expected output:
2
Problem p03047 test case
Input:
3 2

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

Expected output:
4
Problem p03049 test case
Input:
3
ABCA
XBAZ
BAD

Expected output:
2
Problem p03050 test case
Input:
8

Expected output:
10
Problem p03051 test case
Input:
3
1 2 3

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

Expected output:
6
Problem p03053 test case
Input:
3 3
...
.#.
...

Expected output:
2
Problem p03054 test case
Input:
2 3 3
2 2
RRL
LUD

Expected output:
YES
Problem p03055 test case
Input:
3
1 2
2 3

Expected output:
First
Problem p03056 test case
Input:
3 3
...
.##
.##

Expected output:
2
Problem p03057 test case
Input:
4 7
RBRRBRR

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

Expected output:
6
Problem p03059 test case
Input:
3 5 7

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

Expected output:
5
Problem p03061 test case
Input:
3
7 6 8

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

Expected output:
19
Problem p03063 test case
Input:
3
#.#

Expected output:
1
Problem p03064 test case
Input:
4
1
1
1
2

Expected output:
18
Problem p03065 test case
Input:
2
7
-7
14

Expected output:
2
7
Problem p03066 test case
Input:
3 3

Expected output:
14
Problem p03067 test case
Input:
3 8 5

Expected output:
Yes
Problem p03068 test case
Input:
5
error
2

Expected output:
*rr*r
Problem p03069 test case
Input:
3
#.#

Expected output:
1
Problem p03070 test case
Input:
4
1
1
1
2

Expected output:
18
Problem p03071 test case
Input:
5 3

Expected output:
9
Problem p03072 test case
Input:
4
6 5 6 8

Expected output:
3
Problem p03073 test case
Input:
000

Expected output:
1
Problem p03074 test case
Input:
5 1
00010

Expected output:
4
Problem p03075 test case
Input:
1
2
4
8
9
15

Expected output:
Yay!
Problem p03076 test case
Input:
29
20
7
35
120

Expected output:
215
Problem p03077 test case
Input:
5
3
2
4
3
5

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

Expected output:
19
17
15
14
13
12
10
8
Problem p03079 test case
Input:
2 2 2

Expected output:
Yes
Problem p03080 test case
Input:
4
RRBR

Expected output:
Yes
Problem p03081 test case
Input:
3 4
ABC
A L
B L
B R
A R

Expected output:
2
Problem p03082 test case
Input:
2 19
3 7

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

Expected output:
500000004
750000006
750000006
Problem p03084 test case
Input:
4 5 4
EEWW
NSNNS
4 1 1 4
1 3 1 2
4 2 3 2
3 3 3 5

Expected output:
6
11
5
4
Problem p03085 test case
Input:
A

Expected output:
T
Problem p03086 test case
Input:
ATCODER

Expected output:
3
Problem p03087 test case
Input:
8 3
ACACTACG
3 7
2 3
1 8

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

Expected output:
61
Problem p03089 test case
Input:
3
1 2 1

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

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

Expected output:
Yes
Problem p03092 test case
Input:
3 20 30
3 1 2

Expected output:
20
Problem p03093 test case
Input:
3 10
0 2 3 4 5 9

Expected output:
5
Problem p03094 test case
Input:
2

Expected output:
138888890
Problem p03095 test case
Input:
4
abcd

Expected output:
15
Problem p03096 test case
Input:
5
1
2
1
2
2

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

Expected output:
YES
1 0 2 3
Problem p03098 test case
Input:
3 3
1 2 3
3 2 1

Expected output:
3 2 1
Problem p03099 test case
Input:
7
1 3 6
1 5 9
3 1 8
4 3 8
6 2 9
5 4 11
5 7 10
4
L 3 1
R 2 3
D 5 3
U 4 2

Expected output:
36
Problem p03100 test case
Input:
3 2 2 2019
1 2 1
2 3 2
1 3 5
1 3 4

Expected output:
YES
NO
Problem p03101 test case
Input:
3 2
2 1

Expected output:
1
Problem p03102 test case
Input:
2 3 -10
1 2 3
3 2 1
1 2 2

Expected output:
1
Problem p03103 test case
Input:
2 5
4 9
2 4

Expected output:
12
Problem p03105 test case
Input:
2 11 4

Expected output:
4
Problem p03106 test case
Input:
8 12 2

Expected output:
2
Problem p03107 test case
Input:
0011

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

Expected output:
0
0
4
5
6
Problem p03109 test case
Input:
2019/04/30

Expected output:
Heisei
Problem p03110 test case
Input:
2
10000 JPY
0.10000000 BTC

Expected output:
48000.0
Problem p03111 test case
Input:
5 100 90 80
98
40
30
21
80

Expected output:
23
Problem p03112 test case
Input:
2 3 4
100
600
400
900
1000
150
2000
899
799

Expected output:
350
1400
301
399
Problem p03113 test case
Input:
2 1
5 5

Expected output:
7
1 1 2 1 2 2 1
Problem p03114 test case
Input:
4
2
1 2
2 4

Expected output:
136
Problem p03115 test case
Input:
4
-2 1
-2 2
0 1
1 0

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

Expected output:
-1 0
Problem p03117 test case
Input:
8 3

Expected output:
5
Problem p03118 test case
Input:
1
X

Expected output:
500000004 0 500000003
Problem p03119 test case
Input:
2 1
5 5

Expected output:
7
1 1 2 1 2 2 1
Problem p03120 test case
Input:
4
2
1 2
2 4

Expected output:
136
Problem p03121 test case
Input:
4
-2 1
-2 2
0 1
1 0

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

Expected output:
-1 0
Problem p03123 test case
Input:
8 3

Expected output:
5
Problem p03124 test case
Input:
1
X

Expected output:
500000004 0 500000003
Problem p03125 test case
Input:
4 12

Expected output:
16
Problem p03126 test case
Input:
3 4
2 1 3
3 1 2 3
2 3 2

Expected output:
1
Problem p03127 test case
Input:
4
2 10 8 40

Expected output:
2
Problem p03128 test case
Input:
20 4
3 7 8 4

Expected output:
777773
Problem p03129 test case
Input:
3 2

Expected output:
YES
Problem p03130 test case
Input:
4 2
1 3
2 3

Expected output:
YES
Problem p03131 test case
Input:
4 2 6

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

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

Expected output:
6
Problem p03134 test case
Input:
02

Expected output:
3
Problem p03135 test case
Input:
8 3

Expected output:
2.6666666667
Problem p03136 test case
Input:
4
3 8 5 1

Expected output:
Yes
Problem p03137 test case
Input:
2 5
10 12 1 2 14

Expected output:
5
Problem p03139 test case
Input:
10 3 5

Expected output:
3 0
Problem p03140 test case
Input:
4
west
east
wait

Expected output:
3
Problem p03141 test case
Input:
3
10 10
20 20
30 30

Expected output:
20
Problem p03142 test case
Input:
3 1
1 2
1 3
2 3

Expected output:
0
1
2
Problem p03143 test case
Input:
4 4
2 3 5 7
1 2 7
1 3 9
2 3 12
3 4 18

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

Expected output:
-1
9
6
14
15
Problem p03145 test case
Input:
3 4 5

Expected output:
6
Problem p03146 test case
Input:
8

Expected output:
5
Problem p03147 test case
Input:
4
1 2 2 1

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

Expected output:
26
Problem p03149 test case
Input:
1 7 9 4

Expected output:
YES
Problem p03150 test case
Input:
keyofscience

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

Expected output:
3
Problem p03152 test case
Input:
2 2
4 3
3 4

Expected output:
2
Problem p03153 test case
Input:
3 1
1 100 1

Expected output:
106
Problem p03154 test case
Input:
2 1 2

Expected output:
34
Problem p03155 test case
Input:
3
2
3

Expected output:
2
Problem p03156 test case
Input:
7
5 15
1 10 16 2 7 20 12

Expected output:
2
Problem p03157 test case
Input:
3 3
.#.
..#
#..

Expected output:
10
Problem p03158 test case
Input:
5 5
3 5 7 11 13
1
4
9
10
13

Expected output:
31
31
27
23
23
Problem p03159 test case
Input:
7
-2 7 5 6 -8 3 4
1 2
2 3
2 4
1 5
5 6
5 7

Expected output:
1
Problem p03160 test case
Input:
4
10 30 40 20

Expected output:
30
Problem p03161 test case
Input:
5 3
10 30 40 50 20

Expected output:
30
Problem p03162 test case
Input:
3
10 40 70
20 50 80
30 60 90

Expected output:
210
Problem p03163 test case
Input:
3 8
3 30
4 50
5 60

Expected output:
90
Problem p03164 test case
Input:
3 8
3 30
4 50
5 60

Expected output:
90
Problem p03165 test case
Input:
axyb
abyxb

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

Expected output:
3
Problem p03167 test case
Input:
3 4
...#
.#..
....

Expected output:
3
Problem p03168 test case
Input:
3
0.30 0.60 0.80

Expected output:
0.612
Problem p03169 test case
Input:
3
1 1 1

Expected output:
5.5
Problem p03170 test case
Input:
2 4
2 3

Expected output:
First
Problem p03171 test case
Input:
4
10 80 90 30

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

Expected output:
5
Problem p03173 test case
Input:
4
10 20 30 40

Expected output:
190
Problem p03174 test case
Input:
3
0 1 1
1 0 1
1 1 1

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

Expected output:
5
Problem p03176 test case
Input:
4
3 1 4 2
10 20 30 40

Expected output:
60
Problem p03177 test case
Input:
4 2
0 1 0 0
0 0 1 1
0 0 0 1
1 0 0 0

Expected output:
6
Problem p03178 test case
Input:
30
4

Expected output:
6
Problem p03179 test case
Input:
4
<><

Expected output:
5
Problem p03180 test case
Input:
3
0 10 20
10 0 -100
20 -100 0

Expected output:
20
Problem p03181 test case
Input:
3 100
1 2
2 3

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

Expected output:
20
Problem p03183 test case
Input:
3
2 2 20
2 1 30
3 1 40

Expected output:
50
Problem p03184 test case
Input:
3 4 2
2 2
1 4

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

Expected output:
20
Problem p03186 test case
Input:
3 1 4

Expected output:
5
Problem p03187 test case
Input:
10 3
2
7
9

Expected output:
15
Problem p03188 test case
Input:
2

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

Expected output:
6
Problem p03190 test case
Input:
4
0011
0101

Expected output:
4
Problem p03191 test case
Input:
3
1 -1 -1 3 6 -1

Expected output:
5
Problem p03192 test case
Input:
1222

Expected output:
3
Problem p03193 test case
Input:
3 5 2
10 3
5 2
2 5

Expected output:
2
Problem p03194 test case
Input:
3 24

Expected output:
2
Problem p03195 test case
Input:
2
1
2

Expected output:
first
Problem p03196 test case
Input:
3 24

Expected output:
2
Problem p03197 test case
Input:
2
1
2

Expected output:
first
Problem p03198 test case
Input:
4
3 1 4 1

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

Expected output:
8
Problem p03200 test case
Input:
BBW

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

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

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

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

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

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

Expected output:
Christmas
Problem p03207 test case
Input:
3
4980
7980
6980

Expected output:
15950
Problem p03208 test case
Input:
5 3
10
15
11
14
12

Expected output:
2
Problem p03209 test case
Input:
2 7

Expected output:
4
Problem p03210 test case
Input:
5

Expected output:
YES
Problem p03211 test case
Input:
1234567876

Expected output:
34
Problem p03212 test case
Input:
575

Expected output:
4
Problem p03213 test case
Input:
9

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

Expected output:
1
Problem p03215 test case
Input:
4 2
2 5 2 5

Expected output:
12
Problem p03216 test case
Input:
18
DWANGOMEDIACLUSTER
1
18

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

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

Expected output:
3
Problem p03219 test case
Input:
81 58

Expected output:
110
Problem p03220 test case
Input:
2
12 5
1000 2000

Expected output:
1
Problem p03221 test case
Input:
2 3
1 32
2 63
1 12

Expected output:
000001000002
000002000001
000001000001
Problem p03222 test case
Input:
1 3 2

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

Expected output:
21
Problem p03224 test case
Input:
3

Expected output:
Yes
3
2 1 2
2 3 1
2 2 3
Problem p03225 test case
Input:
5 4
#.##
.##.
#...
..##
...#

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

Expected output:
2
Problem p03227 test case
Input:
abc

Expected output:
cba
Problem p03228 test case
Input:
5 4 2

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

Expected output:
21
Problem p03230 test case
Input:
3

Expected output:
Yes
3
2 1 2
2 3 1
2 2 3
Problem p03231 test case
Input:
3 2
acp
ae

Expected output:
6
Problem p03232 test case
Input:
2
1 2

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

Expected output:
7
Problem p03234 test case
Input:
2 0

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

Expected output:
001001
Problem p03236 test case
Input:
2
11
11

Expected output:
5
Problem p03237 test case
Input:
2
11
11

Expected output:
5
Problem p03238 test case
Input:
1

Expected output:
Hello World
Problem p03239 test case
Input:
3 70
7 60
1 80
4 50

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

Expected output:
2 2 6
Problem p03241 test case
Input:
3 14

Expected output:
2
Problem p03242 test case
Input:
119

Expected output:
991
Problem p03243 test case
Input:
111

Expected output:
111
Problem p03244 test case
Input:
4
3 1 3 2

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

Expected output:
2
1 2
RL
UU
DR
Problem p03246 test case
Input:
4
3 1 3 2

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

Expected output:
2
1 2
RL
UU
DR
Problem p03248 test case
Input:
1111

Expected output:
-1
Problem p03249 test case
Input:
7
10
15
13
18
11
14
19

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

Expected output:
53
Problem p03251 test case
Input:
3 2 10 20
8 15 13
16 22

Expected output:
No War
Problem p03252 test case
Input:
azzel
apple

Expected output:
Yes
Problem p03253 test case
Input:
2 6

Expected output:
4
Problem p03254 test case
Input:
3 70
20 30 10

Expected output:
2
Problem p03255 test case
Input:
2 100
1 10

Expected output:
355
Problem p03256 test case
Input:
2 3
AB
1 1
1 2
2 2

Expected output:
Yes
Problem p03257 test case
Input:
2

Expected output:
4 7
23 10
Problem p03258 test case
Input:
aaaa

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

Expected output:
1
-1
Problem p03260 test case
Input:
3 1

Expected output:
Yes
Problem p03261 test case
Input:
4
hoge
english
hoge
enigma

Expected output:
No
Problem p03262 test case
Input:
3 3
1 7 11

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

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

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

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

Expected output:
9
Problem p03267 test case
Input:
4

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

Expected output:
9
Problem p03269 test case
Input:
4

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

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

Expected output:
Yes
Problem p03272 test case
Input:
4 2

Expected output:
3
Problem p03273 test case
Input:
4 4
##.#
....
##.#
.#.#

Expected output:
###
###
.##
Problem p03274 test case
Input:
5 3
-30 -10 10 20 50

Expected output:
40
Problem p03275 test case
Input:
3
10 30 20

Expected output:
30
Problem p03276 test case
Input:
5 3
-30 -10 10 20 50

Expected output:
40
Problem p03277 test case
Input:
3
10 30 20

Expected output:
30
Problem p03278 test case
Input:
4
1 2
2 3
3 4

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

Expected output:
3
Problem p03280 test case
Input:
2 2

Expected output:
1
Problem p03281 test case
Input:
105

Expected output:
1
Problem p03282 test case
Input:
1214
4

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

Expected output:
3
Problem p03284 test case
Input:
7 3

Expected output:
1
Problem p03285 test case
Input:
11

Expected output:
Yes
Problem p03286 test case
Input:
-9

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

Expected output:
3
Problem p03288 test case
Input:
1199

Expected output:
ABC
Problem p03289 test case
Input:
AtCoder

Expected output:
AC
Problem p03290 test case
Input:
2 700
3 500
5 800

Expected output:
3
Problem p03291 test case
Input:
A??C

Expected output:
8
Problem p03292 test case
Input:
1 6 3

Expected output:
5
Problem p03293 test case
Input:
kyoto
tokyo

Expected output:
Yes
Problem p03294 test case
Input:
3
3 4 6

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

Expected output:
1
Problem p03296 test case
Input:
5
1 1 2 2 2

Expected output:
2
Problem p03297 test case
Input:
14
9 7 5 9
9 7 6 9
14 10 7 12
14 10 8 12
14 10 9 12
14 10 7 11
14 10 8 11
14 10 9 11
9 10 5 10
10 10 5 10
11 10 5 10
16 10 5 10
1000000000000000000 17 14 999999999999999985
1000000000000000000 17 15 999999999999999985

Expected output:
No
Yes
No
Yes
Yes
No
No
Yes
No
Yes
Yes
No
No
Yes
Problem p03298 test case
Input:
4
cabaacba

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

Expected output:
12800
Problem p03300 test case
Input:
3
aababb

Expected output:
abab
Problem p03301 test case
Input:
5
20 100 10 1 10

Expected output:
120 21
Problem p03302 test case
Input:
4 11

Expected output:
+
Problem p03303 test case
Input:
abcdefgh
3

Expected output:
adg
Problem p03304 test case
Input:
2 3 1

Expected output:
1.0000000000
Problem p03305 test case
Input:
4 3 2 3
1 4 1 100
1 2 1 10
1 3 20 1

Expected output:
999999999999998
999999999999989
999999999999979
999999999999897
Problem p03306 test case
Input:
3 3
1 2 3
2 3 5
1 3 4

Expected output:
1
Problem p03307 test case
Input:
3

Expected output:
6
Problem p03308 test case
Input:
4
1 4 6 3

Expected output:
5
Problem p03309 test case
Input:
5
2 2 3 5 5

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

Expected output:
2
Problem p03311 test case
Input:
5
2 2 3 5 5

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

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

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

Expected output:
9
Problem p03315 test case
Input:
+-++

Expected output:
2
Problem p03316 test case
Input:
12

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

Expected output:
2
Problem p03318 test case
Input:
10

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

Expected output:
2
Problem p03320 test case
Input:
10

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

Expected output:
4
Problem p03322 test case
Input:
5
+>+<-

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

Expected output:
Yay!
Problem p03324 test case
Input:
0 5

Expected output:
5
Problem p03325 test case
Input:
3
5 2 4

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

Expected output:
56
Problem p03327 test case
Input:
999

Expected output:
ABC
Problem p03328 test case
Input:
8 13

Expected output:
2
Problem p03329 test case
Input:
127

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

Expected output:
3
Problem p03331 test case
Input:
15

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

Expected output:
40
Problem p03333 test case
Input:
3
-5 1
3 7
-4 -2

Expected output:
10
Problem p03334 test case
Input:
2 1 2

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

Expected output:
6
2 3
3 4
4 2
Problem p03336 test case
Input:
2 3 3
11
101

Expected output:
10000
10010
Problem p03337 test case
Input:
3 1

Expected output:
4
Problem p03338 test case
Input:
6
aabbca

Expected output:
2
Problem p03339 test case
Input:
5
WEEWW

Expected output:
1
Problem p03341 test case
Input:
5
WEEWW

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

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

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

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

Expected output:
2
Problem p03347 test case
Input:
4
0
1
1
2

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

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

Expected output:
5
Problem p03350 test case
Input:
3 4
1
01
1011
01001110

Expected output:
10
Problem p03351 test case
Input:
4 7 9 3

Expected output:
Yes
Problem p03352 test case
Input:
10

Expected output:
9
Problem p03353 test case
Input:
aba
4

Expected output:
b