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

Fixed submission:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='No'
if a[1]-a[0]==b[1]-b[0]==c[1]-c[0] and a[2]-a[1]==b[2]-b[1]==c[2]-c[1]:
  if b[0]-a[0]==b[1]-a[1]==b[2]-a[2] and c[0]-b[0]==c[1]-b[1]==c[2]-b[2]:
    ans='Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='No'
if a[1]-a[0]==b[1]-b[0]==c[1]-c[0] and a[2]-a[1]==b[2]-b[1]==c[2]-c[1]:
  b[0]-a[0]==b[1]-a[1]==b[2]-b[2] and c[0]-b[0]==c[1]-b[1]==c[2]-b[2]:
    ans='Yes'
print(ans)
Problem p03436 (python)

Fixed submission:
h,w=map(int,input().split())
maze=[list(input()) for i in range(h)]
distance=[[-1]*w for i in range(h)]

cnt=0
for i in maze:
  cnt+=i.count('#')

Q=[[0,0]]
distance[0][0]=1

ans=-1

while Q:
  p=Q.pop(0)
  if p[0]==h-1 and p[1]==w-1:
    ans=h*w-cnt-distance[h-1][w-1]
    break

  dx=[1,-1,0,0]
  dy=[0,0,1,-1]

  for i in range(4):
    nx=p[0]+dx[i]
    ny=p[1]+dy[i]

    if 0<=nx<h and 0<=ny<w and distance[nx][ny]==-1 and maze[nx][ny]!='#':
      Q.append([nx,ny])
      distance[nx][ny]=distance[p[0]][p[1]]+1

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

h,w=map(int,input().split())
maze=[list(input()) for i in range(h)]
distance=[[-1]*w for i in range(h)]

cnt=0
for i in maze:
  cnt+=i.count('#')

Q=deque()
Q=((0,0))
distance[0][0]=1

ans=-1

while Q:
  p=Q.pop(0)
  if p[0]==h-1 and p[1]==w-1:
    ans=h*w-cnt-distance[h-1][w-1]
    break

  dx=[1,-1,0,0]
  dy=[0,0,1,-1]

  for i in range(4):
    nx=p[0]+dx[i]
    ny=p[1]+dy[i]

    if 0<=nx<h and 0<=ny<w and distance[nx][ny]==-1 and maze[nx][ny]!='#':
      Q.append((nx,ny))
      distance[nx][ny]=distance[p[0]][p[1]]+1

print(ans)
Problem p03455 (python)

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

Buggy submission (verdict: Runtime Error):
if (int(input())*int(input()))%2==0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
if int((input())*int(input()))%2==0:
  print('Even')
else:
  print('Odd')
Problem p03457 (python)

Fixed submission:
n=int(input())

a,b,c=0,0,0

for i in range(n):
  x,y,z=map(int,input().split())
  dist=abs(b-y)+abs(c-z)
  if dist>x-a or (dist-(x-a))%2==1:
    print('No')
    exit()
    
  else:
    a,b,c=x,y,z
    continue
    
print('Yes')

Buggy submission (verdict: Runtime Error):
n=int(input())
ans='Yes'
t,a,b=map(int,input().split())
if (a+b)<t or (a+b-t)%2==1:
  ans='No'
for i in range(n):
  u,x,y=map(int,input().split())
  if (u-t)<abs(x-a)+abs(y-b) or ((u-t)-abs(x-a)-abs(y-b))%2==1:
    ans='No'
    break
  t,a,b=u,x,y
print(ans)
Problem p03469 (python)

Fixed submission:
s=input()
s=s.replace('2017','2018')
print(s)

Buggy submission (verdict: Runtime Error):
s=input()
s[3]='8'
print(s)
Problem p03471 (python)

Fixed submission:
n,y=map(int,input().split())
a,b,c=-1,-1,-1
x=y//1000-n
if y%1000==0:
  for i in range(n+1):
    for j in range(n+1-i):
      if x==9*i+4*j:
        a=i
        b=j
        c=n-i-j
        break
    if a!=-1:
      break
print(a,b,c)

Buggy submission (verdict: Runtime Error):
n,y=map(int,input().split())
a,b,c=-1,-1,-1
x=y//1000-n
if y%1000==0:
  for i in range(n+1):
    for j in range(n+1-j):
      if x==9*i+4*j:
        a=i
        b=j
        c=n-i-j
        break
    if a!=-1:
      break
print(a,b,c)
Problem p03472 (python)

