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

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
for i in range(n):
  temp=a[temp-1]
  result.append(temp)
temp=result.index(result[len(result)-1])
c=len(result)-temp-1
if k<n:
  print(result[k])
else:
  print(result[temp+(k-temp)%c])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
temps=[1]
i=0
while i<k:
  temp=a[temp-1]
  result.append(temp)
  temps=list(set(result))
  if len(temps)!=len(result):
    break
  i=i+1
l=len(result)
temp=result.index(result[l-1])
if k<l:
  print(result[k+1])
else:
  l2=l-1-temp
  print(result[temp+(k-temp)%l2])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
i=0
while i<k:
  temp=a[temp-1]
  if temp in result:
    break
  result.append(temp)
  i=i+1
result.append(temp)

l=len(result)
temp=result.index(result[l-1])
if k<l:
  print(result[k+1])
else:
  l2=l-1-temp
  print(result[temp+(k-temp)%l2])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
i=0
while i<k:
  temp=a[temp-1]
  result.append(temp)
  if temp in result:
    break
  i=i+1

l=len(result)
temp=result.index(result[l-1])
if k<l:
  print(result[k+1])
else:
  l2=l-1-temp
  print(result[temp+(k-temp)%l2])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
i=0
while i<k:
  temp=a[temp-1]
  result.append(temp)
  if i+1!=result.index(temp):
    break
  i=i+1

l=len(result)
temp=result.index(result[l-1])
if k<l:
  print(result[k+1])
else:
  l2=l-1-temp
  print(result[temp+(k-temp)%l2])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
i=0
count=0
while i<k:
  temp=a[temp-1]
  result.append(temp)
  i=i+1
  for j in range(0,i-1):
    if temp==result[j]:
      count=count+1
  if count==1:
    break
temp=0
l=len(result)
for i in range(0,l):
  if result[l-1]==result[i]:
    temp=i
    break
if k<l:
  print(result[k+1])
else:
  l2=l-1-temp
  print(result[temp+(k-temp)%l2])
Problem p02687 (python)

Fixed submission:
S = input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
S = input()
if S=="ABC":
    print("ARC")
elsse:
    print("ABC")
Problem p02748 (python)

Fixed submission:
a,b,m=map(int,input().split())
at=list(map(int,input().split()))
bt=list(map(int,input().split()))
ans=min(at)+min(bt)
for i in range(m):
  x,y,c=map(int,input().split())
  ans=min(ans,at[x-1]+bt[y-1]-c)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,m=map(int,input().split())
at=list(map(int,input().split()))
bt=list(map(int,input().split()))
ans=min(at)+min(bt)
for i in range(m):
  x,y,c=map(int,input().split())
  ans=min(ans,at[x-1]+bt[y-1]-c)
print(ans)
v
Problem p02756 (python)

Fixed submission:
s=str(input())
s=list(s)
q=int(input())
sb=[0]*(q+1)
sa=[0]*(q+1)
sbi=0
sai=0
ta=0
for i in range(q):
  temp=str(input())
  temp=list(temp)
  if temp[0]=="1":
    ta=ta+1
  else:
    if (temp[2]=="1" and ta%2==0) or (temp[2]=="2" and ta%2!=0):
      sb[sbi]=temp[4]
      sbi=sbi+1
    else:
      sa[sai]=temp[4]
      sai=sai+1
lsb=sb.index(0)
lsa=sa.index(0)
sb.reverse()
ans=sb[len(sb)-lsb:len(sb)]+s+sa[0:lsa]
if ta%2!=0:
  ans.reverse()
print("".join(ans))

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
q=int(input())
sb=[0]*q
sa=[0]*q
sbi=0
sai=0
ta=0
for i in range(q):
  temp=str(input())
  temp=list(temp)
  if temp[0]=="1":
    ta=ta+1
  else:
    if (temp[2]=="1" and ta%2==0) or (temp[2]=="2" and ta%2!=0):
      sb[sbi]=temp[4]
      sbi=sbi+1
    else:
      sa[sai]=temp[4]
      sai=sai+1
lsb=sb.index(0)
lsa=sa.index(0)
sa.reverse()
ans=sb[0:lsb]+s+sa[len(sa)-lsa:len(sa)]
if ta%2!=0:
  ans.reverse()
