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

N, M = map(int, input().split())
routes = np.array([list(map(int, input().split())) for _ in range(M)], 'i')
#print(routes)

# i駅まで到達したときの最小コスト（最終電車がjで示される）
dp = [{} for _ in range(N + 1)]
dp[1][0] = 0

for i in range(2, N + 1):
    for (f, t, m) in routes:
        if t != i:
            continue

        if m in dp[f]:
            dp[t][m] = dp[f][m]
        else:
            values = []
            for k, v in dp[f].items():
                if k != m: values.append(v)
            if len(values) > 0:
                dp[t][m] = min(values) + 1

if len(dp[N].values()) > 0:
    print(min(dp[N].values()))
else:
    print(-1)

Fixed submission:
import numpy as np

def many_fomulas(digits):
    mat = np.zeros((len(digits), len(digits)), 'i')

    for i, _ in enumerate(digits):
        if i >= 0:
            mat[i, :i] = 2 ** (i - 1)
        mat[i, i] = 2 ** i

    total = 0
    for i, _ in enumerate(digits):
        for j, v in enumerate(digits):
            total += 10 ** (len(digits) - i - 1) * int(mat[i, j]) * v

    print(total)

#many_fomulas([1, 2, 5])
#many_fomulas([9, 9, 9, 9, 9, 9, 9, 9, 9, 9])
many_fomulas([int(d) for d in input()])
Buggy python submission (verdict: Runtime Error):
n = input()
m = [ int(x) for x in input().split() ]

i = max(m)
j = min(m)

print( i - j )

Fixed submission:
cs = [ int(x) for x in input().split() ]
n = cs[0] * 100 + cs[1] * 10 + cs[2]
if n % 4 == 0 :
            print("YES")
else :
            print("NO")

Buggy python submission (verdict: Runtime Error):
    cs = [ int(x) for x in input().split() ]
    n = cs[0] * 100 + cs[1] * 10 + cs[2]
    if n % 4 == 0 :
        print("YES")
    else :
        print("NO")

Fixed submission:
cs = [ int(x) for x in input().split() ]
n = cs[0] * 100 + cs[1] * 10 + cs[2]
if n % 4 == 0 :
            print("YES")
else :
            print("NO")
Buggy python submission (verdict: Runtime Error):
#すでに調べているか確認
def check(i, j, check, s):
    if s[i][j] == "#":
        return 0
    else:
        for a in range(len(check)):
            if check[a][0] == i and check[a][1] == j:
                return 0
            else:
                return 1

H, W = map(int, input().split())
s = [0] * W
t = [[0 for i in range(W)] for j in range(H)]

for i in range(H):
    s[i] = list(input())

#各マス目の大きさが入っている
t[0][0] = 1
#キュー
queue = [[0,0]]
#調べたマスのリスト
checklist = []

z = 1
while(1):
    if not queue:
        z = 0
        break
    #キューから取り出す
    i = queue[0][0]
    j = queue[0][1]
    del queue[0]
    #ゴールか判断する
    if i == H-1 and j == W-1:
        break

    checklist.append([i, j])
    if i > 0:
        if check(i-1, j, checklist, s) == 1:
            queue.append([i-1, j])
            t[i-1][j] = t[i][j] + 1
    if j > 0:
        if check(i, j-1, checklist, s) == 1:
            queue.append([i, j-1])
            t[i][j-1] = t[i][j] + 1
    if i < H - 1:
        if check(i+1, j, checklist, s) == 1:
            queue.append([i+1, j])
            t[i+1][j] = t[i][j] + 1
    if j < W - 1:
        if check(i, j+1, checklist, s) == 1:
            queue.append([i, j+1])
            t[i][j+1] = t[i][j] + 1

point = 0
if z == 1:
    for i in range(W):
        for j in range(H):
            if s[i][j] == '.':
                point = point + 1

    print(point - t[H-1][W-1])
else:
    print(-1)

Fixed submission:
money = int(input())
A = int(input())

