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

Fixed submission:
from heapq import *
h,w=map(int,input().split())
g=[[] for i in range(10)]
for i in range(10):
    l=list(map(int,input().split()))
    for j in range(10):
         g[i].append([l[j],j])
d={}
for i in range(10):
    q=[[0,i]]
    heapify(q)
    l=[-1 for i in range(10)]
    while l[1]==-1:
        c,t=heappop(q)
        if(l[t]==-1):
            l[t]=c
            for j in g[t]:
                C,T=j
                if(l[T]==-1):
                    heappush(q,[c+C,T])
    d[i]=l[1]           
ans=0
for i in range(h):
    l=list(map(int,input().split()))
    for j in l:
        ans+=d.get(j,0)
print(ans)

Buggy submission (verdict: Runtime Error):
import networkx as nx
G=nx.DiGraph()
G.add_nodes_from([i for i in range(0,10)])
h,w=map(int,input().split())
for i in range(10):
    l=list(map(int,input().split()))
    for j in range(10):
         G.add_edge(i,j,weight=l[j])
d={}
for i in range(10):
    l,p=nx.multi_source_dijkstra(G,[i],target=1)
    d[i]=l
ans=0
for i in range(h):
    l=list(map(int,input().split()))
    for j in l:
        ans+=d.get(j,0)
print(ans)
Problem p03836 (python)

Fixed submission:
sx, sy, tx, ty=map(int, input().split())
print("D"+"R"*(tx-sx+1)+"U"*(ty-sy+1)+"L"*(tx-sx+1)+"D"*(ty-sy)+
      "L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"*(ty-sy+1)+"L"*(tx-sx))

Buggy submission (verdict: Runtime Error):
sx, sy, tx, ty=map(int, input().split())
print("D"+"R"*(tx-sx+1)+"U"*(ty-sy+1)+"L"*(tx-sx+1)+"D"*(tx-sx)+
      "L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"*(tx-sx+1)"L"*(tx-sx))
Problem p03068 (python)

Fixed submission:
N=int(input())
S=str(input())
K=int(input())
W=S[K-1]
for i in range(N):
  if S[i]!=W:
    S=S.replace(S[i],'*')
print(S)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = input()
C = int(input())
d = b[k-1]
new = [e for e in b if e != d]
while(len(new)>i):
  f = new[i]
  b[f] = '*'
  i = i+1
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
c = int(input())
d = b[k-1]
new = [e for e in b if e != d]
while(len(new)>i):
  f = new[i]
  b[f] = '*'
  i = i+1
print(b)

Buggy submission (verdict: Runtime Error):
a = 0
a = int(input())
b = input()
c = 0
c = int(input())
d = b[k-1]
new = [e for e in b if e != d]
while(len(new)>i):
  f = new[i]
  b[f] = '*'
  i = i+1
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
c = int(input())
d = b[k-1]
new = [e for e in b if e != d]
while(len(new)>i):
  f = new[i]
  b[f] = '*'
  i = i+1
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
c = int(input())
d = b[k-1]
new = [e for e in b if e != d]
while(len(new)>i):
  f = new[i]
  b[f] = '*'
  i = i+1
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
c = int(input())
d = b[k-1]
new = [e for e in b if e != d]
while(len(new)>i):
  f = new[i]
  b[f] = '*'
  i++
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()
c = int(input())
d = b[k-1]
new = [e for e in b if e == d]
Problem p02848 (python)

Fixed submission:
N=int(input())
S=list(input())
 
ans=[]
for i in S:
    if ord(i)+N>90:
        temp=chr(ord(i)+N-26)
        ans.append(temp)
    else:
        temp=chr(ord(i)+N)
        ans.append(temp)
 
f=''.join(ans)
 
print(f)

Buggy submission (verdict: Runtime Error):
N=int(input)
S=list(input())

ans=[]
for i in S:
    if ord(i)+N>90:
        temp=chr(ord(i)+N-26)
        ans.append(temp)
    else:
        temp=chr(ord(i)+N)
        ans.append(temp)

f=''.join(ans)

print(f)
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):
c=a*b
 
if c%2==0:
  return 'Even'
else:
  return 'Odd'

Buggy submission (verdict: Runtime Error):
c=a*b
 