print("".join(ans))

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
q=int(input())
sb=[0]*q
sa=[0]*q
sbi=0
sai=0
ta=0
for i in range(q):
  temp=str(input())
  temp=list(temp)
  if temp[0]=="1":
    ta=ta+1
  else:
    if (temp[2]=="1" and ta%2==0) or (temp[2]=="2" and ta%2!=0):
      sb[sbi]=temp[4]
      sbi=sbi+1
    else:
      sa[sai]=temp[4]
      sai=sai+1
lsb=sb.index(0)
lsa=sa.index(0)
sa.reverse()
ans=sb[0:lsb]+s+sa[len(sa)-lsa:len(sa)]
if ta%2!=0:
  ans.reverse()
print("".join(ans))
Problem p02760 (python)

Fixed submission:
a=[]
for i in range(3):
  a1,a2,a3=map(int,input().split())
  a.append(a1)
  a.append(a2)
  a.append(a3)
n=int(input())
for i in range(n):
  b=int(input())
  for j in range(9):
    if a[j]==b:
      a[j]=0
if a[0]==0 and a[1]==0 and a[2]==0:
  print("Yes")
elif a[3]==0 and a[4]==0 and a[5]==0:
  print("Yes")
elif a[6]==0 and a[7]==0 and a[8]==0:
  print("Yes")
elif a[0]==0 and a[3]==0 and a[6]==0:
  print("Yes")
elif a[1]==0 and a[4]==0 and a[7]==0:
  print("Yes")
elif a[2]==0 and a[5]==0 and a[8]==0:
  print("Yes")
elif a[0]==0 and a[4]==0 and a[8]==0:
  print("Yes")
elif a[2]==0 and a[4]==0 and a[6]==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=[]
for i in range(3):
  a1,a2,a3=map(int,input().split())
  a.append(a1,a2,a3)
n=int(input())
for i in range(n):
  b=int(input())
  for j in range(9):
    if a[j]==b:
      a[j]=0
if a[0]==0 and a[1]==0 and a[2]==0:
  print("Yes")
elif a[3]==0 and a[4]==0 and a[5]==0:
  print("Yes")
elif a[6]==0 and a[7]==0 and a[8]==0:
  print("Yes")
elif a[0]==0 and a[3]==0 and a[6]==0:
  print("Yes")
elif a[1]==0 and a[4]==0 and a[7]==0:
  print("Yes")
elif a[2]==0 and a[5]==0 and a[8]==0:
  print("Yes")
elif a[0]==0 and a[4]==0 and a[8]==0:
  print("Yes")
elif a[2]==0 and a[4]==0 and a[6]==0:
  print("Yes")
else:
  print("No")
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
ans=["a"]*n
for i in range(0,m):
  s,c=map(int,input().split())
  if ans[s-1]=="a" or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    break
else:
  if n==1 and ans[0]=="a":
    ans[0]=0
  elif ans[0]=="a":
    ans[0]=1
  for i in range(0,n):
    if ans[i]=="a":
      ans[i]=0
  if i>=2 and ans[0]==0:
    print(-1)
  else:
    if n==3:
      ans=int(ans[0])*100+int(ans[1])*10+int(ans[2])
    elif n==2:
      ans=int(ans[0])*10+int(ans[1])
    else:
      ans=int(ans[0])
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=["a"]*n
for i in range(0,m):
  s,c=map(int,input().split())
  if ans[s-1]=="a" or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    break
else:
  if i==0 and ans[0]=="a":
    ans[0]=0
  elif ans[0]=="a":
    ans[0]=1
  for i in range(0,n):
    if ans[i]=="a":
      ans[i]=0
  if ans[0]==0:
    print(-1)
  else:
    if n==3:
      ans=int(ans[0])*100+int(ans[1])*10+int(ans[2])
    elif n==2:
      ans=int(ans[0])*10+int(ans[1])
    else:
      ans=int(ans[0])
    print(ans)
Problem p02767 (python)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=float("Inf")
for i in range(x[0],x[n-1]+1):
  temp=i
  cal=0
  for j in range(0,n):
    cal=cal+(x[j]-temp)**2
  ans=min(ans,cal)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
x.sort()
ans=float("Inf")
for i in range(x[0],x[n-1]+1):
  print(i)
  cal=0
  for j in range(0,n):
    cal=cal+(x[j]-temp)**2
  ans=min(ans,cal)
