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

Fixed submission:
S=input()
a=S.count("A")
b=S.count("B")
if a==3 or b==3:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S=input()
a=S.count("A")
b=S.count("B")
if a==3 or b==3:
  print("No")
else
  print("Yes")
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for j in range(M):
    b.append(b[j] + B[j])

ans = 0
j = M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j = j -1
    ans = max(ans, i+j)
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
c = 0
while K > 0:
    if not A == [] and not B == []:
        if A[0] <= B[0]:
            K = K - A[0]
            A.remove(A[0])
            if K >= 0:
                c += 1
        else:
            K = K - B[0]
            B.remove(B[0])
            if K >= 0:
                c += 1
    if A == []:
        K = K - B[0]
        B.remove(B[0])
        if K >= 0:
            c += 1
    if B == []:
        K = K - A[0]
        A.remove(A[0])
        if K >= 0:
            c += 1
print(c)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
c = 0
while K > 0:
    if not A == [] and not B == []:
        if A[0] >= B[0]:
            K = K - A[0]
            A.remove(A[0])
            if K >= 0:
                c += 1
        else:
            K = K - B[0]
            B.remove(B[0])
            if K >= 0:
                c += 1
    if A == []:
        K = K - B[0]
        B.remove(B[0])
        if K >= 0:
            c += 1
    if B == []:
        K = K - A[0]
        A.remove(A[0])
        if K >= 0:
            c += 1
print(c)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
c = 0
while K > 0:
    if not A == [] and not B == []:
        if A[0] >= B[0]:
            K = K - A[0]
            A.remove(A[0])
            if K >= 0:
                c += 1
        else:
            K = K - B[0]
            B.remove(B[0])
            if K >= 0:
                c += 1
    if A == []:
        K = K - B[0]
        B.remove(B[0])
        if K >= 0:
                c += 1
    if B == []:
        K = K - A[0]
        A.remove(A[0])
        if K >= 0:
                c += 1
print(c)
Problem p02897 (python)

Fixed submission:
N=int(input())
if N % 2 == 1:
  print(((N+1)/2)/N)
else:
  print((N/2)/N)

Buggy submission (verdict: Runtime Error):
N=int(print())
if N % 2 == 1:
  print(((N+1)/2)/N)
else:
  print((N/2)/N)

Buggy submission (verdict: Runtime Error):
N=int(print())
if N % 2 == 1:
  print((N+1)/2)
else:
  print(N/2)
Problem p02597 (python)

Fixed submission:
N = int(input())
S = input()
r_c = 0
ch = 0
for i in S:
  if i == "R":
    r_c += 1
for i in range(r_c):
  if S[i] == "W":
    ch += 1
print(ch)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
r_c = 0
ch = 0
for i in S:
  if i == "R":
    r_c += 1
for i in range(r_c):
  if i == "W"
    ch += 1
print(ch)
Problem p02659 (python)