Fixed submission:
import sys
import math
input=sys.stdin.readline

n,h=map(int,input().split())

once=[]
infinity=[]

for i in range(n):
  a,b=map(int,input().split())
  once.append(b)
  infinity.append(a)
  
once.sort(reverse=True)

pin=max(infinity)

once2=[]
for i in range(n):
  if once[i]>pin:
    once2.append(once[i])
  
  else:
      break

ans=0
for i in once2:
    ans+=1
    h-=i
    if h<=0:
        print(ans)
        exit()

ans+=math.ceil(h/pin)


print(ans)

Buggy submission (verdict: Runtime Error):
from math import ceil

n,h=map(int,input().split())
a=[]
b=[]
ans=0

for i in range(n):
  aa,bb=map(int,input().split())
  a.append(aa)
  b.append(bb)

b.sort()

pin=max(a)

while True:
  p=b.pop()
  if p<pin:
    break
  ans+=1
  h-=p

ans+=ceil(h/pin)


print(ans)

Buggy submission (verdict: Runtime Error):
from math import ceil

n,h=map(int,input().split())
a=[]
b=[]
lst=[]
ans=0

for i in range(n):
  aa,bb=map(int,input().split())
  a.append(aa)
  b.append(bb)
  lst.append([aa,bb])




lst.sort(key=lambda x:max(x[0],x[1]))


guilty=sum(b)
app=max(a)

ans+=ceil((h-guilty)/app)
h-=ans*app

cnt=0

for i in b:
  if i<app:
    cnt+=1

while cnt>0:
  cnt-=1
  ans+=1
  h-=app
  if h<=0:
    print(ans)
    exit()

while True:
  p,q=lst.pop()
  z=max(p,q)
  ans+=1
  h-=z
  if h<=0:
    h+=z
    xxx,yyy=lst.pop()
    h-=yyy
    if h<=0:
      print(ans-1)
      exit()

    else:
      print(ans)
      exit()
Problem p03474 (python)

Fixed submission:
a,b=map(int,input().split())
s=input()
if s[a]=='-' and s.count('-')==1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import re
a,b=map(int,input().split())
s=input()
if re.fullmatch('^[0-9]{a}-[0-9]{b}$',s)==True:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import re
a,b=map(int,input().split())
s=input()
if re.fullmatch(^[0-9]{a}-[0-9]{b}$,s)==True:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import re
a,b=map(int,input().split())
s=input()
if re.fullmatch([0-9]{a}-[0-9]{b},s)==True:
  print('Yes')
else:
  print('No')
Problem p03485 (python)

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

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

Fixed submission:
s=list(input())
t=list(input())
s.sort()
t.sort()
if s==t and s.count(s[0])==len(s) and t.count(s[0])==len(t):
    print('No')
elif s.count(s[0])==len(s) and t.count(s[0])==len(t):
    if len(s)<len(t):
      print('Yes')
    else:
      print('No')
else:
    if ord(s[0])==ord(t[-1]):
      print('No')
    elif ord(s[0])<ord(t[-1]):
      print('Yes')
    else:
      print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())
s.sort()
t.sort()
if s==t and s.count(s[0])==len(s) and t.count(s[0])==len(t):
  print('No')
  elif s.count(s[0])==len(s) and t.count(s[0])==len(t):
    if len(s)<len(t):
      print('Yes')
    else:
      print('No')
  else:
    if ord(s[0])==ord(t[-1]):
      print('No')
    elif ord(s[0])<ord(t[-1]):
      print('Yes')
    else:
      print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())
s.sort()
t.sort()
for i in range(min(len(s),len(t))):
  if s[-1*(i+1)]==t[-1*(i+1)]:
    x=1
    continue
  elif ord(s[-1*(i+1)])>ord(t[-1*(i+1)]):
    print('No')
    x=0
    break
  else:
    x=0
    print('Yes')
    break
if x=1:
  if len(s)<len(t):
    print('Yes')
  else:
    print('No')
Problem p03493 (python)

Fixed submission:
s=input()
print(s.count('1'))

Buggy submission (verdict: Runtime Error):
s=input()
print(s.count(1))
Problem p03494 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=30
for i in a:
  x=0
  while True:
    if i%2==1:
      break
    else:
      x+=1
      i=i//2
      continue
  ans=min(ans,x)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=30
for i in a:
  x=0
  while True:
    if i%2==1:
      break
    else:
    x+=1
    i=i//2
    continue
  ans=min(ans,x)
