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

Fixed submission:
a,b = map(int,input().split())
sum=0
cnt=0
while(cnt<b-a):
    cnt+=1
    sum+=cnt
print(sum-b)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
sum=0
cnt=0
while(cnt<b-a):
    cnt+=1
    l+=cnt
print(l-b)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print((b-a-1)*(b-a)//2-a)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print((b-a-1)*(b-a)//2-a)
Problem p03591 (python)

Fixed submission:
s = input()
if len(s) >= 4 and s[:4] == "YAKI":
    print("Yes")
else:
    print("No");

Buggy submission (verdict: Runtime Error):
s = input()
if len(s) >= 4 && s[:4] == "YAKI":
    print("Yes")
else:
    print("No");
Problem p02607 (python)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=0

if (N%2 == 0):
  c=N//2
else:
  c=N//2 + 1

for i in range(c):
  if (a[2*i] %2 !=0):
    b +=1

print(b)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
b=0
c=N//2

for i in range(c+1):
  if (a[2*i] %2 !=0):
    b +=1

print(b)
Problem p03143 (python)

Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    w = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 3 * m))
    e = [(dat[i*3+2], dat[i*3] - 1, dat[i*3+1] - 1) for i in xrange(m)]
    e.sort()
    p = range(n)
    ok = [0] * m
    h = [None] * n
    g = [tuple() for i in xrange(m)]
    st = []
    pu = st.append
    for i, z in enumerate(e):
        c, u, v = z
        x = u
        while x != p[x]:
            pu(x)
            x = p[x]
        pu(x)
        t = x
        x = v
        while x != p[x]:
            pu(x)
            x = p[x]
        for y in st:
            p[y] = x
        del st[:]
        if x != t:
            w[x] += w[t]
            if w[x] >= c:
                ok[i] = 1
            g[i] = (h[x], h[t])
            h[x] = i
        else:
            if w[x] >= c:
                ok[i] = 1
            g[i] = (h[x],)
            h[x] = i
    d = [0] * m
    po = st.pop
    for i in xrange(m - 1, -1, -1):
        if d[i]:
            continue
        pu(i)
        while st:
            x = po()
            d[x] = 1
            for y in g[x]:
                if y is not None:
                    ok[y] |= ok[x]
                    pu(y)
    print m - sum(ok)
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    w = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 3 * m))
    e = [(dat[i*3+2], dat[i*3] - 1, dat[i*3+1] - 1) for i in xrange(m)]
    e.sort()
    p = range(n)
    ok = [0] * n
    h = [None] * n
    g = [None] * m
    st = []
    pu = st.append
    for i, z in enumerate(e):
        c, u, v = z
        x = u
        while x != p[x]:
            pu(x)
            x = p[x]
        pu(x)
        t = x
        x = v
        while x != p[x]:
            pu(x)
            x = p[x]
        for y in st:
            p[y] = x
        del st[:]
        if x != t:
            w[x] += w[t]
            if w[x] >= c:
                ok[i] = 1
            g[i] = (h[x], h[t])
            h[x] = i
        elif w[x] >= c:
            ok[i] = 1
            g[i] = (h[x],)
            h[x] = i
    d = [0] * m
    po = st.pop
    for i in xrange(m - 1, -1, -1):
        if d[i]:
            continue
        pu(i)
        while st:
            x = po()
            d[x] = 1
            if g[x] is None:
                continue
            for y in g[x]:
                if y is not None:
                    ok[y] |= ok[x]
                    pu(y)
    print m - sum(ok)
main()
Problem p03591 (python)

Fixed submission:
print "Yes" if raw_input().startswith("YAKI") else "No"

Buggy submission (verdict: Runtime Error):
h, w, k = map(int, raw_input().split())
b = [[0] * w for i in xrange(h)]
c = "YGBR"
for i in xrange(h):
    for j in xrange(w):
        b[i][j] = c[(i+j)/k%2+(i-j)/k%2*2]
    print "".join(b[i])