if (money % 500) > A:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
#すでに調べているか確認
def check(i, j, check, s):
    if s[i][j] == "#":
        return 0
    else:
        for a in range(len(check)):
            if check[a][0] == i and check[a][1] == j:
                return 0
            else:
                return 1

H, W = map(int, input().split())
s = [0] * W
t = [[0 for i in range(W)] for j in range(H)]

for i in range(H):
    s[i] = list(input())

#各マス目の大きさが入っている
t[0][0] = 1
#キュー
queue = [[0,0]]
#調べたマスのリスト
checklist = []

z = 1
while(1):
    if not queue:
        z = 0
        break
    #キューから取り出す
    i = queue[0][0]
    j = queue[0][1]
    del queue[0]
    #ゴールか判断する
    if i == H-1 and j == W-1:
        break

    checklist.append([i, j])
    if i > 0:
        if check(i-1, j, checklist, s) == 1:
            queue.append([i-1, j])
            t[i-1][j] = t[i][j] + 1
    if j > 0:
        if check(i, j-1, checklist, s) == 1:
            queue.append([i, j-1])
            t[i][j-1] = t[i][j] + 1
    if i < H - 1:
        if check(i+1, j, checklist, s) == 1:
            queue.append([i+1, j])
            t[i+1][j] = t[i][j] + 1
    if j < W - 1:
        if check(i, j+1, checklist, s) == 1:
            queue.append([i, j+1])
            t[i][j+1] = t[i][j] + 1

point = 0
if z = 1:
    for i in range(W):
        for j in range(H):
            if s[i][j] == '.':
                point = point + 1

    print(point - t[H-1][W-1])
else:
    print(-1)

Fixed submission:
money = int(input())
A = int(input())

if (money % 500) > A:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
money = int(input())
A = int(input())

if (money % 500) > A:
    print('NO')
else:
    print('YES')


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

a.sort()
a.reverse()

Alice = 0
Bob  = 0

for i in range(len(a)):
    if i % 2 == 0:
        Alice = Alice + a[i]
    else:
        Bob = Bob + a[i]

print(Alice - Bob)
Buggy python submission (verdict: Runtime Error):
c0 = map(int, raw_input().split())
c1 = map(int, raw_input().split())
c2 = map(int, raw_input().split())

d0 = c0 - c2
d1 = c1 - c2
d2 = c2 - c1

b0 = ((d0[0] == d0[1]) and (d0[1] == d0[2]))
b1 = ((d1[0] == d1[1]) and (d1[1] == d1[2]))
b2 = ((d2[0] == d2[1]) and (d2[1] == d2[2]))

if (b0 and b1 and b2):
  print 'Yes'
else:
  print 'No'

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
# 整数の入力
c1 = np.zeros((3,3),dtype=np.int64)
c2 = np.zeros((3,3),dtype=np.int64)
# スペース区切りの整数の入力
c1[0] = np.array(map(int, raw_input().split()))
c1[1] = np.array(map(int, raw_input().split()))
c1[2] = np.array(map(int, raw_input().split()))

c2[0] = c1[0] - c1[2]
c2[1] = c1[1] - c1[2]
c2[2] = c1[2] - c1[1]

b0 = ((c2[0,0] == c2[0,1]) and (c2[0,1] == c2[0,2]))
b1 = ((c2[1,0] == c2[1,1]) and (c2[1,1] == c2[1,2]))
b2 = ((c2[2,0] == c2[2,1]) and (c2[2,1] == c2[2,2]))

if (b0 and b1 and b2):
  print 'Yes'
else:
  print 'No'
Buggy python submission (verdict: Runtime Error):
import numpy as np

def operation(infos):
  for i in xrange(len(infos)):
    for j in xrange(len(infos)):
      if(infos[j][0] == infos[i][1]):
        infos[i] = [infos[i][0],infos[j][1],infos[i][2]+infos[j][2]]
        print infos

def check(infos):
  for i in xrange(len(infos)):
    if(infos[i][0]==infos[i][1] and infos[i][2]!=0):
      return False
    for j in xrange(len(infos)):
      if(infos[i][0:2]==infos[j][0:2] and infos[i][2]!=infos[j][2]):
        return False
  return True
  


