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

Fixed submission:
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
d=set([])
n=10**5+1
p=[0]*(10**5+1)
for i in range(2,n):
    if prime_t(i):
        d.add(i)
    if (i in d and (i+1)//2 in d): p[i]=p[i-1]+1
    else: p[i]=p[i-1]

q=int(input())
for i in range(q):
    ans=0
    l,r=map(int,input().split())
    print(p[r]-p[l-1])

Buggy submission (verdict: Runtime Error):
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
d=[]
n=10**5+1
for i in range(2,n):
    if prime_t(i):
        d.append(i)
 
q=int(input())
for i in range(q):
    ans=0
    l,r=map(int,input().split())
    for j in range(l,r+1,2):
        if (j in d and (j+1)//2 in d): ans+=1
    print(ans)
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
d=[]
n=10**5+1
for i in range(2,n):
    if prime_t(i):
        d.append(i)

q=int(input())
for i in range(q):
    ans=0
    l,r=map(int,input().split())
    for j in range(l,r+1,2):
        if (j in d and (j+1)//2 in d): ans+=1
    print(ans)
Problem p03488 (python)

Fixed submission:
s=input()
x,y=map(int,input().split())
xx,yy=[],[]
w=[0,0]
ans=chk=0
f=0
for i in s:
    if f==0 and i=='F':
        w[0]+=1
    elif f==0 and i=='T':
        f=1
    elif f==1 and i=='F':
        chk+=1
    elif f==1 and i=='T':
        yy.append(chk)
        chk=0
        f=2
    elif f==2 and i=='F':
        chk+=1
    elif f==2 and i=='T':
        xx.append(chk)
        chk=0
        f=1
if chk and f==1:
    yy.append(chk)
elif chk and f==2:
    xx.append(chk)
xx.sort()
yy.sort()
for i in xx[::-1]:
    if w[0]<=x:
        w[0]+=i
    else:
        w[0]-=i
for i in yy[::-1]:
    if w[1]<=y:
        w[1]+=i
    else:
        w[1]-=i
print("Yes" if w[0]==x and w[1]==y else "No")

Buggy submission (verdict: Runtime Error):
s=input()
x,y=map(int,input().split())
xx,yy=[],[]
w=[0,0]
ans=chk=0
f=0
for i in s:
    if f==0 and i=='F':
        w[0]+=1
    elif f==0 and i=='T':
        f=1
    elif f==1 and i=='F':
        chk+=1
    elif f==1 and i=='T':
        yy.append(chk)
        chk=0
        f=2
    elif f==2 and i=='F':
        chk+=1
    elif f==2 and i=='T':
        xx.append(chk)
        chk=0
        f=1
if chk and f==1:
    yy.append(ckh)
elif chk and f==2:
    xx.append(chk)
xx.sort()
yy.sort()
for i in xx[::-1]:
    if w[0]<=x:
        w[0]+=i
    else:
        w[0]-=i
for i in yy[::-1]:
    if w[1]<=y:
        w[1]+=i
    else:
        w[1]-=i
print("Yes" if w[0]==x and w[1]==y else "No")
Problem p03543 (python)

Fixed submission:
n=input()
print("Yes" if n[1]==n[2] and (n[0]==n[1] or n[3]==n[1])  else "No")

Buggy submission (verdict: Runtime Error):
n=int(input())
print("Yes" if n[1]==n[2] and (n[0]==n[1] or n[3]==n[1])  else "No")
Problem p03544 (python)

Fixed submission:
l=[2,1]
for i in range(85):
    l.append(l[-1]+l[-2])
n=int(input())
print(l[n])

Buggy submission (verdict: Runtime Error):
l=[2,1]
for i in range(85):
    l.append(l[-1]+l[-2])
n=int(input
Problem p03546 (python)

Fixed submission:
h,w=map(int,input().split())
c=[]
for i in range(10):
    l=[int(i) for i in input().split()]
    c.append(l)
a=[]
for i in range(h):
    l=[int(i) for i in input().split()]
    a.append(l)
p=[0]*10
for i in range(10):
    if i==1: continue
    d=[1003]*10
    d[i]=0
    q=set([i])
    while 1:
        if len(q)==0: break
        x=q.pop()
        for j in range(10):
            if i==j: continue
            if (d[j]>d[x]+c[x][j]):
                d[j]=d[x]+c[x][j]
                q.add(j)
    p[i]=d[1]
ans=0
for i in range(h):
    for j in range(w):
        if a[i][j]==-1: pass
        else: ans+=p[a[i][j]]
print(ans)

Buggy submission (verdict: Runtime Error):
def sol():
    h,w=map(int,input().split())
    c=[list(map(int,input().split())) for i in range(10)]
    a=[list(map(int,input().split())) for i in range(h)]
    for k in range(10):
        for i in range(10):
            for j in range(10):
                #if (c[i][k]!=0 and c[k][j]!=0): c[i][j]=min(c[i][j],c[i][k]+c[k][j])
                c[k][j]!=0): c[i][j]=min(c[i][j],c[i][k]+c[k][j])
    ans=0
    for i in range(h):
        for j in range(w):
            if a[i][j]==-1: pass
            else: ans+=c[a[i][j]][1]
    print(ans)

if __name__=="__main__":
    sol()

Buggy submission (verdict: Runtime Error):
def son():
    h,w=map(int,input().split())
    c=[]
    for i in range(10):
        l=[int(i) for i in input().split()]
        c.append(l)
    a=[]
    for i in range(h):
        l=[int(i) for i in input().split()]
        a.append(l)
    p=[0]*10
    for i in range(10):
        if i==1: continue
        d=[1003]*10
        d[i]=0
        q=set([i])
        while 1:
            if len(q)==0: break
            x=q.pop()
            for j in range(10):
                if i==j: continue
                if (d[j]>d[x]+c[x][j]):
                    d[j]=d[x]+c[x][j]
                    q.add(j)
        p[i]=d[1]
    ans=0
    for i in range(h):
        for j in range(w):
            if a[i][j]==-1: pass
            else: ans+=p[a[i][j]]
    print(ans)

if __name__=="__main__":
    sol()
Problem p03599 (python)

Fixed submission:
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
res=chk=0
ans=[]

for i in range(16):
    for j in range(16):
        for k in range(1501):
            w=(i*a)+(j*b)
            s=(k*c)
            o=(w//100)*e
            if w==0:
                pass
            elif w+s>f or s>o:
                break
            else:
                s+=(min(f-w-s,o-s)//d)*d
                if len(ans)==0:
                    ans=[s/(w+s),w+s,s]
                elif s/(w+s)>ans[0]:
                    ans=[s/(w+s),w+s,s]
print(ans[1],ans[2])

Buggy submission (verdict: Runtime Error):
a*=100
b*=100
res=chk=0
ans=[]
for i in range(31):
    for j in range(31):
        for k in range(31):
            for l in range(31):
                w=i*a+j*b
                s=k*c+l*d
                if w+s==0: pass
                elif w+s<f and (100*s)//(w+s)<=e*(w//100):
                    res=max(res,(100*s)//(w+s))
                    ans=[w+s,s]
print(*ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
ans=chk=0
for i in range(31)
    for j in range(31):
        for k in range(31):
            for l in range(31):
                w=i*a+j*b
                s=k*c+l*d
                if w+s<f and (100*s)//(w+s)<=e*(w//100): ans=max(ans,(100*s)//(w+s)
print(ans)
Problem p03626 (python)

Fixed submission:
mod=1000000007
n=int(input())
a=input()
b=input()
#1 22
#1
d=[1]
for i in range(1,n):
    if a[i-1]==a[i]:
        d[-1]+=1
    else:
        d.append(1)
ans=[3,6][d[0]-1]
for i in range(1,len(d)):
    if d[i-1]==d[i]==1:
        t=2
    elif d[i-1]==d[i]==2:
        t=3
    elif d[i-1]==2 and d[i]==1:
        t=1
    else:
        t=2
    ans=(ans*t)%mod
print(ans)

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

d=[0]
for i in range(1,n):
    if s[i-1]==s[i]:
        d[-1]+=1
    else:
        d.append(0)
ans=[3,6][d[0]]
for i in range(1,len(d)):
    if d[i-1]==d[i]==1:
        t=3
    elif d[i-1]!=1:
        t=2
    ans=(ans*t)%mod
print(ans)

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

d=[0]
for i in range(1,n):
    if s[i-1]==s[i]:
        d[-1]+=1
    else:
        d.append(0)
ans=[3,6][d[0]]
for i in range(1,len(d)):
    if d[i-1]==d[i]==1:
        t=3
    elif d[i-1]==1:
        t=1
    else:
        t=2
    ans=(ans*t)%mod
print(ans)
Problem p03633 (python)

Fixed submission:
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b//gcd(a,b)
n=int(input())
ans=1
for i in range(n):
    t=int(input())
    ans=lcm(ans,t)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=1
for i in range(n):
    t=int(input())
    print(t)
    ans=lcm(ans,t)
print(ans)
Problem p03638 (python)

Fixed submission:
h,w=map(int,input().split())
n=int(input())
a=[int(i) for i in input().split()]
f=0
d=[]
for i in range(n):
  for j in range(a[i]):
    d.append(i+1)
    if len(d)==w and f:
      print(*d[::-1])
      f=0
      d=[]
    elif len(d)==w:
      print(*d)
      f=1
      d=[]

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

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

hw = []

for i, ai in enumerate(a):
    for j in range(ai):
        hw.append(i+1)
        
hw = np.asarray(hw)
HW = np.reshape(hw, (H, W))

for i in range(H):
#     print(*HW[i])
    if i % 2 == 1:
        print(*HW[i][::-1])
    else:
        print(*HW[i])
Problem p03695 (python)

Fixed submission:
n=int(input())
l=[int(i) for i in input().split()]
cnt=[0]*9
ans=0
for i in l:
    if i>3199:
        i=3200
    cnt[i//400]+=1
for p in range(8):
    i=cnt[p]
    if i!=0:
        ans+=1
print(ans if ans!=0 else 1,ans+cnt[-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[int(i) for i in input().split()]
cnt=[0]*9
ans=0
for i in l:
    if i>3199:
        i=3200
    cnt[i//400]+=1
for p in range(n-1):
    i=cnt[p]
    if i!=0:
        ans+=1
print(ans if ans!=0 else 1,ans+cnt[-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
cnt=[0]*9
ans=0
for i in l:
    if i>3199:
        i=3200
    cnt[i//400]+=1
for p in range(n-1):
    i=cnt[p]
    if i!=0:
        ans+=1
print(ans if ans!=0 else 1,ans+cnt[-1])
Problem p03696 (python)

Fixed submission:
n=int(input())
s=input()
d=[0,0]
for i in s:
    if i=="(": d[0]+=1
    if i==")" and d[0]>0: d[0]-=1
for i in s[::-1]:
    if i==")": d[1]+=1
    if i=="(" and d[1]>0: d[1]-=1
s="("*d[1]+s+")"*d[0]
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
t=s[0]
chk=0
d=[]
for i in s:
    if i==")"==t:
        chk-=1
    elif i=="("==t:
        chk+=1
    else:
        d.append(chk)
        t=["(",")"][i==")"]
        chk=[1,-1][i==")"]
d.append(chk)
if d[0]<0: d=[0]+d
if d[-1]>0: d.append(d[-1]*-1)
p=sum(d)
if p<0: ans[0]+=abs(p)
if p>0: ans[-1]+=p
ans=""
for i in d:
    ans+=["(",")"][i<0]*abs(i)
print(ans)
Problem p03700 (python)

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

ans=[0]*2

d=[]
for i in range(n):
    h=int(input())
    d.append(h)
d.sort(reverse=True)
ans[1]=max(d)
while ans[1]-ans[0]!=1:
    x=z=(ans[1]+ans[0])//2
    y=x*b
    for i in range(n):
        p=d[i]-y
        if p<=0:
            break
        x-=(p+t-1)//t
        if x<0:
            break
    if x<0:
        ans[0]=z
    else:
        ans[1]=z
print(ans[1])

Buggy submission (verdict: Runtime Error):
import heapq
#n=int(input())
n,a,b=map(int,input().split())
ans=chk=0
d=[]
for i in range(n):
    x=int(input())
    heapq.heappush(d,-x)
c=a-b
while 1:
#for i in range(5):
    t=heapq.heappop(d)
    if t+chk>=0: break
    ans+=1
    p=(abs(t-d[0])+c-1)//c
    p=max(1,p)
    t+=c*p
    chk+=b*p
    heapq.heappush(d,t)
print(ans)
Problem p03711 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

x,y=map(int,input().split())
a=[4,6,9,11]
if x==2 or y==2 or (x in a and y not in a) or (x not in a and y in a):
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

h,w=map(int,input().split())
for i in range(h+2):
    if i==0 or i==h+1:
        print("#"*w+"##")
    else:
        a=input()
        print("#"+a+"#")
Problem p03713 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

h,w=map(int,input().split())
ans=h*w
if h*w%3==0:
    print(0)
else:
    for x,y in ((h,w),(w,h)):
        x1=x//3
        x2=(x+2)//3
        y1=y//2
        y2=(y+1)//2
        ans=min(ans,abs(y*x2-y*x1))
        t=(y*x1,y2*(x-x1),(y-y2)*(x-x1))
        ans=min(ans,max(t)-min(t))
        t=(y*x2,y2*(x-x2),(y-y2)*(x-x2))
        ans=min(ans,max(t)-min(t))
    print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
ans=h*w
if h>2:
    t=[h//3*w,(h-(h//3))//2*w,(h-(h//3)+1)//2*w]
    t.sort()
ans=min(ans,t[2]-t[0])
if w>2:
    t=[w//3*h,(w-(w//3))//2*h,(w-(w//3)+1)//2*h]
    t.sort()
ans=min(ans,t[2]-t[0])
a,b=h,w
#for i in range(max(1,a//3-1),min(a//2+1,a-1)):
#    t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
#    t.sort()
#    ans=min(ans,t[2]-t[0])
a,b=w,h
#for i in range(max(1,a//3-1),min(a//2+1,a-1)):
#    t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
#    t.sort()
#    ans=min(ans,t[2]-t[0])
print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
ans=h*w
if h>2:
    t=[h//3*w,(h-(h//3))//2*w,(h-(h//3)+1)//2*w]
    t.sort()
ans=min(ans,t[2]-t[0])
if w>2:
    t=[w//3*h,(w-(w//3))//2*h,(w-(w//3)+1)//2*h]
    t.sort()
ans=min(ans,t[2]-t[0])
a,b=h,w
for i in range(max(1,a//3-1),min(a//2+1,a-1)):
    t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
    t.sort()
    ans=min(ans,t[2]-t[0])
a,b=w,h
for i in range(max(1,a//3-1),min(a//2+1,a-1)):
    t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
    t.sort()
    ans=min(ans,t[2]-t[0])
print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
ans=h*w
if h>2:
    t=[h//3*w,(h-(h//3))//2*w,(h-(h//3)+1)//2*w]
    t.sort()
ans=min(ans,t[2]-t[0])
if w>2:
    t=[w//3*h,(w-(w//3))//2*h,(w-(w//3)+1)//2*h]
    t.sort()
ans=min(ans,t[2]-t[0])
a,b=h,w
for i in range(max(1,3//a-1),min(a//2+1,a-1)):
    t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
    t.sort()
    ans=min(ans,t[2]-t[0])
a,b=w,h
for i in range(max(1,3//a-1),min(a//2+1,a-1)):
    t=[i*b,(a-i)*(b//2),(a-i)*((b+1)//2)]
    t.sort()
    ans=min(ans,t[2]-t[0])
print(ans)
Problem p03732 (python)

Fixed submission:
n,w=map(int,input().split())
d={}
p=0
for i in range(n):
    a,b=map(int,input().split())
    if a in d: d[a].append(b)
    else: d[a]=[b]
    p=max(p,a)

for i in range(4):
    if p-i in d:d[p-i].sort(reverse=True)
    else: d[p-i]=[0]

l={}
for i in d:
    t=0
    l[i]=[0]
    for j in d[i]:
        t+=j
        l[i].append(t)
ans=0
for ai,i in enumerate(l[p]):
    for bj,j in enumerate(l[p-1]):
        for ck,k in enumerate(l[p-2]):
            for em,m in enumerate(l[p-3]):
                x=ai*p+bj*(p-1)+ck*(p-2)+em*(p-3)
                if x<=w:
                    ans=max(ans,i+j+k+m)
print(ans)

Buggy submission (verdict: Runtime Error):
n,w=map(int,input().split())
d={}
p=0
ans=[0,0]
u=[[] for i in range(4)]
for i in range(n):
    a,b=map(int,input().split())
    if a in d: d[a].append(b)
    else:d[a]=[0,b]
    p=max(p,a)
for i in range(4):
    if p-i in d: d[p-i].sort()
    else: d[p-i]=[0]

for x in range(4):
    if len(d[p-x])*(p-x)+ans[0]<=w:
        ans[0]+=len(d[p-x])*(p-x)
        ans[1]+=sum(d[p-x])
        u[x]=[o for o in d[p-x]]
        d[p-x]=[0]
    else:
        for i in range(-1,-1-len(d[p-x]),-1):
            if p+ans[0]-x<=w:
                ans[0]+=p-x
                ans[1]+=d[p-x][-1]
                u[x].append(d[p-x].pop())
            else:
                break
#u[-1].sort(reverse=True)
while len(u[0]):
    if u[0][-1]<d[p-1][-1]:
        ans[0]-=1
        ans[1]+=d[p-1][-1]
        u[-1].pop()
        u[-1].append(d[p-1].pop())
    else:
        break
print(ans[1])
Problem p03761 (python)

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

d={}
t={}
for i in range(ord("a"),ord("z")+1):
  d[chr(i)]=0
  t[chr(i)]=0
  
for i in s:
  d[i]+=1
for i in range(n-1):
  s=input()
  for j in s: t[j]+=1
  for j in t: d[j]=min(d[j],t[j])
  for j in s: t[j]=0
ans=[]
for i in d:
  for j in range(d[i]):
    ans.append(i)
ans.sort()
x="".join(ans)
print(x)

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

d={}
t={}
for i in range(ord("a"),ord("z")+1):
  d[chr(i)]=0
  t[chr(i)]=0
  
for i in s:
  d[i]+=1
for i in range(n-1):
  s=input()
  for j in s: t[j]+=1
  for j in t: d[i]=min(d[i],t[i])
  for j in s: t[i]=0
ans=[]
for i in d:
  for j in range(d[i]):
    ans.append(i)
ans.sort()
x="".join(ans)
print(x)

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

d={}
t={}
for i in range(ord(a),ord(z)+1):
  d[chr(i)]=0
  t[chr(i)]=0
  
for i in s:
  d[i]+=1
for i in range(n-1):
  s=input()
  for j in s: t[j]+=1
  for j in t: d[i]=min(d[i],t[i])
  for j in s: t[i]=0
ans=[]
for i in d:
  for j in range(d[i]):
    ans.append(i)
ans.sort()
x="".join(ans)
print(x)
Problem p03807 (python)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
od=[i for i in a if i%2]
print('YES' if len(od)%2==0 else 'NO')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]
od=[i for i in a if a%2]
print('YES' if len(od)%2==0 else 'NO')
Problem p03815 (python)

Fixed submission:
x=int(input())-1
ans=0
ans+=x//11*2
if x%11<6:
  ans+=1
elif x%11>5:
  ans+=2
print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
if x==1:
  print(0)
  exit()
t=n-5
ans=1
ans+=t//11*2
if 0<(t%11)<7:
  ans+=1
elif t%11>6:
  ans+=2
print(ans)
Problem p03826 (python)

Fixed submission:
a,b,c,d=[int(i)for i in input().split()]
print(max(a*b,c*d))

Buggy submission (verdict: Runtime Error):
a,b,c,d=[int(i)for i in input().split()]
print(max(a*b,c*d)
Problem p03828 (python)

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


def prime(t):
    i=2
    while i**2<=t:
        if t%i==0: return 0
        i+=1
    return 1

mod=10**9+7

p=[]
for i in range(2,1008):
    if prime(i):
        p.append(i)

d={i:0 for i in p}
n=int(input())

ans=tmp=1
for i in range(1,n+1):
    tmp*=i
    for j in p:
        while tmp%j==0:
            d[j]+=1
            tmp//=j
        if tmp<j: break

for i in d:
    ans*=d[i]+1
    ans%=mod
print(ans)

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


def prime(t):
    i=2
    while i**2<=t:
        if t%i==0: return 0
        i+=1
    return 1

mod=10**9+7

p=[]
for i in range(2,1008):
    if prime(i):
        p.append(i)

d={i:0 for i in p}
n=int(input())

tmp=1
for i in range(1,n+1):
    tmp*=i
    for j in p:
        while tmp%j==0:
            d[j]+=1
            tmp//=j
        if tmp<j: break
 
for i in d:
    ans*=d[i]+1
    ans%=mod
print(ans)
Problem p03830 (python)

Fixed submission:
# -*- coding: UTF-8 -*-
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
p=[]

for i in range(2,1008):
    if prime_t(i):
        p.append(i)
d={i:0 for i in p}
mod=10**9+7
n=int(input())
tmp=1
ans=1
R=[i for i in range(168)]
for i in range(1,n+1):
    tmp*=i
    for j in R:
        while tmp%p[j]==0:
            d[p[j]]+=1
            tmp//=p[j]
        if tmp<p[j]:
            break
for i in d:
    ans*=(d[i]+1)
    ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env pypy3
# -*- coding: UTF-8 -*-
import sys
import re
import math
import itertools
import collections
import bisect
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.1415926535897932
IS=float('inf')
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
def niten(a,b): return abs(a-b) if a>=0 and b>=0 else  a+abs(b) if a>=0 else abs(a)+b if b>=0 else abs(abs(a)-abs(b))
def fib(n): return [(seq.append(seq[i-2] + seq[i-1]), seq[i-2])[1] for seq in [[0, 1]] for i in range(2, n)]
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b/gcd(a,b)
def eucl(x1,y1,x2,y2): return ((x1-x2)**2+(y1-y2)**2)**0.5
def choco(xa,ya,xb,yb,xc,yc,xd,yd): return 1 if abs((yb-ya)*(yd-yc)+(xb-xa)*(xd-xc))<1.e-10 else 0
def pscl(num,l=[1]):
    for i in range(num):
        l = map(lambda x,y:x+y,[0]+l,l+[0])
    return l

n=int(input())
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
ans=chk=0
print(ans)
Problem p03856 (python)

Fixed submission:
t=raw_input()
#t=t.replace('eraser','').replace('dreamer','').replace('erase','').replace('dream','')
while len(t):
    if len(t)>10 and t[:11]=='dreameraser':
        t=t[11:]
    elif len(t)>9 and t[:10]=='dreamerase':
        t=t[10:]
    elif len(t)>6 and t[:7]=='dreamer':
        t=t[7:]
    elif len(t)>4 and t[:5]=='dream':
        t=t[5:]
    elif len(t)>5 and t[:6]=='eraser':
        t=t[6:]
    elif len(t)>4 and t[:5]=='erase':
        t=t[5:]
    else:
        break
print 'YES' if t=='' else 'NO'

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import re
import math
import itertools
import collections
import bisect
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.141592653589
IS=float('inf')
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
def niten(a,b): return abs(a-b) if a>=0 and b>=0 else  a+abs(b) if a>=0 else abs(a)+b if b>=0 else abs(abs(a)-abs(b))
def fib(n): return [(seq.append(seq[i-2] + seq[i-1]), seq[i-2])[1] for seq in [[0, 1]] for i in range(2, n)]
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b/gcd(a,b)
def eucl(x1,y1,x2,y2): return ((x1-x2)**2+(y1-y2)**2)**0.5
def choco(xa,ya,xb,yb,xc,yc,xd,yd): return 1 if abs((yb-ya)*(yd-yc)+(xb-xa)*(xd-xc))<1.e-10 else 0
def pscl(num,l=[1]):
    for i in range(num):
        l = map(lambda x,y:x+y,[0]+l,l+[0])
    return l

class UnionFind:
    def __init__(self, size):
        self.rank=[0]*size
        self.par =range(size)
        self.grp =size

    def find(self, x):
        if x==self.par[x]: return x

        self.par[x]=self.find(self.par[x])
        return self.par[x]

    def same(self, x, y): #2つの頂点が同じグループであるかを判定する
        return self.find(x)==self.find(y)

    def unite(self, x, y): #辺で接続されている2つの頂点を投げて統合する
        x,y=self.find(x),self.find(y)
        if x==y:
            return

        self.grp-=1
        if self.rank[x]<self.rank[y]:
            self.par[x]=y
        else:
            self.par[y]=x
            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1

    def group_num(self):
        return self.grp
    def ra(self):
        return self.rank

n,k,l=map(int,raw_input().split())
uf=UnionFind(n)
q1,q2=[],[]
ans=[0]*n
for i in range(k):
    a,b=map(int,raw_input().split())
    uf.unite(a-1,b-1)
    q1.append((a-1,b-1))
    ans[a-1]=1
    ans[b-1]=1

for i in range(l):
    a,b=map(int,raw_input().split())
    if ans[a-1]==0: ans[a-1]=1
    if ans[b-1]==0: ans[b-1]=1
    if uf.same(a-1,b-1):
        ans[a-1]=2
        ans[b-1]=2

uf=UnionFind(n)
for i in q2:
    uf.unite(i[0],i[1])
for i in q1:
    if uf.same(i[0],i[1]):
        ans[i[0]]=2
        ans[i[1]]=2
    
print ' '.join(map(str,ans))
Problem p03861 (python)

Fixed submission:
a,b,x=map(int,raw_input().split())
print b/x-a/x if a%x else b/x-a/x+1

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>

using namespace std;

int main(){
    long long a,b,x;
    scanf("%lld %lld %lld",&a,&b,&x);
    printf("%lld\n",(b/x)-(a/x)+(a%x==0?1:0));
    return 0;
}
Problem p03919 (python)

Fixed submission:
h,w=map(int,raw_input().split())
#l=map(int,raw_input().split())
for i in range(h):
    l=map(str,raw_input().split())
    if 'snuke' in l:
        print chr(l.index('snuke')+ord('A'))+str(i+1)

Buggy submission (verdict: Runtime Error):
l=[]
for i in range(1,5001):
    if i%2==0:
        l.append((1+i)*(i/2))
    else:
        l.append((1+i)*(i/2)+(i+1)/2)
n=int(raw_input())
if n in l:
    for i in range(1,l.index(n)+2):
        print i
chk=bisect.bisect_right(l,n)
tmp=l[chk]
for i in range(1,chk+2):
    if i!=tmp-n:
        print i
Problem p03938 (python)

Fixed submission:
n=int(input())
line=input().split()
for i in range (n):
    line[i]=int(line[i])
 
b=[]
for i in range (n):
    b.append(22000*i+1)
a=b[:]
b.reverse()
 
for i in range (1,n):
    a[line[i]-1]+=i
 
print (" ".join(map(str,a)))
print (" ".join(map(str,b)))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[int(i) for i in input().split()]


b=[]
for i in range(n):
    b.append(22000*i+1)
a=b[:]
b.reverse()
for i in range(1,n):
    a[i[i]-1]+=1
print(*a)
print(*b)