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

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

ans = 1

import sys

if 0 in A:
  print(0)
  sys.exit()
  
for a in A:
  ans *= a
  if ans > pow(10, 18):
      print(-1)
      sys.exit()

print(ans)

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

ans = 1

import sys

if 0 in A:
  print(0)
  sys.exit()
  

for a in A:
  ans *= a
	if ans > pow(10, 18):
  	print(-1)
  	sys.exit()

print(ans)
Problem p02683 (python)

Fixed submission:
N, M, X = map(int, input().split())
C = [0] * N
A = []

for __ in range(N):
    nums = list(map(int, input().split()))
    C[__] = nums[0]
    A.append(nums[1:])

mincost = 10e9
ok = False
for i in range(1 << N):
    cost = 0
    skill = [0] * M

    for u in range(N):
        if i & (1<<u):
            cost += C[u]
            for si, s in enumerate(A[u]):
                skill[si] += s
    
    # check
    if all([s >= X for s in skill]):
        ok = True
        if mincost > cost:
            mincost = cost

print(mincost if ok else -1)

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

for __ in range(N):
    nums = list(map(int, input().split()))
    C[__] = nums[0]
    A.append(nums[1:])
mincost = 10e9
ok = False
for i in range(1 << N):
    cost = 0
    skill = [0] * M

    for u in range(N):
        if i & (1<<u):
            cost += C[u]
            for si, s in enumerate(A[u]):
                skill[si] += s
    
    # check
    if all([s >= X for s in skill]):
        ok = True
        if mincost > cost:
            mincost = cost

print(mincost if ok else -1)
 dp
Problem p02684 (python)

Fixed submission:
import sys

n, k = map(int, input().split())
ara = [0]
ara += list(map(int, input().split()))

now = 1
vis = []
taken = [0]*(n+1)

while taken[now] == 0:
    vis.append(now)
    taken[now] = 1
    now = ara[now]

cycleLen = len(vis) - vis.index(now)

if k < vis.index(now):
    print(vis[k])
    sys.exit()

k -= vis.index(now)
k %= cycleLen

print(vis[k + vis.index(now)])

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

mp = dict()
for ix in range(N):
    mp[ix+1] = A[ix]

hist = set()
cur = 1
cnt = 0

while True:
    cur = mp[cur]
    cnt += 1

    if cur in hist:
        break
    else:
        hist.add(cur)

cycle_sp = cur
cycle_l = 0

while True:
    cur = mp[cur]
    cycle_l += 1

    if cur == cycle_sp:
        cycle_l -= 1
        break

rest = (K-cnt) % cycle_l

while rest > 0:
    cur = mp[cur]
    rest -= 1

print(cur)
Problem p02690 (python)

Fixed submission:
X = int(input())
import sys
for a in range(-118, 120, 1):
    for b in range(-119, 119, 1):
        if X == pow(a,5) - pow(b,5):
            print(a, b)
            sys.exit()

Buggy submission (verdict: Runtime Error):
X = int(input())
import sys
for a in range(-118, 120, 1):
    for b in range(-119, 119, 1):
        if x == pow(a,5) - pow(b,5):
            print(x)
            sys.exit()
Problem p02705 (python)

Fixed submission:
r = int(input())
import math
print(2*r * math.pi)

Buggy submission (verdict: Runtime Error):
r = int(input())
import math
print(2*r * math.PI)

Buggy submission (verdict: Runtime Error):
r = int(input())
import math
print(r * math.PI)
Problem p02706 (python)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
         
t = sum(A)
if N < t:
  print(-1)
  exit(0)
else:
  print(N-t)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
         
t = sum(A)
if N < t:
  print(-1)
  exit(0)
else:
  print(N-A)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split())
         
t = sum(A)
if N < t:
  print(-1)
else:
  print(N-A)

Buggy submission (verdict: Runtime Error):
r = int(input())
import math
print(2*r * math.pi)
Problem p02748 (python)

Fixed submission:
A, B, M = map(int, input().split())
Frz = list(map(int, input().split()))
Mic = list(map(int, input().split()))
C = []