if __name__ == '__main__':

  # Get standard in
  n, m  = map(int, raw_input().split())
  infos = []
  for i in range(m):
    infos.append(map(int, raw_input().split()))

  print infos
  operation(infos)
  if(check(infos)):
    print 'Yes'
  else:
    print 'No'


Fixed submission:
n = int(raw_input())
c0 = map(int, raw_input().split())
c1 = map(int, raw_input().split())

ame = []
for i in xrange(n):
  ame.append(sum(c0[:i+1]+c1[i:]))
print max(ame)
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
travel = [map(int, raw_input().split()) for i in range(n)]

accessible_now = [(0,0)]
limit = 1e5 + 1

stroke = 0
for target in travel:
  t, x, y = target
  while (stroke<t):
    stroke += 1
    accessible_next = [] 
    for loc in accessible_now:
      for step in [(1,0),(0,1),(-1,0),(0,-1)]:
        loc_next = (loc[0]+step[0],loc[1]+step[1])
        if ((-1 in loc_next) or (limit in loc_next)):
          continue
        if (loc_next in accessible_next):
          continue
        accessible_next.append(loc_next)
    accessible_now = accessible_next
    #print stroke, t, accessible_now
    if (stroke == t):
      if ((x,y) in accessible_now):
        continue
      else:
        print 'No'
        exit(0) 
res = 'Yes' if (stroke==t) else 'No'
print res


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

res = 'Even' if (a*b%2==0) else 'Odd'
print res
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
travel = [map(int, raw_input().split()) for i in range(n)]

accessible_now = [(0,0)]
limit = 1e5 + 1

stroke = 0
for target in travel:
  t, x, y = target
  while (stroke<t):
    stroke += 1
    accessible_next = [] 
    for loc in accessible_now:
      for step in [(1,0),(0,1),(-1,0),(0,-1)]:
        loc_next = (loc[0]+step[0],loc[1]+step[1])
        if ((-1 in loc_next) or (limit in loc_next)):
          continue
        if (loc_next in accessible_next):
          continue
        accessible_next.append(loc_next)
    accessible_now = accessible_next
    #print stroke, t, accessible_now
    if (stroke == t):
      if ((x,y) in accessible_now):
        accessible_now = [(x,y)]
        continue
      else:
        print 'No'
        exit(0) 
res = 'Yes' if (stroke==t) else 'No'
print res


Fixed submission:
n = int(raw_input())
travel = [map(int, raw_input().split()) for i in range(n)]

loc = (0,0)
now = 0
res = 'Yes'

for dest in travel:
  t, x, y = dest
  minpath = abs(x-loc[0]) + abs(y-loc[1])
  tmp = (t-now)-minpath
  if (tmp%2==0 and tmp>=0 ):
    loc = (x,y)
    now = t
    continue
  else:
    res = 'No'
    break
print res

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
travel = [map(int, raw_input().split()) for i in range(n)]

accessible_now = [(0,0)]
limit = 1e5 + 1

stroke = 0
for target in travel:
  t, x, y = target
  while (stroke<t):
    stroke += 1
    accessible_next = [] 
    for loc in accessible_now:
      for step in [(1,0),(0,1),(-1,0),(0,-1)]:
        loc_next = (loc[0]+step[0],loc[1]+step[1])
        if ((-1 in loc_next) or (limit in loc_next)):
          continue
        if (loc_next in accessible_next):
          continue
        accessible_next.append(loc_next)
    accessible_now = accessible_next
    #print stroke, t, accessible_now
    if (stroke == t):
      if ((x,y) in accessible_now):
        continue
      else:
        print 'No'
        exit(0) 
res = 'Yes' if (stroke==t) else 'No'
print res


Fixed submission:
n = int(raw_input())
travel = [map(int, raw_input().split()) for i in range(n)]

loc = (0,0)
now = 0
res = 'Yes'