Problem p03594 (python)

Fixed submission:
h, w, k = map(int, raw_input().split())
b = [[0] * w for i in xrange(h)]
c = "YGBR"
for i in xrange(h):
    for j in xrange(w):
        b[i][j] = c[(i+j)/k%2+(i-j)/k%2*2]
    print "".join(b[i])

Buggy submission (verdict: Runtime Error):
h, w, k = map(int, raw_input().split())
b = [[0] * w for i in xrange(w)]
c = "YGBR"
for i in xrange(h):
    for j in xrange(w):
        b[i][j] = c[(i+j)/k%2+(i-j)/k%2*2]
    print "".join(b[i])
Problem p03619 (python)

Fixed submission:
from sys import stdin
from math import pi
from bisect import bisect
from itertools import repeat
def main():
    x1, y1, x2, y2 = map(int, stdin.readline().split())
    sx = 1
    if x1 > x2:
        x1, x2 = -x1, -x2
        sx = -1
    sy = 1
    if y1 > y2:
        y1, y2 = -y1, -y2
        sy = -1
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    a = []
    for i in xrange(n):
        x, y = dat[i*2:i*2+2]
        x *= sx
        y *= sy
        if x1 <= x <= x2 and y1 <= y <= y2:
            a.append((x, y))
    a.sort()
    c = pi * 10 - 20
    b = [-10 ** 9] + [10 ** 9] * 200010
    m = 1
    for x, y in a:
        p = bisect(b, y, lo=0, hi=m)
        b[p] = y
        if p == m:
            m += 1
    d = pi * 5 - 20
    if m <= min(x2 - x1 + 1, y2 - y1 + 1):
        c = d
    print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + (m - 2) * d + c)
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
from math import pi
from bisect import bisect
from itertools import repeat
def main():
    x1, y1, x2, y2 = map(int, stdin.readline().split())
    sx = 1
    if x1 > x2:
        x1, x2 = -x1, -x2
        sx = -1
    sy = 1
    if y1 > y2:
        y1, y2 = -y1, -y2
        sy = -1
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    a = []
    for i in xrange(n):
        x, y = dat[i*2:i*2+2]
        x *= sx
        y *= sy
        if x1 <= x <= x2 and y1 <= y <= y2:
            a.append((x, y))
    a.sort()
    c = pi * 5 - 10
    if x1 == x2 or y1 == y2:
        if a:
            print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + 2 * c)
        else:
            print "%.12f" % ((x2 - x1 + y2 - y1) * 100)
        return
    b = [-10 ** 9] + [10 ** 9] * 200010
    m = 1
    for x, y in a:
        p = bisect(b, y, lo=0, hi=m)
        b[p] = y
        if p == m:
            m += 1
    c = pi * 5 - 20
    print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + (m - 1) * c)
main()
from sys import stdin
from math import pi
from bisect import bisect
from itertools import repeat
def main():
    x1, y1, x2, y2 = map(int, stdin.readline().split())
    sx = 1
    if x1 > x2:
        x1, x2 = -x1, -x2
        sx = -1
    sy = 1
    if y1 > y2:
        y1, y2 = -y1, -y2
        sy = -1
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    a = []
    for i in xrange(n):
        x, y = dat[i*2:i*2+2]
        x *= sx
        y *= sy
        if x1 <= x <= x2 and y1 <= y <= y2:
            a.append((x, y))
    a.sort()
    c = pi * 5 - 10
    if x1 == x2 or y1 == y2:
        if a:
            print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + 2 * c)
        else:
            print "%.12f" % ((x2 - x1 + y2 - y1) * 100)
        return
    b = [-10 ** 9] + [10 ** 9] * 200010
    m = 1
    for x, y in a:
        p = bisect(b, y, lo=0, hi=m)
        b[p] = y
        if p == m:
            m += 1
    c = pi * 5 - 20
    print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + (m - 1) * c)
main()
Problem p03688 (python)

