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

Fixed submission:
m1,d1=map(int,input().split())
m2,d2=map(int,input().split())
if d2==1:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
t1,t2=map(int,input().split())
a1,a2=map(int,input().split())
b1,b2=map(int,input().split())
sa1=(a1-b1)*t1
sa2=(a2-b2)*t2
if sa1>=0:
    --sa1
    --sa2
if sa1+sa2==0:
    print("infinity")
if sa1+sa2<0:
    print(0)
if sa1+sa2>0:
    ans=((-sa1)//(sa2+sa1))*2+1
    if sa1%(sa1+sa2)==0:
        ans-=1
    print(ans)
Problem p02850 (python)

Fixed submission:
from collections import deque
N=int(input())

G=[[] for _ in range(N+1)]
edge={}

for i in range(N-1):
    a,b=map(int, input().split())
    G[a].append(b)
    G[b].append(a)
    edge[(a,b)]=i
    edge[(b,a)]=i
que=deque()
que.append(1)
visited=[-1]*(N+1)
visited[1]=0
ans=[0]*(N-1)
while que:
    v=que.pop()
    j=1
    for u in G[v]:
        if visited[u]<0:
            if j==visited[v]:
                j+=1
            visited[u]=j
            ans[edge[(u,v)]]=j
            que.appendleft(u)
            j+=1
print(max(ans))
for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
from collections import deque
N=int(input())

G=[[] for _ in range(N+1)]
edge={}

for i in range(N-1):
    a,b=map(int, input().split())
    G[a].append(b)
    G[b].append(a)
    edge[(a,b)]=i
    edge[(b,a)]=i
que=deque()
que.append(1)
visited=[0]*(N+1)
visited[1]=0
ans=[0]*(N-1)
while que:
    v=que.pop()
    j=1
    for u in G[v]:
        if visited[u]==0:
            if j==viisted[v]:
                j+=1
            visited[u]=j
            ans[edge[(u,v)]]=j
            que.appendleft(u)
            j+=1
print(max(ans))
for a in ans:
    print(a)
Problem p02865 (python)

Fixed submission:
n=int(input())
if n%2 == 0:
    print((n>>1)-1)
else:
    print(n>>1)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    #ans = ans * pow(num[i-1], num[i], 998244353)%998244353
    ans*=num[i-1]**num[i]

if d[0]!=0 or d.count(0)!=1:
    print(0)
else:
    print(ans%998244353)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    #ans = ans * pow(num[i-1], num[i], 998244353)%998244353
    ans*=num[i-1]**num[i]

if d[0]!=0 or d.count(0)!=1:
    print(0)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
error=0
if num[0]!=1:
    error=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    ans = ans * pow(num[i-1], num[i], 998244353)
    #ans*=num[i-1]**num[i]
    if num[i]==0:
        error=1
if error==0:
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int, input().split())))
num=[]

for i in range(max(d)+1):
    count=d.count(i)
    num.append(count)
ans=1
if d[0]!=0:
    print(0)
else:
    for i in range(1, max(d)+1):
        ans*=num[i-1]**num[i]
    print(ans)
Problem p02866 (python)

Fixed submission:
import collections
n=int(input())
d=list(map(int, input().split()))
num=collections.Counter(d)
"""d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1"""
#print(num)
ans=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    #ans = ans * pow(num[i-1], num[i], 998244353)%998244353
    ans*=num[i-1]**num[i]

if d[0]!=0 or d.count(0)!=1:
    print(0)
else:
    print(ans%998244353)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    ans = ans * pow(num[i-1], num[i], 998244353)%998244353
    #ans*=num[i-1]**num[i]

if d[0]!=0 or d.count(0)=!1:
    print(0)
else:
    print(ans)
Problem p02921 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
print(long(n*(n-1)/2)
Problem p02923 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
a=0
max=0
for i in range(1,n):
    if h[i]<=h[i-1]:
        a+=1
        if i==n-1 and a>max:
            max=a
    elif a>max:
        max=a
        a=0
    else:
        a=0
print(max)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input(),split()))
a=0
max=0
for i in range(1,n):
    if h[i]<=h[i-1]:
        a+=1
    else :
        max=a
        a=0
print(max)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input(),split()))
a=0
max=0
for i in range(1,n):
    if h[i]>h[i-1]:
        a+=1
    else :
        max=a
        a=0
print(max)

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input(),split()))
a=0
for i in range(1,n):
    if h[i]>h[i-1]:
        a+=1
    else :
        a=0
print(a)
Problem p02924 (python)