print(ans)
Problem p03502 (python)

Fixed submission:
n=int(input())
m=str(n)
x=0
for i in m:
  x+=int(i)
if n%x==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
m=str(n)
x=0
for i in m:
  x+=i
if n%x==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=input()
x=0
for i in n:
  x+=i
if int(n)%x==0:
  print('Yes')
else:
  print('No')
Problem p03545 (python)

Fixed submission:
a=list(input())
for i in range(4):
  a[i]=int(a[i])
x=sum(a)-7
dict={0:'+',1:'-'}
ans=0
for i in range(2):
  for j in range(2):
    for k in range(2):
        if x==(i*a[1]+j*a[2]+k*a[3])*2:
          print(a[0],dict[i],a[1],dict[j],a[2],dict[k],a[3],'=7',sep='')
          ans=1
        if ans==1:
          break
    if ans==1:
      break
  if ans==1:
    break

Buggy submission (verdict: Runtime Error):
import itertools
x=list(input())

for lst in itertools.product(['+','-'],repeat=3)
  sum=int(x[0])
  for i in range(3):
    if lst[i]=='+':
      sum+=int(x[i+1])
    else:
      sum-=int(x[i+1])
  if sum==7:
    print(x[0]+lst[0]+x[1]+lst[1]+x[2]+lst[2]+x[3]+'=7')
    break
Problem p03556 (python)

Fixed submission:
n=int(input())
for i in range(1,40000):
  if i**2>n:
    print((i-1)**2)
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1,40000):
  if i*i>n:
  　print(i-1)
    break
Problem p03568 (python)

Fixed submission:
n=int(input())
n=3**n
a=list(map(int,input().split()))

a=[2 if i%2==0 else 1 for i in a]

cnt=1

for i in a:
  cnt*=i
  
  
print(n-cnt)

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

a=[2 if i%2==0 for i in a else 1]

cnt=1

for i in a:
  cnt*=i
  
  
print(n-cnt)
Problem p03607 (python)

Fixed submission:
import collections
n=int(input())
lst=[int(input()) for i in range(n)]
xs=list(set(lst))
ans=0
lst=collections.Counter(lst)
for i in xs:
  if lst[i]%2==1:
    ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
lst=[int(input()) for i in range(n)]
xs=list(set(lst))
ans=0
lst=collections.Counter(lst)
for i in xs:
  if lst[i]%=1:
    ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=set(a)
ans=0
for i in b:
  a.count(i)%2==1:
    ans+=1
print(ans)
Problem p03609 (python)

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

Buggy submission (verdict: Runtime Error):
print(max((int(input())-int(input())),0))

Buggy submission (verdict: Runtime Error):
print(int(input())-int(input()))
Problem p03637 (python)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
a,b,c=0,0,0
ans='No'
for i in x:
  if i%4==0:
    a+=1
  elif i%2==0:
    b+=1
  else:
    c+=1
if n%2==1:
  if c-a==1:
    if b==0:
      ans='Yes'
  elif a>=c:
    ans='Yes'
else:
  if a>=c:
    ans='Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a,b,c=0,0,0
ans='No'
for i in a:
  if a%4==0:
    a+=1
  elif a%2==0:
    b+=1
  else:
    c+=1
if n%2==1:
  if c-a==1:
    if b==0:
      ans='Yes'
  elif a>=c:
    ans='Yes'
else:
  if a>=c:
    ans='Yes'
print(ans)
Problem p03640 (python)

Fixed submission:
h,w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))
lst=[]


for i in range(1,n+1):
  for j in range(a[i-1]):
    lst.append(str(i))

lst.reverse()
    
ans=[[0]*w for i in range(h)]

for i in range(h):
  if i%2==0:
    for j in range(w):
      ans[i][j]=lst.pop()

  else:
    for j in range(w-1,-1,-1):
      ans[i][j]=lst.pop()

for i in ans:
  print(' '.join(i))

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

for i in range(1,n+1):
  for j in range(i):
    lst.append(str(i))
    
ans=[[0]*w for i in range(h)]

for i in range(h):
  if i%2==0:
    for j in range(w):
      ans[i][j]=lst.pop()

  else:
    for j in range(w-1,-1,-1):
      ans[i][j]=lst.pop()

for i in ans:
  print(' '.join(i))
Problem p03645 (python)

Fixed submission:
n,m=map(int,input().split())
lst=[list(map(int,input().split())) for i in range(m)]

x=[]
y=[]

