Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np

S = input()
S_int = int(S)

tile_color = []

keta = len(S)
for i in range(keta):
    if S_int/10 == int(S_int/10):
        tile_color.insert(0, '0')
    else:
        tile_color.insert(0, '1')
    S_int = int(S_int/10)

length_of_S = len(tile_color)

candidate_1 = np.zeros((1,length_of_S))
candidate_1[0,0::2] = 1
candidate_2 = np.zeros((1,length_of_S))
candidate_2[0,1::2] = 1

tile_color = [int(n) for n in tile_color]

distance = [np.sum(np.abs(tile_color - candidate_1[0,:])), np.sum(np.abs(tile_color - candidate_2[0,:]))]

print(int(min(distance)))

Fixed submission:
import numpy as np

S = input()

tile_color = []
for i in S:
    tile_color.append(int(i))

candidate = np.zeros((2,len(S)))
candidate[0, 0::2] = 1
candidate[1, 1::2] = 1

distance = [np.sum(np.abs(candidate[0,:] - tile_color)), np.sum(np.abs(candidate[1,:] - tile_color))]

print(int(min(distance)))

Buggy python submission (verdict: Runtime Error):
import numpy as np

S = input()
S_int = int(S)

tile_color = []

keta = len(S)
for i in range(keta):
    if S_int/10 == int(S_int/10):
        tile_color.insert(0, '0')
    else:
        tile_color.insert(0, '1')
    S_int = int(S_int/10)

length_of_S = len(tile_color)

candidate_1 = np.zeros((1,length_of_S))
candidate_1[0,0::2] = 1
candidate_2 = np.zeros((1,length_of_S))
candidate_2[0,1::2] = 1

tile_color = [int(n) for n in tile_color]

distance = [np.sum(np.abs(tile_color - candidate_1[0,:])), np.sum(np.abs(tile_color - candidate_2[0,:]))]

print(int(min(distance)))

Fixed submission:
import numpy as np

S = input()

tile_color = []
for i in S:
    tile_color.append(int(i))

candidate = np.zeros((2,len(S)))
candidate[0, 0::2] = 1
candidate[1, 1::2] = 1

distance = [np.sum(np.abs(candidate[0,:] - tile_color)), np.sum(np.abs(candidate[1,:] - tile_color))]

print(int(min(distance)))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
print(max(A)-max(B))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
m1=max(A)
m2=min(A)
print(m1-m2)
Buggy python submission (verdict: Runtime Error):
a,b,c,x,y=map(int,input().split())
ans=a*x+b*y
for i in range(x+1):
  for j in range(y+1):
    if a*i+j*b+(x+y-i+j)*c<num:
      ans=a*i+j*b+(x+y-i+j)*c
print(ans)      
    

Fixed submission:
a,b,c,x,y=map(int,input().split())

_1=a*x+b*y

if x>=y:
  _2=c*2*y+(x-y)*a
  _3=2*x*c
else:
  _2=c*2*x+(y-x)*b
  _3 = 2*y*c

print(min(_1,_2,_3)  )
Buggy python submission (verdict: Runtime Error):
a,b=input().split()

if int(a)*int(b)//2==0:
  print("Even")
 else:
  print("Odd")

Fixed submission:
a,b=input().split()
 