for dest in travel:
  t, x, y = dest
  minpath = abs(x-loc[0]) + abs(y-loc[1])
  tmp = (t-now)-minpath
  if (tmp%2==0 and tmp>=0 ):
    loc = (x,y)
    now = t
    continue
  else:
    res = 'No'
    break
print res
Buggy python submission (verdict: Runtime Error):
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print('No')
else:
	print('Yes')


Fixed submission:
N = int(input())
A = int(input())
if (N % 500 > A):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print("No")
else:
	print("Yes")

Fixed submission:
N = int(input())
A = int(input())
if (N % 500 > A):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print("No")
else
	print("Yes")

Fixed submission:
N = int(input())
A = int(input())
if (N % 500 > A):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A= (int(i) for i in input().split())
a = N % 500
if (a > A):
	print("No")
    else
    print("Yes")

Fixed submission:
N = int(input())
A = int(input())
if (N % 500 > A):
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if ((a*b)%2):
    print('Odd')
else:
    print('Even')

Fixed submission:
a,b= (int(i) for i in input().split())
if ((a*b)%2):
    print('Odd')
else:
    print('Even')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# get a integer
a = int(raw_input())

list = a.split()

left = int(list[0])+int(list[1])
right = int(list[2])+int(list[3])

if left < right:
  print("Right")
elif left > right:
  print("Left")
else:
  print("Balanced")

Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
a = raw_input()

list = a.split()

left = int(list[0])+int(list[1])
right = int(list[2])+int(list[3])

if left < right:
  print("Right")
elif left > right:
  print("Left")
else:
  print("Balanced")
Buggy python submission (verdict: Runtime Error):
a = raw_input()

people = 0
for i in range(int(a)):
  number_list = raw_input().split()
  people += int(number_list[1])-int(number_list[0]) +1
  
print(str(people))

Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
a = int(raw_input())

print("ABC"+str(a))

Buggy python submission (verdict: Runtime Error):
a = raw_input()

people = 0
for i in range(int(a)):
  number_list = raw_input().split()
  people += int(number_list[1])-int(number_list[0]) +1
  
print(people)

Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
a = int(raw_input())

print("ABC"+str(a))

Buggy python submission (verdict: Runtime Error):
N = raw_input("Please enter something: ")

return("ABC" + str(N))

Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
a = int(raw_input())

print("ABC"+str(a))
Buggy python submission (verdict: Runtime Error):
import numpy as np
c0= list(map(int, input().split(' ')))
c1= list(map(int, input().split(' ')))
c2= list(map(int, input().split(' ')))

C = np.array([c0, c1, c2])
if C[1][0] - C[0][0] == C[1][1]-C[0][1] == C[1][2] - C[0][2] and C[2][0] - C[0][0] == C[2][1]-C[0][1 ]== C[2][2] - C[0][2]  :
 print('Yes')
else:
 print('No')

Fixed submission:
N = int(input())
A = int(input())
if A >= N % 500 :
 print('Yes')
else:
 print('No')
Buggy python submission (verdict: Runtime Error):
import numpy as np
c0= list(map(int, input().split(' ')))
c1= list(map(int, input().split(' ')))
c2= list(map(int, input().split(' ')))
 
C = np.array([c0, c1, c2])
if C[1][0] - C[0][0] == C[1][1]-C[0][1] == C[1][2] - C[0][2] and C[2][0] - C[0][0] == C[2][1]-C[0][1 ]== C[2][2] - C[0][2]  :
 print('Yes')
else:
 print('No')
import numpy as np
c0= list(map(int, input().split(' ')))
c1= list(map(int, input().split(' ')))
c2= list(map(int, input().split(' ')))

C = np.array([c0, c1, c2])
if C[1][0] - C[0][0] == C[1][1]-C[0][1] == C[1][2] - C[0][2] and C[2][0] - C[0][0] == C[2][1]-C[0][1 ]== C[2][2] - C[0][2]  :
 print('Yes')
else:
 print('No')


Fixed submission:
import numpy as np
c0= list(map(int, input().split(' ')))
c1= list(map(int, input().split(' ')))
c2= list(map(int, input().split(' ')))
 