if c%2==0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
c=a*b

if c%2=0:
  print('Even')
else:
  print('Odd')
Problem p03494 (python)

Fixed submission:
a=int(input())
b=input().split()
 
l=[int(i) for i in b]
 
cnt=[0 for i in range(a)]
 
for i in range(a):
    while l[i]%2==0:
        cnt[i]+=1
        l[i]=l[i]/2
        if l[i]%2==1:
            break
 
print(min(cnt))

Buggy submission (verdict: Runtime Error):
a=input()
b=input().split()

l=[int(i) for i in b]

cnt=[0 for i in range(a)]

for i in range(a):
    while l[i]%2==0:
        cnt[i]+=1
        l[i]=l[i]/2
        if l[i]%2==1:
            break

print(min(cnt))
Problem p02923 (python)

Fixed submission:
import sys

N = int(input())
H = list(map(int,input().split()))
hight = []
count = []

if N == 1:
    print(0)
    sys.exit()

# lower...1,higher...0
for n in range(N-1):
    if H[n]>=H[n+1]:
        hight.append(1)
    else:
        hight.append(0)

#print(hight)

count.append(hight[0])
for l in range(1,N-1):
    if hight[l]==1:
        count.append(count[l-1]+1)
    else:
        count.append(0)

#print(count)

print(max(count))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
hight = []
count = []

# lower...1,higher...0
for n in range(N-1):
    if H[n]>=H[n+1]:
        hight.append(1)
    else:
        hight.append(0)

count.append(hight[0])
for l in range(1,N-1):
    if hight[l]==1:
        count.append(count[l-1]+1)
    else:
        count.append(0)

print(max(count))
Problem p03079 (python)

Fixed submission:
import sys

A, B, C = input().split()
a = int(A)
b = int(B)
c = int(C)

if a == b:
    if a == c:
        print('Yes')
        sys.exit()

print('No')

Buggy submission (verdict: Runtime Error):
import sys

A, B, C = input().split()

if a == b:
    if a == c:
        print('YES')
        sys.exit()

print('NO')
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
count = 0
for i in range(n-2):
  if s[i] == "A" and s[i+1] == "B" and s[i+2] =="C":
    count +=1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0
for i in range(n):
  if s[i] == "A" and s[i+1] == "B" and s[i+2] =="C":
    count +=1
print(count)
Problem p02911 (python)

Fixed submission:
n,k,q = map(int,input().split())
ans_list =[]
point = []
for i in range(n):
  point.append(k)
#print(point)      
for j in range(q):
  ans_list.append(int(input()))
#print(ans_list)
for k in ans_list:
  point[k-1] += 1
#print(point)
for l in range(n):
  point[l] -= q
  if point[l]>0:
    print("Yes")
  else:
    print("No")
#print(point)

Buggy submission (verdict: Runtime Error):
ans_list =[]
point = []
for i in range(n):
  point.append(k)
#print(point)      
for j in range(q):
  ans_list.append(int(input()))
#print(ans_list)
for k in ans_list:
  point[k-1] += 1
#print(point)
for l in range(n):
  point[l] -= q
  if point[l]>0:
    print("Yes")
  else:
    print("No")
#print(point)

Buggy submission (verdict: Runtime Error):
n,k,q = map(int,input().split())
ans_list =[]
point = []
for i in range(n):
  point.append(k)
#print(point)      
for j in range(q):
  ans_list.append(int(input()))
#print(ans_list)
for k in ans_list:
  point[k] += 1
for l in range(n):
  point[l] -= q
  if point[l]>0:
    print("Yes")
  else:
    print("No")
#print(point)
Problem p02608 (python)