for _ in range(M):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    C.append((x,y,c))

minF = min(Frz)
minM = min(Mic)
ans = minF + minM

for x, y, z in C:
    tmp = Frz[x] + Mic[y] - z
    if tmp < ans:
        ans = tmp

print(ans)

Buggy submission (verdict: Runtime Error):
A, B, M = map(int, input().split())
F = list(map(int, input().split()))
M = list(map(int, input().split()))
C = []

for _ in range(M):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    C.append((x,y,c))

minF = min(F)
minM = min(M)
ans = minF + minM

for x, y, z in C:
    tmp = F[x] + F[y] - z
    if tmp < ans:
        ans = tmp

print(ans)
Problem p02760 (python)

Fixed submission:
import sys
bingo_size = 3
a = []
an = set()
for _ in range(3):
  a.append(list(map(int, input().split())))

n = int(input())
b = set()
for _ in range(n):
  bi = int(input())
  b.add(bi)

for hi in range(3):
  ok = True
  for _ in range(3):
    if a[hi][_] not in b:
      ok = False
      
  if ok:
    print("Yes")
    sys.exit()

for wi in range(3):
  ok = True
  for _ in range(3):
    if a[_][wi] not in b:
      ok = False
      
  if ok:
    print("Yes")
    sys.exit()

if all([a[0][0] in b, a[1][1] in b, a[2][2] in b]) or all([a[0][2] in b, a[1][1] in b, a[2][0] in b]):
           print("Yes")
           sys.exit()
           
print("No")

Buggy submission (verdict: Runtime Error):
import sys
bingo_size = 3
a = []
an = set()
for _ in range(3):
  a.append(list(map(int, input().split())))
  for i in a[_]:
    an.add(i)

n = int(input())
b = set()
for _ in range(n):
  bi = int(input())
  if bi in an:
    b.add(bi)

for hi in range(3):
  ok = True
  for _ in range(3):
    if a[hi][_] not in b:
      ok = false
      break
    if ok:
      print("Yes")
      sys.exit()

for wi in range(3):
  ok = True
  for _ in range(3):
    if a[_][wi] not in b:
      ok = False
      break
  if ok:
    print("Yes")
    sys.exit()

if all([a[0][0] in b, a[1][1] in b, a[2][2] in b]) or all([a[0][2] in b, a[1][1] in b, a[2][0] in b]):
           print("Yes")
           sys.exit()
           
print("No")

Buggy submission (verdict: Runtime Error):
import sys
bingo_size = 3
a = []
an = set()
for _ in range(3):
  a.append(list(map(int, input().split())))
  for i in a[_]:
    an.add(i)

n = int(input())
b = set()
for _ in range(n):
  bi = int(input())
  if bi in an:
    b.add(bi)

for hi in range(3):
  ok = True
  for _ in range(3):
    if a[hi][_] not in b:
      ok = false
      break
    if ok:
      print("Yes")

for wi in range(3):
  ok = True
  for _ in range(3):
    if a[_][wi] not in b:
      ok = false
      break
  if ok:
    print("Yes")

if all([a[0][0] in b, a[1][1] in b, a[2][2] in b]) or all([a[0][2] in b, a[1][1] in b, a[2][0] in b]):
           print("Yes")
           
print("No")
Problem p02796 (python)

Fixed submission:
N = int(input())
P = []

for _ in range(N):
    x, l = map(int,input().split())
    P.append((x - l, x+l))

P.sort(key=lambda x: x[1])

ans = 0
last = -1e9
for ix in range(0, N):
    if last <=  P[ix][0]:
        ans += 1
        last = P[ix][1]

print(ans)

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

diff = [0] * N
neg = []
pos = []
for i in range(N):
    diff[i] = A[i] - B[i]
    if diff[i] < 0:
        neg.append(diff[i])
    else:
        pos.append(diff[i])

if sum(diff) < 0:
    print(-1)
    exit(0)

tobe_supplied = sum(neg)
pos.sort(reverse=True)

cnt = len(neg)

for p in pos:
    if tobe_supplied >= 0:
        break
    cnt += 1
    tobe_supplied += p    