C = np.array([c0, c1, c2])
if C[1][0] - C[0][0] == C[1][1]-C[0][1] == C[1][2] - C[0][2] and C[2][0] - C[0][0] == C[2][1]-C[0][1 ]== C[2][2] - C[0][2]  :
 print('Yes')
else:
 print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())

N %= A
if N <= A:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
A = int(input())

N %= 500
if N <= A:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
n%500=m
if m<=a:
    print("Yes")
else :
    print("No")


Fixed submission:
n=int(input())
a=int(input())

if n<500:
    if n<=a:
        print("Yes")
    else:
        print("No")
elif n>500 and (n%500)<=a:
    print("Yes")
else :
    print("No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
n//500=m
if m<=a:
    print("Yes")
else :
    print("No")


Fixed submission:
n=int(input())
a=int(input())

if n<500:
    if n<=a:
        print("Yes")
    else:
        print("No")
elif n>500 and (n%500)<=a:
    print("Yes")
else :
    print("No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())

n//500=m

if m<=a
    print("Yes")
else :
    print("No")

Fixed submission:
n=int(input())
a=int(input())

if n<500:
    if n<=a:
        print("Yes")
    else:
        print("No")
elif n>500 and (n%500)<=a:
    print("Yes")
else :
    print("No")
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
X=int(input())

num = 0
scoA = X//500


while scoA > 0:
    sco1 = X - (scoA*500)
    sco2 = sco1//100
    while sco2 > 0:
        sco2 -= 1
        num += 1
        
        if (sco1-(sco2*100))//50 < C:
            continue
        elif sco2 > B:
            continue


    num +=1
    scoA -= 1

    if scoA == 0:
        break


print(num)


Fixed submission:
x = int(input())
A = int(input())
B = int(input())

x = (x-A)

y = x%B
print(y)
Buggy python submission (verdict: Runtime Error):
i = 2
while True:
    cond = i * 4
    all_primes = primes + prime_decomposition(i)
    total = reduce(lambda x, y: x * y, all_primes)
    candi_primes = [p for p in all_primes if p <= cond - 2]

    r = find_result(candi_primes, cond, total)
    if r is not None:
        h, n, w = r
        print '{} {} {}'.format(int(total/h), int(total/n), int(total/w))
        break
    i += 1

Fixed submission:
# coding: utf-8
from itertools import combinations


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


def find_result(primes, cond, total):
    combi = {}
    for i in range(len(primes)):
        for c in combinations(primes, i+1):
            s = reduce(lambda x, y: x * y, c)
            if s <= cond - 2 and total / s < 3500:
                combi[tuple(c)] = s

    keys = sorted(combi.keys())
    for h in keys:
        for n in keys:
            for w in keys:
                s = combi[h] + combi[n] + combi[w]
                if s == cond:
                    return combi[h], combi[n], combi[w]
    return None


N = int(raw_input())
primes = [
    1,
] + prime_decomposition(N)

i = 2
while True:
    cond = i * 4
    all_primes = primes + prime_decomposition(i)
    total = reduce(lambda x, y: x * y, all_primes)
    candi_primes = [p for p in all_primes if p <= cond - 2]

    r = find_result(candi_primes, cond, total)
    if r is not None:
        h, n, w = r
        print '{} {} {}'.format(int(total/h), int(total/n), int(total/w))
        break
    i += 1
Buggy python submission (verdict: Runtime Error):
N, M = map(int, raw_input().split(' '))
A = [map(int, raw_input().split(' ')) for _ in xrange(N)]

answer = N
for m in xrange(M-1):
    participants = [0] * (M + 1)
    for n in xrange(N):
        participants[A[n][0]] += 1
    sport_with_max_participants = max(xrange(M), key=lambda x: participants[x])
    answer = min(answer, participants[sport_with_max_participants])
    for n in xrange(N):
        A[n].remove(sport_with_max_participants)

print answer

Fixed submission:
N, M = map(int, raw_input().split(' '))
A = [map(int, raw_input().split(' ')) for _ in xrange(N)]

answer = N
for _ in xrange(M):
    participants = [0] * M
    for n in xrange(N):
        participants[A[n][0]-1] += 1
    sport_with_max_participants = max(xrange(M), key=lambda x: participants[x])
    answer = min(answer, participants[sport_with_max_participants])
    for n in xrange(N):
        A[n].remove(sport_with_max_participants+1)

print answer
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)

alice = 0
bob = 0

for x in range(n):
    if x % 2 == 0:
        alice += a[x]
    else:
        bob += a[x]

res = alice - bob
print(res)

Fixed submission:
n = int(input())
a = int(input())

x = n % 500
if x != 0:
    if x <= a:
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)