print(ans)
Problem p02772 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(0,n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      count=count+1
  else:
    count=count+1
if count==n:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
count=0
for i in range(0,n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      count=count+1
  else:
    count=count+1
if count==n:
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
count=0
for i in range(0,n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      count=count+1
  else:
    count=count+1
if count==n
  print("APPROVED")
else:
  print("DENIED")
Problem p02783 (python)

Fixed submission:
h,a=map(int,input().split())
if h%a==0:
  print((int(h/a)))
else:
  print((int(h/a)+1))

Buggy submission (verdict: Runtime Error):
h,a=map(int,input().split())
if h%a==0:
  print((int(h/a))
else:
  print((int(h/a)+1))
Problem p02791 (python)

Fixed submission:
n=int(input())
b=list(map(int,input().split()))
count=1
temp=b[0]
for i in range(1,n):  
  if b[i]==min(b[i],temp):
    count=count+1
    temp=b[i]
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
b=list(map(int,input().split()))
count=1
temp=[b[0]]
for i in range(1,n):  
  if b[i]==min(b[i],temp):
    count=count+1
    temp=b[i]
print(count)
Problem p02806 (python)

Fixed submission:
n=int(input())
s=[]
t=[]
for i in range(n):
  st,tt=input().split()
  s.append(st)
  t.append(int(tt))
x=str(input())
temp=0
ans=sum(t)
for i in range(n):
  temp=temp+t[i]
  if s[i]==x:
    break
print(ans-temp)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[]
t=[]
for i in range(n):
  st,tt=map(input().split())
  s.append(st)
  t.append(tt)
x=str(input())
ans=0
for i in range(n):
  ans=ans+1
  if t[i]==x:
    break
print(ans)
Problem p02823 (python)

Fixed submission:
n,a,b=map(int,input().split())
if abs(a-b)%2==0:
  print(abs(a-b)//2)
else:
  temp=min(min(a-1,b-1),min(n-a,n-b))+1  
  print(min(temp+(abs(a-b)-1)//2,min(max(a-1,b-1),max(n-a,n-b))))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if abs(a-b)%2==0:
  print(abs(a-b)//2)
else:
  print(min(max(a-1,b-1),max(n-a,n-b))
Problem p02837 (python)

Fixed submission:
n=int(input())
xy=[[] for i in range(n)]
ans=0
a=[0]*n
for i in range(n):
  a[i]=int(input())
  for j in range(a[i]):
    x,y=map(int,input().split())
    xy[i].append([x,y])
for i in range(2**n):
  temp=[0]*n
  for j in range(n):
    if ((i >> j) & 1):
      temp[j]=1
  count=True
  for j in range(n):
    for k in range(a[j]):
      if temp[j]==1:
        p=xy[j][k][0]-1
        if temp[p]!=xy[j][k][1]:
          count=False
          break
  if count==True:
    ans=max(ans,sum(temp))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
xy=[[] for i in range(n)]
ans=0
a=[0]*n
for i in range(n):
  a[i]=int(input())
  for j in range(a[i]):
    x,y=map(int,input().split())
    xy[i].append([x,y])
for i in range(2**n):
  temp=[0]*n
  for j in range(n):
    if ((i >> j) & 1):
      temp[j]=1
  count=True
  for j in range(n):
    for k in range(a[j]):
      if temp[j]==1:
        p=xy[j][k][0]
        if temp[p]!=xy[j][k][0]:
          count=False
      else:
        p=xy[j][k][0]
        if temp[p]==xy[j][k][0]:
          count=False     
  if count==True:
    ans=max(ans,sum(temp))
print(ans)
Problem p02842 (python)

Fixed submission:
n=int(input())
for i in range(1,n+1):
  if i*1.08>=n and i*1.08<n+1:
    print(i)
    break
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
  if int(temp*1.08)==n:
    print(temp)
    break
else:
  print(":(")
Problem p02939 (python)

Fixed submission:
s=str(input())
s=list(s)
ans=1
i=1
temp=s[0]
while True:
  if s[i]!=temp:
    ans=ans+1
    temp=s[i]
    i=i+1
  elif s[i]==temp and i==len(s)-1:
    i=i+1
  else:
    temp=s[i]+s[i+1]
    i=i+2
    ans=ans+1
  if i>len(s)-1:
    break
print(ans)

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
ans=1
i=1
temp=s[0]
while True:
  if s[i]!=temp:
    ans=ans+1
    temp=s[i]
    i=i+1
  else:
    temp=s[i]+s[i+1]
    i=i+2
    ans=ans+1
  if i>len(s)-1:
    break
print(ans)
Problem p02953 (python)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
base=0
for h in H:
    if base>h:
        print("No")
        break
    base=max(base,h-1)
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
temp=0
if n==1:
  print("Yes")
else:
  for i in h:
    if h[i]<temp:
      print("No")
      break
    temp=max(temp,h[i]-1)
  else:
    print("Yes")
Problem p02993 (python)

Fixed submission:
n=str(input())
n=list(n)
if n[0]==n[1] or n[1]==n[2] or n[2]==n[3]:
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
n=int(input())
n=list(str(n))
if n[0]==n[1] or n[1]==n[2] or n[2]==n[3]:
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
n=int(input())
n=list(str(n))
if n[0]==n[1] or n[0]==n[2] or n[0]==n[3] or n[1]==n[2] or n[1]==n[3] or n[2]==n[3]:
  print("Good")
else:
  print("Bad")
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())
print(w*h/2,int(x==w/2 and y==h/2))

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
if w==x and h==y:
  print(w*h,1)
else:
  temp1=min(w*y,w*(h-y))
  temp2=min(h*x,h*(w-x))
  print(max(temp1,temp2),int(temp1==temp2))w,h,x,y=map(int,input().split())
if w==x and h==y:
  print(w*h,1)
else:
  temp1=min(w*y,w*(h-y))
  temp2=min(h*x,h*(w-x))
  print(max(temp1,temp2),int(temp1==temp2))
Problem p03030 (python)

Fixed submission:
n=int(input())
temp=[0]*n
for i in range(0,n):
  s,p=input().split()
  temp[i]=[i,s,int(p)]
temp=sorted(temp, key=lambda x: (x[1],-x[2]))
for i in range(0,n):
  print(temp[i][0]+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
temp=[0]*n
for i in range(0,n):
  s,p=input().split()
  temp[i]=[i,s,int(p)]
temp=sorted(temp, key=lambda x: (x[1],-x[2]))
for i in range(0,n)
  print(temp[i])
Problem p03103 (python)

Fixed submission:
n,m=map(int,input().split())
t=[0]*n
ans=0
temp=0
for i in range(n):
  at,bt=map(int,input().split())
  t[i]=[at,bt]
t.sort()
i=0
while True:
  if temp+t[i][1]>=m:
    ans=ans+t[i][0]*(m-temp)
    break
  else:
    ans=ans+t[i][0]*t[i][1]
    temp=temp+t[i][1]
    i=i+1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
ans=0
temp=0
for i in range(n):
  at,bt=map(int,input().split())
  a[i]=at
  b[i]=bt
import numpy as np
a=np.array(a)
b=np.array(b)
t=np.argmin(a)
while temp<m:
  ans=ans+a[t]
  temp=temp+1
  b[t]=b[t]-1
  if b[t]==0:
    a=np.delete(a,t)
    b=np.delete(b,t)
    t=np.argmin(a)
print(ans)
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
temp=[]
for i in range(1,min(a,b)+1):
  if a%i==0 and b%i==0:
    temp.append(i)
print(temp[len(temp)-k])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
import math
temp=a*b//math.gcd(a,b)
print(temp*k)
Problem p03126 (python)

Fixed submission:
import itertools
n,m=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(list(map(int,input().split())))
  del a[i][0]
a=list(itertools.chain.from_iterable(a))
count=0
for i in range(0,m):
  if a.count(i+1)==n:
    count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
import itertools
n,m=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(list(map(int,input().split())))
  del a[i][0]
a=list(itertools.chain.from_iterable(a))
count=0
for i in range(0,m):
  if a.count(i)==n
  count=count+1
print(count)
Problem p03211 (python)

Fixed submission:
s=str(input())
s=list(s)
ans=999
for i in range(0,len(s)-2):
  temp=int(s[i])*100+int(s[i+1])*10+int(s[i+2])
  ans=min(ans,abs(753-temp))
print(ans)

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
ans=999
for i in range(0,len(s)-2):
  temp=s[i]*100+s[i+1]*10+s[i+2]
  ans=min(ans,abs(753-temp))
print(ans)
Problem p03244 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
temp1=[]
temp2=[]
for i in range(0,n):
  if i%2==0:
    temp1.append(v[i])
  else:
    temp2.append(v[i])
count=0
from collections import Counter
c1=Counter(temp1)
values1,counts1=zip(*c1.most_common())
counts1=list(counts1)
mode1=counts1[0]
if len(counts1)>1:
  mode1s=counts1[1]
c2=Counter(temp2)
values2,counts2=zip(*c2.most_common())
counts2=list(counts2)
mode2=counts2[0]
if len(counts2)>1:
  mode2s=counts2[1]
if len(counts1)==1 and len(counts2)==1 and c1.most_common()[0][0]==c2.most_common()[0][0]:
  count=min(mode1,mode2)
elif c1.most_common()[0][0]==c2.most_common()[0][0]:
  if len(temp1)-mode1s>=len(temp2)-mode2s:
    count=len(temp1)-mode1+len(temp2)-mode2s
  else:
    count=len(temp2)-mode2+len(temp1)-mode1s
else:
  count=len(temp1)-mode1+len(temp2)-mode2
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
temp1=[]
temp2=[]
for i in range(0,n):
  if i%2==0:
    temp1.append(v[i])
  else:
    temp2.append(v[i])
count=0
from collections import Counter
c1=Counter(temp1)
mode1=c1.most_common()[0][1]
mode1s=c1.most_common()[1][1]
c2=Counter(temp2)
mode2=c2.most_common()[0][1]
mode2s=c2.most_common()[1][1]
if c1.most_common()[0][0]==c2.most_common()[0][0]:
  if mode1s>=mode2s:
    count=len(temp1)-mode1s
  else:
    count=len(temp2)-mode2s
else:
  count=len(temp1)-mode1+len(temp2)-mode2
print(count)
Problem p03251 (python)

Fixed submission:
n,m,x,y=map(int,input().split())
xt=list(map(int,input().split()))
yt=list(map(int,input().split()))
xt.sort()
yt.sort()
if max(x,xt[len(xt)-1])<min(y,yt[0]):
  print("No War")
else:
  print("War")

Buggy submission (verdict: Runtime Error):
n,m,x,y=map(int,input().split())
xt=list(map(int,input().split()))
yt=list(map(int,input().split()))
xt.sort()
yt.sort()
if x<y and xt[len(xt)-1]<y[0]:
  print("No War")
else:
  print("War")
Problem p03264 (python)

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

Buggy submission (verdict: Runtime Error):
k=int(input())
print(int(n/2))k=int(input())
if n%2==0:
  print(int((n/2)*(n/2)))
else:
  print(int(n/2)*(int(n/2)+1))
Problem p03309 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
temp=[0]*n
for i in range(0,n):
  temp[i]=a[i]-(i+1)
temp.sort()
ave=int(n/2)
ans=0
for i in range(0,n):
  ans=ans+abs(temp[i]-temp[ave])
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
temp=[0]*n
for i in range(0,n):
  temp[i]=a[i]-(i+1)
temp.sort()
ave=temp/n
print(ave)
Problem p03385 (python)

Fixed submission:
s=str(input())
s=list(s)
s=list(set(s))
s.sort()
if len(s)>=3:
  if s[0]=="a" and s[1]=="b" and s[2]=="c":
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
s=list(set(s))
s.sort()
if s[0]=="a" and s[1]=="b" and s[2]=="c":
  print("Yes")
else:
  print("No")
Problem p03393 (python)

Fixed submission:
s=str(input())
t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
if len(s)!=26:
  s=list(s)
  for i in range(26):
    if t[i] not in s:
      s.append(t[i])
      break
  print("".join(s))
else:
  if "".join(s)=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
  else:
    a=[]
    for i in range(26):
      a.append(s[25-i])
      for j in a:
        if s<s[:25-i]+j:
          print(s[:25-i]+j)
          exit()

Buggy submission (verdict: Runtime Error):
s=str(input())
t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
if len(s)!=26:
  for i in range(26):
    if t[i] not in s:
      s.append(t[i])
      break
  print("".join(s))
else:
  if "".join(s)=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
  else:
    a=[]
    for i in range(26):
      a.append(s[25-i])
      for j in a:
        if s<s[:25-i]+j:
          print(s[:25-i]+j)
          exit()

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
if len(s)!=26:
  for i in range(26):
    if t[i] not in s:
      s.append(t[i])
      break
  print("".join(s))
else:
  if "".join(s)=="abcdefghijklmnopqrstuvwxyz":
    print("abcdefghijklmnopqrstuvwxzy")
  elif "".join(s)=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
  else:
    ans=[]
    for i in range(26):
      if s[i]==t[i]:
        ans.append(s[i])
      else:
        if len(ans)==1:
          ans.append(t[i])
        else:
          del ans[len(ans)-1]
          ans.append(t[i])
          break
    print("".join(ans))

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
if len(s)!=26:
  for i in range(26):
    if t[i] not in s:
      s.append(t[i])
      break
  print("".join(s))
else:
  if "".join(s)=="abcdefghijklmnopqrstuvwxyz":
    print("abcdefghijklmnopqrstuvwxzy")
  elif "".join(s)=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
  else:
    ans=[]
    for i in range(26):
      if s[i]==t[i]:
        ans.append(s[i])
      else:
        del ans[len(ans)-1]
        ans.append(t[i])
        break
    print("".join(ans))
Problem p03427 (python)

Fixed submission:
n=int(input())
t=list(str(n))
cnt=0
for i in range(1,len(t)):
  if t[i]=="9":
    cnt=cnt+1
if cnt==len(t)-1:
  print(int(t[0])+9*cnt)
else:
  print(int(t[0])-1+9*(len(t)-1))

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(str(n))
if n%10**len(t)==0:
  print(9*(len(t)-1))
elif: n%10**(len(t)-1)==0:
  print(t[0]+9*(len(t)-2))
else:
  print(t[0]-1+9*(len(t)-2))
Problem p03457 (python)

Fixed submission:
n = int(input())
count=0
temp=0
xtemp=0
ytemp=0
for i in range(0,n):
    t,x,y = map(int, input().split())
    if abs(t-temp)>=abs(x-xtemp)+abs(y-ytemp) and (x-xtemp+y-ytemp-(t-temp))%2==0:
        count=count+1
    temp=t
    xtemp=x
    ytemp=y
if count==n:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):

n = int(input())
count=0
for i in range(0,n):
    t,x,y = map(int, input().split())
    if (t-temp)>=x+y and (x+y-(t-temp))%2==0:
        count=count+1
    temp=t
if count==n:
    print("Yes")
else:
    print("No")
Problem p03471 (python)

Fixed submission:
x,y=map(int,input().split())
a1=-1
b1=-1
c1=-1
for a in range(0,x+1):
    for b in range(0,x+1-a):
        c=x-a-b
        if 10000*a+5000*b+1000*c==y:
            a1=a
            b1=b
            c1=c
print(a1,b1,c1)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
    a1=-1
    b1=-1
    c1=-1
    for a in range(0,x+1):
    	for b in range(0,x+1-a):
    		c=x-a-b
    		if 10000*a+5000*b+1000*c==y:
    			a1=a
    			b1=b
    			c1=c
    print(a1,b1,c1)
Problem p03501 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
print(min(a*t,b))
Problem p03502 (python)

Fixed submission:
n=int(input())
temp=list(str(n))
a=0
for i in range(0,len(temp)):
  a=a+int(temp[i])
if n%a==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
temp=list(n)
if n%sum(temp)==0:
  print("Yes")
else:
  print("No")
Problem p03523 (python)

Fixed submission:
s=str(input())
s=list(s)
if s[0]!="A":
  s.insert(0,"A")
if len(s)>=5:
  if s[4]!="A":
    s.insert(4,"A")
if len(s)>=7:
  if s[6]!="A":
    s.insert(6,"A")
if s[len(s)-1]!="A":
  s.append("A")
if "".join(s)=="AKIHABARA":
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
if s[0]!="A":
  s.insert(0,"A")
if len(s)>=4:
  if s[4]!="A":
    s.insert(4,"A")
if len(s)>=6:
  if s[6]!="A":
    s.insert(6,"A")
if s[len(s)-1]!="A":
  s.append("A")
if "".join(s)=="AKIHABARA":
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s=str(input())
s=list(s)
if s[0]!="A":
  s.insert(0,"A")
if s[4]!="A":
  s.insert(4,"A")
if s[6]!="A":
  s.insert(6,"A")
if s[8]!="A":
  s.insert(8,"A")
if "".join(s)=="AKIHABARA":
  print("YES")
else:
  print("NO")
Problem p03547 (python)

Fixed submission:
x,y=map(str,input().split())
if x<y:
  print("<")
elif x>y:
  print(">")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if x<y:
  print("<")
elif x>y:
  print(">")
else:
  print("=")