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

Fixed submission:
# coding: utf-8
# Your code here!

a,b = map(int,input().split())

print(max(0,a-2*b))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

a,b = map(int,input().split())

print(max(0,a-2b))
Problem p02911 (python)

Fixed submission:
n,k,q = map(int,(input().split()))

an = [0] * n

for i in range(q):
    an[int(input())-1] += 1

ans = ["No","Yes"]
#print(an)
for j in range(n):
    print(ans[k-q+an[j]>0])

Buggy submission (verdict: Runtime Error):
n,k,q = map(int,(input().split()))

an = [0] * n

for i in range(q):
    an[int(input())] += 1

ans = ["No","Yes"]

for j in range(n):
    print(ans[k-q+an[j]>0])
Problem p02934 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
     
tmp = 0
for i in a:
    tmp += 1/i

print(1/tmp)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

tmp = 0
for i in a:
   tmp += 1/a 

print(1/tmp)
Problem p02953 (python)

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

i = 0
flag = 0

if(n > 2):
    for i in range(1,n-1):
        #print(h)
        if(h[i] > h[i+1] + 1):
            flag = 1
            break
        elif(h[i] == h[i+1]+1):
            if(h[i-1] == h[i]):
                flag = 1
                break
            else:
                h[i] -= 1
        elif(h[i-1] != h[i]):
            h[i] -= 1
    
    if(h[-2] > h[-1]):
        flag = 1   
elif(n == 2):
    if(h[0]-1 > h[1]):
        flag = 1


if(flag == 0 or n == 1):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))

i = 0
flag = 0

if(n > 2):
    for i in range(1,n-1):
        print(h)
        if(h[i] > h[i+1] + 1):
            flag = 1
            break
        elif(h[i] == h[i+1]+1):
            if(h[i-1] == h[i]):
                flag = 1
                break
            else:
                h[i] -= 1
        elif(h[i-1] != h[i]):
            h[i] -= 1
    
    if(h[-2] > h[-1]):
        flag = 1   
elif(n == 2):
    if(h[0]-1 > h[1]):
        flag = 1

if(flag == 0 or n == 1):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))

i = 0
flag = 0
for i in range(1,n-1):
    #print(h)
    if(h[i] > h[i+1] + 1):
        break
        flag = 1
    elif(h[i] == h[i+1]+1):
        if(h[i-1] == h[i]):
            break
            flag = 1
        else:
            h[i] -= 1
    elif(h[i-1] != h[i]):
        h[i] -= 1

if(h[-2] > h[-1]):
    flag = 1    


if(flag == 0 or n == 1):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))

i = 0
flag = 0
for i in range(1,n-1):
    print(h)
    if(h[i] > h[i+1]+2):
        break
        flag = 1
    elif(h[i] >= h[i+1]+1):
        if(h[i-1] == h[i]):
            break
            flag = 1
        else:
            h[i] -= 1
    elif(h[i-1] != h[i]):
        h[i] -= 1

if(h[n-2] > h[n-1]):
    flag = 1    



if(flag == 0 or n == 1):
    print("Yes")
else:
    print("No")
Problem p02969 (python)

Fixed submission:
# coding: utf-8
# Your code here!

r = int(input())
 
print(3*r*r)

Buggy submission (verdict: Runtime Error):
 r = int(input())
 
 print(3*r*r)
Problem p02971 (python)

Fixed submission:
n = int(input())

li = [int(input()) for i in range(n)]
ls = sorted(li, reverse = True)

m1 = ls[0]
m2 = ls[1]
"""
for i in range(0,n):
    if(ls[i] != m1):
        m2 = ls[i]
        break
"""

for i in li:
    print(m1 if(i != m1) else m2)

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

li = [int(input()) for i in range(n)]
ls = sorted(li, reverse = True)

m1 = ls[0]

for i in range(1,n):
    if(ls[i] != m1):
        m2 = ls[i]
        break

for i in li:
    print(m1 if(i != m1) else m2)
Problem p02981 (python)

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

print(min(n*a, b))

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

print(min(n*a,b))
Problem p02983 (python)

Fixed submission:
import math

l, r = map(int, input().split())

