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

Fixed submission:
from collections import deque

N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = pow(10,9)+7

A.sort(reverse=True)

deque = deque()
for a in A:
    deque.append(a)

ans = 1
cnt = 0
if K%2 == 1:
    ans *= deque.popleft()
    cnt += 1
    
if ans <= 0:
    for i in range(K-1):
        ans *= deque.popleft()
        ans %= mod
else:
    while cnt < K:
        x1 = deque.popleft()
        x2 = deque.popleft()
        deque.appendleft(x2)
        deque.appendleft(x1)
        y1 = deque.pop()
        y2 = deque.pop()
        if x1*x2 < y1*y2:
            ans *= y1*y2
            ans %= mod
            cnt += 2
        else:
            ans *= x1*x2
            ans %= mod
            if deque:
                x1 = deque.popleft()
            if deque:
                x2 = deque.popleft()
            deque.append(y2)
            deque.append(y1)
            cnt += 2
            
print(ans)

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

N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = pow(10,9)+7

A.sort(reverse=True)

deque = deque()
for a in A:
    deque.append(a)

ans = 1
cnt = 0
if K%2 == 1:
    ans *= deque.popleft()
    cnt += 1
    
if ans <= 0:
    for i in range(K-1):
        ans *= deque.popleft()
        ans %= mod
else:
    while cnt < K:
        x1 = deque.popleft()
        x2 = deque.popleft()
        deque.appendleft(x2)
        deque.appendleft(x1)
        y1 = deque.pop()
        y2 = deque.pop()
        if x1*x2 < y1*y2:
            ans *= y1*y2
            ans %= mod
            cnt += 2
        else:
            ans *= x1*x2
            ans %= mod
            x1 = deque.popleft()
            x2 = deque.popleft()
            deque.append(y2)
            deque.append(y1)
            cnt += 2
            
print(ans)
Problem p02640 (python)

Fixed submission:
x, y = map(int, input().split())

def func(x,y):
    if y % 2 == 1:
        return False
    if 4*x < y:
        return False
    if y < 2*x:
        return False
    else:
        return True
    
if func(x,y):
    print("Yes")
else:
    print("No")

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

def func(x,y):
    if y % 2 == 1:
        return False
    if 4*x < y:
        return False
    else:
        return True
    
if func(x,y):
    print("Yes")
else:
Problem p02678 (python)

Fixed submission:
from collections import deque

n, m = map(int, input().split())
path = list(list(map(int, input().split())) for _ in range(m))

d = deque()

dic = dict()
for i in range(m):
    p = path[i]
    if p[0] not in dic:
        dic[p[0]] = [p[1]]
    else:
        dic[p[0]].append(p[1])
    if p[1] not in dic:
        dic[p[1]] = [p[0]]
    else:
        dic[p[1]].append(p[0])
        
sign = [0]*n
done = [0]*n
done[0] = 1

for i in dic[1]:
    d.appendleft(i)
    sign[i-1] = 1
    done[i-1] = 1

while len(d) > 0:
    x = d.pop()
    for i in dic[x]:
        if done[i-1] == 0:
            d.appendleft(i)
            sign[i-1] = x
            done[i-1] = 1
        