print(cnt)
Problem p02797 (python)

Fixed submission:
N, K, S=map(int, input().split())
A=[str(S)]*K
if S==10**9:
  B=["1"]*(N-K)
else:
  B=[str(S+1)]*(N-K)
ans=A+B
print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
N, K, S = map(int, input().split())
ans = []

for i in range(N):
    if i < K:
        ans.append(S)
    else:
        ans.append(S+1)

print(" ".join(ans))
Problem p02811 (python)

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

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
if 500*K >= X:
  print("Yes")
else;
  print("No")
Problem p02866 (python)

Fixed submission:
N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

if D[0] != 0:
    print(0)
    exit(0)

cd = Counter(D)
if cd[0] != 1:
    print(0)
    exit(0)

tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1


for kx in range(1, max(D)+1):
    ans *= pow(cd[kx-1], cd[kx],M)
    ans %= M

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

if D[0] != 0:
    print(0)
    exit(0)

cd = Counter(D)
if cd[0] != 1:
    print(0)
    exit(0)

tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1
# for kx in range(1, max(D)+1):
for kx in range(2, len(tmp)+1):
    __, p = tmp[kx-1]
    _, v = tmp[kx]
    # p = cd[kx-1]
    # v = cd[kx]
    # print("{}^{}".format(p, v))
    while v > 0:
        ans *= p
        ans %= M
        v -= 1
# print(cd)

# for kx in range(1, max(D)+1):
#     ans *= pow(cd[kx-1], cd[kx],M)
#     ans %= M

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

if D[0] != 0:
    print(0)
    exit(0)

cd = Counter(D)
if cd[0] != 1:
    print(0)
    exit(0)

tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1

import math
for kx in range(1, max(D)+1):
    ans *= math.pow(cd[kx-1], cd[kx],M)
    ans %= M

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))
M = 998244353
from collections import Counter

if D[0] != 0:
    print(0)
    exit(0)

if D[1:].index(0):
    print(0)
    exit(0)

cd = Counter(D)
tmp = sorted(cd.items(), key=lambda x: x[0])

ans = 1
# for kx in range(2, len(tmp)):
#     __, p = tmp[kx-1]
#     _, v = tmp[kx]
#     while v > 0:
#         ans *= p%M
#         v -= 1
# print(cd)
for kx in range(1, len(tmp)-1):
    _, p = tmp[kx]
    __, v = tmp[kx+1]
    # ans *= p**v%M
    while v > 0:
        ans *= p%M
        v -= 1

print(ans%M)
Problem p02888 (python)

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

import bisect

L.sort()
# print(L)

ans = 0
for i in range(0, N-1):
    for j in range(i+1, N-1):
        ix = bisect.bisect_left(L, L[i] + L[j])
        ans += max(0, ix - j - 1)

print(ans)

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

ans = 0
for aix in range(N):
    for bix in range(aix, N):
        for cix in range(cix, N):
            if L[aix] < L[bix] + L[cix] and L[bix] < L[aix] + L[cix] and L[cix] < L[aix] + L[bix]:
                ans += 1

print(ans)
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
rint(int(((N-1) * N)/2))

Buggy submission (verdict: Runtime Error):
print((N-1)/2 * N)
Problem p02975 (python)

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

import sys
from collections import Counter
d = Counter(A)

if d[0] == N:
    print("Yes")
    sys.exit()

if d[0] == N // 3:
    for x in d.keys():
        if d[x] == 2 * N // 3:
            print("Yes")
            sys.exit()

third = N // 3
if len(d.keys()) == 3:
    a, b, c = d.keys()
    if d[a] == d[b] and d[b] == d[c]:
        if a ^ b ^ c == 0:
            print("Yes")
            sys.exit()

print("No")

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

import sys
from collections import Counter
d = Counter(A)

if d[0] == N:
    print("Yes")
    sys.exit()

if d[0] == N // 3:
    for x in d.keys():
        if d[x] == 2 * N // 3:
            print("Yes")
            sys.exit()