Fixed submission:
n=int(input())
print(n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
n=int(input())
print(long(n*(n-1)/2)
Problem p02945 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
ptint(max(a+b,a-b,a*b))
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)%2===0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)%2===0:
    print((a+b)//2)
else("IMPOSSIBLE")
Problem p02991 (python)

Fixed submission:
from collections import deque
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
    u,v=list(map(int,input().split()))
    g[u-1].append(v-1)
S,T=map(int,input().split())
S-=1;T-=1
INF=10**9
U=[[INF]*n for i in range(3)]
U[0][S]=0
que=deque([(0,S)])
while que:
    t,v=que.popleft()
    u=(t+1)%3
    if t==2:
        U[t][v]+=1
    for w in g[v]:
        if U[u][w]!=INF:
            continue
        que.append((u,w))
        U[u][w]=U[t][v]
print(U[0][T] if U[0][T]<INF else -1)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
    u,v=list(map(int,input().split()))
    g[u-1].append(v-1)
S,T=map(int,input().split())
S-=1;T-=1
INF=10**9
U=[[INF]*n for i in range(3)]
U[0][S]=0
que=deque([(0,S)])
while que:
    t,v=que.popleft()
    u=(t+1)%3
    if t==2:
        U[t][v]+=1
    for w in g[v]:
        if U[u][w]!=INF:
            continue
        que.append((u,w))
        U[u][w]=d
print(U[0][T] if U[0][T]<INF else -1)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
    u,v=list(map(int,input().split()))
    g[u-1].append(v-1)
s,t=map(int,input().split())
s-=1;t-=1
INF=10**9
U=[[INF]*n for i in range(3)]
U[0][s]=0
que=deque([s,0])
while que:
    v,t=que.pop()
    u=(t+1)%3
    d=U[u][v]
    if t==2:
        d+=1
    for w in g[v]:
        if U[u][w]!=INF:
            continue
        que.append((w,u))
        U[u][w]=d
print(U[0][t] if U[0][t]<INF else -1)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m=map(int,input.split())
g=[[] for _ in range(n)]
for _ in range(m):
    u,v=list(map(int,input().split()))
    g[u-1].append(v-1)
s,t=map(int,input().split())
s-=1;t-=1
INF=10**9
U=[[INF]*n for i in range(3)]
U[0][s]=0
que=deque([s,0])
while que:
    v,t=que.pop()
    u=(t+1)%3
    d=U[u][v]
    if t==2:
        d+=1
    for w in g[v]:
        if U[u][w]!=INF:
            continue
        que.append((w,u))
        U[u][w]=d
print(U[0][t] if U[0][t]<INF else -1)
Problem p02994 (python)

Fixed submission:
n,l=map(int,input().split())
ringo=[0]*n
ringoz=[0]*n
min=1000000000000000
mini=0
for i in range(n):
    ringo[i]+=i+l
    if ringo[i]<0:
        ringoz[i]=-ringo[i]
    else:
        ringoz[i]=ringo[i]
    if ringoz[i]<min:
        min=ringoz[i]
        mini=i
ringo.pop(mini)

print(sum(ringo))

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
ringo=[0]*n
for i in range(n):
    ringo[i]+=i+l
for i in range(n):
    if ringo[i]<0:
        ringo[i]=-ringoz[i]
print(sum(ringo)-min(ringo))
Problem p02995 (python)

Fixed submission:
from fractions import gcd
a,b,c,d=map(int,input().split())
e=c*d//gcd(c,d)
x=b//c+b//d-b//e
y=(a-1)//c+(a-1)//d-(a-1)//e
print(b-a+1-(x-y))

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b,c,d=map(int,input().split())
print(b-a-(b-a)//c-(b-a)//d+(b-a)//(c*d//gcd(c,d)))
Problem p02997 (python)

Fixed submission:
N,K=map(int,input().split())
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
if N==2 and K>=1:
    print(-1)
    exit()
if K>cmb(N-1,2):
    print(-1)
else:
    count=cmb(N-1,2)-K
    print(cmb(N,2)-K)
    for i in range(2,N+1):
        print(1,i)

    for i in range(2,N):
        for j in range(i+1,N+1):
            if count==0:
                exit()
            print(i,j)
            count-=1

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
if N==2:
    print(-1)
    break
if K>cmb(N-1,2):
    print(-1)
else:
    count=cmb(N-1,2)-K
    print(cmb(N,2)-K)
    for i in range(2,N+1):
        print(1,i)

    for i in range(2,N):
        for j in range(i+1,N+1):
            if count==0:
                exit()
            print(i,j)
            count-=1
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())
ans=[w*h/2]
if (x==0 and y==0) or (x==0 and y==h) or (x==w and y==0) or (x==w and y==h):
    ans.append(0)
elif y*w==x*h or y*h==x*w:
    ans.append(1)
else:ans.append(0)
print(*ans)

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
ans=w*h/2
if w/2=x and h/2=y:
    print(ans,1)
else:
    print(ans,0)

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
ans=w*h/2
if w=2*x and h=2*y:
    print(ans,1)
else:
    print(ans,0)

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
ans=[w*h/2]
if y/x==h/w or y/x==w/h:
    ans.append(1)
else:ans.append(0)
print(*ans)
Problem p03014 (python)

Fixed submission:
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko=[[0]*w for _ in range(h)]
tate=[[0]*w for _ in range(h)]
count=0
for i in range(h):
    a=[0]
    for j in range(w):
        if s[i][j]=="#":
            a.append(j+1)
    a.append(w+1)
    for j in range(1,len(a)):
        for k in range(a[j-1],a[j]-1):
            yoko[i][k]=a[j]-a[j-1]-1
for i in range(w):
    a=[0]
    for j in range(h):
        if s[j][i]=="#":
            a.append(j+1)
    a.append(h+1)
    for j in range(1,len(a)):
        for k in range(a[j-1],a[j]-1):
            tate[k][i]=a[j]-a[j-1]-1

ans=1
for i in range(h):
    for j in range(w):
        ans=max(ans,yoko[i][j]+tate[i][j]-1)
print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko=[[0]*w for _ in range(h)]
tate=[[0]*w for _ in range(h)]
count=0
for i in range(h):
    a=[0]
    for j in range(w):
        if s[i][j]=="#":
            a.append(j+1)
    a.append(w+1)
    for j in range(1,len(a)):
        for k in range(a[j-1],a[j]-1):
            yoko[i][k]=a[j]-a[j-1]-1
for i in range(w):
    a=[0]
    for j in range(h):
        if s[j][i]=="#":
            a.append(j+1)
    a.append(h+1)
    for j in range(1,len(a)):
        for k in range(a[j-1],a[j]-1):
            tate[k][i]=a[j]-a[j-1]-1

ans=1
for i in range(w):
    for j in range(h):
        ans=max(ans,yoko[i][j]+tate[i][j]-1)
print(ans)
Problem p03030 (python)

Fixed submission:
n=int(input())
sp=[list(map(str,input().split()))+[i+1] for i in range(n)]
for i in range(n):
    sp[i][1]=int(sp[i][1])

sp.sort(key=lambda x:x[1],reverse=True)

sp.sort(key=lambda x:x[0])
for i in range(n):
    print(sp[i][2])

Buggy submission (verdict: Runtime Error):
n=int(input())
sp=[]
for i in range(n):
    s,p=input().split()
    sp.append(s,-int(p),i+1)
sp.sort()
for i in sp:
    print(i[2])
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a,b)+max(max(a,b)-1,min(a,b)))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a+b)+max(max(a+b)-1,min(a,b)))
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
num=[0]
c=1
for i in range(1,n):

    if s[i]==s[i-1]:
        c+=1
    else:
        num.append(c)
        c=1