if int(a)*int(b)%2==0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input(),split())
print((a+b+1)//2)
        
        

Fixed submission:
a,b=map(int,input().split())
print((a+b+1)//2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
l = list(map(int, input().split()))

count=0

while True:
  for i in range(len(l)):
    if l[i]%2==0:
        l[i] //= 2
        else:
            print(count)
            exit()
    count += 1
  
      

Fixed submission:
n=int(input())
l = list(map(int, input().split()))

count=0

while True:
  for i in range(len(l)):
    if l[i]%2==0:
        l[i] //= 2
    else:
        print(count)
        exit()
    
  count += 1
Buggy python submission (verdict: Runtime Error):
n = int(input())
cnt= [0]*100000
a = list(map(int, input().split()))
for v in a:
    cnt[v-1] += 1
    cnt[v] += 1
    cnt[v+1] += 1

print(max(cnt))

Fixed submission:
n = int(input())
cnt= [0]*100002
a = list(map(int, input().split()))
for v in a:
    cnt[v-1] += 1
    cnt[v] += 1
    cnt[v+1] += 1

print(max(cnt))

Buggy python submission (verdict: Runtime Error):
n = int(input())
cnt= [0]*10001
a = list(map(int, input().split()))
for v in a:
    cnt[v-1] += 1
    cnt[v] += 1
    cnt[v+1] += 1

print(max(cnt))

Fixed submission:
n = int(input())
cnt= [0]*100002
a = list(map(int, input().split()))
for v in a:
    cnt[v-1] += 1
    cnt[v] += 1
    cnt[v+1] += 1

print(max(cnt))
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=1
for i in range(a,(n+1)):
  if (i//ans)%2 == 0:
    ans=i
print(ans)    
  


Fixed submission:
n=int(input())
ans=1
for i in range(1,(n+1)):
  if (i//ans)%2 == 0:
    ans=i
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=a
for i in range(a,(n+1)):
  if (i//ans)%2 == 0:
    ans=i
print(ans)    
  

Fixed submission:
n=int(input())
ans=1
for i in range(1,(n+1)):
  if (i//ans)%2 == 0:
    ans=i
print(ans)
Buggy python submission (verdict: Runtime Error):
S=input()

print(S.rfind("Z")-S.find("A"+1))

Fixed submission:
S=input()

print(S.rfind("Z")-S.find("A")+1)
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int, input().split())
count=0

for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z==s:
        count+=1

print(count)



Fixed submission:
k,s=map(int, input().split())
count=0

for x in range(k+1):
  for y in range(k+1):
    if 0<=s-x-y<=k:
      count+=1
    

print(count)
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=[]
for i in range(n):
  s.append(input())
  
  
s.sort()
for i in range(l):
  print(s[i],end="")
         

Fixed submission:
n,l=map(int,input().split())
s=[]
for i in range(n):
  s.append(input())
  
  
s.sort()
print("".join(s))

Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=[]
for i in range(n):
  tmp=input()
  s.append(tmp)

s.sort()
for i in range(l):
  print(s[i],end="")

Fixed submission:
n,l=map(int,input().split())
s=[]
for i in range(n):
  s.append(input())
  
  
s.sort()
print("".join(s))
Buggy python submission (verdict: Runtime Error):
S = list(map(int, input()))

count = 0
tmp = S[0]
for ii in S:
    if ii != tmp:
        count += 1
    tmp = abs(tmp-1)

print(count)

Fixed submission:
A, B = map(int, input().split())

ans = 0
if A == B:
    ans = A + B
elif A > B:
    ans = A + (A - 1)
else:
    ans = B + (B - 1)

print(ans)

Buggy python submission (verdict: Runtime Error):
#include<algorithm>
#include<iostream>
int main(argc, **argv) {
	int a, b;
  	cin>>a;
  	cin>>b;
  	int ans = 0;
  	ans = max(ans, a + a-1);
  	ans = max(ans, a + b);
  	ans = max(ans, b + b-1);
  	cout << asn << endl;
}

Fixed submission:
line = input().strip()
line = line.split(' ')
A = int(line[0])
B = int(line[1])
ans = 0
ans = max(ans, A + A - 1)
ans = max(ans, A + B)
ans = max(ans, B + B - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
line = trim(input(STDIN))
line = line.split(' ')
A = line[0]
B = line[1]
ans = 0
ans = max(ans, A + A - 1)
ans = max(ans, A + B)
ans = max(ans, B + B - 1)
print(ans)


Fixed submission:
line = input().strip()
line = line.split(' ')
A = int(line[0])
B = int(line[1])
ans = 0
ans = max(ans, A + A - 1)
ans = max(ans, A + B)
ans = max(ans, B + B - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
line = trim(input(STDIN))
line = ' '.split(line)
A = line[0]
B = line[1]
ans = 0
ans = max(ans, A + A - 1)
ans = max(ans, A + B)
ans = max(ans, B + B - 1)
print(ans)

Fixed submission:
line = input().strip()
line = line.split(' ')
A = int(line[0])
B = int(line[1])
ans = 0
ans = max(ans, A + A - 1)
ans = max(ans, A + B)
ans = max(ans, B + B - 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input().strip()
ansB = 0
ansW = 0
for i,c in emumerate(S):
  if (i % 2 == 0):
    if (c == '0'):
      ansW += 1
  else:
   	if (c == '1'):
      ansB += 1

ans = min(ansW, ansB)
print(ans)

Fixed submission:
S = input().strip()
ansB = 0
ansW = 0
for i,c in enumerate(S):
	if (i % 2 == 0):
		if (c == '0'):
			ansW += 1
		else:
			ansB += 1
	else:
		if (c == '1'):
			ansW += 1
		else:
			ansB += 1
ans = min(ansW, ansB)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int(input()))

l = [2*a-1, a+b, 2b-1]

print(max(l))

Fixed submission:
a, b = map(int,input().split())

l = [2*a-1, a+b, 2*b-1]

print(max(l))
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = str(input())
lists = list(list(map(int, input().split())) for i in range(q))
AC_index = []
counter = 0

for i in range(n-1):
    if s[i] + s[i+1] == 'AC':
        AC_index.append(i)

for i in range(q):
    l, r = (lists[i][0]-1), (lists[i][1]-1)
    for j in AC_index:
        if l <= j <= r-1:
            counter += 1
    print(counter)
    counter = 0


Fixed submission:
X = str(input())

words = {
    'A': 'T',
    'T': 'A',
    'C': 'G',
    'G': 'C'
}

print(words[X])
Buggy python submission (verdict: Runtime Error):
S = str(input())
counter = 0
series = []

for i in S:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        counter += 1
    else:
        series.append(counter)
        counter = 0

print(max(series))


Fixed submission:
S = str(input())
counter = 0
max = 0

for i in S:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        counter += 1
        if counter >= max:
            max = counter
    else:
        counter = 0

print(max)

Buggy python submission (verdict: Runtime Error):
S = str(input())
counter = 0
series = []

for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'C' or S[i] == 'G':
        counter += 1
    else:
        series.append(counter)
        counter = 0

print(max(series))

Fixed submission:
S = str(input())
counter = 0
max = 0

for i in S:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        counter += 1
        if counter >= max:
            max = counter
    else:
        counter = 0

print(max)

Buggy python submission (verdict: Runtime Error):
S = str(input())
counter = 0
series = []

for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'T' or S[i] == 'C' or S[i] == 'G':
        counter += 1
    else:
        series.append(counter)
        counter = 0

print(max(series))

Fixed submission:
S = str(input())
counter = 0
max = 0

for i in S:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        counter += 1
        if counter >= max:
            max = counter
    else:
        counter = 0

print(max)
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = [[i for i in input().split()] for i in range(N)]
C = 0

for i in range(N):
    if M[i][1] == 'JPY':
        C += int(M[i][0])
    elif M[i][1] == 'BTC':
        C += float(M[i][0])*380000

print(C)

Fixed submission:
y, m ,d = map(int, input().split('/'))

A = None

if y > 2019 :
    A = 'TBD'
elif m > 4 :
    A = 'TBD'
elif d > 30 :
    A = 'TBD'
else:
    A = 'Heisei'
    
print(A)
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = [[int(i) for i in input().split()] for i in range(N)]
C = 0

for i in range(N):
    if A[i][1] == 'JPY':
        C += M[i][0]
    elif A[i][1] == 'BTC':
        C += M[i][0]*380000

print(C)

Fixed submission:
N = int(input())
M = [[i for i in input().split()] for i in range(N)]
C = 0

for i in range(N):
    if M[i][1] == 'JPY':
        C += int(M[i][0])
    elif M[i][1] == 'BTC':
        C += float(M[i][0])*380000

print(C)

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = [[int(i) for i in input().split()] for i in range(N)]
C = 0

for i in range(N):
    if A[i][1] == 'JPY':
        C += M[i][0]
    elif A[i][1] == 'BTC':
        C += M[i][0]*380000

print(C)

Fixed submission:
N = int(input())
M = [[i for i in input().split()] for i in range(N)]
C = 0

for i in range(N):
    if M[i][1] == 'JPY':
        C += int(M[i][0])
    elif M[i][1] == 'BTC':
        C += float(M[i][0])*380000

print(C)
Buggy python submission (verdict: Runtime Error):
s = str(input())
odd =[]

n = int(len(s)/2)

for i in range(n+1):
    odd.append(s[2*i])

print(''.join(odd))

Fixed submission:
s = str(input())
s = s[::2]
print(s)
Buggy python submission (verdict: Runtime Error):
s = str(input())

import string

s = set(sorted(list(s)))
t = set(list(string.ascii_lowercase))
remain = t - s
remain = list(remain)

print(min(remain))

Fixed submission:
s = str(input())

import string

s = set(sorted(list(s)))
t = set(list(string.ascii_lowercase))
remain = t - s
remain = list(remain)

if len(remain) > 0:
    print(min(remain))
else:
    print('None')
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
c = 0

for x in range(k+1):
    for y in range(x, k+1):
        for z in range(y, k+1):
            if x+y+z == s:
                if x == y == z:
                    c += 1
                elif x == y or y == z:
                    c += 3
                else:
                    c += 6

print(c)

Fixed submission:
k, s = map(int, input().split())
c = 0

for x in range(k+1):
    for y in range(x, k+1):
        z = s-x-y
        if y <= z <= k:
            if x == y == z:
                c += 1
            elif x == y or y == z:
                c += 3
            else:
                c += 6

print(c)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
c = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z == s:
                c += 1

print(c)

Fixed submission:
k, s = map(int, input().split())
c = 0

for x in range(k+1):
    for y in range(x, k+1):
        z = s-x-y
        if y <= z <= k:
            if x == y == z:
                c += 1
            elif x == y or y == z:
                c += 3
            else:
                c += 6

print(c)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

mod = a*b/2
if c == 1:
  print('Odd')
else c == 0:
  print('Even')

Fixed submission:
a, b = map(int, input().split())

mod = (a*b)%2
if mod == 1:
    print('Odd')
else:
    print('Even')

Buggy python submission (verdict: Runtime Error):

mod = (a*b)/2

if mod == 1:
    print(Odd)
else mode == 0:
    print(Even)

Fixed submission:
a, b = map(int, input().split())

mod = (a*b)%2
if mod == 1:
    print('Odd')
else:
    print('Even')
Buggy python submission (verdict: Runtime Error):

N, K = (int(i) for i in input().split())
S = list(str(input()))

L0 = []
L1 = []

pre = -1
now = -1
count = 1

for i in range(1,len(S)):
    pre = int(S[i-1])
    now = int(S[i])
    
    if pre != now:
        if pre == 1:
            L1.append(count)
        else:
            L0.append(count)
        count = 1
        continue
    
    count += 1
        
    
if now  == 1:
    L1.append(count)
else:
    L0.append(count)


if int(S[0]) == 0 and int(S[-1]) == 0:
    L1.append(0)
    L1.insert(0,0)

if int(S[0]) == 1 and int(S[-1]) == 0:
    L1.append(0)

if int(S[0]) == 0 and int(S[-1]) == 1:
    L1.insert(0,0)        

maxi = 0


for i in range(len(L1)-1):
    sum1 = sum(L1[i:i+K+1])
    sum0 = sum(L0[i:i+K])
    sum_ = sum0 + sum1
    if maxi < sum_ :
        maxi = sum_
        
if maxi == 0:
    maxi = 1
    
print(maxi)

Fixed submission:
A, B = (int(i) for i in input().split())  
coin = 0

if A >= B + 2:
    coin = A + (A-1)
elif A + 2 <= B:
    coin = B + (B-1)
else:
    coin = A + B
    
print(coin)
Buggy python submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split())  
  
if b/a % 0:
	c = a + b
else:
	c = b - a
    
print(c)


Fixed submission:
a, b = map(int, input().split())

if b%a == 0:
	c = a + b
else:
	c = b - a
    
print(c)

Buggy python submission (verdict: Runtime Error):
a, b = (int(i) for i in input().split())  
  
if a/b % 0:
	c = a + b
else:
	c = b - a
    
print(c)


Fixed submission:
a, b = map(int, input().split())

if b%a == 0:
	c = a + b
else:
	c = b - a
    
print(c)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
if print("Even" if a*b%2==0 else "Odd")


Fixed submission:
a,b=map(int, input().split())
print("Even" if a*b%2==0 else "Odd")
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
k = int(input())
tf = any(a[i + 1] - a[i] > k for i in range(4))
print("Yay!" if !tf else ":(")

Fixed submission:
a = [int(input()) for i in range(5)]
k = int(input())
flag = True
for i in range(5):
    for j in range(i + 1, 5):
        flag &= a[j] - a[i] <= k
print("Yay!" if flag else ":(")
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
AB = []
D = defaultdict(lambda: [])
for i in range(N + M - 1):
    a, b = map(int, input().split())
    AB.append((a - 1, b - 1))
    D[a - 1].append(b - 1)

z = [0]*N
for a, b in AB:
    z[b] += 1

ans = [-1]*N
root = z.index(0)
ok = [False]*N
def rec(u, p):
    ans[u] = p
    ok[u] = True
    for v in D[u]:
        z[v] -= 1
    for v in D[u]:
        if z[v] == 0 and not ok[v]:
            rec(v, u)


rec(root, -1)

for i in range(N):
    print(ans[i] + 1)


Fixed submission:
N, A, B = map(int, input().split())
a = min(A, B)
b = max(0, A + B - N)
print(a, b)
Buggy python submission (verdict: Runtime Error):
import heapq
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append((a, i))
    B.append((b, i))

OA = A[:]
OB = B[:]
A.sort(key=lambda x:x[0])
B.sort(key=lambda x:x[0])


used = [False]*N
x, y = 0, 0
for _ in range(N):
    if _ % 2 == 0:
        while A:
            a, i = A.pop()
            if used[i]:
                continue
            b, j = B[-1]
            if a > b:
                x += a
                used[i] = True
            else:
                x += OA[j][0]
                used[j] = True
            break
    else:
        while B:
            b, i = B.pop()
            if used[i]:
                continue
            a, j = A[-1]
            if b > a:
                y += b
                used[i] = True
            else:
                y += OB[j][0]
                used[j] = True
            break
print(x - y)


Fixed submission:
N = int(input())
A, B = [], []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

AB = sorted([i for i in range(N)], key=lambda x: A[x] + B[x], reverse=True)
x, y = 0, 0
for (cnt, i) in enumerate(AB):
    if cnt % 2 == 0: 
        x += A[i]
    else:
        y += B[i]
print(x - y)
Buggy python submission (verdict: Runtime Error):
S = raw_input()
w = int(raw_input())
print "".join(S[i] for i in xrange(0, len(S), w))

Fixed submission:
a,b = map(int, raw_input().split())
print "+" if a + b == 15 else "*" if a*b == 15 else "x"
Buggy python submission (verdict: Runtime Error):
inf = 1e18

N = int(raw_input())
HP = sorted(sorted([map(int, raw_input().split()) for i in xrange(N)]), key = lambda x:x[1])
dp =[inf] * 5005

for i in xrange(N):
    H, P = HP[i]
    for j in xrange(N + 1, -1, -1):
        if dp[j] < inf and dp[j] <= H:
            dp[j + 1] = min(dp[j + 1], dp[j] + P)
    dp[1] = min(dp[1], P)

ans = max(i for i in xrange(N + 1) if dp[i] < inf)

print ans


Fixed submission:
S = raw_input()
if "HA" not in S and "H" in S:
    S = S.replace("H", "HA")
if "BA" not in S and "B" in S:
    S = S.replace("B", "BA")
if "RA" not in S and "R" in S:
    S = S.replace("R", "RA")
if S[0] != "A":
    S = "A" + S
if S == "AKIHABARA":
    print "YES"
else:
    print "NO"

Buggy python submission (verdict: Runtime Error):
S = raw_input()
if S.index("HA") == -1 and S.index("H") > 0:
    S = S.replace("H", "HA")
if S.index("BA") == -1 and S.index("B") > 0:
    S = S.replace("B", "BA")
if S.index("RA") == -1 and S.index("R") > 0:
    S = S.replace("R", "HA")
if S[0] != "A":
    S = "A" + S
if S == "AKIHABARA":
    print "YES"
else:
    print "NO"



Fixed submission:
S = raw_input()
if "HA" not in S and "H" in S:
    S = S.replace("H", "HA")
if "BA" not in S and "B" in S:
    S = S.replace("B", "BA")
if "RA" not in S and "R" in S:
    S = S.replace("R", "RA")
if S[0] != "A":
    S = "A" + S
if S == "AKIHABARA":
    print "YES"
else:
    print "NO"
Buggy python submission (verdict: Runtime Error):
import defaultdict from collections
N = int(raw_input())
d = defaultdict(int)
for i in xrange(N):
    A = int(raw_input())
    d[A] = (d[A] + 1) % 2
ans = 0
for v in d.values():
    ans += v
print ans

Fixed submission:
from collections import defaultdict 

N = int(raw_input())
d = defaultdict(int)
for i in xrange(N):
    A = int(raw_input())
    d[A] = (d[A] + 1) % 2
ans = 0
for v in d.values():
    ans += v
print ans
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = int(raw_input())
A = map(int, raw_input().split())
B = [A[0]]
for ai in A[1:]:
    if B[-1] != ai:
        B.append(ai)
A = B[:]

ans = 1
i = 0
while i < N - 2:
    if A[i] <= A[i + 1] <= A[i + 2]:
        i += 1
    elif A[i] >= A[i + 1] >= A[i + 2]:
        i += 1
    else:
        ans += 1
        i += 2

print ans


Fixed submission:
# -*- coding: utf-8 -*-

N = int(raw_input())
A = map(int, raw_input().split())
B = [A[0]]
for ai in A[1:]:
    if B[-1] != ai:
        B.append(ai)
A = B[:]
N  = len(A)

ans = 1
i = 0
while i < N - 2:
    if A[i] <= A[i + 1] <= A[i + 2]:
        i += 1
    elif A[i] >= A[i + 1] >= A[i + 2]:
        i += 1
    else:
        ans += 1
        i += 2

print ans
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N, M = map(int, raw_input().split())
ab = [map(int, raw_input().split()) for i in xrange(N)]
cd = [map(int, raw_input().split()) for i in xrange(N)]

for i, (a, b) in enumerate(ab):
    mn = 1e10
    p = -1
    for j, (c, d) in enumerate(cd, 1):
        tmp = abs(a - c) + abs(c - d)
        if tmp < mn:
            mn = tmp
            p = j
    print p


Fixed submission:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N, M = map(int, raw_input().split())
ab = [map(int, raw_input().split()) for i in xrange(N)]
cd = [map(int, raw_input().split()) for i in xrange(M)]

for i, (a, b) in enumerate(ab):
    mn = 1e10
    p = -1
    for j, (c, d) in enumerate(cd, 1):
        tmp = abs(a - c) + abs(b - d)
        if tmp < mn:
            mn = tmp
            p = j
    print p
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
class UnionFind:
    def __init__(self, size):
        self.rank = [0] * size
        self.par = range(size)

    def find(self, x):
        if x == self.par[x]: return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y: return

        if (self.rank[x] > self.rank[y]):
            self.par[y] = x
        else:
            self.par[x] = y
            if (self.rank[x] == self.rank[y]): self.rank[y] += 1

N, K, L = map(int, raw_input().split())
pq = [map(int, raw_input().split()) for i in xrange(K)]
rs = [map(int, raw_input().split()) for i in xrange(L)]

road = UnionFind(N)
rail = UnionFind(N)
for p, q in pq:
    road.unite(p - 1, q - 1)
for r, s in rs:
    rail.unite(r - 1, s - 1)

for i in xrange(N):
    road.find(i)
    rail.find(i)

pair = defaultdict(int) 
for i, j in zip(road.par, rail.par):
    pair[i, j] += 1

print " ".join(map(str, [pair[road.par[i], rail.par[i]] for i in xrange(N)]))


Fixed submission:
W = ["dream", "dreamer", "erase", "eraser"]
S = raw_input()

while S:
    for w in W:
	if S.endswith(w):
             S = S[:-len(w)]
             break
    else:
        print "NO"
        break
else:
    print "YES"
Buggy python submission (verdict: Runtime Error):
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H, W = map(int, raw_input().split())
S = [raw_input().split() for i in xrange(H)]

for h in xrange(H):
	for w in xrange(W):
		if S[h][w] == "snuke":
			print alpha[w] + str(h + 1)
			exit()
torii@xps45:~/roiti46/procon/Contest/2

Fixed submission:
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H, W = map(int, raw_input().split())
S = [raw_input().split() for i in xrange(H)]

for h in xrange(H):
	for w in xrange(W):
		if S[h][w] == "snuke":
			print alpha[w] + str(h + 1)
			exit()