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

Fixed submission:
import sys
s=input()
a=int(s[0]);b=int(s[1]);c=int(s[2]);d=int(s[3])
if a+b+c+d==7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
  sys.exit()
elif a+b+c-d==7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
  sys.exit()
elif a+b-c+d==7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
  sys.exit()
elif a+b-c-d==7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
  sys.exit()
elif a-b+c+d==7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
  sys.exit()
elif a-b+c-d==7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
  sys.exit()
elif a-b-c+d==7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
  sys.exit()
elif a-b-c-d==7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
  sys.exit()

Buggy submission (verdict: Runtime Error):
s=input()
a=int(s[0]);b=int(s[1]);c=int(s[2]);d=int(s[3])
if a+b+c+d==7:
  print(str(a)+"+"str(b)+"+"str(c)+"+"+str(d)+"=7")
  break
elif a+b+c-d==7:
  print(str(a)+"+"str(b)+"+"str(c)+"-"+str(d)+"=7")
  break
elif a+b-c+d==7:
  print(str(a)+"+"str(b)+"-"str(c)+"+"+str(d)+"=7")
  break
elif a+b-c-d==7:
  print(str(a)+"+"str(b)+"-"str(c)+"-"+str(d)+"=7")
  break
elif a-b+c+d==7:
  print(str(a)+"-"str(b)+"+"str(c)+"+"+str(d)+"=7")
  break
elif a-b+c-d==7:
  print(str(a)+"-"str(b)+"+"str(c)+"-"+str(d)+"=7")
  break
elif a-b-c+d==7:
  print(str(a)+"-"str(b)+"-"str(c)+"+"+str(d)+"=7")
  break
elif a-b-c-d==7:
  print(str(a)+"-"str(b)+"-"str(c)+"-"+str(d)+"=7")
  break
Problem p03565 (python)

Fixed submission:
s=input()
t=input()
strs=[]
S=len(s)
T=len(t)
for i in range(S-T+1):
  flag=0
  for j in range(T):
    if s[i+j]=="?":
      continue
    if s[i+j]!=t[j]:
      flag=1;break
  if flag==0:
    posstr=s[:i]+t+s[i+T:]
    strs.append(posstr.replace("?","a",50))
strs.sort()
if strs==[]:print("UNRESTORABLE")
else:print(strs[0])

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
strs=[]
S=len(s)
T=len(t)
for i in range(S-T+1):
  flag=0
  for j in range(T):
    if S[i+j]=="?":
      continue
    if S[i+j]!=T[j]:
      flag=1;break
  if flag==0:
    posstr=s[:i]+t+s[i+T:]
    posstr.replace("?","a")
    strs.append(posstr)
if strs==[]:print("UNRESTORABLE")
else:print(strs[0])
Problem p03574 (python)

Fixed submission:
h,w=map(int,input().split())
field=[]
nfield=[[] for i in range(h)]
for i in range(h):
  field.append(input())
def check(a,b):
  num=0
  if field[a][b]=="#":
    return
  for i in range(a-1,a+2):
    for j in range(b-1,b+2):
      try:
        if j !=-1 and i!=-1 and field[i][j]=="#":
          num+=1
      except:
        pass
  return num
for i in range(h):
  for j in range(w):
    if field[i][j]==".":
      nfield[i].append(check(i,j))
    else:
      nfield[i].append("#")
for i in range(h):
  for j in range(w):
    if j != w-1:
      print(nfield[i][j],end="")
    else:
      print(nfield[i][j])

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
field=[]
nfield=[[] for i in range(h)]
for i in range(n):
  field.append(input())
def check(a,b):
  num=0
  if field[a][b]=="#":
    return
  for i in range(a-1,a+2):
    for j in range(b-1,b+2):
      try:
        if field[i][j]=="#":
          num+=1
      except:
        pass
  return num
for i in range(h):
  for j in range(w):
    if field[i][j]==".":
      nfield[i][j]=check(i,j)
    else:
      nfield[i][j]="#"
for i in range(h):
  for j in range(w):
    if j != w-1:
      print(nfield[i],end="")
    else:
      print(nfield[i])

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
field=[]
for i in range(n):
  field.append(input())
def check(a,b):
  num=0
  if field[a][b]=="#":
    return
  for i in range(a-1,a+2):
    for j in range(b-1,b+2):
      try:
        if field[i][j]=="#":
          num+=1
      except:
        pass
  return num