Fixed submission:
if __name__ == "__main__":
    
    n = int(input())

    """for o in range(1, n+1):
        s = 1
        if o > 6:
            s = -1 + int((o-2)**0.5)
        for x in range(s, 100):
            isFound = False
            for y in range(1, x+1):
                for z in range(1, y+1):
                    m = x**2+y**2+z**2+x*y+y*z+z*x
                    if m == o:
                        isFound = True
                        if x==y and y==z: print(1)
                        elif x==y or y==z or z==x: print(3)
                        else: print(6)
                        break
                    elif m > o:
                        break
                if isFound: break
            if isFound: break
        if not isFound: print(0)"""

    ans = [0 for _ in range(10001)]
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                m = x**2+y**2+z**2+x*y+y*z+z*x
                if m > 10000: break
                ans[m] += 1

    for i in range(n):
        print(ans[i+1])

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    
    n = int(input())

    for o in range(1, n+1):
        for x in range(int(n**0.5), 100):
            isFound = False
            isOver = False
            for y in range(1, x+1):
                for z in range(1, y+1):
                    m = x**2+y**2+z**2+x*y+y*z+z*x
                    if m == o:
                        isFound = True
                        if x==y and y==z: print(1)
                        elif x==y or y==z or z==x: print(3)
                        else: print(6)
                        break
                    elif m > o:
                        isOver = True
                        break
                if isFound or isOver: break
            if isFound: break
        if not isFound: print(0)
Problem p02639 (python)

Fixed submission:
if __name__ == "__main__":
    s = input().split()
    for i, num in enumerate(s):
        if num == "0":
            print(i+1)

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    n = int(input())
    l_a = list(map(int, input().split()))
    s_a = list(set(l_a))

    s_a.sort()

    dub_a = [0]*(max(s_a)+1)

    for i in l_a:
        dub_a[i] += 1

    dp = [1]*(max(s_a)+1)

    for i in s_a:
        if dp[i] == 0:
            pass
        else:
            for j in range(2*i, len(dp), i):
                dp[j] = 0


    count = 0
    for i in s_a:
        if dp[i]==1 and dub_a[i]==1:
            count += 1
    print(count)
Problem p02677 (python)

Fixed submission:
import math


if __name__ == "__main__":
    a, b, h, m = input().split()

    a = int(a)
    b = int(b)
    h = int(h)
    m = int(m)

    theta = 2.0 * math.pi * (h + m / 60.0) / 12.0
    phi = 2.0 * math.pi * m / 60.0

    xa = a * math.sin(theta)
    ya = a * math.cos(theta)

    xb = b * math.sin(phi)
    yb = b * math.cos(phi)

    distance = math.sqrt(math.pow(xa-xb, 2) + math.pow(ya-yb, 2))

    print(distance)

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    a, b, h, m = input().split()

    a = float(a)
    b = float(b)
    h = float(h)
    m = float(m)

    theta = 2.0 * math.pi * h / 12.0
    phi = 2.0 * math.pi * m / 60.0

    xa = a * math.sin(theta)
    ya = a * math.cos(theta)

    xb = b * math.sin(phi)
    yb = b * math.cos(phi)

    print(xa, ya)
    print(xb, yb)
    distance = math.sqrt(math.pow(xa-xb, 2) + math.pow(ya-yb, 2))

    print(distance)
Problem p02576 (python)

Fixed submission:
N,X,T = map(int, input().split())  # 3個の数字の入力を受け取る