Fixed submission:
n = int(raw_input())
a = map(int, raw_input().split())
b = max(a)
c = min(a)
if b - c > 1:
    print "No"
elif b == c:
    print "Yes" if b == n - 1 or 2 * b <= n else "No"
else:
    t = sum(c == x for x in a)
    if t >= b:
        print "No"
    else:
        print "Yes" if (b - t) * 2 <= n - t else "No"

Buggy submission (verdict: Runtime Error):
nwin@linux-lqq3:~/atcoder/g16> cat b.py
n = int(raw_input())
a = map(int, raw_input().split())
b = max(a)
c = min(a)
if b - c > 1:
    print "No"
elif b == c:
    print "Yes" if b == n - 1 or 2 * b <= n else "No"
else:
    t = sum(c == x for x in a)
    if t >= b:
        print "No"
    else:
        print "Yes" if (b - t) * 2 <= t else "No"
Problem p03996 (python)

Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    q = int(stdin.readline())
    a = map(int, stdin.readline().split(), repeat(10, q))
    a = [x - 1 for x in a]
    l = [[] for i in xrange(m)]
    la = []
    for i in xrange(q - 1, -1, -1):
        x = a[i]
        if not l[x]:
            la.append(x)
        l[x].append(i)
    ok = 1
    b = [q] * n
    f = [0] * m
    xt = 0
    for i, x in enumerate(la):
        j = 0
        for y in l[x]:
            if j < n and y < b[j]:
                b[j] = y
                j += 1
        if j < n:
            ok = 0
            b[j] = -1
        if not ok:
            while f[xt]:
                  xt += 1
            if x != xt:
                print "No"
                return
            f[xt] = 1
        else:
            f[x] = 1
    print "Yes"
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    q = int(stdin.readline())
    a = map(int, stdin.readline().split(), repeat(10, q))
    a = [x - 1 for x in a]
    l = [[] for i in xrange(q)]
    la = []
    for i in xrange(q - 1, -1, -1):
        x = a[i]
        if not l[x]:
            la.append(x)
        l[x].append(i)
    ok = 1
    b = [q] * n
    f = [0] * m
    xt = 0
    for i, x in enumerate(la):
        j = 0
        for y in l[x]:
            if j < n and y < b[j]:
                b[j] = y
                j += 1
        if j < n:
            ok = 0
            b[j] = -1
        if not ok:
            while f[xt]:
                  xt += 1
            if x != xt:
                print "No"
                return
            f[xt] = 1
        else:
            f[x] = 1
    print "Yes"
main()
Problem p04033 (python)

Fixed submission:
a, b = map(int, raw_input().split())
if a <= 0 <= b:
    print 'Zero'
elif a > 0:
    print 'Positive'
elif (b - a) % 2:
    print 'Positive'
else:
    print 'Negative'

Buggy submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if a <= 0 <= b:
    print 'Zero'
elif a > 0:
    print 'Positive'
elif (b - a) % 2:
    print 'Positive'
else:
    print 'Negative'
a, b = map(int, raw_input().split())
if a <= 0 <= b:
    print 'Zero'
elif a > 0:
    print 'Positive'
elif (b - a) % 2:
    print 'Positive'
else:
    print 'Negative'
Problem p04034 (python)

Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    a = [0] + [2] * n
    a[1] = 1
    for i in xrange(m):
        x, y = dat[i*2], dat[i*2+1]
	if a[x] == 0:
            continue
        a[y] += 2
        if a[x] & 1 and a[y] & 1 ^ 1:
            a[y] -= 1
        a[x] -= 2
	if a[x] < 0:
            a[x] = 0
    print sum(x & 1 for x in a)
main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    a = [0] + [2] * n
    a[1] = 1
    for i in xrange(m):
        x, y = dat[i*2], dat[i*2+1]
	if a[x] == 0:
            continue
        a[y] += 2
        if a[x] & 1 and a[y] & 1 ^ 1:
            a[y] -= 1
        a[x] -= 2
	if a[x] < 0:
            a[x] = 0
    print sum(x & 1 for x in a)