print("Yes")
for i in range(n-1):
    print(sign[i+1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
path = list(list(map(int, input().split())) for _ in range(m))

dic = dict()
for i in range(m):
    p = path[i]
    if p[0] not in dic:
        dic[p[0]] = [p[1]]
    else:
        dic[p[0]].append(p[1])
    if p[1] not in dic:
        dic[p[1]] = [p[0]]
    else:
        dic[p[1]].append(p[0])
        
table = [0]*n
sign = [0]*n

def bfs(k):
    for i in dic[k]:
        if table[i-1] == 0 and i != 1:
            table[i-1] = table[k-1] + 1
            sign[i-1] = k
        elif table[k-1] + 1 < table[i-1]:
            table[i-1] = table[k-1] + 1
            sign[i-1] = k
        else:
            continue
        bfs(i)
    return

bfs(1)

print("Yes")
for i in range(n-1):
    print(sign[i+1])
Problem p02702 (python)

Fixed submission:
s = input()
mod = 2019
array = [0]*(len(s)+1)

for i in range(len(s)):
    array[i+1] = (array[i] + pow(10,i,mod)*int(s[len(s)-(i+1)])) % mod
    

    
array.sort()

cnt = 0
w = 1

for i in range(0, len(array)-1):
    if array[i] == array[i+1]:
        w += 1
    else:
        if w >= 2:
            cnt += w*(w-1)/2
            w = 1
            
if w != 1:
    cnt += w*(w-1)/2
    
print(int(cnt))

Buggy submission (verdict: Runtime Error):
s = input()
mod = 2019
array = [0]*(len(s)+1)

for i in range(len(s)):
    array[i+1] = (array[i] + pow(10,i,mod)*int(s[len(s)-(i+1)])) % mod
        
array.sort()

cnt = 0
w = 1

for i in range(0, len(array)-1):
    if array[i] == array[i+1]:
        w += 1
    else:
        if w >= 2:
            cnt += w*(w-1)/2
            w = 1
            
if w != 1:
    cnt += factorial(w) / (factorial(2)*factorial(w - 2))
    
print(int(cnt))

Buggy submission (verdict: Runtime Error):
s = input()
mod = 2019
array = [0]*(len(s)+1)

for i in range(len(s)):
    array[i+1] = (array[i] + pow(10,i,mod)*int(s[len(s)-(i+1)])) % mod
    

    
array.sort()

cnt = 0
w = 1

for i in range(0, len(array)-1):
    if array[i] == array[i+1]:
        w += 1
    else:
        if w >= 2:
            cnt += w*(w-1)/2
            w = 1
            
if w != 1:
    cnt += factorial(w) / (factorial(2)*factorial(w - 2))
    
print(int(cnt))

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

dp = [[0]*2019 for i in range(len(s))]

mod = 2019

for l in range(0, len(s)-1):
    dp[l][int(s[l])] += 1
    for m in range(0, mod):
        if dp[l][m] != 0:
            num = int(s[l+1])
            dp[l+1][(10*m+num)%mod] += dp[l][m]
            
cnt = 0
for l in range(0, len(s)):
    if dp[l][0] != 0:
        cnt += dp[l][0]
        
print(cnt)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N, Q = map(int, input().split())
Edges = list([] for _ in range(N))
for i in range(N-1):
    a, b = map(int, input().split())
    Edges[a-1].append(b-1)
    Edges[b-1].append(a-1)
P = [0 for _ in range(N)]
for i in range(Q):
    p, x = map(int, input().split())
    P[p-1] += x

gone = [False for _ in range(N)]

def dfs(counter, count, cur_node):
    count += P[cur_node]
    gone[cur_node] = True
    counter[cur_node] += count
    for next_node in Edges[cur_node]:
        if gone[next_node]:
            continue
        dfs(counter, count, next_node)

counter = [0 for _ in range(N)]
dfs(counter, 0, 0)

for c in counter:
    print(c)

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

if N > 1000:
    import sys
    sys.setrecursionlimit(N)

Edges = list([] for _ in range(N))
for i in range(N-1):
    a, b = map(int, input().split())
    Edges[a-1].append(b-1)
    Edges[b-1].append(a-1)
P = [0 for _ in range(N)]
for i in range(Q):
    p, x = map(int, input().split())
    P[p-1] += x

gone = [False for _ in range(N)]

def dfs(counter, count, cur_node):
    count += P[cur_node]
    gone[cur_node] = True
    counter[cur_node] += count
    for next_node in Edges[cur_node]:
        if gone[next_node]:
            continue
        dfs(counter, count, next_node)

counter = [0 for _ in range(N)]
dfs(counter, 0, 0)

for c in counter:
    print(c)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
Edges = list([] for _ in range(N))
for i in range(N-1):
    a, b = map(int, input().split())
    Edges[a-1].append(b-1)
    Edges[b-1].append(a-1)
P = [0 for _ in range(N)]
for i in range(Q):
    p, x = map(int, input().split())
    P[p-1] += x

gone = [False for _ in range(N)]

def dfs(counter, count, cur_node):
    count += P[cur_node]
    gone[cur_node] = True
    counter[cur_node] += count
    for next_node in Edges[cur_node]:
        if gone[next_node]:
            continue
        dfs(counter, count, next_node)

counter = [0 for _ in range(N)]
dfs(counter, 0, 0)

for c in counter:
    print(c)
Problem p03668 (python)

Fixed submission:
import sys
sys.setrecursionlimit(pow(10,6))

N = int(input())
Edges = list([] for _ in range(N))
for n in range (N-1):
    x, y = map(int, input().split())
    Edges[x-1].append(y-1)
    Edges[y-1].append(x-1)

def dfs(cur_node, parent_node):
    grundy = 0
    for child_node in Edges[cur_node]:
        if child_node == parent_node:
            continue
        else:
            grundy ^= (dfs(child_node, cur_node) + 1)
    return grundy

G = dfs(0, -1)
if G == 0:
    print("Bob")
else:
    print("Alice")

Buggy submission (verdict: Runtime Error):
N = int(input())
Edges = list([] for _ in range(N))
for n in range (N-1):
    x, y = map(int, input().split())
    Edges[x-1].append(y-1)
    Edges[y-1].append(x-1)

def dfs(cur_node, parent_node):
    grundy = 0
    for child_node in Edges[cur_node]:
        if child_node == parent_node:
            continue
        else:
            grundy ^= (dfs(child_node, cur_node) + 1)
    return grundy

G = dfs(0, -1)
if G == 0:
    print("Bob")
else:
    print("Alice")
Problem p02612 (python)

Fixed submission:
n = int(input())
for i in range(11):
  x = i * 1000
  if x >= n:
    print(x-n)
    break

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(11):
  x = i * 1000
  if x => n:
    print(x-n)
    break
Problem p02641 (python)

Fixed submission:
x,n = map(int,input().split(" "))
if n == 0:
  print(x)
else:
  num = list(map(int, input().split(" ")))
  num.sort()

  if x not in num:
    print(x)
  else:
    y = num.index(x)
    if y == (n-1):
      if num[y-1] == x-1:
        print(x+1)
      else:
        print(x-1)
    elif y == 0:
      print(x-1)
    else:
      for i in range(100):
        y = x-i
        if y not in num:
          under = y
          count_under = i
          break
      for j in range(100):
        y = x + j
        if y not in num:
          upper = y
          count_upper = j
          break
      
      if count_under <= count_upper:
        print(under)
      else:
        print(upper)

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split(" "))
if n == 0:
  print(x)
else:
  num = list(map(int, input().split(" ")))
  num.sort()

  if x not in num:
    print(x)
  else:
    y = num.index(x)
    if y == (n-1):
      if num[y-1] == x-1:
        print(x+1)
      else:
        print(x-1)
    elif y == 0:
      print(x-1)
    else:
      for i in range(x):
        y = x-i
        if y not in num:
          under = y
          count_under = i
          break
      for j in range(x):
        y = x + j
        if y not in num:
          upper = y
          count_upper = j
          break
      
      if count_under <= count_upper:
        print(under)
      else:
        print(upper)
Problem p02742 (python)

Fixed submission:
h, w = map(int, input().split())
if h==1 or w == 1:
  print(1)
else:
  ans = h * w //2 + (h*w)%2
  print(ans)

Buggy submission (verdict: Runtime Error):
h, w= map(int, input().split(""))
answer = (h*w)/2 + (h*w)%2
print(answer)
Problem p02748 (python)

Fixed submission:
A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
X = [list(map(int, input().split())) for i in range(M)]

ans = [min(a) + min(b)]
for x in X:
    a_idx, b_index, c = x
    ans.append(a[a_idx - 1] + b[b_index - 1] - c)

print(min(ans))

Buggy submission (verdict: Runtime Error):
a,b,m = list(map(int,input().split()))
a_li = list(map(int,input().split()))
b_li = list(map(int,input().split()))
cost = [min(a_li) + min(b_li)]

for i in range(m):
  x,y,c = list(map(int,input().split()))
  price = a_li[x-1] + a_li[y-1] - c
  cost.append(price)
print(min(cost))

Buggy submission (verdict: Runtime Error):
a,b,m = list(map(int,input().split()))
a_li = list(map(int,input().split()))
b_li = list(map(int,input().split()))
cost = [min(a_li) + min(b_li)]

for i in range(m):
  x,y,c = map(int,input().split())
  price = a_li[x-1] + a_li[y-1] - c
  cost.append(price)
print(min(cost))

Buggy submission (verdict: Runtime Error):
a,b,m = map(int,input().split())
a_li = list(map(int,input().split()))
b_li = list(map(int,input().split()))
cost = [min(a_li) + min(b_li)]

for i in range(m):
  x,y,c = map(int,input().split())
  price = a_li[x-1] + a_li[y-1] - c
  cost.append(price)
print(min(cost))

Buggy submission (verdict: Runtime Error):
a,b,m = map(int,input().split())
a_li = list(map(int,input().split()))
b_li = list(map(int,input().split()))
cost = min(a_li) + min(b_li)
for i in range(m):
  x,y,c = map(int,input().split())
  price = a_li[x-1] + a_li[y-1] - c
  if price < cost:
    cost = price
print(cost)
Problem p02922 (python)

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

for i in range(20):
  d = (a-1)*i +1
  if d >= b:
    print(i)
    break

Buggy submission (verdict: Runtime Error):
a, b = map(input().split(" "))
i = 1
while i >=1:
  d = (a-1)*i +1
  if d >= b:
    print(i)
    break
Problem p03076 (python)

Fixed submission:
dish = [int(input()) for i in range(5)]
a = [i%10 for i in dish]

x=10
for i in a:
  if i>0:
    x=min(x,i)
if x ==10:
  x = 0
y = a.index(x)
l = dish.pop(y)

time = [(i//10+1)*10  if i%10 != 0 else i for i in dish]

ans = sum(time) + l
print(ans)

Buggy submission (verdict: Runtime Error):
dish = [int(input()) for i in range(5)]
a = [i%10 for i in dish]
x=10
for i in a:
  if i>0:
    x=min(x,i)
y = a.index(x)
l = dish.pop(y)

time = [(i//10+1)*10  if i%10 != 0 else i for i in dish ]

ans = sum(time) + l
print(ans)
Problem p03254 (python)

Fixed submission:
n, x = map(int,input().split())
children = list(map(int,input().split())) 
children.sort()
count=0
c = 0
if x < children[0]:
  print(0)
  exit()
for i in range(n):
  count += children[i]
  c += 1
  if count == x:
    print(c)
    exit()
  elif count > x:
    print(c-1)
    exit()

print(n-1)

Buggy submission (verdict: Runtime Error):
children = list(map(int,input().split())) 
children.sort()
count=0
c = 0
if x < children[0]:
  print(0)
  exit()
for i in range(n):
  count += children[i]
  c += 1
  if count == x:
    print(c)
    exit()
  elif count > x:
    print(c-1)
    exit()

print(n-1)
Problem p03436 (python)

Fixed submission:
from collections import deque

H, W = map(int,input().split())
maze = list(list(input()) for i in range(H))



def bfs(maze,maze_s,sy,sx):
  maze_s[sy][sx] = 0
  queue = deque([[sy,sx]])
  while queue:
    y,x = queue.popleft()
    if maze[y][x] == "g":
      return maze_s[y][x]
    else:
      for j,k in [(0,1),(0,-1),(1,0),(-1,0)]:
        new_y,new_x = y+j, x+k
        if 0 <= new_y <= H-1 and 0 <= new_x <= W-1:
          if maze[new_y][new_x] != "#" and maze_s[new_y][new_x] == -1:
            maze_s[new_y][new_x] = maze_s[y][x] + 1
            queue.append([new_y,new_x])
  else:
    print(-1)
    exit()

maze_s = list([-1] * W for i in range(H))
count = 0
for row in maze:
  count += row.count(".")

maze[H-1][W-1] = "g"

ans = count - bfs(maze,maze_s,0,0) -1
print(ans)

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

H, W = map(int,input().split())
maze = list(list(input()) for i in range(H))



def bfs(maze,maze_s,sy,sx):
  maze_s[sy][sx] = 0
  queue = deque([[sy,sx]])
  while queue:
    y,x = queue.popleft()
    if maze[y][x] == "g":
      return maze_s[y][x]
    else:
      for j,k in [(0,1),(0,-1),(1,0),(-1,0)]:
        new_y,new_x = y+j, x+k
        if 0 <= new_y <= H-1 and 0 <= new_x <= W-1:
          if maze[new_y][new_x] != "#" and maze_s[new_y][new_x] == -1:
            maze_s[new_y][new_x] = maze_s[y][x] + 1
            queue.append([new_y,new_x])

maze_s = list([-1] * W for i in range(H))
count = 0
for row in maze:
  count += row.count(".")

maze[H-1][W-1] = "g"

ans = count - bfs(maze,maze_s,0,0) -1
print(ans)
Problem p02576 (python)

Fixed submission:
q = input().strip().split()
N, X, T = int(q[0]), int(q[1]), int(q[2])
ans = (N + X - 1) // X * T
print(ans)

Buggy submission (verdict: Runtime Error):
q = input().strip().split()
N, X, T = int(q[0]), int(q[1]), int(q[2])
ans = ((N + x) // x - 1) * T
print(ans)
Problem p02616 (python)

Fixed submission:
MOD = 10 ** 9 + 7
it = lambda: list(map(int, input().strip().split()))

def solve():
    N, K = it()
    A = it()
    
    zero = 0
    neg = []
    pos = []
    for i in range(N):
        if A[i] < 0:
            neg.append(A[i])
        elif A[i] > 0:
            pos.append(A[i])
        else:
            zero += 1
    
    if not neg and not pos:
        return 0
    
    pos.sort()
    neg.sort(reverse=True)

    if not pos and K % 2 == 1:
        if zero > 0:
            return 0

        ans = 1
        for i in range(K):
            ans = ans * neg[i] % MOD
        return ans

    ans = 1
    for _ in range(K >> 1):
        if len(pos) >= 2 and len(neg) >= 2:
            if neg[-1] * neg[-2] >= pos[-1] * pos[-2]:
                ans = ans * neg.pop() % MOD * neg.pop() % MOD
            else:
                ans = ans * pos.pop() % MOD * pos.pop() % MOD
        elif len(pos) >= 2:
            ans = ans * pos.pop() % MOD * pos.pop() % MOD
        elif len(neg) >= 2:
            ans = ans * neg.pop() % MOD * neg.pop() % MOD
        elif len(pos) == 1 and len(neg) == 1:
            ans = ans * pos.pop() % MOD * neg.pop() % MOD
        else:
            return 0
    
    if K % 2 == 1:
        if pos:
            ans = ans * pos.pop() % MOD
        elif neg:
            ans = ans * neg.pop() % MOD
        else:
            return 0
    if zero > 1 and ans < 0:
        return 0
    return ans


if __name__ == '__main__':
    print(solve())

Buggy submission (verdict: Runtime Error):
MOD = 10 ** 9 + 7
it = lambda: list(map(int, input().strip().split()))

def solve():
    N, K = it()
    A = it()
    
    neg = []
    pos = []
    for i in range(N):
        if A[i] < 0:
            neg.append(A[i])
        elif A[i] > 0:
            pos.append(A[i])
    
    if not neg and not pos:
        return 0
    
    pos.sort()
    neg.sort(reverse=True)

    if not pos and K % 2 == 1:
        ans = 1
        for i in range(K):
            ans = ans * neg[i] % MOD
        return ans

    ans = 1
    i = 0
    j = 0
    for _ in range(K >> 1):
        if len(pos) >= 2 and len(neg) >= 2:
            if neg[-1] * neg[-2] >= pos[-1] * pos[-2]:
                ans = ans * neg.pop() % MOD * neg.pop() % MOD
            else:
                ans = ans * pos.pop() % MOD * pos.pop() % MOD
        elif len(pos) >= 2:
            ans = ans * pos.pop() % MOD * pos.pop() % MOD
        elif len(neg) >= 2:
            ans = ans * neg.pop() % MOD * neg.pop() % MOD
    
    if K % 2 == 1:
        if pos:
            ans = ans * pos.pop() % MOD
        else:
            ans = ans * neg.pop() % MOD
    return ans


if __name__ == '__main__':
    print(solve())
Problem p02677 (python)

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

theta_M = M*6
theta_H = H*30 + M*0.5

theta = abs(theta_M - theta_H)
if theta > 180:
  theta = 360 - theta
  
import math
x = A**2 + B**2 - 2 * A * B * math.cos(math.radians(theta))
x = math.sqrt(x)
print(x)

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

theta_M = M*6
theta_H = H*30 + M*0.5

theta = abs(theta_M - theta_H)
if theta > 180:
  theta = 360 - theta
  
import math
x = A**2 + B**2 - 2 * 3 * 4 * math.cos(math.radians(theta))
x = math.sqrt(x)
print(x)
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')
Problem p02721 (python)

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

A = list()
B = list()

i = 0
num = 0
while num < K:
  if S[i] == "o":
    A.append(i)
    num += 1
    i += C
  i += 1
i = len(S)-1
num = 0
while num < K:
  if S[i] == "o":
    B.append(i)
    num+=1
    i -= C
  i -= 1
B.sort()

for i,j in zip(A,B):
  if i == j:
    print(i+1)

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

A = list()
B = list()

i = 0
num = 0
while num < K:
  if S[i] == "o":
    A.append(i)
    num += 1
    i += 3
  i += 1
i = len(S)-1
num = 0
while num < K:
  if S[i] == "o":
    B.append(i)
    num+=1
    i -= 3
  i -= 1
B.sort()

for i,j in zip(A,B):
  if i == j:
    print(i+1)
Problem p02817 (python)

Fixed submission:
S,T = input().split()
print("{}{}".format(T,S))

Buggy submission (verdict: Runtime Error):
S,T = input.split()
print(T+S)
Problem p02846 (python)

Fixed submission:
import math

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

sa = A1 * T1
sb = B1 * T1
ea = A2 * T2
eb = B2 * T2
fa = sa + ea
fb = sb + eb

if fa < fb:
  if sa < sb:
    print(0)
  elif sa == sb:
    print(1)
  elif sa > sb:
    d1 = sa - sb
    di = fb - fa
    c = int(d1 / di) + math.ceil(d1 / di)#  + 1
    print(c)
elif fa == fb:
  print("infinity")
elif fa > fb:
  if sa < sb:
    d1 = sb - sa
    di = fa - fb
    c = int(d1 / di) + math.ceil(d1 / di)# + 1
    print(c)
  elif sa == sb:
    print(1)
  elif sa > sb:
    print(0)

Buggy submission (verdict: Runtime Error):
import math

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

sa = A1 * T1
sb = B1 * T1
fa = sa + ea
fb = sb + eb

if fa < fb:
  if sa < sb:
    print(0)
  elif sa == sb:
    print(1)
  elif sa > sb:
    d1 = sa - sb
    di = fb - fa
    c = int(d1 / di) * 2 + 1
    print(c)
elif fa == fb:
  print("infinity")
elif fa > fb:
  if sa < sb:
    d1 = sb - sa
    di = fa - fb
    c = int(d1 / di) * 2 + 1
    print(c)
  elif sa == sb:
    print(1)
  elif sa > sb:
    print(0)
Problem p03000 (python)

Fixed submission:
n, x = input().strip().split()
n = int(n)
x = int(x)
l = input().strip().split()
l = list(map(int, l))
now = 0
for i in range(n):
  now += l[i]
  if now > x:
    print(i+1)
    exit()
print(n+1)

Buggy submission (verdict: Runtime Error):
n, x = input().strip().split()
n = int(n)
x = int(x)
l = input().strip().split()
now = 0
for i in range(n):
  now += l[i]
  if now > x:
    print(i)

Buggy submission (verdict: Runtime Error):
n, x = input().strip().split()
n = int(n)
x = int(x)
l = input().strip().split()
now = 0
for i in range(n):
  now += l[i]
  if now > x:
    print(i)
    exit()
Problem p03228 (python)

Fixed submission:
def present(n):
  if n%2 == 0:
    return n/2
  else:
    return (n-1)/2

s = input()
a, b, k = s.split()
a = int(a)
b = int(b)
for i in range(int(k)):
  if i % 2 == 0:
    a = present(a)
    b = b + a
  else:
    b = present(b)
    a = a + b

print("{} {}".format(int(a),int(b)))

Buggy submission (verdict: Runtime Error):
def present(n):
  if n%2 == 0:
    return n/2
  else:
    return (n-1)/2

s = input()
a, b, k = s.split()

for i in range(int(k)):
  if i % 2 == 0:
    a = present(a)
    b = b + a
  else:
    b = present(b)
    a = a + b

print("{} {}".format(a,b))
Problem p02621 (python)

Fixed submission:
x = int(input())
print(int(x+x**2+x **3))

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

n = int(n)
m = int(m)
k = int(k)
a = list(map(int, a))
b = list(map(int, b))

a.extend(b)
a.sort()

add = 0
cnt = 0
for item in a:
  if add > k:
    break
  add += item
  cnt += 1
print(cnt)
Problem p02657 (python)

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

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

print(a*b)
Problem p02675 (python)

Fixed submission:
n = input()
n = int(n[-1])

if n in [2, 4, 5, 7, 9]:
  ans = 'hon'
elif n in [0, 1, 6, 8]:
  ans = 'pon'
else:
  ans = 'bon'
print(ans)

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

n = n[-1]

if n in [2, 4, 5, 7, 9]:
  ans = 'hon'
elif n in [0, 1, 6, 8]:
  ans = 'pon'
else:
  ans = 'bon'
print(ans)
Problem p02789 (python)

Fixed submission:
a = list(map(int, input().split()))
if a[0] == a[1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = list(map(int, input()))
if a[0] == a[1]:
  print("Yes")
else:
  print("No")