third = N // 3
if len(d.keys() == 3):
    a, b, c = d.keys()
    if d[a] == d[b] and d[b] == d[c]:
        if a ^ b ^ c == 0:
            print("Yes")
            sys.exit()

"""
# O(N^3)
third = N // 3
# print(third)
cand = list(filter(lambda x: d[x] == third, A))
# print(cand)
for ix1 in range(len(cand)):
    for ix2 in range(ix1 + 1, len(cand)):
        for ix3 in range(ix2 + 1, len(cand)):
            if cand[ix1] ^ cand[ix2] ^ cand[ix3] == 0:
                print("Yes")
                sys.exit()
"""
print("No")
Problem p03006 (python)

Fixed submission:
N = int(input())

P = []
for _ in range(N):
    x, y = map(int, input().split())
    P.append((x, y))

from collections import defaultdict

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

cnt = defaultdict(int)
for pi in range(N):
    for pj in range(N):
        if pi == pj:
            continue
        # x
        dx = P[pi][0] - P[pj][0]

        # y
        dy = P[pi][1] - P[pj][1]

        cnt[(dx, dy)] += 1

ans = N-max(cnt.values())
print(ans)

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

P = []
for _ in range(N):
    x, y = map(int, input().split())
    P.append((x, y))

from collections import defaultdict

cnt = defaultdict(int)
for pi in range(N):
    for pj in range(pi+1, N):
        if pi == pj:
            continue
        # x
        dx = abs(P[pi][0] - P[pj][0])

        # y
        dy = abs(P[pi][1] - P[pj][1])

        cnt[(dx, dy)] += 1

ans = N-max(cnt.values())
print(ans)
Problem p03048 (python)