num.append(c)
num.append(0)
#print(num)

ans=0
#print(num)
if s[0]=="0":
    if len(num)-2*k+1<=0:
        ans=sum(num)
    else:
        asum=sum(num[0:2*k+1])
        ans=asum
        #print(asum)
        for i in range(2,len(num)-2*k,2):
            #print(asum,num[i+2*k],num[i+2*k-1],num[i-1],num[i-2])
            asum=asum+num[i+2*k]+num[i+2*k-1]-num[i-1]-num[i-2]
            ans=max(ans,asum)
if s[0]=="1":
    if len(num)-2*k+2<=0:
        ans=sum(num)
    else:
        asum=sum(num[1:2*k+2])
        ans=asum
        for i in range(3,len(num)-2*k,2):
            #print(asum,num[i+2*k],num[i+2*k-1],num[i-1],num[i-2])
            asum=asum+num[i+2*k]+num[i+2*k-1]-num[i-1]-num[i-2]
            ans=max(ans,asum)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
num=[0]
c=1
for i in range(1,n):

    if s[i]==s[i-1]:
        c+=1
    else:
        num.append(c)
        c=1
num.append(c)
num.append(0)
#print(num)

ans=0
#print(num)
if s[0]=="0":
    if len(num)-2*k+1<=0:
        ans=sum(num)
    else:
        asum=sum(num[0:2*k+1])
        ans=asum
        #print(asum)
        for i in range(2,len(num)-2*k,2):
            #print(asum,num[i+2*k],num[i+2*k-1],num[i-1],num[i-2])
            asum=asum+num[i+2*k]+num[i+2*k-1]-num[i-1]-num[i-2]
            ans=max(ans,asum)