for i in range(h):
  for j in range(w):
    if field[i][j]==".":
      field[i][j]==check(i,j)
for i in range(h):
  print(field[i])
Problem p03583 (python)

Fixed submission:
N=int(input())
flag=0
for w in range(1,3501):
  if flag==1:
    break
  for n in range(1,3501):
    if 4*w*n-N*n-N*w<=0:
      continue
    if N*w*n%(4*w*n-N*n-N*w)==0:
      print(N*w*n//(4*w*n-N*n-N*w),w,n)
      flag=1
      break

Buggy submission (verdict: Runtime Error):
N=int(input())
for w in range(1,3501):
  for n in range(1,3501):
    if N*w*n%(4*w*n-N*n-N*w)==0:
      print(N*w*n//(4*w*n-N*n-N*w),w,n)
      break
Problem p03591 (python)

Fixed submission:
s=input()
if len(s)<=3:
  print("No")
else:
  if s[0:4]=="YAKI":
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a={}
for i in range(26):
  a[chr(i+97)]=0
for i in range(h):
  s=input()
  for j in s:
    a[j]+=1
if h==1 and w==1:print("Yes")
elif h==1 or w==1:
  cnt=0
  for i in a.values():
    if i%2==1:cnt+=1
  if cnt!=1:print("No")
  else:print("Yes")
elif h%2==0 and w%2==0:
  for i in a.values():
    if i%4!=0:print("No");exit()
  print("Yes")
elif h%2==1 and w%2==0:
  cnt=0
  for i in a.values():
    if i%4==1 or i%4==3:
      print("No");exit()
    if i%4==2:cnt+=1
  if cnt>w//2:
    print("No")
  else:print("Yes")
elif h%2==0 and w%2==1:
  cnt=0
  for i in a.values():
    if i%4==1 or i%4==3:
      print("No");exit()
    if i%4==2:cnt+=1
  if cnt>h//2:
    print("No")
  else:print("Yes")
else:
  cnt3=0;cnt2=0;cnt1=0
  for i in a.values():
    if i%4==1:cnt1+=1
    elif i%4==2:cnt2+=1
    elif i%4==3:cnt3+=1
  rem=1-cnt1
  elif cnt1+cnt3!=1:print("No")
  elif cnt2+cnt3>h+w-2:print("No")
  else:
    print("Yes")
Problem p03593 (python)

Fixed submission:
h,w=map(int,input().split())
a={}
for i in range(26):
  a[chr(i+97)]=0
for i in range(h):
  s=input()
  for j in s:
    a[j]+=1
if h==1 and w==1:print("Yes")
elif h%2==0 and w%2==0:
  for i in a.values():
    if i%4!=0:print("No");exit()
  print("Yes")
elif h%2==1 and w%2==0:
  cnt=0
  for i in a.values():
    if i%4==1 or i%4==3:
      print("No");exit()
    if i%4==2:cnt+=1
  if cnt>w//2:
    print("No")
  else:print("Yes")
elif h%2==0 and w%2==1:
  cnt=0
  for i in a.values():
    if i%4==1 or i%4==3:
      print("No");exit()
    if i%4==2:cnt+=1
  if cnt>h//2:
    print("No")
  else:print("Yes")
else:
  cnt3=0;cnt2=0;cnt1=0
  for i in a.values():
    if i%4==1:cnt1+=1
    elif i%4==2:cnt2+=1
    elif i%4==3:cnt3+=1
  if cnt1+cnt3!=1:print("No")
  elif cnt2+cnt3>(h-1)//2+(w-1)//2:print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a={}
for i in range(26):
  a[chr(i+97)]=0
for i in range(h):
  s=input()
  for j in s:
    a[j]+=1
if h==1 and w==1:print("Yes")
elif h==1 or w==1:
  cnt=0
  for i in a.values():
    if i%2==1:cnt+=1
  if cnt!=1:print("No")
  else:print("Yes")
elif h%2==0 and w%2==0:
  for i in a.values():
    if i%4!=0:print("No");exit()
  print("Yes")
elif h%2==1 and w%2==0:
  cnt=0
  for i in a.values():
    if i%4==1 or i%4==3:
      print("No");exit()
    if i%4==2:cnt+=1
  if cnt>w//2:
    print("No")
  else:print("Yes")
elif h%2==0 and w%2==1:
  cnt=0
  for i in a.values():
    if i%4==1 or i%4==3:
      print("No");exit()
    if i%4==2:cnt+=1
  if cnt>h//2:
    print("No")
  else:print("Yes")
else:
  cnt3=0;cnt2=0;cnt1=0
  for i in a.values():
    if i%4==1:cnt1+=1
    elif i%4==2:cnt2+=1
    elif i%4==3:cnt3+=1
  rem=1-cnt1
  elif cnt1+cnt3!=1:print("No")
  elif cnt2+cnt3>h+w-2:print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a={}
for i in range(26):
  a[chr(i+97)]=0
for i in range(h):
  s=input()
  for j in s:
    a[j]+=1
if h%2==0 and w%2==0:
  for i in a.values():
    if i%4!=0:print("No");exit()
  print("Yes")
elif h%2==1 and w%2==0:
  cnt=0
  for i in a.values():
    if i%4!=2:cnt+=1
  if cnt>w//2:
    print("No")
  else:print("Yes")
elif h%2==0 and w%2==1:
   cnt=0
  for i in a.values():
    if i%4!=2:cnt+=1
  if cnt>h//2:
    print("No")
  else:print("Yes")
else:
  cnt2=0;cnt1=0
  for i in a.values():
    if i%4==1:cnt1+=1
    elif i%4==2:cnt2+=1
  if cnt1!=1:print("No")
  elif 2*cnt2>h+w-2:print("No")
  else:
    print("Yes")
Problem p03608 (python)

Fixed submission:
from itertools import permutations
n,m,r=map(int,input().split())
visit=list(map(int,input().split()))
dist=[[10**9]*n for i in range(n)]
for i in range(m):
  a,b,c=map(int,input().split())
  dist[a-1][b-1],dist[b-1][a-1]=c,c
for i in range(n):
  dist[i-1][i-1]=0
for i in range(n):
  for j in range(n):
    for k in range(n):
      dist[j][k]=min(dist[j][k],dist[j][i]+dist[i][k])
ans=10**9
check=permutations(visit)
for i in check:
  c=0
  for j in range(1,r):
    c+=dist[i[j-1]-1][i[j]-1]
  if c<ans:ans=c
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import permutations
n,m,r=map(int,input().split())
visit=list(map(int,input().split()))
dist=[[10**9]*n for i in range(n)]
for i in range(m):
  a,b,c=map(int,input().split())
  dist[a-1][b-1],dist[b-1][a-1]=c,c
for i in range(n):
  dist[i-1][i-1]=0
for i in range(n):
  for j in range(n):
    for k in range(n):
      dist[j][k]=min(dist[j][i]+dist[i][k])
ans=10**9
check=permutations(visit)
for i in check:
  c=0
  for j in range(r-1):
    c+=dist[i[j]][i[j+1]]
  if c<ans:ans=c
print(ans)
Problem p03609 (python)

Fixed submission:
x,t=map(int,input().split())
print(max(x-t,0))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
cnt=0
for i in range(n):
  if l[i] == i+1:
    change=l[i]
    l[i]=l[i+1]
    l[i+1]=change
    cnt+=1
print(cnt)
Problem p03611 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
l.sort()
a=[0]*(l[-1]-l[0]+3)
b=l[0]
for i in range(n):
  l[i]-=b
for i in range(n):
  a[l[i]]+=1
  a[l[i]+1]+=1
  a[l[i]+2]+=1
print(max(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
l.sort()
a=[0]*(l[-1]-l[0]+3)
for i in range(n):
  l[i]-=l[0]
for i in range(n):
  a[l[i]]+=1
  a[l[i]+1]+=1
  a[l[i]+2]+=1
print(max(a))
Problem p03612 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if l[i] == i+1:
    l[i],l[i+1]=l[i+1],l[i]
    cnt+=1
if l[-1]==n:
  cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input().split())
l=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if (l[i] == i+1) and (l[i+1] == i+2):
    {l[i],l[i+1]}={l[i+1],l[i]}
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input().split())
l=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if l[i] == i+1 and l[i+1] == i+2:
    l[i]=change
    change=l[i+1]
    l[i+1]=l[i]
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input().split())
l=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if l[i] == i+1 and l[i+1] == i+2:
    {l[i],l[i+1]}={l[i+1],l[i]}
    cnt+=1
print(cnt)
Problem p03627 (python)

Fixed submission:
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
d=[]
L=Counter(l)
a=L.most_common()
for i in range(len(a)):
  if a[i][1]>=4:
    d.append(a[i][0])
    d.append(a[i][0])
  elif a[i][1]>=2:
    d.append(a[i][0])
d.sort(reverse=True)
print(d[0]*d[1] if len(d)>=2 else 0)

Buggy submission (verdict: Runtime Error):
from collcections import Counter
n=int(input())
l=list(map(int,input().split()))
d=[]
L=Counter(l)
a=L.most_common()
for i in a:
  if a[i][1]>=4:
    d.append(a[i][1])
    d.append(a[i][1])
  elif a[i][1]>=2:
    d.append(a[i][1])
d.sort(reverse=True)
print(d[0]*d[1] if len(d)>=2 else 0)
Problem p03640 (python)

Fixed submission:
h,w=map(int,input().split())
n=int(input())
c=list(map(int,input().split()))
d=[]
for i in range(1,n+1):
  for j in range(c[i-1]):
    d.append(i)
ansl=[[0]*w for i in range(h)]
for i in range(h):
  if i%2==0:
    for j in range(w):
      ansl[i][j]=str(d[i*w+j])
  else:
    for j in range(w):
      ansl[i][w-j-1]=str(d[i*w+j])
for j in ansl:
  print(" ".join(j))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
n=int(input())
c=list(map(int,input().split()))
d=[]
for i in range(1,n+1):
  for j in c[i-1]:
    d.append(i)
ansl=[[0]*w for i in range(h)]
for i in range(h):
  if i%2==0:
    for j in range(w):
      ansl[i][j]=str(d[i*w+j])
  else:
    for j in range(w):
      ansl[i][w-j-1]=str(d[i*w+j])
for j in ansl:
  print(" ".join(j))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
n=int(input())
c=list(map(int,input().split()))
d=[]
for i in range(1,n+1):
  for j in c[i-1]:
    d.append(i)
ansl=[[0]*w for i in range(h)]
for i in range(h):
  if i%2==0:
    for j in range(w):
      ansl[i][j]=str(d[i*w+j])
  else:
    for j in range(w):
      ansl[i][w-j-1]=str(d[i*w+j])
for j in ansl:
  print(" ".join(j))
Problem p03658 (python)

Fixed submission:
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
for i in range(m):
  ans+=l[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
for i in range(m)
ans+=l[i]

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
print(l[0]+l[1]+l[2])
Problem p03672 (python)

Fixed submission:
s=input()
ans=len(s)
def check(m):
  a=len(m)
  if a%2==1:
    return False
  else:
    if s[0:a//2]==s[a//2:a]:
      return True
    else:
      return False
for i in range(len(s)-1,0,-1):
  ans-=1
  if check(s[0:i])==True:
    print(ans)
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=len(s)
def check(m):
  a=len(m)
  if a%2==1:
    return False
  else:
    if s[0:m//2]==s[m//2:m]:
      return True
    else:
      return False
for i in range(1,len(s),-1):
  ans-=1
  if check(s[0:i])==True:
    print(ans)
Problem p03673 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
if n%2==1:
  l=l[n-1::-2]+l[1::2]
  for i in range(n):
    print(l[i],end=" ")
else:
  l=l[n-1::-2]+l[::2]
  for i in range(n):
    print(l[i],end=" ")

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
if n%2==1:
  l=l[n-1::-2]+l[1::2]
  for i in range(5):
    print(l[i],end=" ")
else:
  l=l[n-1::-2]+l[::2]
  for i in range(5):
    print(l[i],end=" ")
Problem p03680 (python)

Fixed submission:
n=int(input())
button=[int(input()) for i in range(n)]
temp=1
ans=0
while True:
  temp=button[temp-1]
  ans+=1
  if temp==2:
    print(ans)
    break
  elif ans>=n:
    print(-1)
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
button=[int(input()) for i in range(n)]
temp=1
ans=1
while button[temp-1] not in check:
  temp=button[temp-1]
  ans+=1
  if button[temp-1]==2:
    print(ans)
    break
  elif ans>=n:
    print(-1)
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
button=[int(input()) for i in range(n)]
temp=1
ans=1
while button[temp-1] not in check:
  temp=button[temp-1]
  ans+=1
  if button[temp-1]==2:
    print(ans)
    break
  elif ans>=n+1:
    print(-1)
    break
Problem p03681 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
m,d=map(int,input().split())
def fac(n):
  a=1
  if n==1:
    return a
  else:
    a=n*fac(n-1)
    return a%(10**9+7)
if abs(m-d)>=2:
  print(0)
elif abs(m-d)==1:
  print((fac(m)*fac(d))%(10**9+7))
else:
  print(2*(fac(m)**2)%(10**9+7))

Buggy submission (verdict: Runtime Error):
m,d=map(int,input().split())
def fac(n):
  a=1
  if n==1:
    return a
  else:
    a=n*fac(n-1)
    return a%(10**9+7)
if abs(m-d)>=2:
  print(0)
elif abs(m-d)==1:
  print((fac(m)*fac(d))%(10**9+7))
else:
  print(2*(fac(m)**2)%(10**9+7))
Problem p03682 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline
n=int(input())
points=[list(map(int,input().split()))+[i] for i in range(n)]
points.sort(key = lambda x:x[1])
edge=[]
for i in range(n-1):
    edge.append((points[i][2],points[i+1][2],points[i+1][1]-points[i][1]))
points.sort()
for i in range(n-1):
    edge.append((points[i][2],points[i+1][2],points[i+1][0]-points[i][0]))
class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.size = [1 for i in range(N)]
    
    def merge(self, a, b):
        if self.issame(a,b):
            return
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
        self.size[pb] += self.size[pa]
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r
    
    def issame(self, x, y):
        return self.root(x) == self.root(y)
    
    def getsize(self, x):
        return self.size[self.root(x)]
edge.sort(key=lambda x:x[2])
uf=UnionFind(n)
ans=0
for ed in edge:
    if uf.issame(ed[0],ed[1]):continue
    ans+=ed[2]
    uf.merge(ed[0],ed[1])
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
points=[list(map(int,input().split()))+[i] for i in range(n)]
points.sort(key = lambda x:x[1])
edge=[]
for i in range(n-1):
    edge.append((points[i][2],points[i+1][2],points[i+1][1]-points[i][1]))
points.sort()
for i in range(n-1):
    edge.append((points[i][2],points[i+1][2],points[i+1][0]-points[i][0]))
class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.size = [1 for i in range(N)]
    
    def merge(self, a, b):
        if self.issame(a,b):
            return
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
        self.size[pb] += self.size[pa]
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r
    
    def issame(self, x, y):
        return self.root(x) == self.root(y)
    
    def getsize(self, x):
        return self.size[self.root(x)]
edge.sort(key=lambda x:x[2])
uf=UnionFind(n)
ans=0
for ed in edge:
    if uf.issame(ed[0],ed[1]):continue
    ans+=ed[2]
    uf.merge(ed[0],ed[1])
print(ans)
Problem p03693 (python)

Fixed submission:
a=input().replace(" ","")
if int(a)%4==0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a=input().strip()
if int(a)%4==0:
  print("YES")
else:
  print("NO")
Problem p03695 (python)

Fixed submission:
n=int(input())
rates=list(map(int,input().split()))
over3200=sum(1 for i in rates if i>=3200)
fixed=set()
for i in rates:
  if i//400<=7:
    fixed.add(i//400)
f=len(fixed)
if f==0:
  print(1,over3200)
else:
  print(f,f+over3200)

Buggy submission (verdict: Runtime Error):
n=int(input())
rates=list(map(int,input().split()))
over3200=sum(1 for i in rates if i>=3200)
fixed=set()
for i in rates:
  if i//<=7:
    fixed.add(i)
f=len(fixed)
if f==0:
  print(1,over3200)
else:
  print(f,f+over3200)
Problem p03699 (python)

Fixed submission:
n=int(input())
q=[]
for i in range(n):
  q.append(int(input()))
q.sort()
s=sum(q)
check=s%10
if check!=0:
  print(s)
else:
  r=max(q)
  cnt=0
  for i in q:
    if i%10!=0 and i<=r:
      r=i
      cnt+=1
  if cnt==0:
    print(0)
  else:
    print(s-r)

Buggy submission (verdict: Runtime Error):
n=int(input())
q=[]
for i in range(n):
  q.append(int(input()))
s=sum(q)
check=s%10
if check!=0:
  print(s)
else:
  r=max(q)
  cnt=0
  for i in q:
    if i%10!=0 and i<r:
      r=i
      cnt+=1
  if cnt=0:
    print(0)
  else:
    print(q-r)
Problem p03712 (python)

Fixed submission:
h,w = map(int,input().split())
for i in range(h+2):
  if i ==0 or i == h+1:
    for d in range(w+1):
      print("#",end="")
    print("#")
    continue
  print("#"+input()+"#")

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
for i in range(h+2):
  if i ==0 or i == h+1:
    for d in range(w+2):
      print("#",end="")
      continue
  print("#"+input()+"#")

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
for i in range(h+2):
  if i ==0 or i == h+1:
    for d in range(w+2):
      print("#",end="")
  print("#"+input()+"#")
Problem p03733 (python)

Fixed submission:
n,t=map(int,input().split())
oyu=list(map(int,input().split()))
inl=[]
ans=n*t
for i in range(n-1):
  inl.append(oyu[i+1]-oyu[i])
for i in range(n-1):
  if inl[i]<t:
    ans-=t-inl[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
oyu=list(map(int,input.split()))
inl=[]
ans=n*t
for i in range(n-1):
  inl.append(oyu[i+1]-oyu[i])
for i in range(n-1):
  if inl[i]<t:
    ans-=t-inl[i]
print(ans)
Problem p03737 (python)

Fixed submission:
a,b,c=map(str,input().split())
print(a[0].upper()+b[0].upper()+c[0].upper())

Buggy submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
print(a[0].upper+b[0].upper+c[0].upper)
Problem p03738 (python)

Fixed submission:
a=input()
b=input()
c=len(a)
d=len(b)
if c>d:
  print("GREATER")
elif c<d:
  print("LESS")
else:
  flag=0
  for i in range(c):
    if int(a[i])>int(b[i]):
      print("GREATER")
      flag=1
      break
    elif int(a[i])<int(b[i]):
      print("LESS")
      flag=1
      break
    else:
      continue
  if flag==0:
    print("EQUAL")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=len(a)
d=len(b)
if c>d:
  print("GREATER")
elif c<d:
  print("LESS")
else:
  flag=0
  for i in range(c):
    if int(a[i])>int(b[i]):
      print("GREATER")
      flag=1
      break
    elif int(a[i])<int(b[i]):
      print("LESS")
      flag=1
    else:
      continue
if flag==0:
  print("EQUAL")
Problem p03762 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
X=0;Y=0
mod=10**9+7
for i in range(n-1):
  X+=(a[i+1]-a[i])*(i+1)*(n-i-1)
  X%=mod
for i in range(m-1):
  Y+=(b[i+1]-b[i])*(i+1)*(m-i-1)
  Y%=mod
print((X*Y)%mod)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
X=0;Y=0
mod=10**9+7
for i in range(n-1):
  X+=(a[i+1]-a[i])*(i+1)*(n-i-1)
  X%=mod
for i in range(n-1):
  Y+=(b[i+1]-b[i])*(i+1)*(n-i-1)
  Y%=mod
print(X*Y%mod)
Problem p03796 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
x=int(input())
def factorial(n):
  a=1
  if n==1:
    return a
  else:
    a= n*factorial(n-1)
    return a%(10**9+7)
print(factorial(x))

Buggy submission (verdict: Runtime Error):
x=int(input())
def factorial(n):
  a=1
  if n==1:
    return a
  else:
    a= n*factorial(n-1)
    return a%(10**9+7)
print(factorial(x))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
x=int(input())
def factorial(n):
  a=1
  if n==1:
    return a
  else:
    a= n*factorial(n-1)
    return a
print(factorial(x)%(10**9+7))

Buggy submission (verdict: Runtime Error):
x=int(input())
def factorial(n):
  a=1
  if n==1:
    return a
  else:
    a= n*factorial(n-1)
    return a
print(factorial(x)%(10**9+7))

Buggy submission (verdict: Runtime Error):
def factorial(n):
  a=1
  if n==1:
    return a
  else:
    a*= factorial(n-1)
  return a
print(a/(10**9+7))
Problem p03807 (python)

Fixed submission:
n=int(input())
odd=0
even=0
a=list(map(int,input().split()))
for i in range(n):
  if a[i]%2==1:
    odd+=1
  else:
    even+=1
if odd%2==1:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
n=int(input())
odd=0
even=0
a=list(map(int,input().split()))
for i in range(n):
  if a[i]%2=1:
    odd+=1
  else:
    even+=1
if odd%2==1:
  print("NO")
else:
  print("YES")