m=(N//X) 
m1=m*T


if N%X==0:
  print(m1)
else:
  print(m1+T)

Buggy submission (verdict: Runtime Error):
N,X,T=input(),input(),input()

m=(N//X) 
m1=m*T

if N%X==0:
  print(m)
else:
  print(m+1)

Buggy submission (verdict: Runtime Error):
N,X,T=input(),input(),input()

m=(N//X)*T

if N%X==0:
  print(m)
else:
  print(m+1)
Problem p02694 (python)

Fixed submission:
X = int(input())
x = 100
i = 0
while x < X:
    x += x//100 
    i += 1

print(i)

Buggy submission (verdict: Runtime Error):
import sys
K = int(input())
A, B = map(int, input().split())

for i in range(1000):
    s = K * i
    if A <= s <= B:
        print("OK")
        sys.exit()
print("NG")
Problem p02713 (python)

Fixed submission:
n = int(input())

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a

ans = 0
if n == 1:
    ans = 1
else:
    for i in range(n):
        i = i + 1
        for j in range(n):
            j = j + 1
            for k in range(n):
                k = k + 1
                ij = gcd(i,j)
                ans = ans + gcd(ij,k)

print(ans)

Buggy submission (verdict: Runtime Error):
import gcd from math
n = int(input())

ans = 0
if n == 1:
    ans = 1
else:
    for i in range(n):
        i = i + 1
        for j in range(n):
            j = j + 1
            for k in range(n):
                k = k + 1
                ij = gcd(i,j)
                ans = ans + gcd(ij,k)

print(ans)
Problem p02576 (python)

Fixed submission:
import math
N, X, T = map(int, input().split())
S = math.ceil(N/X)
Ans = S * T
print(Ans)

Buggy submission (verdict: Runtime Error):
import math
N, X, T = input()
S = math.ceil(N/X)
Ans = S * T
print(Ans)
Problem p02600 (python)

Fixed submission:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
 
X=int(input())
ans=0
if(400<=X and X<=599):
    ans=8
if(600<=X and X<=799):
    ans=7
if(800<=X and X<=999):
    ans=6
if(1000<=X and X<=1199):
    ans=5
if(1200<=X and X<=1399):
    ans=4
if(1400<=X and X<=1599):
    ans=3
if(1600<=X and X<=1799):
    ans=2
if(1800<=X and X<=1999):
    ans=1
 
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())
if 400 <= x < 600:
    print(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 1000 <= x < 1200:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif 1800 <= x < 2000:
    print(1)
x = int(input())
if 400 <= x < 600:
    prtint(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 1000 <= x < 1200:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif 1800 <= x < 2000:
    print(1)

Buggy submission (verdict: Runtime Error):
x = int(input())
if 400 <= x < 600:
    prtint(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 1000 <= x < 1200:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif 1800 <= x < 2000:
    print(1)

Buggy submission (verdict: Runtime Error):
ans = input()
if 400 <= ans <= 599:
  print(8)
elif 600 <= ans <= 799:
  print(7)
elif 800 <= ans <= 999:
  print(6)
elif 1000 <= ans <= 1199:
  print(5)
elif 1200 <= ans <= 1399:
  print(4)
elif 1400 <= ans <= 1599:
  print(3)
elif 1600 <= ans <= 1799:
  print(2)
elif 1800 <= ans <= 1999:
  print(1)
Problem p02600 (python)

Fixed submission:
x = int(input())
ran = list(range(400,2200,200))
pointer = 0
while x >= ran[pointer]:
    pointer += 1
print(9-pointer)

Buggy submission (verdict: Runtime Error):
x = int(input())
ran = list(range(400,2000,200))
pointer = 0
while x >= ran[pointer]:
    pointer += 1
print(9-pointer)
Problem p02719 (python)

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs((-1*n)%k)))

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,input().split())
print(z,x,y)
Problem p02743 (python)

Fixed submission:
a,b,c = map(int,input().split())
if (c>a+b) and (c>2):
  print('Yes' if (c-a-b)**2 > 4*a*b else 'No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def mysqrt(x):
    g = 1.0
    while True:
        if abs(g**2 - x) < 0.000000000001:
            return g
        g = (g+x/g)/2 
print('Yes' if mysqrt(a) + mysqrt(b) < mysqrt(c) else 'No')
Problem p02756 (python)

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
ref=0
for i in range(Q):
    T=input().split()
    if T[0] == '2':
        if (T[1]=='1' and ref%2==0):
            S.appendleft(T[2])
        elif (T[1]=='2' and ref%2==0):
            S.append(T[2])
        elif (T[1]=='1' and ref%2==1):
            S.append(T[2])
        elif (T[1]=='2' and ref%2==1):
            S.appendleft(T[2])
    else:
        ref+=1
for i in range(len(S)):
    if ref%2==0:
        char=S.popleft()
        print(char,end='')
    else:
        char=S.pop()
        print(char,end='')

Buggy submission (verdict: Runtime Error):
S=input()
Q=int(input())
ref=0
for i in range(Q):
    T=input().split()
    if T[0] == '2':
        if (T[1]=='1' and ref%2==0):
            S=T[2]+S
        elif (T[1]=='2' and ref%2==0):
            S=S+T[2]
        elif (T[1]=='1' and ref%2==1):
            S=S+T[2]
        elif (T[1]=='2' and ref%2==1):
            S=T[2]+S
    else:
        ref+=1
    print(S)
print(S if ref%2==0 else S[::-1])
Problem p03963 (python)

Fixed submission:
N,K=map(int,input().split())
print(K*(K-1)**(N-1))

Buggy submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
print(int(math.factorial(N)/math.factorial(N-K)))
Problem p02926 (python)

Fixed submission:
import numpy as np

n=int(input())

def div2(x,y):
    if x>0:
        return (1,y/x)
    elif x<0:
        return (-1,y/x)
    else:
        if y>0:
            return (-1,-float("inf"))
        else:
            return (1,-float("inf"))
    

L=[list(map(int,input().split())) for i in range(n)]

L.sort(key=lambda x:div2(x[0],x[1]))

m=0
for i in range(n):
    for j in range(i,n):
        x0=y0=0
        x1=y1=0
        for k in range(n):
            if i<=k<=j:
                x0+=L[k][0]
                y0+=L[k][1]
            else:
                x1+=L[k][0]
                y1+=L[k][1]
        m=max(m,x0**2+y0**2,x1**2+y1**2)

print('{:.12f}'.format(np.sqrt(m)))

Buggy submission (verdict: Runtime Error):
import numpy as np

n=int(input())
a1=[0,0]
a2=[0,0]
a3=[0,0]
a4=[0,0]

def d1(a):
    return np.sqrt((a[0])**2+(a[1])**2)

def d2(a,b):
    return np.sqrt((a[0]+b[0])**2+(a[1]+b[1])**2)

def d3(a,b,c):
    return np.sqrt((a[0]+b[0]+c[0])**2+(a[1]+b[1]+c[1])**2)

def d4(a,b,c,d):
    return np.sqrt((a[0]+b[0]+c[0]+d[0])**2+(a[1]+b[1]+c[1]+d[1])**2)

for i in range(n):
    x=list(map(int,input().split()))
    if ((x[0]<0 and x[1]<0)or(x[0]<0 and x[1]==0)or(x[0]==0 and x[1]<0)):
        a3[0] += x[0]
        a3[1] += x[1]
    if x[0]<0 and x[1]>0:
        a2[0] += x[0]
        a2[1] += x[1]
    if x[0]>0 and x[1]<0:
        a4[0] += x[0]
        a4[1] += x[1]
    if ((x[0]>0 and x[1]>0)or(x[0]>0 and x[1]==0)or(x[0]==0 and x[1]>0)):
        a1[0] += x[0]
        a1[1] += x[1]

k1=max(d1(a1),d1(a2),d1(a3),d1(a4))
k2=max(d2(a1,a4),d2(a1,a2),d2(a2,a3),d2(a3,a4))
k3=max(d3(a1,a2,a4),d3(a1,a2,a3),d3(a2,a3,a4),d2(a3,a4,a1))

k=max(k1,k2,k3,d4(a1,a2,a3,a4))

print('{:.12f}'.format(k))
Problem p02934 (python)

Fixed submission:
import numpy as np

n=int(input())
a=list(map(float,input().split()))
s=1

for i in range(n):
  s *= a[i]

b=[s/a[j] for j in range(n)]

print(s/np.sum(b))

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

for i in range(n):
  s *= a[i]

b=s/a
Problem p03126 (python)

Fixed submission:
import numpy as np

n,m=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(t) if x == n]
print(len(maxIndex))

Buggy submission (verdict: Runtime Error):
n,m=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(t) if x == max(t)]
print(len(maxIndex)

Buggy submission (verdict: Runtime Error):
n,m=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(a) if x == max(tmp)]
print(len(maxIndex)
Problem p03260 (python)

Fixed submission:
a=list(map(int,input().split()))
if a[0]!=2 and a[1]!=2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
if a[0]!=2 and a[1]!=2:
  print("Yes")
else:
  print("No)
Problem p03261 (python)

Fixed submission:
import sys
n=int(input())
a=[]
for i in range(n):
  a.append(list(map(str,input())))
  
for j in range(1,n):
  if a[j][0]!=a[j-1][-1]:
    print("No")
    sys.exit()
  for l in range(j):
    if a[l]==a[j]:
      print("No")
      sys.exit()
  
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  a.append(list(map(str,input())))
  
for j in range(1,n):
  if a[j][0]!=a[j-1][-1]:
    print("No")
    break
  elif j==n-1:
    print("Yes")
    break
  for l in range(j-1):
    if a[l]==a[j]:
      print("No")
      sys.exit()
    elif j==n-1 and l==j-2:
      print("Yes")
      sys.exit()
Problem p03289 (python)

Fixed submission:
str=list(input())

count1=0
count2=0
if str[0]=="A":
  for i in range(len(str)-3):
    if str[i+2]=="C":
      count1 += 1
  for i in range(len(str)):
    if str[i]==str[i].capitalize():
      count2 += 1
  if count1 == 1 and count2 ==2 :
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Buggy submission (verdict: Runtime Error):
str=list(input())

count1=0
count2=0
if str[0]=="A":
  for i in range(len(str)-3):
    if str[i+2]=="C":
      count1 += 1
  for i in range(len(str)):
    if str[i]==str[i].capitalize():
      count2 += 1
  if count1 == 1 && count2 !=0 :
    print("AC")
  else:
    print("WA")
else:
  print("WA")
Problem p02995 (python)

Fixed submission:
import fractions
A, B, C, D = [int(i) for i in input().split()]
result = B+1 - A
def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)
def wareru(min_num, max_num, waru):
    return (max_num)//waru - (min_num-1)//waru
result -= wareru(A, B, C) + wareru(A, B, D) - wareru(A, B, lcm(C,D))
print(result)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = [int(i) for i in input().split()]
result = B+1 - A
def lcm(a, b):
    return (a * b) // math.gcd(a, b)
def wareru(min_num, max_num, waru):
    return (max_num)//waru - (min_num-1)//waru
result -= wareru(A, B, C) + wareru(A, B, D) - wareru(A, B, lcm(C,D))
print(result)
Problem p03139 (python)

Fixed submission:
N, A, B = [int(i) for i in input().split()]

X = A if A < B else B
Y = 0 if N > A+B else A+B-N

print("{0} {1}".format(X, Y))

Buggy submission (verdict: Runtime Error):
I = int(input())
A = input()
B = input()
C = input()

count = 0
for i in range(I):
  if not (A[i]==B[i]==C[i]):
    count += 1 if A[i]==B[i] or B[i]== C[i] or A[i]==C[i] else 2

print(count)
Problem p02576 (python)

Fixed submission:
x=input().split()

n=int(x[0])
t=int(x[1])
k=int(x[2])


if n%t==0: print(k*int(n/t))
else: print(k*int(n/t + 1))

Buggy submission (verdict: Runtime Error):
x=input().split()

n=int(x[0])
t=int(x[1])
k=int(x[2])

print(k*ceil(20/12))
Problem p02642 (python)

Fixed submission:
N=int(input())
#5
A=sorted(map(int,input().split()))
#24 11 8 3 16

dp = [1]*max(A)
l = len(dp)

for a in A:
	if dp[a-1] == 1:
		dp[a-1] = 2
		for i in range(2*a, l+1, a):
			dp[i-1] = 0
	elif dp[a-1] == 2:
		dp[a-1] = 0

print(sum([1 for a in A if dp[a-1] != 0]))

Buggy submission (verdict: Runtime Error):
N=int(input())
#5
A=sorted(map(int,input().split()))
#24 11 8 3 16
B = A.copy()

for i in range(N):
	if A[i] != 0:
		for j in range(i+1,N):
				if A[j] % A[i] == 0:
					A[j] = 0

if A[0] == B[1]:
	A[0] = 0

print(sum([1 for a in A if a != 0]))
Problem p02646 (python)

Fixed submission:
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if V <= W:
	print("NO")
else:
	if abs((B-A))/(V-W) <= T:
		print("YES")
	else:
		print("NO")

Buggy submission (verdict: Runtime Error):
A,V = map(int,input().split())
1 2
B,W = map(int,input().split())
3 1
T = int(input())
3

if V <= W:
	print("NO")
else:
	if abs((B-A))/(V-W) <= T:
		print("YES")
	else:
		print("NO")

Buggy submission (verdict: Runtime Error):
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

if V <= W:
	print("NO")
else:
	if (B-A)/(W-T) <= T:
		print("YES")
	else:
		print("NO")