main()
Problem p04048 (python)

Fixed submission:
from fractions import gcd
n, x = map(int, raw_input().split())
g = gcd(n, x)
n /= g
x /= g
print 3 * (n - 1) * g

Buggy submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())
g = gcd(n, x)
n /= g
x /= g
print 3 * (n - 1) * g
Problem p02817 (python)

Fixed submission:
print(''.join(input().split()[::-1]))

Buggy submission (verdict: Runtime Error):
print(''.join([input(),input()][::-1]))
Problem p02818 (python)

Fixed submission:
a,b,k=map(int,input().split())
if a+b<=k:print(0,0)
elif a<=k:print(0,a+b-k)
else:print(a-k,b)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input())
if a+b<=k:print(0,0)
elif a<=k:print(0,a+b-k)
else:print(a-k,b)
Problem p02969 (python)

Fixed submission:
print(3*int(input())**2)

Buggy submission (verdict: Runtime Error):
a=[int(input())for i in[0]*int(input())]
b=max(a)
if a.count(b)>1:print('\n'.join([str(b)]*len(a)))
else:
  c=[b for i in a]
  c[a.index(b)]=max(a[:a.index(b)]+a[a.index(b)+1:])

Buggy submission (verdict: Runtime Error):
a=[int(input())for i in[0]*int(input())]
b=max(a)
if a.count(b)>1:print('\n'.join([b for i in a]))
else:
  c=[b for i in a]
  c[a.index(b)]=max(a[:a.index(b)]+a[a.index(b)+1:])

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(-(-a//(1+2*b)))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(-(-a//(1+2*b)))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(0-(-a//b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(0--a//b)
Problem p02971 (python)

Fixed submission:
a=[int(input())for i in[0]*int(input())]
b=max(a)
if a.count(b)>1:print('\n'.join([str(b)]*len(a)))
else:
  c=[b for i in a]
  c[a.index(b)]=max(a[:a.index(b)]+a[a.index(b)+1:])
  print('\n'.join([str(i)for i in c]))

Buggy submission (verdict: Runtime Error):
a=[int(input())for i in[0]*int(input())]
b=max(a)
if a.count(b)>1:print('\n'.join([b for i in range(len(a))]))
else:
  c=[b for i in a]
  c[a.index(b)]=max(a[:a.index(b)]+a[a.index(b)+1:])
Problem p03079 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b and b==c:print('Yes')
else:print('No')

Buggy submission (verdict: Runtime Error):
from math import factorial as f;b,w=map(int,input().split());gcd=lambda a,b:gcd(max(a,b)%min(a,b),min(a,b))if max(a,b)%min(a,b)else min(a,b);p=f(b+w)//f(b)//f(w)
def g(x,y):print((1000000008*x)//y)
q=2
for i in range(min(b,w)):g(1,2);q*=2
x,y=1,2
for i in range(b+w-min(b,w)-1):bunbo=q;bunsi=q//2+1;x,y=bunbo,bunsi;g(y,x);q*=2
g(y,x)

Buggy submission (verdict: Runtime Error):
b,w=map(int,input().split())
from math import factorial as f
from math import gcd
p=f(b+w)//f(b)//f(w)
def g(x,y):print((1000000008*x)//y)
q=2
for i in range(min(b,w)):
    g(1,2)
    q*=2
x,y=1,2
for i in range(b+w-min(b,w)-1):
 bunbo=q
 bunsi=q//2+1
 x,y=bunbo,bunsi
 g(y,x)
 q*=2
g(y,x)
Problem p03101 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
c,d=map(int,input())
print((a-c)*(b-d))
Problem p03105 (python)

Fixed submission:
a,b,c=map(int,input().split());print(min(b//a,c))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input());print(min(b//a,c))
Problem p03109 (python)

Fixed submission:
print('TBD'if int(input().split('/')[1])>4 else 'Heisei')

Buggy submission (verdict: Runtime Error):
print('TBD'if int(input().split()[1])>4 else 'Heisei')
Problem p03110 (python)

Fixed submission:
a=0
for i in range(int(input())):
  b=input().split()
  if b[1]=='JPY':
    a+=eval(b[0])
  else:
    a+=eval(b[0])*380000
print(a)

Buggy submission (verdict: Runtime Error):
a=0
for i in range(int(input())):
  b=input().split()
  if b[1]=='JPY':
    a+=int(b[0])
  else:
    a+=int(b[0])*380000
print(a)
Problem p03282 (python)

Fixed submission:
a=input()
b=int(input())
if b<101:
  if a[:b]=='1'*b:print(1)
  else:
    k=0
    while a[k]=='1':k+=1
    print(a[k])
else:
  k=0
  while a[k]=='1':k+=1
  print(a[k])

Buggy submission (verdict: Runtime Error):
a=input()
b=int(input())
if a[:b]=='1'*b:print(1)
else:
  k=0
  while a[k]=='1':k+=1
  print(a[k])

Buggy submission (verdict: Runtime Error):
a=input()
k=0
while a[k]=='1'and len(a)>k:
  k+=1
b=int(input())
if b<k or a=='1'*len(a):print(1)
else:print(a[k])
Problem p03647 (python)

Fixed submission:
a,b=map(int,input().split())
c=[list(map(int,input().split()))for i in[0]*b]
d=[]
e=[]
for i in c:
  if i[0]==1:d+=[i[1]]
  elif i[1]==a:e+=[i[0]]
print((set(d)&set(e)==set())*'IM'+'POSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=[list(map(int,input().split()))for i in[0]*b]
print(({i[1]for i in c if c[0]==1}&{i[0]for i in c if c[1]==a}=={})*'IM'+'POSSIBLE')
Problem p03697 (python)

Fixed submission:
a,b=map(int,input().split())
print('error'if a+b>=10 else a+b)

Buggy submission (verdict: Runtime Error):
a,b=map(input().split())
print('error'if a+b>=10 else a+b)
Problem p03447 (python)

Fixed submission:
x = input()
a = input()
b = input()
print (x - a) % b

Buggy submission (verdict: Runtime Error):
x = input()
a = input()
b = input()
print (x - a) % b
Problem p02601 (python)

Fixed submission:
A, B, C = list(map(int, input().split())) 
K = int(input())
N = 0

while B <= A:
    B = B * 2
    N = N + 1

while C <= B:
    C = C * 2
    N = N + 1

if K >= N:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
while B <= A:
    B = B * 2
    N = N + 1

while C <= B:
    C = C * 2
    N = N + 1

if K >= N:
    print('Yes')
else:
    print('No')
Problem p02602 (python)

Fixed submission:
N, K = list(map(int, input().split())) 
A = list(map(int, input().split())) 

H0 = 1
H1 = 1

for i in range(N-K):
    # for j in range(K):
    #     H0 = int(H0 * A[j])
    # H1 = int(H0/A[i] * A[K+i])
    H0 = A[i]
    H1 = A[K+i]

    if H1 > H0:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split())) 
A = list(map(int, input().split())) 

H0 = 1
H1 = 1

for i in range(N-K):
    for j in range(K):
        H0 = int(H0 * A[j])

    H1 = int(H0/A[i] * A[K+i])

    if H1 > H0:
        print('Yes')
    else:
        print('No')
Problem p02603 (python)

Fixed submission:
N = int(input()) 
A = list(map(int, input().split())) 

M = 1000
X = 0

for i in range(N-1):
    if A[i] < A[i+1]:
        X = int(M/A[i])
        M = int(M - X * A[i])
    
    M = M + X * A[i+1]
    X = 0

print(int(M))

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

M = 1000
X = 0

for i in range(N-1):
    if A[i] < A[i+1]:
        X = int(M/A[i])
        M = int(M - X * A[i])
    
	M = M + X * A[i+1]
    X = 0

print(int(M))

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

M = 1000
X = 0

for i in range(N-1):
    if A[i] < A[i+1]:
        X = int(M/A[i])
        M = int(M - X * A[i])
    
	M = M + X * A[i+1]

print(int(M))
Problem p02909 (python)

Fixed submission:
S = str(input())

A = ['Sunny','Cloudy','Rainy']
i = 0

if S == 'Sunny':
    i = 1
elif S == 'Cloudy':
    i = 2
else:
    i =0

print(A[i])

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)] 

p = Q - K
for i in range(N):
    j = A.count(i+1)
    if j > p:
        print('Yes')
    else:
        print('No')
    j = 0
Problem p02657 (python)

Fixed submission:
A,B = input().split()
print(int(A)*int(B))

Buggy submission (verdict: Runtime Error):
N = int(input())
primeNum = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999]

pow = 1
time = 0
while True:
    for p in primeNum:
        z = p**pow
        if p <= N:
            if N % z == 0:
                N = int(N / (z))
                time+=1
        else:
            break
    pow+=1
    if pow >= N:
        break

print(time)
Problem p02818 (python)

Fixed submission:
cookies = [int(x) for x in input().split()]
leftOver = cookies[0] - cookies[2]
takahashi = max(0, leftOver)
print(str(takahashi)+ ' ' + (str(cookies[1]) if takahashi > 0  else str(max(0,cookies[1] - abs(leftOver)))))

Buggy submission (verdict: Runtime Error):
A, B, K = input().split()
A = int(A)
B = int(B)
K = int(K)
if (A + B) - K <= 0:
    Ta = 0
    Ao = 0
else:
    if A > B:
        Ta = (A + B) - K
        Ao = 0
    else:
        Ao = (A + B) - K
        Ta = 0
print(f"{Ta} {Ao}")

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

if (A+B) - K <= 0:
    Ta=0
    Ao=0
else:
    if A < B:
        Ta = (A+B) - K
        Ao = 0
    else:
        Ao = (A+B) - K
        Ta = 0

    
print(f"{Ta} {Ao}")

Buggy submission (verdict: Runtime Error):
A,B,K = input().split()
print(f"{0 if A <= K else A - k} {0 if B <= K else B-k}")
Problem p02741 (python)

Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(list[K-1])

Buggy submission (verdict: Runtime Error):
import random
list = []
for i in range(31):
  list.append(random.randint(0,10000))
K = int(input())
print(list[K-1])

Buggy submission (verdict: Runtime Error):
import random
list = []
for i in range(31):
  list.append(random.randint(0,10000))
print(list)
K = int(input())
print(list[K-1])

Buggy submission (verdict: Runtime Error):
import random
list = []
for i in range(31):
  list.append(random.randint(0,100))
K = int(input())
print(list[K-1])

Buggy submission (verdict: Runtime Error):
import random
list = []
for i in range(32):
  list.append(random.randint(0,100))
K = int(input())
print(list[K])
Problem p02603 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

money = 1000
ticket = 0
for i in range(N - 1):
    # buy
    if A[i] < A[i + 1]:
        ticket += money // A[i]
        money -= (money // A[i]) * A[i]
    elif A[i] == A[i + 1]:
        pass
    # sell
    else:
        money += A[i] * ticket
        ticket = 0

money += A[-1] * ticket

print(money)

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

#print(N)
#print(A)

syozi = 1000
kabu = 0

for i in range(N-1):
#  print(str(i)+': '+ str(A[i]) + ', ' + str(kabu) + ', ' + str(syozi) )
  if A[i] < A[i+1]:
    kabu = syozi // A[i] 
    syozi = int( syozi % A[i] )
  elif A[i] > A[i+1]:
    syozi += A[i] * kabu
    kabu = 0
  else:
    pass
#  print( str(i)+': '+str(A[i]) + ', ' + str(kabu) + ', ' + str(syozi) )

if A[N-2] < A[N-1]:
  syozi += A[N-1] * kabu
  kabu = 0

print(syozi)