Fixed submission:
R,G,B,N = list(map(int, input().split()))
ans=0
for r in range(N//R+1):
    x = N-R*r
    for g in range(x//G+1):
        if (x-G*g)%B==0:
            ans+=1
print(ans)

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

ans = 0
for r in range(N//R+1):
    for g in range(tmp//G+1):
        check = (tmp - R*r - G*g)
        if check%B == 0 and check > 0:
            ans += 1

print(ans)
Problem p03150 (python)

Fixed submission:
S = input()

def range_strip(S, i, j):
    return S[:i] + S[j:]

for i in range(len(S)):
    for j in range(i, len(S)):
        if range_strip(S,i,j) == "keyence":
            print("YES")
            exit(0)
print("NO")

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

"""
7<=|S|<=100
c ∈ {[a-z]}

keyaaence
keyence
"""

ref = "keyence"

if S == ref:
    print("YES")
    exit(0)

ri = 0
ci = 0

missmatch=[]

while ci < len(S):
    if ref[ri] == S[ci] and ri <= len(ref)-1:
        # match
        ri+=1
    else:
        missmatch.append(ci)

    ci += 1
if ri != len(ref):
    print("NO")
    exit(0)

ok = True
for i in range(len(missmatch)-1):
    if missmatch[i] + 1 != missmatch[i+1]:
        ok = False
# print(missmatch)
if ok:
    print("YES")
else:
    print("NO")
Problem p03231 (python)

Fixed submission:
N, M = map(int, input().split())
S = input()
T = input()

import sys

def gcd(a, b):
    if a == 0:
        return b
    else:
        return gcd(b%a, a)


g = gcd(N, M)
sn = N//g
sm = M//g

ok = True
for k in range(0, g):
    a = k * sn
    b = k * sm
    if S[a] != T[b]:
        ok = False
        break

if ok:
    print(N*M//g)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = input()
T = input()

import sys

def gcd(a, b):
    if a == 0:
        return b
    else:
        gcd(b%a, a)

g = gcd(N, M)
sn = N/g
sm = M/g

ok = True
for k in range(0, g):
    a = k * sn
    b = k * sm
    if S[a] != T[b]:
        ok = False
        break

if ok:
    print(N*M/g)
else:
    print(-1)
Problem p03241 (python)

Fixed submission:
from math import sqrt
N, M = map(int, input().split())

cand = []

for i in range(1, int(sqrt(M))+1):
    if M % i == 0:
        cand.append(i)
        u = M // i
        if u != i:
            cand.append(u)

cand.sort()

ans = 1
for j in cand:
    if N * j <= M:
        ans = max(ans, j)

print(ans)

Buggy submission (verdict: Runtime Error):
from math import sqrt
N, M = map(int, input().split())

cand = []

for i in range(2, int(sqrt(M))+1):
    if M % i == 0:
        cand.append(i)
        cand.append(M//i)

cand.sort()

for j in cand:
    if N * j <= M:
        ans = j

print(ans)
Problem p03244 (python)

Fixed submission:
from collections import Counter
 
n = int(input())
v_array = list(map(int,input().split()))
 
v_odd = v_array[0::2]
v_even = v_array[1::2]
 
v_odd_common = Counter(v_odd).most_common()
v_even_common = Counter(v_even).most_common()
 
v_odd_common.append((0,0))
v_even_common.append((0,0))
 
if v_odd_common[0] != v_even_common[0]:
    print(n-v_odd_common[0][1]-v_even_common[0][1])
else:
    print(min(n-v_odd_common[0][1]-v_even_common[1][1],n-v_odd_common[1][1]-v_even_common[0][1]))

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

v_odd[1::2]
v_even[0::2]

v_odd_mc = Counter(v_odd).most_common()
v_even_mc = Counter(v_even).most_common()

v_odd_mc.append((0, 0))
v_even_mc.append((0, 0))

if v_odd_mc[0] != v_even_mc[0]:
    print(n-v_odd_mc[0][1]-v_even_mc[0][1])
else:
    print(n - max(v_odd_mc[0][1] + v_even_mc[1][1], v_odd_mc[1][0]+v_even_mc[0][1]))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
v = list(map(int, input().split()))

odd = defaultdict(int)
even = defaultdict(int)

nodd = 0
neven = 0
for ix in range(1, n+1):
    if ix & 1:
        odd[v[ix-1]] += 1
        nodd += 1
    else:
        even[v[ix-1]] += 1
        neven += 1

odd_sorted = sorted(odd.items(), key=lambda x: x[1], reverse=True)
even_sorted = sorted(even.items(), key=lambda x: x[1], reverse=True)

odd_top = odd_sorted[0]
even_top = even_sorted[0]

# solve

ans = 0

if odd_top[0] == even_top[0]:

    if len(odd) == len(even) == 1:
        ans = nodd
    else:
        if len(odd) == 1:
            ans += nodd - odd_top[1]
            ans += neven - even_sorted[1][1]

        elif len(even) == 1:
            ans += nodd - odd_sorted[1][1]
            ans += neven - even_top[1]

        else:
            odd_sec = odd_sorted[1]
            even_sec = even_sorted[1]

            # use others
            if nodd_sec[1] < neven_sec[1]:
                # use nodd_sec
                ans += nodd - odd_sec[1]
                ans += neven - even_top[1]
            else:
                ans += nodd - odd_top[1]
                ans += neven - even_sec[1]
else:
    ans += nodd - odd_top[1]
    ans += neven - even_top[1]

# print("odd_top", odd_top)
# print("even_top", even_top)
print(ans)
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
S=sorted(set(range(a,min(a+k,b+1))) | set(range(max(b+1-k,a),b+1)))
for _ in S:
    print(_)

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

# cand = list(range(a, b+1))

S = sorted(list(set(cand[:k] + cand[-k:])))
# for i in res:
#     print(i)
# last = 0
# for so in range(a, a+k, 1):
#     if so <= b:
#         print(so)
#         last = so

# for lo in range(b-(k-1), b+1, 1):
#     if last < lo and lo <= b:
#         print(lo)

# S=sorted(set(range(a,min(a+k,b+1))) | set(range(max(b+1-k,a),b+1)))
for _ in S:
    print(_)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
cand = list(range(a, b+1))

# res = sorted(list(set(cand[:k] + cand[-k:])))
# for i in res:
#     print(i)
# last = 0
# for so in range(a, a+k, 1):
#     if so <= b:
#         print(so)
#         last = so

# for lo in range(b-(k-1), b+1, 1):
#     if last < lo and lo <= b:
#         print(lo)

S=sorted(set(range(a,min(a+k,b+1))) | set(range(max(b+1-k,a),b+1)))
for _ in S:
    print(_)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
cand = list(range(a, b+1))

# res = sorted(list(set(cand[:k] + cand[-k:])))
# for i in res:
#     print(i)
last = 0
for so in range(a, a+k, 1):
    if so <= b:
        print(so)
        last = so

for lo in range(b-(k-1), b+1, 1):
    if last < lo and lo <= b:
        print(lo)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
cand = list(range(a, b+1))
res = sorted(list(set(cand[:k] + cand[-k:])))
for i in res:
    print(i)
Problem p03416 (python)

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

ans = 0
for i in range(A, B+1):
    buf = str(i)
    is_par = True
    for u in range(len(buf)//2):
        if buf[u] != buf[-1-u]:
            is_par = False
            break
    if is_par:
        ans += 1


print(ans)

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

ans = 0
for i in range(A, B+1):
  buf = str(i)
  is_par = true
  for u in range(buf.size()//2):
    if buf[u] != buf[-1-u]:
      is_par = false
      break
  if is_par:
    ans += 1
print(ans)
Problem p03438 (python)

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

ba = 0
bb = 0
for i in range(N):
    if a[i] > b[i]:
        ba += a[i] - b[i]
    if b[i] > a[i]:
        bb += (b[i] - a[i])//2

if bb >= ba:
    print("Yes")
else:
    print("No")

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

ba = 0, bb = 0
for i in range(N):
    if a[i] > b[i]:
        ba += a[i] - b[i]
    if b[i] > a[i]:
        bb += (b[i] - a[i])//2

if bb >= ba:
    print("Yes")
else:
    print("No")
Problem p03456 (python)

Fixed submission:
a, b = input().split()
 
import math
c = math.sqrt(int(a + b))
ok = c.is_integer()
 
if ok:
  print("Yes")
else:
  print("No")

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

import math
c = math.sqrt(int(a + b))
ok = c.is_instance(c, int)

if ok:
  print("Yes")
else:
  print("No")
Problem p03472 (python)

Fixed submission:
N, H = map(int, input().split())
# B = []
A = []
B = []
amax = -1
bmax = -1

for _ in range(N):
    a, b = map(int, input().split())
    # B.append((a,b))
    A.append(a)
    B.append(b)

    if amax < a:
        amax = a
    
    if bmax < b:
        bmax = b

if amax >= bmax:
    m = H % amax
    if m != 0:
        ans = H // amax + 1
    else:
        ans = H // amax

else:
    ans = 0
    throw_lst = list(filter(lambda x: x > amax, B))
    throw_lst.sort(reverse=True)

    for tb in throw_lst:
        H -= tb
        ans += 1
        if H <= 0:
            print(ans)
            exit(0)

    m = H % amax
    if m != 0:
        ans += H // amax + 1
    else:
        ans += H // amax

print(ans)

Buggy submission (verdict: Runtime Error):
N, H = map(int, input().split())
# B = []
A = []
B = []
amax = -1
bmax = -1

for _ in range(N):
    a, b = map(int, input().split())
    # B.append((a,b))
    A.append(a)
    B.append(b)

    if amax < a:
        amax = a
    
    if bmax < b:
        bmax = b

if amax >= bmax:
    m = H % amax
    if m != 0:
        ans = H // amax + 1
    else:
        ans = H // amax

else:
    ans = 0
    throw_lst = list(filter(lambda x: x > amax, B)).sort(reverse=True)

    for tb in throw_lst:
        H -= tb
        ans += 1
        if H <= 0:
            break

    m = H % amax
    if m != 0:
        ans += H // amax + 1
    else:
        ans += H // amax

print(ans)
Problem p03563 (python)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy submission (verdict: Runtime Error):
h, w = 2, 3
c = []

for _ in range(h):
    c.append(input())

if c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]:
    print("YES")
else:
    print("NO")