Fixed submission:
A, B = input().split()
BA, BB = B.split(".")
#print(A, BA, BB)
print((int(A)*(int(BA)*100+int(BB))//100))

Buggy submission (verdict: Runtime Error):
import math
A, B = input().split()
B *= 100
print((A*B)/100))
Problem p02707 (python)

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

k = [0]*N

for i in a:
  k[i-1] += 1

for i in k:
  print(i)

Buggy submission (verdict: Runtime Error):
10
1 1 1 1 1 1 1 1 1
Problem p02777 (python)

Fixed submission:
(red, blue) = list(input().split())
(p, q) = list(map(int, input().split()))
st = input()

if red == st:
  print( str(p-1)+ " " +str(q) )
else:
  print( str(p)+ " " +str(q-1) )

Buggy submission (verdict: Runtime Error):
(red, blue) = list(input().split())
(p, q) = list(input().split())
st = input()

if red == st:
  print( p-1+ " " +q )
else:
  print( p+ " " +q-1 )
Problem p02879 (python)

Fixed submission:
A, B = list(map(int, (input().split())))
k = -1
if (A <= 9 ) and ( B <= 9):
  k = A * B
print(str(k))

Buggy submission (verdict: Runtime Error):
A, B = list(map(int, (input().split())))
k = -1
if A <= 9 && B <= 9:
  k = A * B
print(str(k))

Buggy submission (verdict: Runtime Error):
A, B = list(map(int, (input().split())))
k = -1
if A <= 9 && B <= 9:
  k = A * B
print(k)
Problem p02916 (python)

Fixed submission:
N = int(input())
AryA = list(map(int, input().split()))
AryB = list(map(int, input().split()))
AryC = list(map(int, input().split()))

sum = 0
tmpBox = N+1

for item in AryA:
	sum += AryB[item-1]
	if (item == tmpBox + 1):
		sum += AryC[tmpBox-1]
	tmpBox = item
print(sum)

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

AryA = list(map(int, input().split()))

AryB = list(map(int, input().split()))

AryC = list(map(int, input().split()))

sum = 0
tmpBox = N+1

for item in AryA:
	sum += AryB[item]
	if (item == tmpBox + 1):
		sum += AryC[tmpBox]

print sum
Problem p02933 (python)

Fixed submission:
a= input()
b= input()

if (int(a) < 3200):
    b = 'red'

print(b)

Buggy submission (verdict: Runtime Error):
a= input()
b= input()

if (int(a) >= 3200)
b = 'red'

print(b)
Problem p02951 (python)

Fixed submission:
a, b, c = list(map(int, input().split()))
d = c - (a - b)
if d > 0:
  print(d)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a b c = list(map(int, input().split()))
d = c - (a - b)
if d > 0:
  print(d)
else:
  print(0)
Problem p02577 (python)

Fixed submission:
s=input()
ans=0
for c in s:
    ans+=int(c)
    ans%=9
if ans==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

s=input()
ans=0
for c in s:
    ans+=int(c)
    ans%=9
if ans==0:
    print('Yes')
else:
    print('No')
Problem p02590 (python)

Fixed submission:
import numpy 
 
def convolve(g, h):
  s=len(g)+len(h)+1
  n=1
  while n<s:
    n*=2
  gg=numpy.fft.fft(g+[0]*(n-len(g)))
  hh=numpy.fft.fft(h+[0]*(n-len(h)))
  ff=[gg[i]*hh[i] for i in range(n)]
  ff=numpy.fft.ifft(ff)
  ans=[int(ff[i].real+0.5) for i in range(n)]
  return ans

p=200003
n=int(input())
arr=list(map(int,input().split()))
g=2
order=[1]
while g!=1:
  order.append(g)
  g*=2
  g%=p
pos=[0]*p
for i in range(len(order)):
  pos[order[i]]=i
cnt1=[0]*p
cnt2=[0]*p
coef=[0]*p
for val in arr:
  if val!=0:
    cnt1[pos[val]]+=1
    cnt2[pos[val]]+=1
    coef[(val*val)%p]-=1
ans=convolve(cnt1,cnt2)
for i in range(len(ans)):
  if ans[i]!=0:
    prod=order[i%(p-1)]
    coef[prod]+=ans[i]
total=0
for i in range(p):
  total+=(coef[i]//2)*i
print(total)

Buggy submission (verdict: Runtime Error):
import numpy 
 
def convolve(g, h):
  s=len(g)+len(h)+1
  n=1
  while n<s:
    n*=2
  gg=numpy.fft.fft(g+[0]*(n-len(g)))
  hh=numpy.fft.fft(h+[0]*(n-len(h)))
  ff=[gg[i]*hh[i] for i in range(n)]
  ff=numpy.fft.ifft(ff)
  ans=[int(ff[i].real+0.5) for i in range(n)]
  return ans

p=200003
n=int(input())
arr=list(map(int,input().split()))
pos={}
tmp=1
for i in range(p):
  pos[tmp]=i
  tmp*=2
  tmp%=p
cnt1=[0]*p
cnt2=[0]*p
for val in arr:
  if val!=0:
    cnt1[pos[val]]+=1
    cnt2[pos[val]]+=1
ans=convolve(cnt1,cnt2)
for val in arr:
  ans[pos[val]*2]-=1
total=0
for i in range(len(ans)):
  if ans[i]!=0:
    total+=(ans[i]//2)*pow(2,i,p)
print(total)
Problem p02598 (python)

Fixed submission:
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

n,k=map(int,input().split())
arr=list(map(int,input().split()))
l=0
r=max(arr)+1
while r-l!=1:
    persuit=(r+l)//2
    cnt=0
    for val in arr:
        if val<=persuit:
            continue
        if val%persuit==0:
            cnt+=val//persuit-1
        else:
            cnt+=val//persuit
    if cnt<=k:
        r=persuit
    else:
        l=persuit
print(r)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

n,k=map(int,input().split())
arr=list(map(int,input().split()))
l=-1
r=max(arr)+1
while r-l!=1:
    persuit=(r+l)//2
    cnt=0
    for val in arr:
        if val<=persuit:
            continue
        if val%persuit==0:
            cnt+=val//persuit-1
        else:
            cnt+=val//persuit
    if cnt<=k:
        r=persuit
    else:
        l=persuit
print(r)
Problem p02629 (python)

Fixed submission:
def calc():
  n=int(input())
  arr=[]
  check='abcdefghijklmnopqrstuvwxyz'
  while n!=0:
    n-=1
    arr.append(check[n%26])
    n//=26
  arr=arr[::-1]
  print(''.join(map(str,arr)))
  
calc()

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=''
check='abcdefghijklmnopqrstuvwxyz'
while n!=0:
  n-=1
  ans+=check[n%26]
  n//=26
print(ans[::-1]
Problem p02661 (python)

Fixed submission:
n=int(input())
arr=[list(map(int,input().split())) for _ in range(n)]
if n%2==0:
  l=0
  r=10**9+1
  while r-l!=1:
    mid=(l+r)//2
    cnt1=0
    cnt2=0
    cnt3=0
    for a,b in arr:
      if mid<a:
        cnt1+=1
      elif mid>b:
        cnt2+=1
      else:
        cnt3+=1
    if cnt1>n//2:
      l=mid
    elif cnt2>n//2-1:
      r=mid
    else:
      l=mid
  r1=l
  l=0
  r=r1+1
  while r-l!=1:
    mid=(l+r)//2
    cnt1=0
    cnt2=0
    cnt3=0
    for a,b in arr:
      if mid<a:
        cnt1+=1
      elif mid>b:
        cnt2+=1
      else:
        cnt3+=1
    if cnt1>n//2:
      l=mid
    elif cnt2>n//2-1:
      r=mid
    else:
      r=mid
  l1=r
  l=0
  r=10**9+1
  while r-l!=1:
    mid=(l+r)//2
    cnt1=0
    cnt2=0
    cnt3=0
    for a,b in arr:
      if mid<a:
        cnt1+=1
      elif mid>b:
        cnt2+=1
      else:
        cnt3+=1
    if cnt1>n//2-1:
      l=mid
    elif cnt2>n//2:
      r=mid
    else:
      l=mid
  r2=l
  l=0
  r=r2+1
  while r-l!=1:
    mid=(l+r)//2
    cnt1=0
    cnt2=0
    cnt3=0
    for a,b in arr:
      if mid<a:
        cnt1+=1
      elif mid>b:
        cnt2+=1
      else:
        cnt3+=1
    if cnt1>n//2-1:
      l=mid
    elif cnt2>n//2:
      r=mid
    else:
      r=mid
  l2=r
  print((r1+r2)-(l1+l2)+1)  
elif n%2==1:
  l=0
  r=10**9+1
  while r-l!=1:
    mid=(l+r)//2
    cnt1=0
    cnt2=0
    cnt3=0
    for a,b in arr:
      if mid<a:
        cnt1+=1
      elif mid>b:
        cnt2+=1
      else:
        cnt3+=1
    if cnt1>n//2:
      l=mid
    elif cnt2>n//2:
      r=mid
    else:
      l=mid
  l1=l
  r1=r
  l=0
  r=l1+1
  while r-l!=1:
    mid=(l+r)//2
    cnt1=0
    cnt2=0
    cnt3=0
    for a,b in arr:
      if mid<a:
        cnt1+=1
      elif mid>b:
        cnt2+=1
      else:
        cnt3+=1
    if cnt1>n//2:
      l=mid
    elif cnt2>n//2:
      r=mid
    else:
      r=mid
  l2=l
  r2=r
  print(l1-r2+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr1=[]
arr2=[]
for _ in range(n):
  a,b=map(int,input().split())
  arr1.append(a)
  arr2.append(b)
arr1=sorted(arr1)
arr2=sorted(arr2)
if n%2==1:
  l=arr1[n//2]
  r=arr2[n//2]
else:
  l=arr1[n//2]+arr1[n//2+1]
  r=arr2[n//2]+arr2[n//2+1]
print(r-l+1)
Problem p02693 (python)

Fixed submission:
k=int(input())
a,b=map(int,input().split())
if b//k-(a-1)//k>=1:
  print('OK')
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
k=int(input())
a,b=int(input())
if b//k-(a-1)//k>=1:
  print('OK')
else:
  print('NG')
Problem p02723 (python)

Fixed submission:
s=input()
if s[2]==s[3] and s[4]==s[5]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=int(input())
if s[2]==s[3] and s[4]==s[5]:
  print('Yes')
else:
  print('No')
Problem p02757 (python)

Fixed submission:
import collections

n,p=map(int,input().split())
s=input()
arr=[int(s[i]) for i in range(len(s))]
if p==2 or p==5:
  ans=0
  for i in range(n):
    if arr[i]%p==0:
      ans+=i+1
  print(ans)
else:
  dic=collections.defaultdict(int)
  match=[]
  pows=[1]
  for _ in range(n):
    pows.append((pows[-1]*10)%p)
  tmp=0
  for i in range(n-1,-1,-1):
    tmp+=arr[i]*pows[n-1-i]
    tmp%=p
    match.append(tmp)
    dic[tmp]+=1
  match=match[::-1]
  ans=0
  rem=0
  rev=pow(10,p-2,p)
  for i in range(n-1,-1,-1):
    ans+=dic[rem]
    rem+=arr[i]*pows[n-1-i]
    rem%=p
    dic[match[i]]-=1
  print(ans)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
s=input()
arr=[int(s[i]) for i in range(len(s))]
dic={}
match=[]
pows=[1]
for _ in range(n):
  pows.append((pows[-1]*10)%p)
tmp=0
for i in range(n-1,-1,-1):
  tmp+=arr[i]*pows[n-1-i]
  tmp%=p
  match.append(tmp)
  if tmp not in dic:
    dic[tmp]=1
  else:
    dic[tmp]+=1
match=match[::-1]
ans=0
rem=0
rev=pow(10,p-2,p)
for i in range(n-1,-1,-1):
  ans+=dic[rem]
  rem*=rev
  rem+=arr[i]
  rem%=p
  dic[match[i]]-=1
print(ans)
Problem p02779 (python)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
arr=sorted(arr)
for i in range(n-1):
  if arr[i]==arr[i+1]:
    print('NO')
    break
else:
  print('YES')

Buggy submission (verdict: Runtime Error):
n=input()
arr=list(map(int,input().split()))
arr=sorted(arr)
for i in range(n-1):
  if arr[i]==arr[i+1]:
    print('NO')
    break
else:
  print('YES')
Problem p02829 (python)

Fixed submission:
ans=[1,2,3]
a=int(input())
b=int(input())
ans.remove(a)
ans.remove(b)
print(ans[0])

Buggy submission (verdict: Runtime Error):
ans=[1,2,3]
a=int(input())
b=int(input())
ans.del(a)
ans.del(b)
print(ans[0])
Problem p02835 (python)

Fixed submission:
a,b,c=map(int,input().split())
t=a+b+c
if t<=21:
  print('win')
else:
  print('bust')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input())
t=a+b+c
if t<=21:
  print('win')
else:
  print('bust')
Problem p02859 (python)

Fixed submission:
r=int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
r＝int(input())
print(r**2)
Problem p02881 (python)

Fixed submission:
n=int(input())
ans=10**18
for i in range(1,10**6+1):
  if n%i==0:
    j=n//i
  ans=min(ans,i+j-2)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=10**18
for i in range(10**6+1):
  if n%i==0:
    j=n//i
  ans=min(ans,i+j-2)
print(ans)
Problem p02892 (python)

Fixed submission:
from scipy.sparse.csgraph import floyd_warshall
import sys
sys.setrecursionlimit(10**8)

n=int(input())
arr=[input() for _ in range(n)]
g=[[] for _ in range(n)]
for i in range(n):
  for j in range(n):
    if i==j:
      continue
    if arr[i][j]=='1':
      g[i].append(j)
g2=[[0]*n for _ in range(n)]
for i in range(n):
  for j in range(n):
    g2[i][j]=int(arr[i][j])

colors=[0]*n

def dfs(v,color):
  colors[v]=color
  for u in g[v]:
    if colors[u]==color:
      return False
    if colors[u]==0 and not dfs(u,-color):
      return False
  return True

def is_bipartite():
  return dfs(0,1)

if is_bipartite()==False:
  print(-1)
  exit()

ans=0
d=floyd_warshall(g2)
for i in range(n):
  ans=max(ans,int(max(d[i])+1))
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
from scipy.sparse.csgraph import floyd_warshall
import sys
sys.setrecursionlimit(10**8)

n=int(input())
arr=[input() for _ in range(n)]
g=[[] for _ in range(n)]
for i in range(n):
  for j in range(n):
    if i==j:
      continue
    if arr[i][j]=='1':
      g[i].append(j)

colors=[0]*n

def dfs(v,color):
  colors[v]=color
  for u in g[v]:
    if colors[u]==color:
      return False
    if colors[u]==0 and not dfs(u,-color):
      return False
  return True

def is_bipartite():
  return dfs(0,1)

if is_bipartite()==False:
  print(-1)
  exit()

ans=0
for v in range(n):
  q=collections.deque()
  q.append((v,1))
  checked=[0]*n
  anss=[]
  while len(q)!=0:
    tmp,depth=q.popleft()
    anss.append(depth)
    checked[tmp]=1
    for v in g[tmp]:
      if checked[v]==0:
        q.append((v,depth+1))
  ans=max(ans,max(anss))
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import floyd_warshall
import sys
sys.setrecursionlimit(10**8)

n=int(input())
arr=[input() for _ in range(n)]
g=[[] for _ in range(n)]
for i in range(n):
  for j in range(n):
    if i==j:
      continue
    if arr[i][j]=='1':
      g[i].append(j)
g2=[[0]*n for _ in range(n)]
for i in range(n):
  for j in range(n):
    g2[i][j]=int(arr[i][j])

colors=[0]*n

def dfs(v,color):
  colors[v]=color
  for u in g[v]:
    if colors[u]==color:
      return False
    if colors[u]==0 and not dfs(u,-color):
      return False
  return True

def is_bipartite():
  return dfs(0,1)

if is_bipartite()==False:
  print(-1)
  exit()

ans=0
d=floyd_warshall(g2)
for i in range(n):
  ans=max(ans,int(max(d[i])+1))
print(ans)
Problem p02948 (python)

Fixed submission:
import heapq

n,m=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
arr2=[[i,0] for i in range(1,m+5)]
arr.extend(arr2)
arr=sorted(arr,reverse=True,key=lambda x:x[1])
arr=sorted(arr,key=lambda x:x[0])
tmp=arr[0][0]
q=[]
ans=0
pos=0
while 1:
  a,b=arr[pos]
  if a>m:
    break
  if a==arr[pos+1][0]:
    heapq.heappush(q,-b)
  else:
    heapq.heappush(q,-b)
    ans-=heapq.heappop(q)
  pos+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

n,m=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
arr2=[[i,0] for i in range(1,m+1)]
arr.extend(arr2)
arr=sorted(arr,reverse=True,key=lambda x:x[1])
arr=sorted(arr,key=lambda x:x[0])
tmp=arr[0][0]
q=[]
ans=0
pos=0
while 1:
  a,b=arr[pos]
  if a>m:
    break
  if a==arr[pos+1][0]:
    heapq.heappush(q,-b)
  else:
    heapq.heappush(q,-b)
    ans-=heapq.heappop(q)
  pos+=1
print(ans)
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
arr=set([int(input()) for _ in range(m)])
dp=[0]*(n+1)
if 1 not in arr:
  dp[1]=1
if n>=2:
  if 2 not in arr:
    dp[2]=dp[1]+1
for i in range(3,n+1):
  if i not in arr:
    dp[i]=(dp[i-1]+dp[i-2])%1000000007
print(dp[n]%1000000007)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
arr=set([int(input()) for _ in range(m)])
dp=[0]*(n+1)
if 1 not in arr:
  dp[1]=1
if 2 not in arr:
  dp[2]=dp[1]+1
for i in range(3,n+1):
  if i not in arr:
    dp[i]=(dp[i-1]+dp[i-2])%1000000007
print(dp[n]%1000000007)
Problem p03053 (python)

Fixed submission:
import collections
q=collections.deque()
h,w=map(int,input().split())
arr=[[] for _ in range(h+2)]
for i in range(w+2):
  arr[0].append('#')
for i in range(h):
  arr[i+1].append('#')
  for j in input():
    arr[i+1].append(j)
  arr[i+1].append('#')
for i in range(w+2):
  arr[h+1].append('#')
dx=[-1,0,1,0]
dy=[0,-1,0,1]
for i in range(1,h+1):
  for j in range(1,w+1):
    if arr[i][j]=='#':
      q.append([i,j,0])
while 1:
  y,x,cnt=q.popleft()
  for i in range(4):
    if arr[y+dy[i]][x+dx[i]]=='.':
      q.append([y+dy[i],x+dx[i],cnt+1])
      arr[y+dy[i]][x+dx[i]]='#'
  if len(q)==0:
    print(cnt)
    break

Buggy submission (verdict: Runtime Error):
q=[]
h,w=map(int,input().split())
arr=[[True]*(w+2)]
for i in range(h):
  tmp=[True]
  for j in input():
    if j=='#':
      tmp.append(True)
    else:
      tmp.append(False)
  tmp.append(True)
  arr.append(tmp)
arr.append([[True]*(w+2)])
for i in range(1,h+1):
  for j in range(1,w+1):
    if arr[i][j]:
      q.append([i,j])
ans=0
while 1:
  nq=[]
  for y,x in q:
    if not arr[y-1][x]:
      nq.append([y-1,x])
      arr[y-1][x]=True
    if not arr[y][x-1]:
      nq.append([y,x-1])
      arr[y][x-1]=True
    if not arr[y+1][x]:
      nq.append([y+1,x])
      arr[y+1][x]=True
    if not arr[y][x+1]:
      nq.append([y,x+1])
      arr[y][x+1]=True
  if len(nq)==0:
    print(ans)
    break
  else:
    q=nq
    ans+=1
Problem p03104 (python)

Fixed submission:
a,b=map(int,input().split())
if b-a<=3:
  ans=0
  for i in range(a,b+1):
    ans=ans^i
  print(ans)
else:
  ans=0
  if a%4!=0:
    for i in range(a,(1+a//4)*4):
      ans=ans^i
  ans2=0
  for i in range((b//4)*4,b+1):
    ans2=ans2^i
  print(ans^ans2)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if b-a<=3:
  ans=a
  for i in range(a+1,b+1):
    ans=ans^i
  print(ans)
else:
  if a%4!=0:
    ans=a
    for i in range(a+1,(a//4)*4+2):
      ans=ans^i
  ans2=b
  for i in range(b+1,(b//4)*4+1):
    ans2=ans2^i
  print(ans^ans2)
Problem p03127 (python)

Fixed submission:
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if b==0:
    return a
  else:
    return gcd(b,a%b)
 
n=int(input())
arr=list(map(int,input().split()))
tmp=gcd(arr[0],arr[1])
for i in range(1,n):
  tmp=gcd(tmp,arr[i])
print(tmp)

Buggy submission (verdict: Runtime Error):
def multigcd(n,arr):
  a,b=max(n,arr[0]),min(n,arr[0])
  while b!=0:
    a,b=b,a%b
  if len(arr)==1:
    return a
  else:
    return multigcd(a,arr[1:])

n=int(input())
arr=list(map(int,input().split()))
print(multigcd(arr[0],arr[1:]))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if b==0:
    return a
  else:
    return gcd(b,a%b)
 
n=int(input())
arr=list(map(int,input()))
tmp=gcd(arr[0],arr[1])
for i in range(1,n):
  tmp=gcd(tmp,arr[i])
print(tmp)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if b==0:
    return a
  else:
    return gcd(b,a%b)

n=int(input())
arr=list(map(int,input()))
for i in range(n-1):
  tmp=gcd(arr[i],arr[i+1])
print(tmp)
Problem p03221 (python)

Fixed submission:
def mks(num):
  s=str(num)
  if len(s)<6:
    s='0'*(6-len(s))+s
  return s

n,m=map(int,input().split())
arr=[]
for i in range(m):
  p,y=map(int,input().split())
  arr.append([p,y,i])
ans=[0]*m
arr=sorted(arr,key=lambda x:x[1])
arr=sorted(arr,key=lambda x:x[0])
tmp=arr[0][0]
cnt=1
for i in range(m):
  if arr[i][0]==tmp:
    s1,s2=mks(tmp),mks(cnt)
    ans[arr[i][2]]=s1+s2
    cnt+=1
  else:
    cnt=1
    tmp=arr[i][0]
    s1,s2=mks(tmp),mks(cnt)
    ans[arr[i][2]]=s1+s2
    cnt+=1
for i in range(m):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
def mks(num):
  s=str(num)
  if len(s)<6:
    s='0'*(6-len(s))+s
  return s

n,m=map(int,input().split())
arr=[]
for i in range(m):
  p,y=map(int,input().split)
  arr.append([p,y,i])
ans=[0]*m
arr=sorted(arr,key=lambda x:x[1])
arr=sorted(arr,key=lambda x:x[0])
tmp=arr[0][0]
cnt=1
for i in range(m):
  if arr[i][0]==tmp:
    s1,s2=mks(tmp),mks(cnt)
    ans[arr[i][2]]=s1+s2
    cnt+=1
  else:
    cnt=1
    tmp=arr[i][0]
    s1,s2=mks(tmp),mks(cnt)
    ans[arr[i][2]]=s1+s2
for i in range(m):
  print(ans[i])
Problem p03250 (python)

Fixed submission:
a,b,c=map(int,input().split())
arr=[a,b,c]
arr=sorted(arr)
print(10*arr[-1]+arr[1]+arr[0])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
arr=[a,b,c]
arr=sorted(a,b,c)
print(10*arr[-1]+arr[1]+arr[0])
Problem p03252 (python)

Fixed submission:
s=input()
t=input()
arr1=[0]*26
arr2=[0]*26
check='abcdefghijklmnopqrstuvwxyz'
for i in range(26):
  arr1[i]=s.count(check[i])
  arr2[i]=t.count(check[i])
arr1=sorted(arr1)
arr2=sorted(arr2)
for i in range(26):
  if arr1[i]!=arr2[i]:
    print('No')
    break
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s=input()
t=inpur()
arr1=[0]*26
arr2=[0]*26
check='abcdefghijklmnopqrstuvwxyz'
for i in range(26):
  arr1[i]=s.count(check[i])
  arr2[i]=s.count(check[i])
arr1=sorted(arr1)
arr2=sorted(arr2)
for i in range(26):
  if arr1[i]!=arr2[i]:
    print('No')
    break
else:
  print('Yes')