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

Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)

Buggy submission (verdict: Runtime Error):

from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
ans = max([P[i+k]-P[i] for i in range(n-k)])
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k = list(map(int,input().split()))
p = np.array(list(map(int,input().split())))

P = 0
for i in range(n-k):
  if P < p[i:i+k].sum():
    P = p[i:i+k].sum()
    mp = p[i:i+4]

ans = 0
for i in mp:
  if i%2 == 0:
    ans += ((i+1) * i//2)/i
  else:
    ans += ((i+1) * (i//2) + (i//2) + 1)/i
print(ans)
Problem p02901 (python)

Fixed submission:
import itertools

N,M = map(int, input().split())
A = []
C = []
comp = sum(1<<int(x) for x in range(N))
for m in range(M):
  a, b = map(int, input().split())
  A.append(a)
  c = list(map(int, input().split()))
  C.append(sum(1<<(int(x)-1) for x in c))

INF = 10**18
dp = [INF] * (1<<N)
dp[0] = 0

for n,(a,c) in itertools.product(range(1<<N),zip(A,C)):
    m = n|c
    x = dp[n]+a
    if dp[m] > x:
      dp[m] = x

answer = dp[-1]
if answer == INF:
    answer = -1
print(answer)

Buggy submission (verdict: Runtime Error):
import itertools

N,M = map(int, input().split())
A = []
comp = sum(10**(x-1) for x in range(1,N+1))
for m in range(M):
  a, b = map(int, input().split())
  c = list(map(int, input().split()))
  box = sum(10**(x-1) for x in c)
  A.append([box, a])

  for i in range(0,len(A)-1):
    A.append([A[0|i][0] + A[m][0], 
              A[0|i][1] + A[m][1]])

ans = min([A[x][1] for x in range(len(A))
           if A[x][0] >= comp] )

print(ans)
Problem p02902 (python)

Fixed submission:
def main():
  from collections import deque
  n,m,*t=map(int,open(0).read().split())
  i=[0]*n
  o=[[]for _ in range(n)]
  for a,b in zip(*[iter(t)]*2):
    o[a-1]+=b-1,
    i[b-1]+=1
  q=deque(v for v,f in enumerate(i)if f<1)
  r=[]
  while q:
    v=q.popleft()
    r+=v,
    for w in o[v]:
      i[w]-=1
      if i[w]==0:q+=w,
  print(-(len(r)==n))
main()

Buggy submission (verdict: Runtime Error):
import itertools
N,M = map(int,input().split())
A = []
X = [[0]]*M

for m in range(M):
  a,b = map(int,input().split())
  A.append([a,b])
  X[m] = X[m] + [a] + [b]


ans = []
XX = []
for _ in range(N-1):
  for x,v in itertools.product(X,A):   
    if x[-1] == v[0]:
      if v[1] in x:
        ans.append(x+[v[1]])
      else:
        XX.append(x + [v[1]])
    X = XX

if ans == []:
  print(-1)
else:
  n = m+2
  for a in ans:
    if n > len(a):
      n = len(a)
      ans_min = a[:-1]
  ans_min[0] = len(ans_min)-1
  print(*ans_min)

Buggy submission (verdict: Runtime Error):
import itertools
N,M = map(int,input().split())
A = []
X = [[0]]*M

for m in range(M):
  a,b = map(int,input().split())
  A.append([a,b])
  X[m] = X[m] + [a] + [b]


ans = []
XX = []
for _ in range(N-1):
  for x,v in itertools.product(X,A):   
    if x[-1] == v[0]:
      if v[1] in x:
        ans.append(x+[v[1]])
      else:
        XX.append(x + [v[1]])
    X = XX

if ans == []:
  print(-1)
else:
  n = m+2
  for a in ans:
    if n > len(a):
      n = len(a)
      ans_min = a[:-1]
  ans_min[0] = len(ans_min)-1
  print(ans_min)

Buggy submission (verdict: Runtime Error):
import itertools
N,M = map(int,input().split())
A = []
X = [[0]]*M

for m in range(M):
  a,b = map(int,input().split())
  A.append([a,b])
  X[m] = X[m] + [a] + [b]

ans = []
for m,v in itertools.product(range(M),A):
    if X[m][-1] == v[0]:
      if v[1] in X[m]:
        ans.append(X[m])
      else:
        X[m] = X[m] + [v[1]]

if ans == []:
  print(-1)
else:
  n = m+2
  for a in ans:
    if n > len(a):
      ans_min = a
  ans_min[0] = len(ans_min)-1
  print(ans_min)
Problem p03290 (python)

Fixed submission:
from collections import deque
import itertools, math
d,g = list(map(int,input().split()))
pc = [list(map(int,input().split())) for _ in range(d)]
g /= 100

#ans = sum([pc[x][0] for x in range(d)])
ans = float('inf')
for bit in range(1<<d):
  cnt = 0
  point = 0
  pat = set(range(1,d+1))
  
  for i in range(d):
    if bit & (1<<i):
      point += pc[i][0]*(i+1) + pc[i][1]//100
      cnt += pc[i][0]
      pat.discard(i+1)
  
  if point < g:
      next = max(pat)
      n = min(pc[next-1][0], math.ceil((g - point)/(next)))
      cnt += n
      point += n*(next)
    
  if point >= g:
      #print(ans,cnt)
      ans = min(ans,cnt)


print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
import itertools
d,g = list(map(int,input().split()))
pc = [list(map(int,input().split())) for _ in range(d)]
g /= 100

pat = list(itertools.permutations(range(d)))
ans = sum([[x,y] for x,y in zip(pc[0], pc[1])][0])

def dfs(k, point, cnt, pat):
  global ans
  i = pat[k]
  
  for j in range(pc[i][0]):
      point += (i+1)
      cnt += 1
      if j == pc[i][0]-1:
        point += pc[i][1]//100
      
      if point >= g:
        ans = min(ans, cnt)
        point = 0
        cnt = 0
        break
    
  if k < d-1:
    dfs(k+1, point, cnt, pat)

for p in pat:
  dfs(0, 0, 0, list(p))

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
import itertools
d,g = list(map(int,input().split()))
pc = [list(map(int,input().split())) for _ in range(d)]
g /= 100

pat = list(itertools.permutations(range(1,d+1)))
ans = sum([[x,y] for x,y in zip(pc[0], pc[1])][0])

def dfs(k, point, cnt, pat):
  global ans
  i = pat[k]
  for j in range(pc[i-1][0]):
    point += i
    cnt += 1
    if j == pc[i-1][0]-1:
      point += pc[i-1][1]/100
    #print(i,j,point,cnt)
    if point >= g:
      ans = min(ans, cnt)
      point = 0
      cnt = 0
      break
  
  if k < d-1:
    dfs(k+1, point, cnt, pat)
    
for p in pat:
  #print(p)
  dfs(0,0,0,list(p))

print(ans)
Problem p03409 (python)

Fixed submission:
n = int(input())
AB = [list(map(int,input().split())) for _ in range(n)]
CD = [list(map(int,input().split())) for _ in range(n)]

que = [[] for _ in range(n)]
for i in range(n):
  for j in range(n):
    if AB[i][0] < CD[j][0] and AB[i][1] < CD[j][1]:
      que[j].append(i)

def dfs(i,v):
  
  for a in que[i]:
    if a in v:
      continue
    v.add(a)
    if ab[a] == -1 or dfs(ab[a], v):
      ab[a] = i
      return True
  return False
      
v = [set() for _ in range(n)]   
ab = [-1]*n

print(sum(dfs(i, set()) for i in range(n)))

Buggy submission (verdict: Runtime Error):

n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]
cd = [list(map(int,input().split())) for _ in range(n)]

ab.sort()
cd.sort()

abf = [0]*n
cdf = [0]*n
que = [[] for _ in range(n)]
for i in range(n):
  for j in range(n):
    if ab[j][0] < cd[i][0] and ab[j][1] < cd[i][1] and \
        abf[j] == 0 and cdf[i] == 0:
      que[i].append(j)

qn = []
for i in range(n):
  qn.append([i,len(que[i])])
qn.sort()
print(qn)
while len(qn) > 0:
  for i in range(len(qn)):
    for idx in que[qn[i][0]]:
      print(idx)
      if abf[idx] == 0:
        abf[idx] = 1
        qn.pop(i)
  
print(sum(abf))
Problem p03565 (python)

Fixed submission:
s = input()
t = input()

if len(s) < len(t):
    print('UNRESTORABLE')
    exit()

s = [x for x in s[::-1]]
t = [x for x in t[::-1]]    

for i in range(len(s)-len(t)+1):
  flg = False
  cnt = 0
  for j in range(len(t)):
    if s[i+j] == '?':
      cnt += 1
      continue
    if s[i+j] == t[j]:
      flg = True
    else:
      flg = False
      break
  if flg or cnt == len(t):
    s[i:i+len(t)] = t
    flg = True
    break

if not flg:
    print('UNRESTORABLE')
    exit()

ans = ''
s = [x for x in s[::-1]]
for i in range(len(s)):
  if s[i] == '?':
    s[i] = 'a'
  ans += s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

s = [x for x in s[::-1]]
t = [x for x in t[::-1]]    

for i in range(len(s)-len(t)):
  flg = False
  cnt = 0
  for j in range(len(t)):
    if s[i+j] == '?':
      cnt += 1
      continue
    if s[i+j] == t[j]:
      flg = True
    else:
      flg = False
      break
  if flg or cnt == len(t):
    s[i:i+len(t)] = t
    flg = True
    break

if not flg:
    print('UNRESTORABLE')
    exit()

ans = ''
s = [x for x in s[::-1]]
for i in range(len(s)):
  if s[i] == '?':
    s[i] = 'a'
  ans += s[i]
print(ans)
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
As = list(map(int, input().split()))
As = [A-1 for A in As]
Vs = [False]*N
p = 0
Rs = [p]
Vs[p] = True
for i in range(N+3):
  n = As[p]
  Rs.append(n)
  if Vs[n]:
    break
  p = n
  Vs[p] = True
p0 = Rs.index(Rs[-1])
#print(Rs, p0)
if K <= p0:
  r = Rs[K]
else:
  r = Rs[p0+(K-p0)%(len(Rs)-p0-1)]
print(r+1)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
As = list(map(int, input().split()))
As = [A-1 for A in As]
Vs = [-1]*N
p = 0
p0 = -1
Rs = [p]
Vs[p] = p
for i in range(N):
  n = As[p]
  Rs.append(n)
  if not Vs[n] < 0:
    p0 = Vs[n]
    break
  p = n
  Vs[p] = p
#print(Rs, p0)
if K <= p0:
  r = Rs[K]
else:
  r = Rs[p0+(K-p0)%(len(Rs)-p0+1)]
print(r+1)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
As = list(map(int, input().split()))
As = [A-1 for A in As]
Vs = [-1]*N
p = 0
p0 = -1
Rs = [p]
Vs[p] = p
for i in range(N):
  n = As[p]
  Rs.append(n)
  if not Vs[n] < 0:
    p0 = Vs[n]
    break
  p = n
  Vs[p] = p
#print(Rs, p0)
if K <= p0:
  r = Rs[K]
else:
  r = Rs[p0+1+(K-p0)%(len(Rs)-p0)]
print(r+1)
Problem p02687 (python)

Fixed submission:
S = input()
if S == "ABC":
  print("ARC")
if S == "ARC":
  print("ABC")

Buggy submission (verdict: Runtime Error):
S = input()
if S = "ABC":
  print("ARC")
if S = "ARC":
  print("ABC")
Problem p02846 (python)

Fixed submission:
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
sA = T1*A1+T2*A2
sB = T1*B1+T2*B2
if sA == sB:
  print("infinity")
  exit()
hA = T1*A1
hB = T1*B1
if sA > sB:
  hA, sA, hB, sB = hB, sB, hA, sA
#print(hA, sA, hB, sB)
if hA < hB:
  print(0)
  exit()
if (hA-hB)%(sB-sA) == 0:
  r = 2*((hA-hB)//(sB-sA))
else:
  r = 2*((hA-hB)//(sB-sA))+1
print(r)

Buggy submission (verdict: Runtime Error):
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
sA = T1*A1+T2*A2
sB = T1*B1+T2*B2
if sA == sB:
  print("infinity")
hA = T1*A1
hB = T1*B1
if sA > sB:
  hA, sA, hB, sB = hB, sB, hA, sA
#print(hA, sA, hB, sB)
if hA < hB:
  print(0)
n = 2*((hA-hB)//(sB-sA))+1
print(n)
Problem p03086 (python)

Fixed submission:
S = input()
r = 0
L = []
for c in S:
  if c == "A" or c == "C" or c == "G" or c == "T":
    r += 1
  else:
    L.append(r)
    r = 0
L.append(r)
print(max(L))

Buggy submission (verdict: Runtime Error):
S = input()
r = 0
L = []
for c in S:
  if c == "A" or c == "C" or c == "G" or c == "T":
    r += 1
  else:
    L.append(r)
    r = 0
print(max(L))
Problem p03447 (python)

Fixed submission:
X = int(input())
A = int(input())
B = int(input())
r = X-A
r -= r//B*B
print(r)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
r = 0;
for a in range(0, A + 1):
    for b in range(0, B + 1):
        for c in range(0, C + 1):
            if (500 * a + 100 * b + 50 * c == X):
                r += 1
print(r)
Problem p03477 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
L = A+B
R = C+D
if L > R:
  print("Left")
if L == R:
  print("Balanced")
if L < R:
  print("Right")

Buggy submission (verdict: Runtime Error):
N, A, B = [int(s) for s in input().split()]
r = 0;
def sumdig(n):
    r = 0;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    d = n % 10;
    r += d;
    n = (n - d) / 10;
    return r;
for n in range(1, N + 1):
    s = sumdig(n)
    if (s >= A and s <= B):
        r += n;
print(r)
Problem p03911 (python)

Fixed submission:
N, M = map(int, input().split())
L = []
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
#print(L)
UF = list(range(N+M))
def par(m):
  s = []
  r = UF[m]
  while r != m:
    s.append(m)
    m = r
    r = UF[m]
  for i in s:
    UF[i] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
    unite(N+l, i)
#print(UF)
#for i in range(N+M):
#  p = par(i)
#print(UF)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = []
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
#print(L)
UF = list(range(N+M))
def par(m):
  if UF[m] == m:
    return m
  r = par(UF[m])
  UF[m] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
for i in range(N+M):
  p = par(i)
#print(UF)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = []
S = [[] for i in range(M)]
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
  for l in Ls:
    S[l].append(i)
#print(L)
#print(S)
UF = list(range(N+M))
def par(m):
  if UF[m] == m:
    return m
  r = par(UF[m])
  UF[m] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")
Problem p04014 (python)

Fixed submission:
n = int(input())
s = int(input())
def sub(n, b):
  r = 0
  while n > 0:
    r += n%b
    n = n//b
  return r
if s > n:
  print(-1)
  exit()
if s == n:
  b = n+1
  print(b)
  exit()
for b in range(2, n+1):
  if b*b > n:
    break
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
bs = []
for p in range(1, n+1):
  if p*p > n:
    break
  if (n-s)%p == 0:
    b = (n-s)//p+1
    bs.append(b)
bs.sort()
for b in bs:
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = int(input())
def sub(n, b):
  r = 0
  while n > 0:
    r += n%b
    n = n//b
  return r
if s == n:
  b = n+1
  print(b)
  exit()
for b in range(2, n+1):
  if b*b > n:
    break
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
bs = []
for p in range(1, n+1):
  if p*p > n:
    break
  if (n-s)%p == 0:
    b = (n-s)//p+1
    bs.append(b)
bs.sort()
for b in bs:
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = int(input())
def sub(n, b):
  r = 0
  while n > 0:
    r += n%b
    n = n//b
  return r
if s == n:
  b = n+1
  print(b)
  exit()
for b in range(2, n+1):
  if b*b > n:
    break
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
bs = []
for p in range(1, n+1):
  if p*p > n:
    break
  b = (n-s)//p+1
  bs.append(b)
bs.sort()
for b in bs:
  s2 = sub(n, b)
  if s2 == s:
    print(b)
    exit()
print(-1)
Problem p02675 (python)

Fixed submission:
N = int(input())

N = N % 10

if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
  print("hon")
  
elif N == 0 or N == 1 or N == 6 or N == 8:
  print("pon")
  
else:
  print("bon")

Buggy submission (verdict: Runtime Error):
N = input()

N = N % 10

if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
  print("hon")
  
elif N == 0 or N == 1 or N == 6 or N == 8:
  print("pon")
  
else:
  print("bon")
Problem p02612 (python)

Fixed submission:
money = int(input())

rem = money % 1000

oturi = 0
if rem != 0:
  oturi = 1000 - rem

print(oturi)

Buggy submission (verdict: Runtime Error):
money = input()

oturi = 1000 - money % 1000

print(oturi)
Problem p02983 (python)

Fixed submission:
l,r=map(int,input().split())
if r-l+1<=2019:
	modlist=[]
	lst=list(range(l,r+1))
	for i in range(len(lst)):
		for j in range(i+1,len(lst)):
			q,mod = divmod(lst[i]*lst[j],2019)
			modlist.append(mod)
	print(min(modlist))
else:
	print(0)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
lst=list(range(l,r+1))
modlist=[]
for i in lst:
	q,mod = divmod(i,2019)
	modlist.append(mod)
sor = sorted(modlist)
print(sor[0]*sor[1])
Problem p02995 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
e = gcd(c,d)
f = c * d // e

b_c = b // c
s_c = (a-1) // c
C = b_c - s_c

b_d = b // d
s_d = (a-1) // d
D = b_d - s_d

b_cd = b // f
s_cd = (a-1) // f
CD = b_cd - s_cd

ans = b - a + 1 - (C + D - CD)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D = map(int,input().split())
n = B//C
m = (A-1)//C
p = B//D
q = (A-1)//D

x = B//(C*D// math.gcd(C,D))
y = (A-1)//(C*D// math.gcd(C,D))
L = (B-A+1)-((n-m)+(p-q)-(x-y))
print(L)

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
import math

n = B//C
m = (A-1)//C
p = B//D
q = (A-1)//D
x = B//(C*D// math.gcd(C,D))
y = (A-1)//(C*D// math.gcd(C,D))
L = (B-A+1)-((n-m)+(p-q)-(x-y))
print(L)
Problem p03005 (python)

Fixed submission:
a,b=map(int,input().split())
c=a-b
if b!= 1:
	print(c)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=a-b
if k != 1:
	print(c)
else:
	print(0)
Problem p03023 (python)

Fixed submission:
n = int(input())
x = (n-2)*180
print(x)

Buggy submission (verdict: Runtime Error):
n = input()
x = (n-2)*180
print(x)
Problem p03160 (python)

Fixed submission:

def chmin(a,b):
	if a >= b :
		a = b
		return a
	else:
		return a

n = int(input())
h = list(map(int,input().split()))
dp = [-1]*(n+1)
dp[1] = 0
dp[2] = abs(h[1]-h[0])

for i in range(1,n-1):
	dp[i+2] = chmin(
		dp[i+1]+abs(h[i+1]-h[i])
		,dp[i]+abs(h[i+1]-h[i-1]))

print(dp[n])

Buggy submission (verdict: Runtime Error):

def chmin(a,b):
	if a >= b :
		a = b
		return a
	else:
		return a

n = int(input())
h = list(map(int,input().split()))
dp = [-1]*(n+1)
dp[1] = 0
dp[2] = abs(h[1]-h[0])

for i in range(1,n-1):
	dp[i+2] = my_function.chmin(
		dp[i+1]+abs(h[i+1]-h[i])
		,dp[i]+abs(h[i+1]-h[i-1]))

print(dp[n])

Buggy submission (verdict: Runtime Error):
from my_func import my_function

def chmin(a,b):
	if a >= b :
		a = b
		return a
	else:
		return a

n = int(input())
h = list(map(int,input().split()))
dp = [-1]*(n+1)
dp[1] = 0
dp[2] = abs(h[1]-h[0])

for i in range(1,n-1):
	dp[i+2] = my_function.chmin(
		dp[i+1]+abs(h[i+1]-h[i])
		,dp[i]+abs(h[i+1]-h[i-1]))

print(dp[n])
Problem p03844 (python)

Fixed submission:
a,b,c = input().split()
if b == "+":
	print(int(a)+int(c))
else:
	print(int(a)-int(c))

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
if b == "+":
	print(int(a)+int(b))
else:
	print(int(a)-int(b))
Problem p03852 (python)

Fixed submission:
c = input()
lst = ["a","e","i","o","u"]
if c in lst:
	print("vowel")
else:
	print("consonant")

Buggy submission (verdict: Runtime Error):
c = input()
lst = [a,e,i,o,u]
if c in lst:
	print("vowel")
else:
	print("consonant")
Problem p04043 (python)

Fixed submission:
s=list(map(int,input().split()))
if s == [5,5,7] or s == [7,5,5] or s == [5,7,5]: 
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a,b,c == 5,5,7 
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a,b,c == 5,5,7 or a,b,c == 7,5,5 or a,b,c == 5,7,5:
	print("YES")
else:
	print("NO")
Problem p03284 (python)

Fixed submission:
n,k = map(int, input().split())
if n%k == 0:
    print("0")
else: 
       print("1")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 7 == 0 or n % 4 == 0:
   print("Yes")
elif (n % 28) % 4 == 0 or (n % 28) % 7 == 0:
   print("Yes")
else:
   print("No")
Problem p02971 (python)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

max_val = max(A)
count = A.count(max_val)

subset = list(set(A))
if len(subset) > 1:
  subset.remove(max_val)
  max_val_2 = max(subset)

for i, num in enumerate(A):
  if num < max_val:
    print(max_val)
  else:
    if count > 1:
      print(max_val)
    else:
      print(max_val_2)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]

max_val = max(A)
subset = list(set(A))
subset.remove(max_val)
max_val_2 = max(subset)
count = A.count(max_val)

for i, num in enumerate(A):
  if num < max_val:
    print(max_val)
  else:
    if count > 1:
      print(max_val)
    else:
      print(max_val_2)
Problem p02614 (python)

Fixed submission:
import numpy as np
H, W, K = map(int, input().split())
state = np.zeros((H, W), dtype=int)
for h in range(H):
  hlist = input()
  for w in range(W):
    if hlist[w] == "#":
      state[h][w]=1

startb = np.sum(state)
count = 0

if startb < K:
  print(0)
else:
  h_l = 2**H
  w_l = 2**W
  for h in range(h_l):
    for w in range(w_l):
      t1 = [int(i) for i in list(str(bin(h))[2:])]
      t2 = np.zeros(H-len(t1), dtype=int)
      wflag = np.append(t2, t1)
      state_t = state * np.array([wflag]*W).T

      t1 = [int(i) for i in list(str(bin(w))[2:])]
      t2 = np.zeros(W-len(t1), dtype=int)
      hflag = np.append(t2, t1)
      state_t = state_t * np.array([hflag]*H)

      if np.sum(state_t)==K:
        count=count+1
  print(count)

Buggy submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
state = np.zeros((H, W), dtype=int)
for h in range(H):
  hlist = input()
  for w in range(W):
    if hlist[w] == "#":
      state[h][w]=1

startb = np.sum(state)
count = 0

if startb < K:
  print(0)
else:
  h_l = 2**H
  w_l = 2**W
  for h in range(h_l):
    for w in range(w_l):
      t1 = [int(i) for i in list(str(bin(h))[2:])]
      t2 = np.zeros(H-len(t1), dtype=int)
      wflag = np.append(t2, t1)
      state_t = state * np.array([wflag]*W).T

      t1 = [int(i) for i in list(str(bin(w))[2:])]
      t2 = np.zeros(W-len(t1), dtype=int)
      hflag = np.append(t2, t1)
      state_t = state_t * np.array([hflag]*H)

      if np.sum(state_t)==K:
        count=count+1
  print(count)
Problem p02628 (python)

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
print(sum(a[:k]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
print(sum(p[:k]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = map(int,input().split())
a.sort()
print(sum(p[:k]))

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
a = [int(input()) for i in range(n)]
a.sort()
print(sum(a[:k]))

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
a = [int(input()) for i in range(n)]
a.sort()
print(sum(a[:k]))

Buggy submission (verdict: Runtime Error):
n=input()
k=input()
a = [int(input()) for i in range(int(n))]
a.sort()
print(sum(a[:int(k)]))
Problem p02811 (python)

Fixed submission:
k,x = map(int,input().split())
print("Yes" if 500*k>=x else "No")

Buggy submission (verdict: Runtime Error):
k,x = map(int,input().split)
print("Yes" if 500*k>=x else "No")
Problem p02621 (python)

Fixed submission:
num = int(input())
 
answer = num + num * num + num * num * num
 
print(answer)

Buggy submission (verdict: Runtime Error):
num = input()
 
answer = num + num * num + num * num * num

print(answer)

Buggy submission (verdict: Runtime Error):
num = input()

answer = num + num * num + num * num * num