if s[0]=="1":
    if len(num)-2*k+2<=0:
        ans=sum(num)
    else:
        asum=sum(num[1:2*k+2])
        ans=asum
        for i in range(3,len(num)-2*k+1,2):
            #print(asum,num[i+2*k],num[i+2*k-1],num[i-1],num[i-2])
            asum=asum+num[i+2*k]+num[i+2*k-1]-num[i-1]-num[i-2]
            ans=max(ans,asum)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
num=[0]
c=1
for i in range(1,n):

    if s[i]==s[i-1]:
        c+=1
    else:
        num.append(c)
        c=1
num.append(c)
num.append(0)
#print(num)

ans=0
print(num)
if s[0]=="0":
    if len(num)-2*k+1<=0:
        ans=sum(num)
    else:
        asum=sum(num[0:2*k+1])
        ans=asum
        #print(asum)
        for i in range(2,len(num)-2*k,2):
            print(asum,num[i+2*k],num[i+2*k-1],num[i-1],num[i-2])
            asum=asum+num[i+2*k]+num[i+2*k-1]-num[i-1]-num[i-2]
            ans=max(ans,asum)
if s[0]=="1":
    if len(num)-2*k+2<=0:
        ans=sum(num)
    else:
        asum=sum(num[1:2*k+2])
        ans=asum
        for i in range(3,len(num)-2*k+1,2):
            #print(asum,num[i+2*k],num[i+2*k-1],num[i-1],num[i-2])
            asum=asum+num[i+2*k]+num[i+2*k-1]-num[i-1]-num[i-2]
            ans=max(ans,asum)
print(ans)
Problem p03106 (python)

Fixed submission:
from fractions import gcd
a,b,k=map(int,input().split())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

C=make_divisors(gcd(a,b))
C.sort()
#print(C)
print(C[-k])

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b,k=map(int,input().split())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

C=make_divisors(gcd(a,b))
C.sort()
#print(C)
print(C[-k])
Problem p03109 (python)

Fixed submission:
s=input()
if int(s[:4])<=2019:
    if int(s[5:7])<=4:
        if int(s[8:]):
            print("Heisei")
            exit()
print("TBD")

Buggy submission (verdict: Runtime Error):
s=intput()
if int(s[:4])<=2019:
    if int(s[4:6])<=4:
        if int(s[6:]):
            print("Heisei")
            exit()
print("TBD")
Problem p03110 (python)

Fixed submission:
n=int(input())
xu=[list(map(str,input().split())) for _ in range(n)]
ans=0
for i in range(n):
    if xu[i][1]=="JPY":
        ans+=float(xu[i][0])
    else:
        ans+=float(xu[i][0])*380000.0
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
xu=[list(map(str,input().split())) for _ in range(n)]
ans=0
for i in range(n):
    if xu[i][1]=="JPY":
        ans+=int(xu[i][0])
    else:
        ans+=int(xu[i][0]*380000.0)
print(ans)
Problem p03126 (python)

Fixed submission:
n,m=map(int,input().split())

l=[0]*m
for i in range(n):
    ka=list(map(int,input().split()))
    A=ka[1:]
    for a in A:
        l[a-1]+=1
ans=0
for i in l:
    if i==n:
        ans+=1
print(ans)

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

l=[0]*n
for i in range(n):
    ka=list(map(int,input().split()))
    A=ka[1:]
    for a in A:
        l[a-1]+=1
ans=0
for i in l:
    if i==n:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
k=[]
a=[]
for i in range(n):
    k.append(int(input()))
    a.append(list(map(int,input().split())))
ans=0
for i in range(n):
    f=True
    for j in range(m):
        if a[j]==0:
            f=False
    if f:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input())
k=[]
a=[]
for i in range(n):
    k.append(int(input()))
    a.append(list(map(int,input().split())))
ans=0
for i in range(n):
    f=True
    for j in range(m):
        if a[j]==0:
            f=False
    if f:
        ans+=1
print(ans)
Problem p03210 (python)

Fixed submission:
x=int(input())
if x==3 or x==5 or x==7:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
x=int(iput())
if x==3 or x==5 or x==7:
    print("Yes")
else:
    print("No")
Problem p03211 (python)

Fixed submission:
s=input()
ans=10000
for i in range(len(s)-2):
    ans=min(ans,abs(int(s[i:i+3])-753))
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=10000
for i in range(8):
    ans=min(ans,abs(int(s[i:i+3])-753))
