Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02812 (python)

Fixed submission:
a = input()
a = input()
print(a.count("ABC"))

Buggy submission (verdict: Runtime Error):
a = input().split("\n")[1]
print(a.count("ABC"))

Buggy submission (verdict: Runtime Error):
a = input().split("¥n")[1]
print(a.count("ABC"))

Buggy submission (verdict: Runtime Error):
a = input().split("¥n")[1]
print(len(a.split("ABC"))-1)

Buggy submission (verdict: Runtime Error):
a = input().split("\n")[1]
print(len(a.split("ABC"))-1)

Buggy submission (verdict: Runtime Error):
a,b=input().split("\n")
print(len(b.split("ABC"))-1)

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split("\n"))
print(len(b.split("ABC"))-1)
Problem p02813 (python)

Fixed submission:
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

import itertools
X = list(itertools.permutations(range(1,N+1),N))
for i in range(len(X)):
  x = X[i]
  if P == x:
    a = i 
  if Q == x:
    b = i

print(abs(a-b))

Buggy submission (verdict: Runtime Error):
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

import itertools
X = list(itertools.permutations(range(1,N+1),N))
for i in range(len(X)):
  x = X[i]
  if P == x:
    a = i 
  elif Q == x:
    b = i

print(abs(a-b))
Problem p03101 (python)

Fixed submission:
H, W = map(int, input().split())
h,w = map(int, input().split())

print(abs(H-h)*abs(W-w))

Buggy submission (verdict: Runtime Error):

def to_bin(n):
  s = ''
  while n > 0:
    s += str(n%2)
    n //= 2
  return s[::-1]

def xor(s1, s2):
  s1 = '0'*(len(s2)-len(s1)) + s1
  result = ''
  for i in range(len(s1)):
    if s1[i] == s2[i]:
      result += '0'
    else:
      result += '1'
  return result

def to_den(s):
  s = s[::-1]
  total = 0
  for i in range(0, len(s)):
    total += 2**i*int(s[i])
  return total

def main():
  A, B = map(int, input().split())
  if A == B:
    print(A)
    exit(1)

  cur = xor(to_bin(A), to_bin(A+1))

  for i in range(A+2, B+1):
    s = to_bin(i)
    cur = xor(cur, s)

  print(to_den(cur))

main()
Problem p02952 (python)

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

Buggy submission (verdict: Runtime Error):
N, *p = map(int, open(0).read().split())

if sum(p[i] != i + 1 for i in range(N)) <= 2:
    print('YES')
else:
    print('NO')
Problem p02958 (python)

Fixed submission:
N=int(input())
P=list(map(int,input().split()))
w=0
for i in range(N):
	if P[i]!=i+1:
		w+=1
else:
	print("NO" if w>2 else "YES")

Buggy submission (verdict: Runtime Error):
 N, *p = map(int, open(0).read().split())

if sum(p[i] != i + 1 for i in range(N)) <= 2:
    print('YES')
else:
    print('NO')
Problem p03059 (python)

