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

Fixed submission:
n, m, x = map(int, input().split())
c = []
a = []
for i in range(n):
    l = list(map(int, input().split()))
    c.append(l[0])
    a.append(l[1:])

ans=float("inf")

for i in range(2 ** n):
    cost = 0
    r = [0 for _ in range(m)]
    for j in range(n):
        if (i >> j) & 1:
            cost += c[j]
            for k in range(m):
                r[k] += a[j][k]
    flag = True
    for k in r:
        if k < x:
            flag = False
    if flag:
        ans = min(ans, cost)
if ans!=float("inf"):
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [i-1 for i in list(map(int, input().split()))]

l = []
used = [0 for _ in range(n)]

c = 0
flag = True
while 1:
    if not flag:
        l.append(c)
    if used[c] == 1 and l:
        break
    if not flag:
        used[c] = 1
    c = a[c]
    flag = False

p = 0
length = len(l)
b = []
for i in range(length):
    if l[i] == l[-1]:
        l = l[i:-1]
        b = l[:i]
        p = i
        break

if len(b) >= k:
    print(b[k - 1])
else:
    print(l[(k - p - 1) % len(l)] + 1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [i-1 for i in list(map(int, input().split()))]

l = []
used = [0 for _ in range(n)]

c = 0
flag = True
while 1:
    if not flag:
        l.append(c)
    if used[c] == 1 and l:
        break
    if not flag:
        used[c] = 1
    c = a[c]
    flag = False

p = 0
length = len(l)
b = []
for i in range(length):
    if l[i] == l[-1]:
        l = l[i:-1]
        b = l[::i]
        p = i
        break

if len(b) >= k:
    print(b[k - 1])
else:
    print(l[(k - p - 1) % len(l)] + 1)
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = [i-1 for i in list(map(int, input().split()))]

l = []
used = [0 for _ in range(n)]

c = 0
flag = True
while 1:
    if not flag:
        l.append(c)
    if used[c] == 1 and l:
        break
    if not flag:
        used[c] = 1
    c = a[c]
    flag = False

p = 0
length = len(l)
b = []
for i in range(length):
    if l[i] == l[-1]:
        b = l[:i]
        l = l[i:-1]
        p = i
        break


if len(b) >= k:
    print(b[k - 1]+1)
else:
    print(l[(k - p - 1) % len(l)] + 1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [i-1 for i in list(map(int, input().split()))]

l = []
used = [0 for _ in range(n)]

c = 0
flag = True
while 1:
    if flag:
        flag = False
    else:
        l.append(c)
    if used[c] == 1 and l:
        break
    used[c] = 1
    c = a[c]

p = 0
for i in range(len(l)):
    if l[i] == l[-1]:
        l = l[i:-1]
        p = i
        break

print(l[(k-p)%len(l)-1]+1)

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

a = [i - 1 for i in a]
l = []
used = [0 for _ in range(n)]
used[0] = 0

c = 0
flag = True
while 1:
    if flag:
        flag = False
    else:
        l.append(c)
    if used[c] == 1 and l:
        break
    used[c] = 1
    c = a[c]

if len(l)<k:
    end = l[-1]
    p = 0
    s = []
    for i in range(len(l)):
        if l[i] == end:
            s = l[i:-1]
            p = i
            break

    b = (k-p) % len(s)
    print(l[b] + 1)
else:
    print(l[k-1])
Problem p02696 (python)

Fixed submission:
from math import floor

a, b, n = map(int, input().split())
x = min(b - 1, n)
print(floor(a * x / b) - a * floor(x / b))

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

ans = -float("inf")
for x in range(n, max(-1, (n - a - 1)*10), -1):
    ans = max(ans, a * x // b - a * (x // b))

print(int(ans))
Problem p02783 (python)

Fixed submission:
h,a = map(int,input().split())

if h % a == 0:
    print(h // a)
else:
    print(h // a + 1)

Buggy submission (verdict: Runtime Error):
h = int(input())
a = int(input())

if h % a == 0:
    print(h / a)
else:
    print(h // a + 1)
Problem p02719 (python)

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

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
n %= m
print(min(n, k - n))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
n %= m
print(min(n, m - n))
Problem p02727 (python)

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

rl = lambda: list(map(int, input().split()))

x, y, a, b, c = rl()
p = rl()
q = rl()
r = rl()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
res = sum(sorted(p[:x] + q[:y] + r, reverse=True)[:x+y])
print(res)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def rl():
    return list(map(int, input().split()))

x, y, a, b, c = map(int, input().split())
p = rl()
q = rl()
r = rl()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
res = 0
i = j = k = 0
cp = cq = 0
while cp < x or cq < y:
    if cp < x:
        if r[k] > p[i]:
            res += r[k]
            k += 1
        else:
            res += p[i]
            i += 1
        cp += 1
    if cq < y:
        if r[k] > q[j]:
            res += r[k]
            k += 1
        else:
            res += q[j]
            j += 1
        cq += 1
print(res)
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, raw_input().split())
if (a + b) % 2 == 0:
  print((a + b) // 2)
else:
  print("IMPOSSIBLE")

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

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

Fixed submission:
s = input()
n = len(s)
MOD = 1e9 + 7
dp = [[0] * 13 for _ in range(n)]
for i in range(10):
	if s[0] == "?":
		dp[0][i] = 1
	else:
		cur = ord(s[0]) - ord("0")
		dp[0][cur] = 1
for i in range(1, n):
	if s[i] != "?":
		cur = ord(s[i]) - ord("0")
		for j in range(13):
			dp[i][(10 * j + cur) % 13] += dp[i - 1][j] % MOD
	else:
		for j in range(13):
			for cur in range(10):
				dp[i][(10 * j + cur) % 13] += dp[i - 1][j] % MOD
#print(dp)
print(int(dp[n - 1][5] % MOD))

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
MOD = 1e9 + 7
dp = [[0] * 13 for _ in range(n)]
for i in range(10):
	if s[0] == "?":
		dp[0][i] = 1
	else:
		cur = ord(s[0]) - ord("0")
		dp[0][cur] = 1
for i in range(1, n):
	if s[i] != "?":
		cur = ord(s[i]) - ord("0")
		for j in range(13):
			dp[i][(10 * j + cur) % 13] += dp[i - 1][j]
	else:
		for j in range(13):
			for cur in range(10):
				dp[i][(10 * j + cur) % 13] += dp[i - 1][j]
#print(dp)
print(int(dp[n - 1][5] % MOD))
Problem p02641 (python)

Fixed submission:
x, n = [int(i) for i in input().split()]
flag = [0 for i in range(105)]
if (n != 0):
    p = [int(i) for i in input().split()]

    for i in p:
        flag[i] = 1



for i in range(100):
    if x-i >=0:
        if flag[x-i] == 0:
            ans = x-i
            break
    else:
        ans = -1
        break

    if flag[x+i] == 0:
        ans = x+i
        break
    
print(ans)

Buggy submission (verdict: Runtime Error):
x, n = [int(i) for i in input().split()]
flag = [0 for i in range(101)]
if (n != 0):
    p = [int(i) for i in input().split()]

    for i in p:
        flag[i] = 1



for i in range(100):
    if flag[x-i] == 0:
        ans = x-i
        break

    if flag[x+i] == 0:
        ans = x+i
        break
    
print(ans)
Problem p03109 (python)

Fixed submission:
s = input().split("/")

if (int(s[0]) <= 2019) and (int(s[1]) <= 4) and (int(s[2]) <= 30):
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
import numpy as np
    
INF = float('inf')

n,A,B,C = [int(i) for i in input().split()]

l = [int(input()) for i in range(n)]

def dfs(cur, a, b, c):
    
    if cur == n:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF
    
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a+l[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b+l[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c+l[cur]) + 10

    return min(ret0, ret1, ret2, ret3)


print(dfs(0,0,0,0))
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

N, X  = (int(i) for i in input().split())
x = (int(i) for i in input().split())
x = list(x)
x.append(X)
#print(x)
x = sorted(x)

ans = x[1]-x[0]
for i in range(2, N+1):
    ans = gcd(x[i]-x[i-1],ans)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


N, X  = (int(i) for i in input().split())
x = (int(i) for i in input().split())
x = list(x)
x.append(X)
#print(x)
x = sorted(x)

ans = x[1]-x[0]
for i in range(2, N+1):
    ans = math.gcd(x[i]-x[i-1],ans)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

N, X  = (int(i) for i in input().split())
x = (int(i) for i in input().split())
x = list(x)
x.append(X)
#print(x)
x = sorted(x)
dif = []
for i in range(1, N):
    dif.append(x[i]-x[i-1])

if N == 1:
    print(abs(x[0]-x[1]))
else:
    print(gcd(dif)[0])
Problem p03587 (python)

Fixed submission:
S = raw_input()
ac = 0
for i in S:
    if i == '1':
        ac += 1

print ac

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    N = input()

    for n in range(1,3501):
        for h in range(1,3501):
            w = n * h * N / (4 * n * h - N * n - N * h)
            if isinstance(w, int) and w > 0:
                break

    print w, h, n
Problem p03657 (python)

Fixed submission:
A , B = map(int, input().split())
#print(A, B)
if (A%3==0 or B%3 == 0 or (A+B) % 3 == 0):
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = map(int, raw_input().split())
x = a[0]
y = sum(a) - a[0]
min = abs(x - y)
for i in range (1,N-1):
    y -= a[i]
    x += a[i]
    dummy = abs(x - y)
    if min > dummy:
        min = dummy
print min
Problem p02658 (python)

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

ans = 1

for x in arr:
    if x == 0:
        ans = 0

if ans == 0:
    print(ans)
else:
    for x in arr:
        ans *= x
        if ans > 1000000000000000000:
            break
    if ans > 1000000000000000000:
        print(-1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int, input().split()))
ans = 1
flag = 1
for x in arr:
    ans *= x
    if ans > 1000000000000000000:
        flag = 0
        break
if flag:
    print(ans)
else:
    print -1
Problem p03048 (python)

Fixed submission:
R,G,B,N =map(int,input().split())

cnt =0
    
for r in range(int(N/R)+1):
  ball = N-r*R 
  for g in range(int(ball/G)+1):
    res = N- (r*R+g*G)
    if  res >=0 and res%B ==0:
      cnt+=1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
 R,G,B,N =map(int,input().split())

cnt =0
    
for r in range(int(N/R)+1):
    
    for g in range(int(N/G)+1):
        
        ball =  r*R+g*G  
        
        res = N-ball
        
        if  res >=0  and res%B ==0:
            cnt+=1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
 R,G,B,N =map(int,input().split())

cnt =0
    
for r in range(N+1):
    
    for g in range(N+1):
        
        if r*R+g*G > N:
            continue
            
        temp = N - r*R-g*G
            
        if temp%B ==0:
            cnt+=1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
 R,G,B,N =map(int,input().split())

cnt =0
    
for r in range((int(N//R)+1)):
    
    for g in range((int(N//G)+1)):
        
        if r*R+g*G > N:
            continue
            
        temp = N - r*R-g*G
            
        if temp%B ==0:
            cnt+=1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
 R,G,B,N =map(int,input().split())

cnt =0
    
for r in range((int(N/R)+1)):
    
    for g in range((int(N/G)+1)):
        
        if r*R+g*G > N:
            continue
            
        temp = N - r*R-g*G
            
        if temp%B ==0:
            cnt+=1
    
print(cnt)
Problem p03730 (python)

Fixed submission:
A,B,C = map(int,input().split())

flg=False


for i in range(10**6):
    
    temp = A*i
    
    if temp%B==C:
        flg=True
        break
        
        
if flg==True:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):

flg=False


for i in range(10**6):
    
    temp = A*i
    
    if temp%B==C:
        flg=True
        break
        
        
if flg==True:
    print("Yes")
else:
    print("No")
Problem p02913 (python)

Fixed submission:
import math
MOD = pow(2,61) - 1
def charToNum(char):
    return ord(char) - 96

def check(string,subLen):
    if subLen == 0: return True
    #長さsubLenの部分文字列すべてについてローリングハッシュを計算して、
    #一致するものがあるかどうかを計算する。
    # setOfRollingHash = set()
    dictOfRollingHash = {}
    totalLen = len(string)
    h = 0
    b = 1
    for i in range(subLen):
        c = string[subLen - 1 - i]
        h += charToNum(c) * b
        b *= 27
        b %= MOD
    h %= MOD
    dictOfRollingHash[h] = 0
    maxBase = pow(27,subLen - 1,MOD) 
    for i in range(1,totalLen - subLen + 1):
        h -= maxBase * charToNum(string[i - 1])
        h *= 27
        h += charToNum(string[i + subLen - 1])
        h %= MOD
        if h in dictOfRollingHash:
            if i - dictOfRollingHash[h] >= subLen:
                return True
        else:
            dictOfRollingHash[h] = i
    return False

N = int(input())
S = input()
ok = 0
ng = N + 1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if check(S,mid):
        ok = mid
    else:
        ng = mid
print(ok)

Buggy submission (verdict: Runtime Error):
import math
def charToNum(char):
    return ord(char) - 96

def check(string,subLen):
    if subLen == 0: return True
    #長さsubLenの部分文字列すべてについてローリングハッシュを計算して、
    #一致するものがあるかどうかを計算する。
    # setOfRollingHash = set()
    dictOfRollingHash = {}
    totalLen = len(string)
    h = 0
    b = 1
    for i in range(subLen):
        c = string[subLen - 1 - i]
        h += charToNum(c) * b
        b *= 27
    dictOfRollingHash[h] = 0
    maxBase = math.pow(27,subLen - 1)
    for i in range(1,totalLen - subLen + 1):
        h -= maxBase * charToNum(string[i - 1])
        h *= 27
        h += charToNum(string[i + subLen - 1])
        if h in dictOfRollingHash:
            if i - dictOfRollingHash[h] >= subLen:
                return True
        else:
            dictOfRollingHash[h] = i
    return False

N = int(input())
S = input()
ok = 0
ng = N + 1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if check(S,mid):
        ok = mid
    else:
        ng = mid
print(ok)
Problem p03078 (python)

Fixed submission:
import heapq
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

i=j=k=0
HQ = []
heapq.heapify(HQ)
heapq.heappush(HQ,(-(A[i]+B[j]+C[k]),(i,j,k)))
alreadyAdded = set()
alreadyAdded.add((i,j,k))
for _ in range(K):
    valueNeg,index = heapq.heappop(HQ)
    print(-valueNeg)
    l,m,n = index
    nextIndex = []
    if l+1 < X:
        nextIndex.append((l+1,m,n))
    if m+1 < Y:
        nextIndex.append((l,m+1,n))
    if n+1 < Z:
        nextIndex.append((l,m,n+1))
    for l,m,n in nextIndex:
        if (l,m,n) not in alreadyAdded:
            heapq.heappush(HQ,(-(A[l]+B[m]+C[n]),(l,m,n)))
            alreadyAdded.add((l,m,n))

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
i = 0
j = 0
k = 0
while i+j+k < min(3000,X*Y*Z):
  ans = A[i]+B[j]+C[k]
  deltaA = 10**16
  deltaB = 10**16
  deltaC = 10**16
  if i+j+k == min(3000,X*Y*Z)-1:
    break
  if i+1<X:
    deltaA=A[i]-A[i+1]
  if j+1<Y:
    deltaB=B[j]-B[j+1]
  if k+1<Z:
    deltaC=C[k]-C[k+1]
  L = 10**16
  index = -1
  w = [deltaA,deltaB,deltaC]
  for mm in range(3):
    if w[i] < L:
      L = w[mm]
      index = mm
  if index==0:
    i+=1
  elif index==1:
    j+=1
  else:
    k+=1
I=i+1
J=j+1
M=k+1
answers =[]
for i in range(I):
  for j in range(J):
    for k in range(M):
      answers.append(A[i]+B[j]+C[k])
answers.sort(reverse=True)
for i in range(min(3000,X*Y*Z)):
  print(answers[i])
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
c=100
d=0
while d<k:
  if a%c==0 and b%c==0:
    d+=1
  c-=1
print(c+1)

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
c=100,d=0
while d<k:
  if a%c==0 and b%c==0:
    d+=1
  c-=1
print(c+1)
Problem p03262 (python)

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

def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return(x)
    

xs[0] -= X
g = xs[0]
import math
for i in range(1,N):
    xs[i] -= X
    g = gcd(g,xs[i])
print(abs(g))

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
x = list(map(int,input().split()))
for i in range(N):
  x[i] -= X
import fractions
g = fractions.gcd(x[0],x[1])
for i in range(2,N):
  g = fractions.gcd(g,x[i])
print(g)

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

xs[0] -= X
g = xs[0]
import math
for i in range(1,N):
    xs[i] -= X
    g = math.gcd(g,xs[i])
print(g)
Problem p03308 (python)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
mini=maxi=a[0]
for i in range(1,N):
  mini=min(mini,a[i])
  maxi=max(maxi,a[i])
print(maxi-mini)

Buggy submission (verdict: Runtime Error):
N=input()
a=list(map(int,input().split()))
mini=maxi=a[0]
for i in range(1,N):
  mini=min(mini,a[i])
  maxi=max(maxi,a[i])
print(maxi-mini)
Problem p03548 (python)

Fixed submission:
X,Y,Z = map(int,input().split(" "))
ans = (X-Z)//(Y+Z)
print(ans)

Buggy submission (verdict: Runtime Error):
X,Y,Z = map(int,input.split(" "))
ans = (X-Z)//(Y+Z)
print(ans)
Problem p03599 (python)

Fixed submission:
A,B,C,D,E,F=map(int,input().split())
#100*A*i + 200*B*j == x
#C*i + D*j == y
xs = []
ys = []
def dens(x,y):
    if x+y==0:
        return(-1)
    else:
        return(y/(x+y))
for i in range(31):
    for j in range(16):
        if 100*A*i + 200*B*j <= F:
            xs.append(100*A*i + 200*B*j)
for i in range(3001):
    for j in range(1501):
        if C*i + D*j <= F:
            ys.append(C*i + D*j)
density = 0
water = 100*A
sugar = 0
for x in xs:
    for y in ys:
        if x+y > F or 100*y > E*x:
            continue
        nd = dens(x,y)
        if nd > density:
            density = nd
            sugar = y
            water = x
print(str(water+sugar) + " " + str(sugar))

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())
#100*A*i + 200*B*j == x
#C*i + D*j == y
xs = []
ys = []
def dens(x,y):
    if x+y==0:
        return(-1)
    else:
        return(y/(x+y))
for i in range(31):
    for j in range(16):
        if 100*A*i + 200*B*j <= F:
            xs.append(100*A*i + 200*B*j)
for i in range(3001):
    for j in range(1501):
        if C*i + D*j <= F:
            ys.append(C*i + D*j)
density = 0
for x in xs:
    for y in ys:
        if x+y > F or 100*y > E*x:
            continue
        nd = dens(x,y)
        if nd > density:
            density = nd
            sugar = y
            water = x
            #print([sugar,water,density])
print(str(water+sugar) + " " + str(sugar))
Problem p03854 (python)

Fixed submission:
S = input()
# S.reverse()
S = S[::-1]
#dream, dreamer, erase, eraser
headers = ["resare","esare","remaerd","maerd"]

result = True
while True:
    if S=="":
        result = True
        break
    result = False
    for header in headers:
        if S.startswith(header):
            S = S[len(header):]
            result = True
    if not result:
        break

if result:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
S = input()
# S.reverse()
S = S[::-1]
#dream, dreamer, erase, eraser
headers = ["resare","esare","remaerd","maerd"]

def solve(str):
    if str == "":
        return(True)
    else:
        for header in headers:
            if str.startswith(header):
                return(solve(str[len(header):]))
        return(False)

if solve(S):
    print('YES')
else:
    print('NO')
Problem p02553 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
if(a<=0 and b>=0 or (c<=0 and d>=0)):
  print(max(a*c,b*d,a*d,b*c,0))
else:
  print(max(a*c,b*d,a*d,b*c))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
if(b<=0 and d<=0):
  print(a*c)
elif(b<0 or d<0):
  if(((a<0 and b>0) or (c<0 and d>0))):
    print(0)
  elif(a>0 and b>0):
    print(d*a)
  elif(c>0 and d>0):
    print(b*ChildProcessError)
else:
  print(b*d)
Problem p02613 (python)

Fixed submission:
n=int(input())
list_judge=[]
for i in range (n):
  list_judge.append(str(input()))

acnum=list_judge.count("AC")
wanum=list_judge.count("WA")
tlenum=list_judge.count("TLE")
renum=list_judge.count("RE")

print("AC x ",acnum)
print("WA x ",wanum)
print("TLE x ",tlenum)
print("RE x ",renum)

Buggy submission (verdict: Runtime Error):
n=int(input())
list_judge=[]
for i in range (n):
  list_judge.append(str(input()))

print("AC x ",acnum=list_judge.count("AC"))
print("WA x ",wanum=list_judge.count("WA"))
print("TLE x ",tlenum=list_judge.count("TLE"))
print("RE x ",renum=list_judge.count("RE"))
Problem p02791 (python)

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

ans = 0
m_P = P[0]
for i in range(N):
  if P[i] <= m_P:
    ans += 1
    m_P = P[i]
print(ans)

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

ans = 1
for i in range(1,N):
  pi = p[i]
  pm = min(P[:i])
  if pi <= pm:
    ans +=1

print(ans)
Problem p03000 (python)

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

ans = 0
D = 0
for i in range(N + 1):
  if i == 0:
    ans += 1
  else:
    D += L[i - 1]
    if D <= X:
      ans += 1
    else:
      break

print(ans)

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

ans = 0
D = 0
for i in range(N + 1):
  if D <= X:
    D += L[i]
    ans += 1
  else:
    break

print(ans)
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())
print([i for i in range(1,101) if a%i+b%i<1][-k])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
x = []
if A >= B:
    for i in range(1,A):
        if A % i == 0 and B % i == 0:
            x.append(i)
else:
    for i in range(1,B):
        if A % i == 0 and B % i == 0:
            x.append(i)

print(x[K-1])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
x = []
if A >= B:
    for i in range(1,A):
        if A % i == 0 and B % i == 0:
            x.append(i)
else:
    for i in range(1,B):
        if A % i == 0 and B % i == 0:
            x.append(i)
x.sort(reverse=True)
print(x[K - 1])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
x = []
if A >= B:
  for i in range(1,A):
    if A % i == 0 and B % i == 0:
      x.append(i)
else:
  for i in range(1,B):
    if A % i == 0 and B % i == 0:
      x.append(i)
x.sort(reverse=True)
print(x[K - 1])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
x = []
if A >= B:
  for i in range(1,A):
    if A % i == 0 and B % i == 0:
      x.append(i)
else:
  for i in range(1,B):
    if A % i == 0 and B % i == 0:
      x.append(i)
print(x[K - 1])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
x = []
if A >= B:
  for i in range(1,A):
    if A % i == 0 and B % i == 0:
      x.append(i)
else:
  for i in range(1,B):
    if A % i == 0 and B % i == 0:
      x.append(i)
print(x[-K])