print(ans)
Problem p03219 (python)

Fixed submission:
x,y=map(int,input().split())
print(x+y//2)

Buggy submission (verdict: Runtime Error):
x,y=map(int(input().split())
print(x+y//2)
Problem p03238 (python)

Fixed submission:
n=int(input())
if n==1:
    print("Hello World")
if n==2:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:
    print("Hello World")
if n==2:
    a,b=map(int,input().split())
    print(a+b)
Problem p03262 (python)

Fixed submission:
from fractions import gcd
N,X=map(int,input().split())
x=list(map(int,input().split()))
for i in range(N):
    if abs(x[i]-X)==0:
        continue
    x[i]=abs(x[i]-X)

ans=x[0]
for i in range(N):
    ans=gcd(ans,x[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
x=list(map(int,input().split()))
for i in range(N):
    if abs(x[i]-X)==0:
        continue
    x[i]=abs(x[i]-X)
for i in range(N-1):
    ans=gcd(x[i],x[i+1])
print(gcd)
Problem p03263 (python)

Fixed submission:
H,W=map(int,input().split())
a=[list(map(int,input().split())) for i in range(H)]
for h in range(H):
    for w in range(W):
        if a[h][w]%2==0:
            a[h][w]=0
        else:
            a[h][w]=1
ans=[]
for h in range(H):
    for w in range(W-1):
        if a[h][w]==1:
            a[h][w+1]=a[h][w+1]^a[h][w]
            ans.append([h+1,w+1,h+1,w+2])
for h in range(H-1):
    if a[h][-1]==1:
        a[h+1][-1]=a[h+1][-1]^a[h][-1]
        ans.append([h+1,W,h+2,W])
print(len(ans))
for i in ans:
    print(*i)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
a=[list(map(int,input().split())) for i in range(H)]
for h in range(H):
    for w in range(W):
        if a[h][w]%2==0:
            a[h][w]=0
        else:
            a[h][w]=1
ans=[]
for h in range(H):
    for w in range(W-1):
        if a[h][w]==1:
            a[h][w+1]=a[h][w+1]^a[h][w]
            ans.append([h+1,w+1,h+1,w+2])
for h in range(H-1):
    if a[h][-1]==1:
        a[h+1][-1]=a[h+a][-1]^a[h][-1]
        ans.append([h+1,W,h+2,W])
print(len(ans))
for i in ans:
    print(*i)
Problem p03266 (python)

Fixed submission:
n,k=map(int,input().split())
num=[0]*k
for i in range(1,n+1):
    num[i%k]+=1
res=0
for a in range(k):
    b=(k-a)%k
    c=(k-a)%k
    if (b+c)%k!=0:continue
    res+=num[a]*num[b]*num[c]
print(res)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
num=[0]*k
for i in range(n):
    num[i%k]+=1
for a in range(k):
    b=(k-a)%k
    c=(k-a)%k
    if (b+c)%k!=0:continue
    res+=num[a]*num[b]*num[c]
print(res)
Problem p03267 (python)

Fixed submission:
from math import log2
L=int(input())
ans=[]
i=1
while True:
    if 2**i>L:
        last=i
        break
    ans.append([i,i+1,2**(i-1)])
    ans.append([i,i+1,0])
    i+=1
"""for i in ans:
    print(i)
print(last)"""
num=2**(last-1)
a=L-num
while a>0:
    ans.append([int(log2(a))+1,last,num])
    num+=2**(int(log2(a)))
    a=L-num
print(last,len(ans))
for i in ans:
    print(*i)

Buggy submission (verdict: Runtime Error):
from math import log2
L=int(input())
ans=[]
i=1
while True:
    if 2**i>L:
        last=i
        break
    ans.append([i,i+1,2**(i-1)])
    ans.append([i,i+1,0])
    i+=1
"""for i in ans:
    print(i)
print(last)"""
num=2**(last-1)
a=L-num
while a>0:
    ans.append([int(log2(a))+1,last,num])
    num+=2**(int(log2(a)))
    a=L-num
for i in ans:
    print(*i)

Buggy submission (verdict: Runtime Error):
from math import log2
L=int(input())
ans=[]
i=1
while True:
    if 2**i>L:
        last=i
        break
    ans.append([i,i+1,2**(i-1)])
    ans.append([i,i+1,0])
    i+=1
"""for i in ans:
    print(i)
print(last)"""
num=2**(last-1)
a=L-num
while a>0:
    ans.append([int(log2(a))+1,last,num])
    num+=2**(int(log2(a)))
    a=L-num
for i in ans:
    print(i)