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

Fixed submission:
def resolve():
    A = [list(map(int, input().split())) for _ in range(3)]
    N = int(input())
    B = [int(input()) for _ in range(N)]
    punch = [[False for _ in range(3)] for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if A[i][j] in B:
                punch[i][j] = True
    ans = "No"
    for i in range(3):
        if False not in punch[i]:
            ans = "Yes"
            break
        for j in range(3):
            if not punch[j][i]:
                break
        else:
            ans = "Yes"
            break
    if (punch[0][0] and punch[1][1] and punch[2][2]) or (
            punch[0][2] and punch[1][1] and punch[2][0]):
        ans = "Yes"
    print(ans)


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    A = [list(map(int, input().split())) for _ in range(3)]
    N = int(input())
    B = [int(input()) for _ in range(N)]
    punch = [[False for _ in range(3)] for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if A[i][j] in B:
                punch[i][j] = True
    print(punch, file=sys.stderr)
    ans = "No"
    for i in range(3):
        if False not in punch[i]:
            ans = "Yes"
            break
        for j in range(3):
            if not punch[j][i]:
                break
        else:
            ans = "Yes"
            break
    if (punch[0][0] and punch[1][1] and punch[2][2]) or (
            punch[0][2] and punch[1][1] and punch[2][0]):
        ans = "Yes"
    print(ans)


resolve()
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
rep = s.replace("1", "")
if len(rep) == 0:
  print("1")
else:
  if s.index(rep[0]) < k:
    print(rep[0])
  else:
    print("1")

Buggy submission (verdict: Runtime Error):
s = input()
if "1" == s[0]:
    print(s.replace("1", "")[0])
else:
    print(s[0])

Buggy submission (verdict: Runtime Error):
print(input().replace("1", "")[0])
Problem p03487 (python)

Fixed submission:
def resolve():
    from collections import defaultdict
    N = int(input())
    A = [int(i) for i in input().split()]
    dic = defaultdict(int)
    for a in A:
        dic[a] += 1
    ans = 0
    for k, v in dic.items():
        if k <= v:
            ans += v - k
        else:
            ans += v
    print(ans)


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    from collections import defaultdict
    N = int(input())
    A = [int(i) for i in input().split()]
    dic = defaultdict(int)
    for a in A:
        dic[a] += 1
    ans = 0
    for k, v in dic:
        if k <= v:
            ans += v - k
        else:
            ans += v
    print(ans)


resolve()
Problem p03644 (python)

Fixed submission:
n=int(input())
for i in range(8):
  if 2**i > n:
    print(2**(i-1))
    break

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(8):
  if 2**i > n:
    print(2**(i-1))
    return
Problem p04029 (python)

Fixed submission:
n = int(input())
ans=0
for i in range(1, n+1):
  ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
ans=0
for i in range(1, n+1):
  ans+=i
print(ans)
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [-1] * N
visited[0] = 0
next = A[0]
for i in range(1, K+1):
    present = next
    visited[present - 1] = i

    next = A[present - 1]
    if visited[next - 1] != -1:
        loopLength = visited[present - 1] - visited[next - 1] + 1
        rest = (K - i) % loopLength
        if rest > 0:
            present = visited.index(visited[next - 1] + rest - 1) + 1
        break

print(present)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
visited = [-1] * N
visited[0] = 0
next = A[0]
for i in range(1, K+1):
    present = next
    visited[present - 1] = i

    next = A[present - 1]
    if visited[next - 1] != -1:
        loopLength = visited[present - 1] - visited[next - 1] + 1
        cnt = i
        rest = (K - cnt) % loopLength
        present = visited.index(visited[next - 1] + rest - 1)
        break

print(present)

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

N, K = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
visited = deque()
next = 1
while True:
  present = next
  cnt += 1
  visited.append(present)
  next = A[present-1]
  if next in visited:
    ind = visited.index(next)
    l = len(visited[ind:])
    break

rest = (K-cnt) % l
present = visited[ind + rest]
print(present)
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
S = input()
if S = 'ABC':
  print('ARC')
else:
  print('ABC')

Buggy submission (verdict: Runtime Error):
S = int(input())
if S = 'ABC':
  print('ARC')
else:
  print('ABC')
Problem p02690 (python)

Fixed submission:
X = int(input())
ans = list()
min = float("inf")
r = range(-200,200)
for A in r:
  for B in r:
    if A**5-B**5==X:
      if A**5-B**5< min:
        if len(ans)!=0: ans.pop()      
        ans.append([A,B])
        min = A**5-B**5
        break
      elif A**5-B**5==min:
        ans.append([A,B])
        break
ans=ans[1]
A = ans[0]
B = ans[1]
print(A, B)

Buggy submission (verdict: Runtime Error):
X = int(input())
ans = list()
min = float("inf")
r = range(-100,100)
for A in r:
  for B in r:
    if A**5-B**5==X:
      if A**5-B**5< min:
        if len(ans)!=0: ans.pop()      
        ans.append([A,B])
        min = A**5-B**5
      elif A**5-B**5==min:
        ans.append([A,B])
ans=ans[1]
A = ans[0]
B = ans[1]
print(A, B)
Problem p02791 (python)

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

num = P[0]
count = 1

for i in range(1, N):
  if num >= P[i]:
    count += 1
    num = P[i]

print(count)

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

num = P[0]
count = 1

for i in range(1, n):
  if num >= P[i]:
    count += 1
    num = P[i]

print(count)
Problem p03719 (python)

Fixed submission:
A, B, C = map(int, input().split())
 
if (C >= A and C <= B):
  print("Yes")
  
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = main(int, input().split())
 
if (C >= A and C <= B):
  print("Yes")
  
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = main(int, imput().split())

if (C >= A and C <= B):
  print("Yes")
  
else:
  print("No")
Problem p03737 (python)

Fixed submission:
s1, s2, s3 = input().split()

s1 = s1[0].upper()
s2 = s2[0].upper()
s3 = s3[0].upper()
 
print(s1+s2+s3)

Buggy submission (verdict: Runtime Error):
s1, s2, s3 = map(input().split())

s1 = s1[0].str.upper()
s2 = s2[0].str.upper()
s3 = s3[0].str.upper()

print(s1, s2, s3)
Problem p04011 (python)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<=K:
  Sum = X*N 
elif N>K:
  Sum = X*K + Y*(N-K)
  
print(Sum)

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

if N<K:
  Sum = X*N 
elif N>K:
  Sum = X*K + Y*(N-K)
  
print(Sum)
Problem p02573 (python)

Fixed submission:
# 接続最大クラスタのサイズが答え？

N, M = [int(x) for x in input().split(' ')]

# from collections import defaultdict
# d = defaultdict(set)

# for i in range(M):
#     a, b = [int(x) for x in input().split(' ')]
#     d[a].add(b)
#     d[b].add(a)

class UF:
    def __init__(self):
        self.r = [-1] * N

    def root(self, i):
        r = self.r
        if r[i] < 0:
            return i
        else:
            r[i] = self.root(r[i])
            return r[i]

    def union(self, i, j):
        i -= 1
        j -= 1
        ri = self.root(i)
        rj = self.root(j)
        if ri == rj:
            return
        else:
            if not self.r[ri] < self.r[rj]:
                ri, rj = rj, ri
            self.r[ri] += self.r[rj]
            self.r[rj] = ri
            return

    def max_size(self):
        return -min(self.r)

uf = UF()
for i in range(M):
    uf.union(*[int(x) for x in input().split(' ')])
print(uf.max_size())

Buggy submission (verdict: Runtime Error):
# 接続最大クラスタのサイズが答え？

N, M = [int(x) for x in input().split(' ')]

# from collections import defaultdict
# d = defaultdict(set)

# for i in range(M):
#     a, b = [int(x) for x in input().split(' ')]
#     d[a].add(b)
#     d[b].add(a)

class UF:
    def __init__(self):
        self.r = [-1] * N

    def root(self, i):
        r = self.r
        if r[i] < 0:
            return i
        else:
            r[i] = self.root(r[i])
            return r[i]

    def union(self, i, j):
        ri = self.root(i)
        rj = self.root(j)
        if ri == rj:
            return
        else:
            if not self.r[ri] < self.r[rj]:
                ri, rj = rj, ri
            self.r[ri] += self.r[rj]
            self.r[rj] = ri
            return

    def max_size(self):
        return -min(self.r)

uf = UF()
for i in range(M):
    uf.union(*[int(x) for x in input().split(' ')])
print(uf.max_size())

Buggy submission (verdict: Runtime Error):
# 接続最大クラスタのサイズが答え？

N, M = [int(x) for x in input().split(' ')]

from collections import defaultdict
d = defaultdict(set)

for i in range(M):
    a, b = [int(x) for x in input().split(' ')]
    d[a].add(b)
    d[b].add(a)

def bfs(i, obs=set()):
    # set_obs = d[i] | {i}
    obs |= {i}
    for j in d[i]:
        if j not in obs:
            obs |= bfs(j, obs)
    return obs

print(max(len(bfs(i, set())) for i in range(1, N+1)))
Problem p02818 (python)

Fixed submission:
s = input()
a, b, k = s.split()
a, b, k = int(a), int(b), int(k)


aa = max(a-k, 0)
bb = max(b-max(k-a, 0), 0)
print(aa, bb)

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

aa = max(a-k, 0)
bb = max(b-max(k-a, 0), 0)
print(aa, bb)
Problem p02981 (python)

Fixed submission:
n, a, b = [int(s) for s in input().split(" ")]

print("%d" % min(n * a, b))

Buggy submission (verdict: Runtime Error):
n, a, b = [int(s) for in input().split(" ")]

print("%d" % min(n * a, b))
Problem p02982 (python)

Fixed submission:
import math
n, d = [int(s) for s in input().split(" ")]
pts = []
for _ in range(n):
  pts.append([int(s) for s in input().split(" ")])

def dist(x, y):
  sum = 0
  for xx, yy in zip(x, y):
    sum += (xx - yy)**2
  return math.sqrt(sum)

cnt = 0
for i in range(n):
  for j in range(i + 1, n):
    d = dist(pts[i], pts[j])
    if int(d) == d:
      cnt += 1

print("%d" % cnt)

Buggy submission (verdict: Runtime Error):
n, d = [int(s) for s in input().split(" ")]
pts = []
for _ in range(n):
  pts.append([int(s) for s in input().split(" ")])

def dist(x, y):
  sum = 0
  for xx, yy in zip(x, y):
    sum += (xx - yy)**2
  return math.sqrt(sum)

cnt = 0
for i in range(n):
  for j in range(i + 1, n):
    d = dist(pts[i], pts[j])
    if int(d) == d:
      cnt += 1

print("%d" % cnt)
Problem p03001 (python)

Fixed submission:
w, h, x, y = [int(s) for s in input().split(" ")]

a = w * h

print("%lf %d" % (a * 0.5, int(divmod(w, 2) == (x, 0) and divmod(h, 2) == (y, 0))))

Buggy submission (verdict: Runtime Error):
w, h, x, y = [int(s) for s in input().split(" ")]

a = w * h

print("%f %d" % (a * 0.5, int(w // 2 == x and h // 2 == y))

Buggy submission (verdict: Runtime Error):
w, h, x, y = [int(s) for s in input().split(" ")]

a = w * h

print("%d %d" % (a * 0.5, int(w // 2 == x and h // 2 == y))
Problem p03006 (python)

Fixed submission:
from sys import stdin
n = int(stdin.readline().rstrip())
data = [[int(s) for s in stdin.readline().rstrip().split()] for _ in range(n)]
d = {}

for i in range(n):
  for j in range(i + 1, n):
    diff = (data[i][0] - data[j][0], data[i][1] - data[j][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1
    diff = (data[j][0] - data[i][0], data[j][1] - data[i][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1

if len(d) == 0:
  print(n)
else:
  print(n - max(d.values()))

Buggy submission (verdict: Runtime Error):
from sys import stdin
n = int(stdin.readline().rstrip())
data = [[int(s) for s in stdin.readline().rstrip().split()] for _ in range(n)]
d = {}

for i in range(n):
  for j in range(i + 1, n):
    diff = (data[i][0] - data[j][0], data[i][1] - data[j][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1
    diff = (data[j][0] - data[i][0], data[j][1] - data[i][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1

print(n - max(d.values()))

Buggy submission (verdict: Runtime Error):
from sys import stdin
n = int(stdin.readline().rstrip())
data = [[int(s) for s in stdin.readline().rstrip().split()] for _ in range(n)]
d = {}

for i in range(n):
  for j in range(i + 1, n):
    diff = (data[i][0] - data[j][0], data[i][1] - data[j][1])
    if diff in d:
      d[diff] += 1
    else:
      d[diff] = 1

print(n - max(d.values()))
Problem p03495 (python)

Fixed submission:
from collections import Counter

n, k = map(int, input().split())
s = list(map(int, input().split()))

num = Counter(s)


if len(num) <= k:
    print(0)

else:
    cnt = len(num) - k
    ans = 0
    i = 0
    for v in sorted(num.values()):
        if cnt == i:
            break
        ans += v
        i += 1

    print(ans)

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

n, k = map(int, input().split())
s = list(map(int, input().split()))

num = Counter(s)

if len(num) <= k:
    print(0)
else:
    cnt = len(num) - k
    ans = 0
    i = 0
    for v in sorted(num.values()):
        if cnt == i:
            break
        ans += v
        i += 1

print(ans)
Problem p02584 (python)

Fixed submission:
import math

x,k,d = map(int,input().split())

if x < 0:
    x *= -1

if x-k*d < 0:
    if (k-(math.floor(x/d)))%2 == 0:
        print(x%d)
    else:
        print(abs(x%d-d))
else:
    print(x-k*d)

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

if x < 0:
    x *= -1

if x-k*d < 0:
    if (k-(math.floor(x/d)))%2 == 0:
        print(x%d)
    else:
        print(abs(x%d-d))
else:
    print(x-k*d)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
if (n != 0):
  p = list(map(int, input().split()))
else:
  print(x)
  exit()

kouho = list(range(-200, 200))


for i in range(len(p)):
  if p[i] != x:
    del kouho[kouho.index(p[i])]

kouho_num = kouho.index(x)
right = kouho_num + 1
left = kouho_num - 1

if (x not in p):
  print(x)
elif abs(kouho[right] - kouho[kouho_num]) > abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
elif abs(kouho[right] - kouho[kouho_num]) == abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
else:
  print(kouho[right])

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if (n != 0):
  p = list(map(int, input().split()))
else:
  print(x)
  exit()

kouho = list(range(1, max(p) + n))
# print(kouho)

for i in range(len(p)):
  if p[i] != x:
    del kouho[kouho.index(p[i])]

kouho_num = kouho.index(x)
right = kouho_num + 1
left = kouho_num - 1


if abs(kouho[right] - kouho[kouho_num]) > abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
elif abs(kouho[right] - kouho[kouho_num]) == abs(kouho[kouho_num] - kouho[left]):
  print(kouho[left])
else:
  print(kouho[right])

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if (n != 0):
  p = list(map(int, input().split()))
else:
  print(x)
  exit()

kouho = list(range(1, max(p) + n))
# print(kouho)

for i in range(len(p)):
  if p[i] != x:
    del kouho[kouho.index(p[i])]

kouho_num = kouho.index(x)
right = kouho_num + 1
left = kouho_num - 1


if kouho[right] - kouho[kouho_num] > kouho[kouho_num] - kouho[left]:
  print(kouho[left])
elif kouho[right] - kouho[kouho_num] == kouho[kouho_num] - kouho[left]:
  print(kouho[left])
else:
  print(kouho[right])
Problem p02646 (python)

Fixed submission:
a, v = map(int, input().split())
b, w = map(int, input().split())

t = int(input())

if v <= w:
  print("NO")

else:
  ans = (b - a) / (v - w)
  if t >= abs(ans):
    print("YES")
  else:
    print("NO")

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

t = int(input())


if (v <= w and a < b):
  ans = t + 1
else:
  ans = (b - a) / (v - w)


if t >= ans:
  print("YES")
else:
  print("NO")

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

t = int(input())


if (v <= w) and (b > a):
  ans = t + 1
else:
  ans = (b - a) / (v - w)


if t >= ans:
  print("YES")
else:
  print("NO")

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

t = int(input())


if v <= w and b > a:
  ans = t + 1
else: 
  ans = (b - a) / (v - w)


if t >= ans:
  print("YES")
else:
  print("NO")
Problem p02885 (python)

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

cover_b = b * 2
if cover_b > a:
  print(0)

else:
  print(a - cover_b)

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

cover_b = b * 2
if cover_b > a:
  print(0)

else:
  print(a - cover_b)
Problem p03129 (python)

Fixed submission:
i = list(map(int, input().split()))
n = i[0]
k = i[1]

if n >= 1 and k <= 100:
  if n == 1 and k == 1:
    print("YES")
  elif n > k:
    if n % 2 == 1:
      if int(n / k) >= 2:
        print("YES")
      elif int(n / k) == 1 and (int(n % k) == k - 1):
        print("YES")
      else:
        print("NO")
    else:
      if int(n / k) >= 2:
        print("YES")
      elif n % k == 0:
        print("YES")
      else:
        print("NO")
  else:
    print("NO")

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

if n >= 1 and n <= 100 and k >= 1 and k <= 100:
  if n > 2:
    if n % 2 == 1:
      if n / k >= 1:
        print("YES")
      elif n % k == 1:
        print("YES")
      else:
        print("NO")
    else:
      if n / k >= 2:
        print("YES")
      elif n % k == 0:
        print("YES")
      else:
        print("NO")
  else:
    print("NO")
else:

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

if n >= 1 and n <= 100 and k >= 1 and k <= 100:
  if n > 2:
    if n > k - 2:
      if n % 2 == 1:
        if n / k >= 1:
          print("YES")
        elif n % k == 1:
          print("YES")
        else:
          print("NO")
      elif:
        if n / k >= 2:
          print("YES")
        elif n % k == 0:
          print("YES")
        else:
          print("NO")
      else:
        print("NO")
    else:
      print("NO")
  else:
    print("NO")
else:
  print("NO")
Problem p02681 (python)

Fixed submission:
def resolve():
    '''
    code here
    '''
    S = input()
    T = input()

    if len(T) == len(S) + 1 and S == T[:-1]:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    import collections
    N, K = [int(item) for item in input().split()]
    A_list = [int(item) for item in input().split()]

    bit_k = bin(K)[2:]

    telepo_list = collections.deque([A_list])

    for _ in range(len(bit_k)-1):
        temp_list = telepo_list[-1]
        new_telep = collections.deque([])
        for i in temp_list:
            new_telep.append(temp_list[i-1])

        telepo_list.append(new_telep)

    # print(telepo_list)

    goto = 1
    for i in range(len(bit_k)):
        temp_list = telepo_list.popleft()
        if ((K >> i) & 1): 
            goto = temp_list[goto -1]
            # print(i, goto)

    print(goto)

if __name__ == "__main__":
    resolve()
Problem p02742 (python)

Fixed submission:
def resolve():
    '''
    code here
    '''
    H, W = [int(item) for item in input().split()]

    if H == 1 or W == 1:
        res = 1
    elif H % 2 == 1 and W % 2 == 1:
        res = H * W // 2 +1
    else:
        res = H * W // 2

    print(res)
if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    H, W = [int(item) for item in input().split()]

    if H == 1 or W == 1:
        res = 1
    elif H % 2 == 1 and W % 2 == 1:
        res += H * W // 2 +1
    else:
        res = H * W // 2

    print(res)
if __name__ == "__main__":
    resolve()
Problem p02796 (python)

Fixed submission:
N = int(input())
num_list = [[int(item) for item in input().split()] for _ in range(N)]
num_list2 = []
for x, l in num_list:
    num_list2.append([x-l, x+l])

num_list2.sort(key=lambda x: x[1]) 
# print(num_list2)

temp_max = num_list2[0][1]
cnt = 1

for l, h in num_list2:
    if l >= temp_max:
        cnt += 1
        temp_max = h

print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
num_list = [[int(item) for item in input().split()] for _ in range(N)]
num_list.sort(key=lambda x: x[0]) 
# print(num_list)

temp_max = num_list[0][0] + num_list[0][1]
cnt = 1

for x, l in num_list:
    if x - l >= temp_max:
        cnt += 1
        temp_max = x + l
        # print(x, l, cnt, temp_max)


temp_max2 = num_list[1][0] + num_list[1][1]
cnt2 = 1

for x, l in num_list[1:]:
    if x - l >= temp_max2:
        cnt2 += 1
        temp_max2 = x + l
        # print(x, l, cnt, temp_max)

if cnt2 > cnt:
    cnt, cnt2 = cnt2, cnt
print(cnt)
Problem p02843 (python)

Fixed submission:
line = input()

if int(line) >= 100:
    num = int(line[-2:])
    item_number = int(line[:-2])



    res_list = []
    a = 5
    while True:
        if num == 0:
            break
        for _ in range(num//a):
            res_list.append(a)

        num = num % a

        if 1<= num <= 4:
            res_list.append(num)
            break


    # print(res_list)

    if len(res_list) > item_number:
        print(0)
    else:
        print(1)

else:
    print(0)

Buggy submission (verdict: Runtime Error):
line = input()
num = int(line[-2:])
item_number = int(line[:-2])



res_list = []
a = 5
while True:
    for _ in range(num//a):
        res_list.append(a)

    num = num % a

    if num <= 4:
        res_list.append(num)
        break

# print(res_list)

if len(res_list) > item_number:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
line = input()
num = int(line[-2:])
item_number = int(line[:-2])


res_list = []
a = 5
while True:
    num = num - a
    res_list.append(a)
    if num < a:
        a -= 1

    if num == 0 or a == 0:
        break

if len(res_list) > item_number:
    print(0)
else:
    print(1)
Problem p02853 (python)

Fixed submission:
x, y = [int(item) for item in input().split()]

res = 0

if x == 1:
    res += 300000
elif x == 2:
    res += 200000
elif x == 3:
    res += 100000

if y == 1:
    res += 300000
elif y == 2:
    res += 200000
elif y == 3:
    res += 100000

if x == 1 and y == 1:
    res += 400000

print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = [int(item) for item in input().split()]

all_sum = sum(A_list)

F_sum_list = []

for j in range(1,N):
    F = A_list[:j]
    F_sum = sum(F)
    F_sum_list.append(F_sum)
    if F_sum >= all_sum // 2:
        break

mini = min(all_sum - 2 * F_sum_list[-2], -1*(all_sum - 2 * F_sum_list[-1]))
print(mini)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = [int(item) for item in input().split()]

mini = 2020202020 * 200000
for j in range(1,N):
    F, B = A_list[:j], A_list[j:]
    delta = abs(sum(F) - sum(B))
    if delta <= mini:
        mini = delta

print(mini)

Buggy submission (verdict: Runtime Error):
X, Y = [int(item) for item in input().split()]

res = 0

if X == 1:
    res += 300_000
elif X == 2:
    res += 200_000
elif X == 3:
    res += 100_000

if Y == 1:
    res += 300_000
elif Y == 2:
    res += 200_000
elif Y == 3:
    res += 100_000

if X ==1 and Y == 1:
    res += 400_000

print(res)

Buggy submission (verdict: Runtime Error):
X, Y = [int(item) for item in input().split()]

res = 0

if X == 1:
    res += 300_000
elif X == 2:
    res += 200_000
elif X == 3:
    res += 100_000

if Y == 1:
    res += 300_000
elif Y == 2:
    res += 200_000
elif Y == 3:
    res += 100_000

if X ==1 and Y == 1:
    res += 400_000

print(res)