ls = l % 2019
rs = r % 2019

dif = r // 2019 - l // 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (r - l == 1):
    print(ls*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs+1)))
    print(min(mini))

Buggy submission (verdict: Runtime Error):
import math

l, r = map(int, input().split())

ls = l % 2019
rs = r % 2019

dif = r // 2019 - l // 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (r - l == 1):
    print(lr*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs)))
    print(min(mini))
Problem p03068 (python)

Fixed submission:
n = int(input())
s =list(input())
k = int(input())

chk = s[k-1]
for i in range(len(s)):
	if(s[i] != chk):
		s[i] = "*"
	print(s[i],end="")
print("")

Buggy submission (verdict: Runtime Error):
n = int(input())
s =list(input())
k = int(input())

chk = s[k]
for i in range(len(s)):
	if(s[i] != chk):
		s[i] = "*"
print("".join(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
s =list(input())
k = int(input())

chk = s[k]
for i in range(len(s)):
	if(s[i] != chk):
		s[i] = "*"
print("".join(s))
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(2*a-1,2*b-1,a+b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input.split())
print(max(2a-1,2b-1,a+b))
Problem p03076 (python)

Fixed submission:
x = [int(input()) for i in range(5)]
y = []
for i in range(5):
    tmp = x[i]%10
    if(tmp!=0):
        y.append(tmp)
if (y==[]):
    y = [0]
md = min(y)
print(sum(x[i]//10 for i in range(5))*10 + (len(y)-1)*10+md)

Buggy submission (verdict: Runtime Error):
x = [int(input()) for i in range(5)]
y = []
for i in range(5):
    tmp = x[i]%10
    if(tmp!=0):
        y.append(tmp)
md = min(y)
print(sum(x[i]//10 for i in range(5))*10 + (len(y)-1)*10+md)
Problem p03085 (python)

Fixed submission:
X = input()

if (X == "A"):
    print("T")
elif (X =="T"):
    print("A")
elif (X == "G"):
    print("C")
else:
    print("G")

Buggy submission (verdict: Runtime Error):
X = input()

if (X == “A”):
    print(“T”)
elif (X ==“T”):
    print(“A”)
elif (X == “G”):
    print(“C”)
else:
    print(“G”)

Buggy submission (verdict: Runtime Error):
X = input()

if (X == A):
    print(“T”)
elif (X ==T):
    print(“A”)
elif (X == G):
    print(“C”)
else:
    print(“G”)
Problem p03106 (python)

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

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sort(reverse=True)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)

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

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sorted(reverse)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)

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

olist = []
cnt = 0
for i in range(1, int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    olist.append(i)
    cnt = 1
if (cnt == 1):
  print(olist[len(olist) + 1 - list[2]])
else:
  print(1)

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

olist = []
for i in range(1, int(min(list[0],list[1]) / 2)):
  if(list[0] % i == 0 and list[1] % i == 0):
    olist.append(i)
print(olist[len(olist) + 1 - list[2]])
Problem p03145 (python)

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

if (A*A+B*B==C*C):
    s = A*B/2
elif (A*A+C*C==B*B):
    s = A*C/2
else:
    s = B*C/2

print(int(s))

Buggy submission (verdict: Runtime Error):
A, B, C = int(input())

if (A*A+B*B==C*C):
    print(A*B/2)
elif (A*A+C*C==B*B):
    print(A*C/2)
else:
    print(B*C/2)
Problem p03156 (python)

Fixed submission:
# coding: utf-8

n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

cnt = [0,0,0]

for i in range(0,n):
    if(p[i] <= a):
        cnt[0]+=1
    elif(a < p[i] <= b):
        cnt[1]+=1
    else:
        cnt[2]+=1

#print(cnt)
print(min(cnt))

Buggy submission (verdict: Runtime Error):
# coding: utf-8

n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

sep = []
for i in range(0,n):
    if(p[i] > a):
        sep.append(i)
        break
for i in range(sep[0],n):
    if(p[i] > b):
        sep.append(i)
        break

q1 = len(p[0:sep[0]])
q2 = len(p[sep[0]:sep[1]])
q3 = len(p[sep[1]:n])


#print("{}, {}, {}".format(q1,q2,q3))
print(min(q1,q2,q3))

Buggy submission (verdict: Runtime Error):
# coding: utf-8

n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

sep = []
for i in range(0,n-1):
    if(p[i] > a):
        sep.append(i)
        break
for i in range(sep[0],n-1):
    if(p[i] > b):
        sep.append(i)
        break

q1 = len(p[0:sep[0]])
q2 = len(p[sep[0]:sep[1]])
q3 = len(p[sep[1]:n])


#print("{}, {}, {}".format(q1,q2,q3))
print(min(q1,q2,q3))
Problem p03206 (python)

Fixed submission:
D = int(input())
if (D == 25):
    print("Christmas")
elif (D == 24):
    print("Christmas Eve")
elif (D == 23):
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
Num = []
Num = list(map(int,input().split(" "))) #0-all 1-pick
lists = []
for i in range(0,Num[0]):
    lists.append(int(input()))
lists.sort()
lists.reverse()
dist = lists[0] - lists[0+Num[1]-1]
for j in range(1,Num[0] - Num[1] + 1):
    tmp = lists[j] - lists[j+Num[1]-1]
    if (dist > tmp):
        dist = tmp
print(dist)

Buggy submission (verdict: Runtime Error):
X = int(input())
if (D == 25):
    print("Christmas")
elif (D == 24):
    print("Christmas Eve")
elif (D == 23):
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
Problem p03219 (python)

Fixed submission:
X, Y = map(int, input().split())

print(int(X + Y/2))

Buggy submission (verdict: Runtime Error):
print(int(input())+int(input())/2)

Buggy submission (verdict: Runtime Error):
print(int(input())+Int(input())/2)
Problem p03239 (python)

Fixed submission:
Base = input().split(" ")
N = int(Base[0])
TL = int(Base[1])
TX = 10000

for i in range(N):
    Roi = input().split(" ")
    Coi = int(Roi[0])
    TLi = int(Roi[1])
    if TL >= TLi:
        if TX >= int(Coi) or i ==0:
            TX = Coi
if TX == 10000:
    print("TLE")
else:
    print(TX)

Buggy submission (verdict: Runtime Error):
Base = input().split(" ")
N = int(Base[0])
TL = int(Base[1])
TX = 10000

for i in range(N):
    Roi = input().split(" ")
    Coi = int(Roi[0])
    TLi = int(Roi[1])
    if TL >= TLi:
        if TX >= int(Coi) or i ==0:
            TX = Coi
if TX == 10000:
    print("TLE")
elif:
    print(TX)
Problem p03243 (python)

Fixed submission:
N = int(input())
if N <=111:
    print("111")
elif N <=222:
    print("222")
elif N <=333:
    print("333")
elif N <= 444:
    print("444")
elif N <=555:
    print("555")
elif N <=666:
    print("666")
elif N <=777:
    print("777")
elif N <=888:
    print("888")
else:
    print("999")

Buggy submission (verdict: Runtime Error):
N = int(input())
if N <=111:
    print("111")
elif N <=222:
    print("222")
elif N <=333:
    print("333")
elif N <= 444:
    print("444")
elif N <=555:
    print("555")
elif N <=666
    print("666")
elif N <=777:
    print("777")
elif N <=888:
    print("888")
else:
    print("999")
Problem p03361 (python)

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

mp = []
for i in range(h):
    tmp = list(input())
    tml = []
    for j in range(w):
        tml.append(0 if tmp[j] == "." else 1)
    mp.append(tml)
    
#print(mp)

flg = 0
for i in range(1,h-1):
    for j in range(1,w-1):
        if((mp[i][j] == 1) and (mp[i-1][j]+mp[i+1][j]+mp[i][j-1]+mp[i][j+1] == 0)):
            flg = 1
 #           print("{}, {}".format(i,j))
            break
        
ans = ["Yes","No"]
		
print(ans[flg])

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())

mp = []
for i in range(h):
    tmp = list(input())
    tml = []
    for j in range(w):
        tml.append(0 if tmp[j] == "." else 1)
    mp.append(tml)

flg = 0
for i in range(1,h-1):
    for j in range(1,w-1):
        if(mp[i-1][j]+mp[i+1][j]+mp[i][j-1]+mp[i][j+1] == 0):
            flag = 1
            break
        
ans = ["YES","NO"]
		
print(ans[flag])
Problem p03370 (python)

Fixed submission:
n, x = map(int,input().split())
m = []
ans = n
for i in range(n):
    m.append(int(input()))
x -= sum(m)
ans+=(x//min(m))
print(ans)

Buggy submission (verdict: Runtime Error):
n, x = map(int,input().split())
m = []
ans = len(n)
for i in range(n):
    m.append(int(input()))
x -= sum(m)
ans+=(x//min(m))
Problem p03591 (python)

Fixed submission:
s = input()

ans = 0

if (len(s) >= 4):
    if (s[0:4] == "YAKI"):
        ans = 1

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

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

ans = 0

if (len(s) >= 4):
    if (s[0:4] == "YAKI"):
        ans = 1

if(ans == 1)
    print("Yes")
else:
    print("No")
Problem p04026 (python)

Fixed submission:
s = input()

for i in range(len(s) - 2):
    if (s[i] == s[i + 1] or s[i] == s[i + 2]):
        print("{} {}".format(i + 1, i + 3))
        break
else:
    if (s[-2] == s[-1]):
        print("{} {}".format(len(s) - 1, len(s)))
    else:
        print("-1 -1")

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

for i in range(len(s) - 2):
    if (s[i] == s[i + 1] or s[i] == s[i + 2]):
        print("{} {}".format(i + 1, i + 3))
        break
else:
    if (s[-2] == s[-1]):
        print("{} {}".format(len(n) - 1, len(n)))
    else:
        print("-1 -1")
Problem p04030 (python)

Fixed submission:
s = list(input())

ans = []
for i in s:
    if (i == "B"):
        if(len(ans)!=0):
            ans.pop(-1)
    else:
        ans+=i

for i in ans:
    print(i, end="")

print("")

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

ans = []
for i in s:
    if(i == "B"):
        ans.pop(-1)
    else:
        ans+=i

for i in ans:
    print(i, end="")

print("")
Problem p03262 (python)

Fixed submission:
n,k=map(int,input().split())
t=[]
s=list(map(int,input().split()))
for i in s:
    t.append(abs(i-k))
from fractions import gcd
from functools import reduce
print(reduce(gcd,t))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
t=[]
s=list(map(int,input().split()))
for i in s:
    t.append(abs(i-k))
import math
from functools import reduce
print(reduce(math.gcd,t))
Problem p03330 (python)

Fixed submission:
import numpy as np
N,C=map(int,input().split())
ans=10**9
a=np.array([0]*C)
b=np.array([0]*C)
c=np.array([0]*C)
s=[]
t=[]
for i in range(C):
    s.append(list(map(int,input().split())))
for i in range(N):
    t.append(list(map(int,input().split())))
for j in range(N):
    for i in range(N):
        if (i+j)%3==0:
            a+=np.array(s[t[i][j]-1])
        elif (i+j)%3==1:
            b+=np.array(s[t[i][j]-1])
        else:
            c+=np.array(s[t[i][j]-1])
from itertools import permutations
for i,j,k in permutations(range(C),3):
    p=a[i]+b[j]+c[k]
    ans=min(p,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
ans=10**9
a=np.array([0,0,0])
b=np.array([0,0,0])
c=np.array([0,0,0])
s=[]
t=[]
N,C=map(int,input().split())
for i in range(C):
    s.append(list(map(int,input().split())))
for i in range(N):
    t.append(list(map(int,input().split())))
for j in range(N):
    for i in range(N):
        if (i+j)%3==0:
            a+=np.array(s[t[i][j]-1])
        elif (i+j)%3==1:
            b+=np.array(s[t[i][j]-1])
        else:
            c+=np.array(s[t[i][j]-1])
from itertools import permutations
for i,j,k in permutations(range(C),3):
    p=a[i]+b[j]+c[k]
    ans=min(p,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
ans=10**9
a=np.array([0,0,0])
b=np.array([0,0,0])
c=np.array([0,0,0])
s=[]
t=[]
N,C=map(int,input().split())
for i in range(C):
    s.append(list(map(int,input().split())))
for i in range(N):
    t.append(list(map(int,input().split())))
for j in range(N):
    for i in range(N):
        if (i+j)%3==0:
            a+=np.array(s[t[i][j]-1])
        elif (i+j)%3==1:
            b+=np.array(s[t[i][j]-1])
        else:
            c+=np.array(s[t[i][j]-1])
from itertools import permutations
for i,j,k in list(permutations([0,1,2])):
    p=a[i]+b[j]+c[k]
    ans=min(ans,p)
print(ans)
Problem p03379 (python)

Fixed submission:
N=int(input())
s=list(map(int,input().split()))
t=sorted(s)
p=t[N//2-1]
q=t[N//2]
for i in range(N):
    if s[i]<=p:
        print(q)
    else:
        print(p)

Buggy submission (verdict: Runtime Error):
N=int(input())
s=list(map(int,input().split()))
t=sorted(s)
p=t[N//2]
q=t[N//2+1]
for i in range(N):
    if s[i]<=p:
        print(q)
    else:
        print(p)
Problem p03380 (python)

Fixed submission:
N=int(input())
s=list(map(int,input().split()))
n=max(s)
s.remove(n)
q=n
for i in s:
    t=abs(n/2-i)
    if q>=t:
        q=t
        w=str(n)+" "+str(i)
print(w)

Buggy submission (verdict: Runtime Error):
def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)
ans=0    
N=int(input())
s=list(map(int,input().split()))
t=max(s)
for i in s:
    c=fact(t)/(fact(i)*fact(t-i))
    if ans<c and t!=i:
        ans=c
        an=i
print(str(t)+" "+str(an))

Buggy submission (verdict: Runtime Error):
def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)
ans=0    
N=int(input())
s=list(map(int,input().split()))
t=max(s)
for i in s:
    c=fact(t)/(fact(i)*fact(t-i))
    if ans<c and c!=i:
        ans=c
        an=i
print(str(t)+" "+str(an))        
print(fact(0))

Buggy submission (verdict: Runtime Error):
def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)
ans=0    
N=int(input())
s=list(map(int,input().split()))
t=max(s)
for i in s:
    c=fact(t)/(fact(i)*fact(t-i))
    if ans<c:
        ans=c
        an=i
print(str(t)+" "+str(an))
Problem p03436 (python)

Fixed submission:
h,w=map(int,input().split())
s=[[] for j in range(h)]
t=[[0]*w for k in range(h)]
t[0][0]=1
q=0
u=[]
for i in range(h):
    s[i]+=list(input())
    q+=s[i].count("#")
u.append((0,0))
while u!=[]:
    (x,y)=u[0]
    if x!=h-1:
        if t[x+1][y]==0 and s[x+1][y]==".":
            t[x+1][y]=t[x][y]+1
            u.append((x+1,y))
    if y!=w-1:        
        if t[x][y+1]==0 and s[x][y+1]==".":
            t[x][y+1]=t[x][y]+1
            u.append((x,y+1))
    if x!=0:        
        if t[x-1][y]==0 and s[x-1][y]==".":
            t[x-1][y]=t[x][y]+1
            u.append((x-1,y))
    if y!=0:        
        if t[x][y-1]==0 and s[x][y-1]==".":
            t[x][y-1]=t[x][y]+1
            u.append((x,y-1))
    u.pop(0)
if t[h-1][w-1]==0:
    print(-1)
else:    
    print((h*w-t[h-1][w-1])-q)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[[] for j in range(h)]
t=[[0]*w for k in range(h)]
t[0][0]=1
q=0
u=[]
for i in range(h):
    s[i]+=list(input())
    q+=s[i].count("#")
u.append((0,0))
while t[h-1][w-1]==0:
    (x,y)=u[0]
    if x!=h-1:
        if t[x+1][y]==0 and s[x+1][y]==".":
            t[x+1][y]=t[x][y]+1
            u.append((x+1,y))
    if y!=w-1:        
        if t[x][y+1]==0 and s[x][y+1]==".":
            t[x][y+1]=t[x][y]+1
            u.append((x,y+1))
    if x!=0:        
        if t[x-1][y]==0 and s[x-1][y]==".":
            t[x-1][y]=t[x][y]+1
            u.append((x-1,y))
    if y!=0:        
        if t[x][y-1]==0 and s[x][y-1]==".":
            t[x][y-1]=t[x][y]+1
            u.append((x,y-1))
    u.pop(0)    
print((h*w-t[h-1][w-1])-q)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[[] for j in range(h)]
t=[[0]*w for k in range(h)]
t[0][0]=1
q=0
u=[]
for i in range(h):
    s[i]+=list(input())
    q+=s[i].count("#")
u.append((0,0))
while t[h-1][w-1]==0:
    (x,y)=u[0]
    if x!=h-1:
        if t[x+1][y]==0 and s[x+1][y]==".":
            t[x+1][y]=t[x][y]+1
            u.append((x+1,y))
    if y!=w-1:        
        if t[x][y+1]==0 and s[x][y+1]==".":
            t[x][y+1]=t[x][y]+1
            u.append((x,y+1))
    if x!=0:        
        if t[x-1][y]==0 and s[x-1][y]==".":
            t[x-1][y]=t[x][y]+1
            u.append((x-1,y))
    if y!=0:        
        if t[x][y-1]==0 and s[x][y-1]==".":
            t[x][y-1]=t[x][y]+1
            u.append((x,y-1))
    u.pop(0)    
print((h*w-t[h-1][w-1])-q)
Problem p03449 (python)

Fixed submission:
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
retu = int(input())
gyo1 = list(map(int,input().split()))
gyo2 = list(map(int,input().split()))
num = 0
kai=0
boss=[]
for i in range(retu):
    for ii in range(i + 1):
        num += gyo1[ii]
    for iii in range(retu-i):
        num += gyo2[iii+i]
    boss.append(num)
    num=0
#print(boss)
oss = sorted(boss)
print(oss[retu-1])

Buggy submission (verdict: Runtime Error):
retu = input()
gyo1 = list(map(int,input().split()))
gyo2 = list(map(int,input().split()))
goal=[]
for i in range(retu):
    kai = sum(gyo1[0:i+1]) + sum(gyo2[i:])
    goal.append(kai)
print(max(goal))
Problem p03471 (python)

Fixed submission:
# coding: utf-8
# hello worldと表示する
a,b=map(int,input().split())
ans=True
for i in range(a+1):
    for j in range(a+1-i):
        if ans==True:
            s=10000*i+5000*j+1000*(a-i-j)
            if s == b:
                print(str(i)+" "+str(j)+" "+str(a-i-j))
                ans = False
        else:
            break
if ans==True:
    print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N,ans,x=int(input()),0,0
s=sorted([int(input()) for i in range(N)])
for i in range(N):
    if s[i]>x:
        ans+=1
        x=s[i]
print(ans)
Problem p03486 (python)

Fixed submission:
s=sorted(input())
t=sorted(input(),reverse=True)
a=sorted([s,t])
if s==t:
    print("No")
    exit()
if a[0]==s:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=sorted(input())
t=sorted(input(),reverse=True)
if s==t:
	print("No")
    exit()
a=sorted([s,t])
if a[0]==s:
    print("Yes")
else:
    print("No")
Problem p03543 (python)

Fixed submission:
a,b,c,d = list(input())
if a==b==c or b==c==d:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d = list(input())
#print(b)
if a==b==c or b==c==d:
    print("Yes")
else:
    print("No
Problem p03592 (python)

Fixed submission:
n,m,k=map(int,input().split())
for i in range(n+1):
    for j in range(m+1):
        if m*i+n*j-2*(i*j)==k:
            print("Yes")
            exit()
print("No")

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
if n%k==0 or m%k==0:
    print("Yes")
    exit()
for i in range(1,n+1):
    for j in range(1,m+1):
        if m*i+n*j-2*(i*j)==k:
            print("Yes")
            exit()
print("No")
Problem p03597 (python)

Fixed submission:
print((int(input()))**2-int(input()))

Buggy submission (verdict: Runtime Error):
1 2 10 20 15 200