for i in lst:
  if i[0]==1:
    x+=[i[1]]
    
for i in lst:
  if i[1]==n:
    y+=[i[0]]
    
ans='POSSIBLE'

if len(list(set(x)))+len(list(set(y)))==len(list(set(x+y))):
  ans='IMPOSSIBLE'
    
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[list(map(int,input().split())) for i in range(m)]
x=[]
y=[]
for i in lst:
  if lst[0]==1:
    x+=[i[1]]
for i in lst:
  if lst[1]==n:
    y+=[i[0]]
ans='IMPOSSIBLE'
for i in x:
  if i in y:
    ans='POSSIBLE'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[list(map(int,input().split())) for i in range(m)]
x=[]
y=[]
for i in lst:
  if lst[0]==1:
    x+=[i[1]]
for i in lst:
  if lst[1]==n:
    y+=[i[0]]
ans='IMPOSSIBLE'
for i in x:
  if i in y:
    ans='POSSIBLE'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[list(map(int,input().split())) for i in range(m)]
x=[]
y=[]
for i in lst:
  if lst[0]==1:
    x+=[lst[1]]
for i in lst:
  if lst[1]==n:
    y+=[lst[0]]
ans='IMPOSSIBLE'
for i in x:
  if i in y:
    ans='POSSIBLE'
    break
print(ans)
Problem p03672 (python)