alice = 0
bob = 0

for x in range(n):
    if x % 2 == 0:
        alice += a[x]
    else:
        bob += a[x]

res = alice - bob
print(res)

Fixed submission:
n = int(input())
a = int(input())

x = n % 500
if x != 0:
    if x <= a:
        print('Yes')
    else:
        print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import math


def test(n,dict):
    left = n - 1
    right = n - 2
    leftValue = 0
    rightValue = 0
    if left in dict:
        leftValue = dict[left]
    else:
        leftValue = test(left, dict)

    if right in dict:
        rightValue = dict[right]
    else:
        rightValue = test(right, dict)


    return leftValue + rightValue



if __name__ == "__main__":
    n = int(input())
    dict = {0:2, 1:1}
    print(test(n, dict))

Fixed submission:
# coding: utf-8
from functools import lru_cache


@lru_cache(maxsize=1000)
def test2(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return test2(n-1) + test2(n-2)


if __name__ == "__main__":
    n = int(input())
    dict = {0:2, 1:1}
    print(test2(n))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def lucas(s):
    if s == 0:
        return 2
    elif s == 1:
        return 1
    else:
        return lucas(s-1) + lucas(s-2)

print(lucas(n))

Fixed submission:
n = int(input())

L = [2, 1]
for i in range(2, n+1):
    a = L[i-1] + L[i-2]
    L.append(a)

print(L[n])
Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = [[0,0,0]]
ans = False

for v in range(n):
    t, x, y = map(int,input().split())
    nums.append([t,x,y])

# print(nums)
# print(nums[1][1])

for x in range(n+1):
    p = nums[x+1][0] - nums[x][0]
    px = nums[x+1][1] - nums[x][1]
    py = nums[x+1][2] - nums[x][2]
    ps = px + py
    # print(p,px,py,ps)

    for w in range(p+1):
        pp = w
        mp = p - pp
        # print(pp,mp)
        if pp-mp==ps:
            ans = True

if ans:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
nums = [[0,0,0]]
ans = []

for v in range(n):
    t, x, y = map(int,input().split())
    nums.append([t,x,y])

# print(nums)
# print(nums[1][1])

for x in range(n):
    p = nums[x+1][0] - nums[x][0]
    px = nums[x+1][1] - nums[x][1]
    py = nums[x+1][2] - nums[x][2]
    ps = px + py
    # print(p,px,py,ps)

    for w in range(p+1):
        pp = w
        mp = p - pp
        # print(pp,mp)
        if pp-mp==ps:
            ans.append(1)
        else:
            ans.append(0)

    
sum = 0 
for num in ans:
    sum = sum + num


if sum==n:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
ny = input().split()
n = int(ny[0])
y = int(ny[1])

def solve(n,y):
    Y = y/1000
    p = int((Y - n) // 9)
    for v in range(p+1):
        if (Y - n - 9*v)%4 == 0:
            b = int((Y - n - 9*v)/4)
            c = int((Y - 10*v - 5*b))
            if c*b < 0:
                continue
            else:
                return str(v), str(b), str(c)


ans = solve(n,y)
if ans != None:
    print(' '.join(ans))
else:
    print(-1, -1, -1) 

Fixed submission:
year = input()
year = year.replace('2017','2018')
print(year)