Fixed submission:
a,b,t=map(int, input().split())
print(b*(t//a))

Buggy submission (verdict: Runtime Error):
a,b,t=map(int, input().split())
cnt=0
t+=0.5
for i in range(1,t,a):
    cnt+=b
print(cnt)
Problem p03068 (python)

Fixed submission:
n = int(input())
s = input()
k = int(input())
for i in s:
    if i == s[k-1]:
        print(i, end="")
    else:
        print("*", end="")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
for i in s:
    if i == s[k]:
        print(i, end="")
    else:
        print("*", end="")
Problem p03109 (python)

Fixed submission:
s=input()
print("Heisei" if s <= "2019/04/30" else "TBD")

Buggy submission (verdict: Runtime Error):
s=int(input())
print("Heisei" if s <= "2019/04/30" else "TBD")

Buggy submission (verdict: Runtime Error):
s=int(input())
print("Heisei" if s =< "2019/04/30" else "TBD")
Problem p03308 (python)

Fixed submission:
s=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
list=[input() for i in range(n)]
sorted(list)
print(abs(list[-1]-list[0]))
Problem p03433 (python)

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

Buggy submission (verdict: Runtime Error):
int(N) = input()
int(A) = input()
if N % 500 > A:
    print("Yes")
else:
    print("No")
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')

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

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

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

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

Buggy submission (verdict: Runtime Error):
a, b = input().split()
if (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(intm input().split())
if (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = a * b
if c % 2 == 0：
	print("Even)
else:
	print("Odd")
Problem p03485 (python)

Fixed submission:
import math
a,b = map(int, input().split())
x = (a + b) / 2
print(math.ceil(x))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int, input().split())
print(math.ceil((a+b)/2a))

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

s.sort()
s=''.join(s)

s.sort()
t.reverse()
t=''.join(t)

if s < t:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

s.sort()
s=''.join(s)

s.sort()
t.reverse()
t=''.join(t)

print(s)
print(t)

if s < t:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
(a + b) / 2 = x
print(ceil(x))

Buggy submission (verdict: Runtime Error):
from math import ceil
a, b = map(int, input().split())
(a + b) / 2 = x
print(ceil(x))

Buggy submission (verdict: Runtime Error):
from math import ceil
x = (a + b) / 2
print(ceil(x))
Problem p03486 (python)

Fixed submission:
s = list(input())
t = list(input())

s.sort()
s=''.join(s)

t.sort()
t.reverse()
t=''.join(t)

if s < t:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

s.sort()
s=''.join(s)

s.sort()
t.reverse()
t=''.join(t)

if s < t:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

s.sort()
s=''.join(s)

t.reverse()
t=''.join(t)

if s =< t:
    print('Yes')
else:
    print('No')
Problem p03730 (python)

Fixed submission:
a,b,c = map(int, input().split())
cnt = 0
for i in range(b+1):
    if i*a%b == c:
        cnt =+ 1
        break
    else:
        continue
print("YES" if cnt == 1 else "NO")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
for i in range(B+1):
    if i*a%b == c:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int, input().split())
if c % math.gcd(a, b) == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int, input().split())
if c % math.gcd(a, b) == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
from franctions import gcd
a,b,c = map(int, input().split())
if c % gcd(a, b) == 0:
    print("YES")
else:
    print("NO")
Problem p04044 (python)

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

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
s = sorted([input() for i in n])
print("".join(s))
Problem p03035 (python)

Fixed submission:
a,b=input().split()
if int(a) >= 13:
  print(b)
elif int(a) >= 6:
  m = int(b) /  2
  print(int(m))
else:
  print("0")

Buggy submission (verdict: Runtime Error):
r,d,x=input().split()
m = int(x)
for i in range(1, 11):
    m = int(r) * int(m) - int(d)
    print(int(m))
Problem p03000 (python)

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

distance = 0
for i in range(N):
  distance += L[i]
  if distance > X:
    print(i+1)
    break
else: 
  print(N+1)

Buggy submission (verdict: Runtime Error):
N,X = map(int, input().split())
L = list(map(int, input().split()))

distance = 0
for i in range(N+1):
  distance += L[i]
  if distance >= X:
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
N,X = map(int, input().split())
L = list(map(int, input().split()))

distance = 0
for i in range(N+1):
  distance += L[i]
  if distance > X:
    print(i+1)
    break
Problem p03006 (python)

Fixed submission:
from collections import Counter
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
 
counter = Counter(((b1[0] - b2[0], b1[1] - b2[1])for b1 in xy for b2 in xy if b1 != b2))
print(N - (list(counter.most_common())+[(0,0)])[0][1])

Buggy submission (verdict: Runtime Error):
#標準入力
N = int(input())
S = []
S = [list(map(int, input().split())) for i in range(N)]

ans = 1
i = 0
j = 0
for _ in range(N):
  if i==N:
    break
  try:
    a =(S[i+1][1]-S[i][1])/(S[i+1][0]-S[i][0])
    b = S[i][1]-a*S[i][0]
    for _ in range(N):
      if j == N:
        i = N
        break
      if S[j][1]!=a*S[j][0]+b:
        ans+=1
        break
      else:
        S.remove(S[j])
        N -= 1
      j +=1  
  except:

    for _ in range(N):
      if j == N:
        i = N
        break
      if S[j][0]!=S[i][0]:
        ans+=1
        break
      else: 
        S.remove(S[j])
        N -= 1
      j+=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
#標準入力
N = int(input())
S = []
S = [list(map(int, input().split())) for i in range(N)]

ans = 1
i = 0
j = 0
for _ in range(N):
  if i==N:
    break
  try:
    a =(S[i+1][1]-S[i][1])/(S[i+1][0]-S[i][0])
    b = S[i][1]-a*S[i][0]
    for _ in range(N):
      if j == N:
        i = N
        break
      if S[j][1]!=a*S[j][0]+b:
        ans+=1
        break
      else:
        S.remove(S[j])
        N -= 1
      j +=1  
  except:

    for _ in range(N):
      if j == N:
        i = N
        break
      if S[j][0]!=S[i][0]:
        ans+=1
        i = j
        break
      else: 
        S.remove(S[j])
        N -= 1
      j+=1
    
print(ans)
Problem p03061 (python)

Fixed submission:
import fractions
N = int(input())
values = ([int(x) for x in input().split()])

gcd_from_the_left = []
gcd_from_the_left.append(values[0])
for i in range(N):
	gcd_from_the_left.append(fractions.gcd(gcd_from_the_left[i],values[i]))
gcd_from_the_left.pop(0)

gcd_from_the_right = []
gcd_from_the_right.append(values[-1])
for i in range(N):
	gcd_from_the_right.append(fractions.gcd(gcd_from_the_right[i],values[-i-1]))

gcd_from_the_right.pop(0)

ans = 0
gcd = 0

for i in range(N-2):
  gcd = fractions.gcd(gcd_from_the_left[i],gcd_from_the_right[N-i-3])
  if gcd > ans:
    ans = gcd
    
gcd = gcd_from_the_left[-2]
if gcd > ans:
  ans = gcd
gcd = gcd_from_the_right[-2]
if gcd > ans:
  ans = gcd
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
values = ([int(x) for x in input().split()])

gcd_from_the_left = []
gcd_from_the_left.append(values[0])
for i in range(N):
	gcd_from_the_left.append(fractions.gcd(gcd_from_the_left[i],values[i]))
gcd_from_the_left.pop(0)

gcd_from_the_right = []
gcd_from_the_right.append(values[-1])
for i in range(N):
	gcd_from_the_right.append(fractions.gcd(gcd_from_the_right[i],values[-i-1]))

gcd_from_the_right.pop(0)

ans = 0
gcd = 0

for i in range(N-2):
  gcd = fractions.gcd(gcd_from_the_left[i],gcd_from_the_right[N-3+i])
  if gcd > ans:
    ans = gcd
    
gcd = gcd_from_the_left[-2]
if gcd > ans:
  ans = gcd
gcd = gcd_from_the_right[-2]
if gcd > ans:
  ans = gcd
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
values = ([int(x) for x in input().split()])

gcd_from_the_left = []
gcd_from_the_left.append(values[0])
for i in range(N):
	gcd_from_the_left.append(fractions.gcd(gcd_from_the_left[i],values[i]))
gcd_from_the_left.pop(0)

gcd_from_the_right = []
gcd_from_the_right.append(values[-1])
for i in range(N):
	gcd_from_the_right.append(fractions.gcd(gcd_from_the_right[i],values[-i-1]))

gcd_from_the_right.pop(0)

ans = 0
gcd = 0

for i in range(N):
  gcd = fractions.gcd(gcd_from_the_left[i],gcd_from_the_right[-(N-3+i)])
  if gcd > ans:
    ans = gcd
    
gcd = gcd_from_the_left[-2]
if gcd > ans:
  ans = gcd
gcd = gcd_from_the_right[-2]
if gcd > ans:
  ans = gcd
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import functools
import fractions
from functools import reduce
import itertools
gcd3 = 0
gcd4 = 0
ans = 0
N = int(input())
values = ([int(x) for x in input().split()])

divided_values = [values[i::2] for i in range(2)]

values1 = divided_values[0].copy()
values2 = divided_values[1].copy()
gcd1 = functools.reduce(fractions.gcd,values1)
gcd2 = functools.reduce(fractions.gcd,values2)

for i in range(len(values1)):
  tem = values1.pop(i)
  gcd3 = fractions.gcd(gcd2,functools.reduce(fractions.gcd,values1))
  values1.insert(i,tem)
  if gcd3>gcd4:
    gcd4 = gcd3
    ans = gcd3

if len(values2)>1:
  for i in range(len(values2)):
    tem = values2.pop(i)
    gcd3 = fractions.gcd(gcd1,functools.reduce(fractions.gcd,values2))
    values2.insert(i,tem)
    if gcd3>gcd4:
      gcd4 = gcd3
      ans = gcd3
    
print(ans)
Problem p02811 (python)

Fixed submission:
K,X=map(int,input().split())
if 500*K >= X:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
K,X=input().split()
if 500*K >= X:
  print("Yes")
else*
  print("No")

Buggy submission (verdict: Runtime Error):
X,K=input().split()
if 500*X >= K:
  print("Yes")
else*
  print("No")
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
  print('Hello World')
else:
  a,b=map(int,input().split())
  print(a+b)
Problem p03316 (python)

Fixed submission:
n = int(input())
total = 0
for i in range(len(str(n))):
  total += int(str(n)[i])
if n%total == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
total = 0
for i in range(len(str(n))):
  total += str(n)[i]
if N%total == 0:
  print('Yes')
else:
  print('No')
Problem p03355 (python)

Fixed submission:
s = input().rstrip()
k = int(input())
result = []
for i in range(len(s)):
  for j in range(i+1,i+k+1):
    if j <= len(s) and s[i:j] not in result:
      result.append(s[i:j])
result.sort()
print(result[k-1])

Buggy submission (verdict: Runtime Error):
s = input().rstrip()
k = int(input())
result = []
for i in range(len(s)):
  for j in range(i+1,i+k):
    if i+k <= len(s):
      result.append(s[i:j])
result.sort()
print(result[k-1])
Problem p03362 (python)

Fixed submission:
import math

n=int(input())

# create a list of 2 ... n
primes = list(range(2, 2000))
root_n = int(2000 ** (1/2)) + 1
# check each of numbers
i = j = 0
for p, q in enumerate(primes):
    if q >= root_n:
        break
    elif q:
        for r in range(p + q, 2000 - 2, q):
            if primes[r]:
                primes[r] = 0
result = [str(2)]
Plist = [primes[x] for x in range(len(primes)) if primes[x] > 0 and primes[x]%5 == 1]
for i in range(n-1):
    result.append(str(Plist[i]))
print(' '.join(result))

Buggy submission (verdict: Runtime Error):
import math

n=int(input())

primes = list(range(2, 400))
root_n = int(400 ** (1/2)) + 1
i = j = 0
for p, q in enumerate(primes):
    if q >= root_n:
        break
    elif q:
        for r in range(p + q, 400 - 2, q):
            if primes[r]:
                primes[r] = 0
result = [str(2)]
Plist = [primes[x] for x in range(len(primes)) if primes[x] > 0 and primes[x]%3 == 1]
for i in range(n-1):
    result.append(str(Plist[i]))
print(' '.join(result))
Problem p03386 (python)

Fixed submission:
A,B,K=map(int,input().split())
result = []
L = min(B-A+1,K)
for i in range(A,A+L):
    if i not in result:
        result.append(i)
for j in range(B,B-L,-1):
    if j not in result:
        result.append(j)
result.sort()
for x in result:
    print(x)

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
nums = list(range(A,B+1))
result = []
L = min(B-A+1,K)
for i in range(L):
    if nums[i] not in result:
        result.append(nums[i])
nums.sort(reverse=True)
for j in range(L):
    if nums[j] not in result:
        result.append(nums[j])
result.sort()
for x in result:
    print(x)

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
nums = list(range(A,B+1))
result = set()
L = min(B-A+1,K)
for i in range(L):
    result.add(nums[i])
nums.sort(reverse=True)
for j in range(L):
    result.add(nums[j])
for x in result:
    print(x)

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
nums = list(range(A,B+1))
result = set()
L = min(B-A+1,K)
for i in range(L):
    result.add(nums[i])
for j in range(1,L+1):
    result.add(nums[-j])
for x in result:
    print(x)
Problem p03423 (python)

Fixed submission:
N=int(input())
print(int(N/3))

Buggy submission (verdict: Runtime Error):
tmp =input().split()
H,W,D=int(tmp[0]),int(tmp[1]),int(tmp[2])

list = [[0 for x in range(W)] for y in range(H)]
dict = {}
for i in range(H):
    tmp = input().split()
    for d in range(W):
        dict[tmp[d]] = str(i)+' '+str(d)
result ={}
cost ={}

def calcost(L,R,D):
    if int(R)<=D:
        cost[R] = 0
        return 0
    else:
        posi1 = dict[R].split()
        posi2 = dict[str(int(R)-D)].split()
        costs = abs(int(posi2[0])-int(posi1[0])) + abs(int(posi2[1])-int(posi1[1]))
        if str(int(R)-D) in cost:
            cost[R] = costs + cost[str(int(R)-D)]
            return cost[R]
        else:
            cost[R] = costs + calcost(L,str(int(R)-D),D)
            return cost[R]

for n in range(D+1,H*W+1):
    calcost(str(1),str(n),D)

Q = int(input())
for j in range(Q):
    tmpx = input()
    if tmpx in result:
        print(result[tmpx])
    else:
        tmp = tmpx.split()
        result[tmpx] = cost[tmp[1]]-cost[tmp[0]]
        print(result[tmpx])
Problem p03435 (python)

Fixed submission:
sum = 0
list = [[0 for x in range(3)] for y in range(3)]
for i in range(3):
    tmp = input().split()
    list[i] = tmp
    sum += int(tmp[0]) + int(tmp[1]) + int(tmp[2])

flg = True
if sum%3 ==0:
    for n in range(2):
        for m in range(2):
            if (int(list[n][m]) + int(list[n+1][m+1]))!=(int(list[n+1][m])+int(list[n][m+1])):
                flg = False
                break
    if flg:
        print('Yes')
    else:
        print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
sum = 0
zero = 0
for i in range(3):
	tmp = input().split()
	for j in range(3):
    	if int(tmp[j]) == 0:
    		zero += 1
        else:
        	sum += int(tmp[j])    
if sum%3 ==0 and zero%3 ==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
sum = 0
for i in range(3)
	tmp = input().split()
	sum += int(tmp[0])+int(tmp[1])int(tmp[2])
if sum%3 ==0:
  print('Yes')
else:
  print('No')
Problem p03457 (python)

Fixed submission:
N = int(input())
flg = True
cnt,now,posx,posy=0,0,0,0
while cnt < N and flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
    cnt += 1
if flg:
  print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
flg = True
now,posx,posy=0,0,0
while flg==True:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
if flg:
  print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
flg = True
now,posx,posy=0,0,0
while flg==True:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = n
    posx = x
    posy = y
if flg:
  print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
flg = True
#start
now,posx,posy=0,0,0
while flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = false
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =false
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =false
    print('No')
  else:
    now = n
    posx = x
    posy = y
if flg:
  print('Yes')
Problem p03471 (python)

Fixed submission:
N,Y=map(int,input().split())
Y = Y/1000
a,b,c =0,0,0
flg = True
if 10*N < Y:
  a,b,c = -1,-1,-1
#elif float(Y/10 + Y%5) > float(N):
#  a,b,c = -1,-1,-1
else:
    for n in range(int(N/5)+1):
        c = int(Y%5 + 5*n)
        for i in range(N-c+1):
            if (5*i + 5*N) == (Y + 4*c):
                flg = False
                a , b = i , (N-c-i)
                break
        if not flg:
            break
if flg:
    a,b,c = -1,-1,-1
print(a,b,c)

Buggy submission (verdict: Runtime Error):
N,Y=map(int,input().split())
Y = Y/1000
a,b,c =0,0,0
if 10*N < Y:
  a,b,c = -1,-1,-1
elif Y/10 + Y%5 > float(N):
  a,b,c = -1,-1,-1
else:
    flg = True
    for n in range(int(N/5)+1):
        c = int(Y%5 + 5*n)
        for i in range(N-c+1):
            if (5*i + 5*N) == (Y + 4*c):
                flg = False
                a , b = i , (N-c-i)
                break
        if flg==False:
            break
if flg:
    a,b,c = -1,-1,-1
print(a,b,c)
Problem p03473 (python)

Fixed submission:
N = int(input())
print(48-N)

Buggy submission (verdict: Runtime Error):
import math
import bisect
Q=int(input())

querys = [list(map(int,input().split())) for x in range(Q)]

def siever(x):
  nums = [a for a in range(2,x+1)]
  primes = []
  while nums[0] <= int(math.sqrt(x))+1:
    tmp = nums.pop(0)
    primes.append(tmp)
    for num in nums:
      if num%tmp == 0:
        nums.remove(num)
        continue
  
  return (primes+nums)

L = 0
for query in querys:
  L = max(L,query[1])
primes = siever(L)
L2017= []
for prime in primes:
  if (prime+1)//2 in primes:
    L2017.append(prime)
result = [0]*(max(L2017)+1)
for l in L2017:
  result[l] = 1
for i in range(1,len(result)):
  result[i] += result[i-1]
for query in querys:
  if query[0] == query[1] and query[0] in L2017:
    print(1)
  else:
    if len(result) <= query[0]:
      print(0)
    elif len(result) <= query[1]:
      print(result[-1]-result[query[0]-1])
    else:
      print(result[query[1]]-result[query[0]-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
print(48-M)
Problem p03477 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
if A+B==C+D:
  print('Balanced')
elif A+B>C+D:
  print('Left')
else:
  print('Right')

Buggy submission (verdict: Runtime Error):
X,Y=map(int,input().split())
dev = int(Y/X)
work = 1
for i in range(74):
  tmp = pow(2,i)
  if tmp <= dev and dev < tmp*2:
    work +=i
    break
print(work)

Buggy submission (verdict: Runtime Error):
X,Y=map(int,input().split())
dev = int(Y/X)
work = 1
for i in range(108):
  tmp = pow(2,i)
  if tmp <= dev and dev < tmp*2:
    work +=i
    break
print(work)
Problem p03478 (python)

Fixed submission:
N,A,B=map(int,input().split())
sum = 0
for i in range(1,N+1):
  work = 0
  for j in range(len(str(i))):
    work += int(str(i)[j])
  if A <= work and work <=B:
    sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input())
sum = 0
for i in range(1,N+1):
  work = 0
  for j in range(len(str(i))):
    work += int(str(i)[j])
  if A <= work and work <=B:
    sum +=1
print(sum)