Fixed submission:
s=input()
s=s[:-1]
while True:
  if len(s)%2==0 and s[len(s)//2:]==s[:len(s)//2]:
    print(len(s))
    break
  else:
    s=s[:-1]
    continue

Buggy submission (verdict: Runtime Error):
s=input()
s=s.replace(s[-1],'')
while True:
    s=s.replace(s[-1],'')
    if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
      print(len(s))
      break
Problem p03673 (python)

Fixed submission:
n=int(input())
a=list(input().split())
if n%2==0:  
  b=a[::2]
  a.pop(0)
  c=a[::2]
  c.reverse()
  print(' '.join(c+b))
else:
  b=a[::2]
  a.pop(0)
  c=a[::2]
  b.reverse()
  print(' '.join(b+c))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in a:
  b.append(i)
  b.reverse()
print(' '.join(b))
Problem p03693 (python)

Fixed submission:
r,g,b=map(int,input().split())
if ((g*10+b)%4)==0:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
r,g,b=map(int.input().split())
if ((g*10+b)%4)==0:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
r,g,b=map(int.input().split())
if (g*10+b)%4==0:
  print('YES')
else:
  print('NO')
Problem p03711 (python)

Fixed submission:
a,b=map(int,input().split())
list=[4,6,9,11]
if a==2 or b==2:
  print('No')
elif a in list and b in list:
  print('Yes')
elif a not in list and b not in list:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split()
list=[4,6,9,11]
if a==2 or b==2:
  print('No')
elif a in list and b in list:
  print('Yes')
elif a not in list and b not in list:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split()
if a==2 or b==2:
  print('No')
list=[4,6,9,11]
elif a in list and b in list:
  print('Yes')
elif a not in list and b not in list:
  print('Yes')
else:
  print('No')
Problem p03779 (python)

Fixed submission:
x=int(input())
ans=0
i=1
cnt=0
while x>ans:
  ans+=i
  i+=1
  cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(pow(n*2,0.5)//1+1,0,-1):
  if i*(i-1)<2*n:
    continue
  else:
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(pow(n*2,0.5)//1+1,0,-1):
  if i*(i-1)<2*n:
    continue
  else:
    print(i+1)
Problem p03807 (python)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
a=[]
for i in x:
  if i%2==1:
      a+=[i]
if len(a)%2==1:
  print('NO')
else:
  print('YES')

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

cnt=0
for i in a:
  if i%2=1:
    cnt+=1
    
if cnt%2==1:
  print('NO')
  
else:
  print('YES')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a=[i if i%2==1 else None  for i in a]
if a.count()%2==1:
  print('NO')
else:
  print('YES')
Problem p03838 (python)

Fixed submission:
x,y=map(int,input().split())

ans=abs(abs(x)-abs(y))

if y<x<0 or 0<y<x:
    ans+=2

elif y<x or x<0<y:
    ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())

ans=abs(abs(x)-abs(y))

if y<x<0 or 0<y<x:
    ans+=2

elif y<x x<0<y:
    ans+=1

print(ans)
Problem p03845 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
m=int(input())
for i in range(m):
    s,t=map(int,input().split())
    print(sum(a)-a[s-1]+t)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
m=int(input())
b=[map(int,input().split()) for _ in range(m)]
for i in b:
    print(sum(a)-a[i[0]]+i[1])
Problem p03852 (python)

Fixed submission:
c=input()
if c in ['a','i','u','e','o']:
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
c=input()
if c== ['a'|'i'|'u'|'e'|'o']:
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
c=input()
if c== 'a'|'i'|'u'|'e'|'o':
  print('vowel')
else:
  print('consonant')
Problem p03854 (python)

Fixed submission:
s=input()
t=''
while s!='':
  if len(s)<=4:
    break
  elif s[:5]=='dream':
    if len(s)>=10 and s[5:10]=='erase':
      s=s[5:]
      continue
    elif len(s)>=7 and s[5:7]=='er':
      s=s[7:]
      continue
    else:
      s=s[5:]
      continue
  elif s[:5]=='erase':
    if len(s)>=6 and s[5]=='r':
      s=s[6:]
      continue
    else:
      s=s[5:]
      continue
  
  elif s[:5]!='dream' and s[:5]!='erase':
    break
      
    
if s=='':
  print('YES')
  
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
s=input()
t=''
while s!='':
  if s[:5]=='dream':
    if s[5:10]=='erase':
      s=s[5:]
      continue
    elif s[5:7]=='er':
      s=s[7:]
      continue
    else:
      s=s[5:]
      continue
  elif s[:5]=='erase':
    if s[5]=='r':
      s=s[6:]
      continue
    else:
      s=s[5:]
      continue
      
  else:
    break
    
if s=='':
  print('YES')
  
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
s=input()
t=''
while s!='':
  if s[:5]=='dream':
    if s[5:10]=='erase':
      s=s[5:]
      continue
    elif s[5:7]='er':
      s=s[7:]
      continue
  elif s[:5]=='erase':
    if s[5]=='r':
      s=s[6:]
    else:
      s=s[5:]
      
  else:
    break
    
if s=='':
  print('YES')
  
else:
  print('NO')
Problem p03945 (python)

Fixed submission:
s=list(input())
ans=0
pin=s[0]
for i in range(1,len(s)):
  if s[i]!=pin:
    ans+=1
    pin=s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
ans=0
pin=s[0]
for i in s[1:]:
  if s[i]==pin:
    ans+=1
    pin=s[i]
print(ans)
Problem p03951 (python)

Fixed submission:
n=int(input())
s=input()
t=input()
while True:
  if s==t:
    break
  s=s[1:]
  t=t[:-1]
  n+=1
print(n)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
t=input()
while True:
  if s==t:
    break
  s=s[1:]
  t=[:-1]
  n+=1
print(n)
Problem p03957 (python)

Fixed submission:
s=input()
ans='No'
for i in range(len(s)):
  if s[i]=='C':
    for j in s[i+1:]:
      if j=='F':
        ans='Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans='No'
for i in range(len(s)):
  if s[i]=='C':
    for j in s[i+1:]:
      if s[j]=='F':
        ans='Yes'
print(ans)
Problem p03970 (python)

Fixed submission:
s=input()
t='CODEFESTIVAL2016'
ans=0
for i in range(16):
  if s[i]!=t[i]:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
s=int(input())
t='CODEFESTIVAL2016'
ans=0
for i in range(16):
  if s[i]!=t[i]:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
s=int(input())
t='CODEFESTIVAL2016'
ans=0
for i in range(16):
  if s!=t:
    ans+=1
print(ans)
Problem p03998 (python)

Fixed submission:
a=list(input())
b=list(input())
c=list(input())
order='a'
while True:
  if order=='a':
    if len(a)==0:
      print('A')
      break
    else:
      order=a[0]
      a=a[1:]
  elif order=='b':
    if len(b)==0:
      print('B')
      break
    else:
      order=b[0]
      b=b[1:]
  elif order=='c':
    if len(c)==0:
      print('C')
      break
    else:
      order=c[0]
      c=c[1:]

Buggy submission (verdict: Runtime Error):
a=list(input())
b=list(input())
c=list(input())
order='a'
while True:
  if order='a':
    order=a[0]
    if len(a)==1:
      print('A')
      break
    else:
      a=a[1:]
  elif order='b':
    order=b[0]
    if len(b)==1:
      print('B')
      break
    else:
      b=b[1:]
  elif order='c':
    order=c[0]
    if len(c)==1:
      print('C')
      break
    else:
      c=c[1:]

Buggy submission (verdict: Runtime Error):
a=list(input())
b=list(input())
c=list(input())
x=a
y=''
While True:
  y=x[0]
  x.pop(0)
  x=y
  if len(a)==0:
    print('A'):
      break
  if len(b)==0:
    print('B')
    break
  if len(c)==0:
    print('C')
    break
Problem p04013 (python)

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

z=len(lst)
dp=[[[0]*2501 for i in range(51)] for j in range(z+1)]
dp[0][0][0]=1

for i in range(z):
  x=lst[i]
  for j in range(z):
    for k in range(2451):
      dp[i+1][j][k]+=dp[i][j][k]
      dp[i+1][j+1][k+x]+=dp[i][j][k]

ans=0

for i in range(z+1):
  ans+=dp[-1][i][i*a]

print(ans-1)

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

z=len(lst)
dp=[[[0]*2501 for i in range(51)] for j in range(z+1)]
dp[0][0][0]=1

for i in range(z):
  x=lst[i]
  for j in range(i+1):
    for k in range((i+1)*50):
      dp[i+1][j][k]+=dp[i][j][k]
      dp[i+1][j+1][k+x]+=dp[i][j][k]

ans=0

for i in range(50):
  ans+=dp[-1][i][i*a]

print(ans-1)
Problem p04030 (python)

Fixed submission:
s=input()
x=''
for i in s:
    if i=='B':
        if x!='':
            x=x[:-1]
    else:
        x+=i
print(x)

Buggy submission (verdict: Runtime Error):
s=input()
x=''
for i in s:
    if i=='B':
        if i!='':
            x=x.replace(x[-1],'')
    else:
        x+=i
print(x)
Problem p02599 (python)

Fixed submission:
from operator import add, mul, sub, or_


class SegmentTree:
    '''
    セグメント木(遅延ではない)
    1-indexd セグメント木
    values : 値の配列
    op : 区間に対する関数
    ie : 初期値
    '''

    def __init__(self, values):
        self.values = values
        vlen = len(values)
        self.size = 2 ** (vlen-1).bit_length()
        self.tree = [0]*self.size + self.values + [0]*(self.size-vlen)

        for i in range(self.size-1, 0, -1):
            self.tree[i] = self.tree[i*2] + self.tree[i*2+1]

    def update(self, i, v):
        i += self.size
        self.tree[i] = v
        while i > 0:
            i //= 2
            self.tree[i] = self.tree[i*2] + self.tree[i*2+1]

    def query(self, l, r):
        l += self.size
        r += self.size
        ret = 0
        while l < r:
            if l & 1:
                ret += self.tree[l]
                l += 1
            if r & 1:
                r -= 1
                ret += self.tree[r]
            l //= 2
            r //= 2
        return ret


N, Q = map(int, input().split())
*c, = map(int, input().split())

q = [[] for _ in range(N+1)]
for i in range(Q):
    x, y = map(int, input().split())
    q[y-1].append([i, x-1])

st = SegmentTree([0]*(N+1))
finds = [-1]*(N+1)
ans = [0]*Q
for i in range(N):
    if finds[c[i]] != -1:
        st.update(finds[c[i]], 0)

    finds[c[i]] = i
    st.update(finds[c[i]], 1)

    for j, x in q[i]:
        ans[j] = st.query(x, i+1)

for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
from operator import add, mul, sub, or_


class BIT:
    def __init__(self, n, op, ie):
        self.n = n
        self.tree = [ie]*(n+1)
        self.op = op

    def update(self, i, v):
        while i <= self.n:
            self.tree[i] = self.op(self.tree[i], v)
            i += i & -i

    def query(self, i):
        v = self.ie
        while i:
            v = self.op(self.tree[i], v)
            i -= i & -i
        return v


N, Q = map(int, input().split())
*c, = map(int, input().split())

q = [[] for _ in range(N+1)]
for i in range(Q):
    x, y = map(int, input().split())
    q[y-1].append([i, x-1])

bit = BIT(N, add, 0)
finds = [-1]*(N+1)
ans = [0]*Q
for i in range(N):
    if finds[c[i]] != -1:
        bit.update(finds[c[i]]+1, -1)

    finds[c[i]] = i
    bit.update(finds[c[i]]+1, 1)

    for j, x in q[i]:
        ans[j] = bit.query(i+1) - bit.query(x)

for a in ans:
    print(a)