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

Fixed submission:
import sys
input = sys.stdin.readline
A, B, K = [int(x) for x in input().rstrip().split()]
left = [int(x) for x in range(A, A+K)]
right = [int(x) for x in range(B, B-K, -1)]
ans = []
for i in left:
    if i not in ans and i <= B:
        ans.append(i)
for j in right:
    if j not in ans and j >= A:
        ans.append(j)
ans.sort()
for k in ans:
    print(k)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A, B, K = [int(x) for x in input().rstrip().split()]
import numpy as np
x = np.arange(A, B + 1, np.int64)
left = x[:K]
right = x[::-1][:K]
ans = []
for i in left:
    if i not in ans:
        ans.append(i)
for j in right:
    if j not in ans:
        ans.append(j)
ans.sort()
for k in ans:
    print(k)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A, B, K = [int(x) for x in input().rstrip().split()]
import numpy as np
x = np.arange(A, B + 1)
left = x[:K]
right = x[::-1][:K]
ans = []
for i in left:
    if i not in ans:
        ans.append(i)
for j in right:
    if j not in ans:
        ans.append(j)
ans.sort()
for k in ans:
    print(k)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A, B, K = [int(x) for x in input().split()]
import numpy as np
x = np.arange(A, B + 1)
left = x[:K]
right = x[::-1][:K]
ans = []
for i in left:
    if i not in ans:
        ans.append(i)
for j in right:
    if j not in ans:
        ans.append(j)
ans.sort()
for k in ans:
    print(k)
Problem p03408 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
s = []
for _ in range(N):
    s.append(input().rstrip())
M = int(input())
t = []
for _ in range(M):
    t.append(input().rstrip())
from collections import Counter
cs = Counter(s)
ct = Counter(t)
ans = {}
for i in cs.keys():
    ans[i] = cs[i] - ct[i]
ans_max = max(ans.values())
print(max(0, ans_max))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
s = []
for _ in range(N):
    s.append(input().rstrip())
M = int(input())
t = []
for _ in range(M):
    t.append(input().rstrip())
from collections import Counter
cs = Counter(s)
ct = Counter(t)
ans = {}
for i in cs.keys():
    ans[i] = cs[i] - ct[i]
print(max(ans.values(), 0))
Problem p03424 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip().split()
from collections import Counter
c = Counter(S)
if len(c.keys()) == 4:
    print("Four")
else:
    print("Three")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip().split()
from collections import Counter
c = Counter(S)
if len(c.keys) == 4:
    print("Four")
else:
    print("Three")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
S = input().rstrip().split()
from collections import Counter
c = Counter(s)
if len(c.keys) == 4:
    print("Four")
else:
    print("Three")
Problem p03438 (python)

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

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
cnt = sum(b) - sum(a)
diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt + sum(diff1) # 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
a_add -= sum(c)
b_add -= sum(c)
if a_add*2 == b_add and a_add >= 0 and b_add >= 0:
    print("Yes")
else:
    print("No")

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

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt + sum(diff1) # 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
a_add -= sum(c)
b_add -= sum(c)
if a_add*2 == b_add:
    print("Yes")
else:
    print("No")
Problem p03447 (python)

Fixed submission:
import sys
input = sys.stdin.readline
X = int(input())
A = int(input())
B = int(input())
X -= A
X %= B
print(X)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ed = [[] for _ in range(n)]  # グラフ
v = [float('inf')] * n
for _ in range(m):
  l, r, d = map(int, input().split())
  ed[l-1].append((r-1, d))  # l -> r
  ed[r-1].append((l-1, -d))  # r -> l

visited = [0] * n  # 訪問フラグ（非連結の可能性の為）

def dfs(start):
  s = [start]
  v[start] = 0
  while s:
    label = s.pop()
    if visited[label] == False:
      visited[label] = True
      for to, dist in ed[label]:
        if v[to] == float('inf'):
          v[to] = v[label] + dist
          s.append(to)
        else:
          if v[to] != v[label] + dist:
            return False
  return True

is_exist = True
for i in range(n):
  if v[i] is None:
    if not dfs(i):
      print('No')
      is_exist = False
      break
if is_exist:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ed = [[] for _ in range(n)]  # グラフ
v = [None] * n
for _ in range(m):
  l, r, d = map(int, input().split())
  ed[l-1].append((r-1, d))  # l -> r
  ed[r-1].append((l-1, -d))  # r -> l

visited = [0] * n  # 訪問フラグ（非連結の可能性の為）

def dfs(start):
  s = [start]
  v[start] = 0
  while s:
    label = s.pop()
    if visited[label] == False:
      visited[label] = True
      for to, dist in ed[label]:
        if v[to] == 0:
          v[to] = v[label] + dist
          s.append(to)
        else:
          if v[to] != v[label] + dist:
            return False
  return True

is_exist = True
for i in range(n):
  if v[i] is None:
    if not dfs(i):
      print('No')
      is_exist = False
      break
if is_exist:
  print("Yes")
Problem p03486 (python)

Fixed submission:
import sys
input = sys.stdin.readline
s = list(input().rstrip())
t = list(input().rstrip())
s = sorted(s)
t = sorted(t, reverse=True)
alpha2num = lambda c: ord(c) - ord("a")
if s == t:
    print("No")
    sys.exit()
for i in range(min(len(s), len(t))):
    x, y = s[i], t[i]
    if alpha2num(x) < alpha2num(y):
        print("Yes")
        sys.exit()
    elif alpha2num(x) > alpha2num(y):
        print("No")
        sys.exit()
if len(t) > len(s):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
alpha2num = lambda c: ord(c) - ord("a")
if s == t:
    print("No")
    sys.exit()
for i in range(min(len(s), len(t))):
    x, y = s[i], t[j]
    if alpha2num(x) < alpha2num(y):
        print("Yes")
        sys.exit()
    elif alpha2num(x) > alpha2num(y):
        print("No")
        sys.exit()
if len(t) > len(s):
    print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
alpha2num = lambda c: ord(c) - ord("a")
if s == t:
    print("No")
    sys.exit()
for i in range(min(len(s), len(t))):
    if alpha2num(i) < alpha2num(j):
        print("Yes")
        sys.exit()
    elif alpha2num(i) > alpha2num(j):
        print("No")
        sys.exit()
if len(t) > len(s):
    print("Yes")
Problem p03501 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N, A, B = [int(x) for x in input().split()]
print(min(A * N, B))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, A, B = [int(x) for x in input().split()]
print(min(A * T, B))
Problem p03504 (python)

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

N, C = [int(x) for x in input().split()]
imos = [0]*(10**6 + 2)
stc = [[] for _ in range(31)]
for _ in range(N):
    tmp = [int(x) for x in input().split()]
    stc[tmp[2]].append([tmp[0], tmp[1]])

for i in range(C + 1):
    if len(stc[i]) == 0:
        continue
    stc[i].sort()
    s, t = stc[i][0][0], stc[i][0][1]
    new_stc_i = []
    flag = 1
    for j in range(1, len(stc[i])):
        flag = 0
        if t == stc[i][j][0]:
            t = stc[i][j][1]
            flag = 1
        else:
            new_stc_i.append([s, t])
            s = stc[i][j][0]
            t = stc[i][j][1]
    if flag:
        new_stc_i.append([s, t])
    stc[i] = new_stc_i

for i in range(C + 1):
    stc_i = stc[i]
    for j in stc_i:
        s, t = j 
        s *= 10
        t *= 10
        imos[max(0, s - 5)] += 1
        imos[t] -= 1

from itertools import accumulate

csum = list(accumulate(imos))

print(max(csum))

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

N, C = [int(x) for x in input().split()]
imos = [0]*(10**6 + 1)

for _ in range(N):
    s, t, c = [int(x) for x in input().split()]
    s *= 10
    t *= 10
    imos[max(0, s - 5)] += 1
    imos[t + 1] -= 1

from itertools import accumulate

csum = list(accumulate(imos))

print(max(csum))

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

N, C = [int(x) for x in input().split()]
imos = [0]*(10**6 + 1)

for _ in range(N):
    s, t, c = [int(x) for x in input().split()]
    s *= 10
    t *= 10
    imos[s - 5] += 1
    imos[t + 1] -= 1

from itertools import accumulate

csum = list(accumulate(imos))

print(max(csum))
Problem p03524 (python)

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

s = input().rstrip()

from collections import Counter

c = Counter(s)

if len(s) == 1:
    print("YES")
    sys.exit()

if len(c.keys()) == 1:
    print("NO")
    sys.exit()

values = list(c.values())
values.sort()

if len(c.keys()) == 2:
    if values[0] == 1 and values[1] == 1:
        print("YES")
    else:
        print("NO")
    sys.exit()

values[1] -= values[0]
values[2] -= values[0]

if values[1] == 1 and values[2] == 1:
    print("YES")
elif values[1] == 0 and values[2] == 1:
    print("YES")
elif values[1] == 1 and values[2] == 0:
    print("YES")
elif values[1] == 0 and values[2] == 0:
    print("YES")
else: 
    print("NO")
sys.exit()

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

s = input().rstrip()

from collections import Counter

c = Counter(s)

if n == 1:
    print("YES")
    sys.exit()

if len(c.keys()) == 1:
    print("NO")
    sys.exit()

values = list(c.values())
values.sort()

if len(c.keys()) == 2:
    if values[0] == 1 and values[1] == 1:
        print("YES")
    else:
        print("NO")
    sys.exit()

values[1] -= values[0]
values[2] -= values[0]

if values[1] == 1 and values[2] == 1:
    print("YES")
elif values[1] == 0 and values[2] == 1:
    print("YES")
elif values[1] == 1 and values[2] == 0:
    print("YES")
else: 
    print("NO")
sys.exit()
Problem p03565 (python)

Fixed submission:
import copy
import sys
S = input()
T = input()
if len(T) > len(S):
    print("UNRESTORABLE")
    sys.exit()
I = []
S1 = []
for k in range(len(S)):
    if S[k] == '?':
        S1.append("a")
    else:
        S1.append(S[k])
for i in range(len(S)-len(T) + 1):
    S_ = copy.deepcopy(S1)
    flag = 1
    for j in range(i, i + len(T)):
        if S[j] != T[j-i] and S[j] != "?":
            flag = 0
            break
        else:
            S_[j] = T[j-i]     
    if flag:
        temp = ''.join(S_)
        I.append(temp)
S_ = S_.sort()
if len(I) > 0:
    print(I[-1])
else:
    print("UNRESTORABLE")

Buggy submission (verdict: Runtime Error):
import copy
S = input()
T = input()
I = []
S1 = []
for k in range(len(S)):
    if S[k] == '?':
        S1.append("a")
    else:
        S1.append(S[k])
for i in range(len(S)-len(T) + 1):
    S_ = copy.deepcopy(S1)
    flag = 1
    for j in range(i, i + len(T)):
        if S[j] != T[j-i] and S[j] != "?":
            flag = 0
            break
        else:
            S_[j] = T[j-i]     
    if flag:
        temp = ''.join(S_)
        I.append(temp)
S_ = S_.sort()
if len(I) > 0:
    print(I[-1])
else:
    print("UNRESTORABLE")

Buggy submission (verdict: Runtime Error):
import copy
S = input()
T = input()
I = []
S1 = []
for k in range(len(S)):
    if S[k] == '?':
        S1.append("a")
    else:
        S1.append(S[k])
for i in range(len(S)-len(T) + 1):
    S_ = copy.deepcopy(S1)
    flag = 1
    for j in range(i, i + len(T)):
        if S[j] != T[j-i] and S[j] != "?":
            flag = 0
            break
        else:
            S_[j] = T[j-i]     
    if flag:
        temp = ''.join(S_)
        I.append(temp)
S_ = S_.sort()
if len(I) > 0:
    print(I[0])
else:
    print("UNRESTORABLE")
Problem p03599 (python)

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

A, B, C, D, E, F = [int(x) for x in input().split()]

ans = [0, 0, -1]

for x in range((30 // A) + 1):
    for y in range((30 // B) + 1):
        if 100 * (A * x + B * y) > F or x + y == 0:
            continue
        a = 100 * (A * x + B * y)
        for z in range(1 + ((a // 100) * E) // C):
            b = C * z + D * (((a // 100) * E - C * z) // D)
            b_2 = C * z + D * ((F - (a + C * z)) // D)
            if b + a > F or b > (a // 100) * E:
                b = 0
            if b_2 + a > F or b_2 > (a // 100) * E:
                b_2 = 0
            b = max(b, b_2)
            if b / (a + b) > ans[-1]:
                ans = [a + b, b, b / (a + b)]

print(ans[0], ans[1])

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

A, B, C, D, E, F = [int(x) for x in input().split()]

ans = [0, 0, -1]

for x in range((30 // A) + 1):
    for y in range((30 // B) + 1):
        if 100 * (A * x + B * y) > F:
            continue
        a = 100 * (A * x + B * y)
        for z in range(1 + ((a // 100) * E) // C):
            b = C * z + D * (((a // 100) * E - C * z) // D)
            if b + a > F or b > a * E:
                continue
            if b / (a + b) > ans[-1]:
                ans = [a + b, b, b / (a + b)]

print(ans[0], ans[1])
Problem p03610 (python)

Fixed submission:
import sys
input = sys.stdin.readline
s = list(input().rstrip())
S = s[::2]
print("".join(S))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
s = list(input().rsteip())
S = s[1::2]
print("".join(S))
Problem p03645 (python)

Fixed submission:
import sys
import numpy as np
input = sys.stdin.readline
N, M = [int(x) for x in input().split()]
I = []
for _ in range(M):
    I.append([int(x) for x in input().split()])
s_1 = set()
s_N = set()
for i in I:
    if i[0] == 1 and i[1] == N:
        print("POSSIBLE")
        sys.exit()
    if i[0] == 1:
        if i[1] in s_N:
            print("POSSIBLE")
            sys.exit()
        s_1.add(i[1])
    if i[1] == N:
        if i[0] in s_1:
            print("POSSIBLE")
            sys.exit()
        s_N.add(i[0])
for j in s_1:
    if j in s_N:
        print("POSSIBLE")
        sys.exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
input = sys.stdin.readline
N, M = [int(x) for x in input().split()]
I = []
for _ in range(M):
    I.append([int(x) for x in input().split()])
s_1 = {}
s_N = {}
for i in I:
    if i[0] == 1 and i[1] == N:
        print("POSSIBLE")
        sys.exit()
    if i[0] == 1:
        if i[1] in s_N:
            print("POSSIBLE")
            sys.exit()
        s_1.add(i[1])
    if i[1] == N:
        if i[0] in s_1:
            print("POSSIBLE")
            sys.exit()
        s_N.add(i[0])
for j in s_1:
    if j in s_N:
        print("POSSIBLE")
        sys.exit()
print("IMPOSSIBLE")
Problem p03658 (python)

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

N, K = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
l = sorted(l, reverse=True)
print(sum(l[:K]))

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

N, K = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
l = sorted(l, reverse=True)
print(sum(l[K]))
Problem p03660 (python)

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

#O(ElogV)
import heapq
def dijkstra_heap(s):
    #始点sから各頂点への最短距離
    d = [float("inf")] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d

################################
n = int(input()) #n:頂点数　w:辺の数
w = n - 1

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列
for i in range(w):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    z = 1
    edge[x].append([z,y])
    edge[y].append([z,x]) 

dis_from_f = dijkstra_heap(0)
dis_from_s = dijkstra_heap(n - 1)

cnt = 0
for i, j in zip(dis_from_f, dis_from_s):
    if i <= j:
        cnt += 1
if cnt > n - cnt:
    print("Fennec")
else:
    print("Snuke")

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

import heapq
def dijkstra(s):
    # 始点sから各頂点への最短距離
    d = [float('inf')]*n
    d[s] = 0
    # 各頂点が訪問済みかどうか
    used = [False]*n
    used[s] = True
    # 仮の距離を記録するヒープ
    que = []
    for e in edge[s]:
        heapq.heappush(que, e)
    while que:
        minedge = heapq.heappop(que)
        if used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = True
        for e in edge[v]:
            if not used[e[1]]:
                heapq.heappush(que, [e[0] + d[v], e[1]])
    return d

################################
n = int(input()) #n:頂点数　w:辺の数
w = n - 1

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列
for i in range(w):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    z = 1
    edge[x].append([z,y])
    edge[y].append([z,x]) 

dis_from_f = dijkstra_heap(0)
dis_from_s = dijkstra_heap(n - 1)

cnt = 0
for i, j in zip(dis_from_f, dis_from_s):
    if i <= j:
        cnt += 1
if cnt > n - cnt:
    print("Fennec")
else:
    print("Snuke")
Problem p03697 (python)

Fixed submission:
import sys
input = sys.stdin.readline
A, B = [int(x) for x in input().split()]
if A + B >= 10:
    print("error")
else:
    print(A + B)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A, B = [int(x) for x in inpput().split()]
if A + B >= 10:
    print("error")
else:
    print(A + B)
Problem p03711 (python)

Fixed submission:
import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
for i in [A, B, C]:
    if x in i and y in i:
        print("Yes")
        sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
x, y = [int(x) for x in input().split()]
for i in [A, B, C]:
    if x in i and y in i:
        print("Yes")
        sys.exit()
print("No")
Problem p03730 (python)

Fixed submission:
import sys
input = sys.stdin.readline
A, B, C = [int(x) for x in input().split()]
AmodB = A % B
if AmodB == 0:
    if C == 0:
        print("YES")
        sys.exit()
    else:
        print("NO")
        sys.exit()

mod = [AmodB]
i = AmodB
while True:
    if C in mod:
        print("YES")
        sys.exit()
    i += AmodB
    i %= B
    if i in mod:
        print("NO")
        sys.exit()
    else:
        mod.append(i)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A, B, C = [int(x) for x in input().split()]
AmodB = A % B
if C % AmodB == 0:
    print("YES")
else:
    print("NO")
Problem p03759 (python)

Fixed submission:
import sys
input = sys.stdin.readline
a, b, c = [int(x) for x in input().split()]
if b - a == c - b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
a, b, c = input().split()
if b - a == c - b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
A, B, C = input().split()
if b - a == c - b:
    print("YES")
else:
    print("NO")
Problem p03861 (python)

Fixed submission:
import sys
input = sys.stdin.readline
a, b, x = [int(x) for x in input().split()]
B = 1 + b // x
if a == 0:
    print(B)
elif a % x == 0:
    A = 1 + a // x
    print(B - A + 1)
else:
    A = 1 + a // x
    print(B - A)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
a, b, x = [int(x) for x in input().split()]
B = 1 + b // x
if a == 0:
    print(B)(
elif a % x == 0:
    A = 1 + a // x
    print(B - A + 1)
else:
    A = 1 + a // x
    print(B - A)
Problem p04001 (python)

Fixed submission:
S = input()
s = S[0]
ans = 0
def dfs(n,S,s):
    global ans
    s_0 = s + "+" + S[n]
    s_1 = s + S[n]
    if n == len(S) - 1:
        ans += eval(s_0) + eval(s_1)
    else:
        dfs(n+1,S,s_0)
        dfs(n+1,S,s_1)
if len(S) == 1:
    print(int(S))
else:
    dfs(1,S,s)
    print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
s = S[0]
ans = 0
def dfs(n,S,s):
    global ans
    s_0 = s + "+" + S[n]
    s_1 = s + S[n]
    if n == len(S) - 1:
        ans += eval(s_0) + eval(s_1)
    else:
        dfs(n+1,S,s_0)
        dfs(n+1,S,s_1)
dfs(1,S,s)
print(ans)
Problem p04030 (python)

Fixed submission:
import sys
input = sys.stdin.readline
ans = []
s = list(input().rstrip())
for i in s:
    if i == "0":
        ans.append("0")
    elif i == "1":
        ans.append("1")
    elif len(ans) > 0:
        ans.pop()
print("".join(ans))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
ans = []
s = list(input().rstrip())
for i in s:
    if s == "0":
        ans.apppend("0")
    elif s == "1":
        ans.append("1")
    else:
        ans.pop()
print("".join(ans))
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())
print((H + A-1)//A)

Buggy submission (verdict: Runtime Error):
H, A = list(map(int, input().split))
print((H + A-1)//A)
Problem p02786 (python)

Fixed submission:
H = int(input())
A = []
A.append((H, 1))
ans = 0
while len(A) > 0:
    h, c = A[0]
    A.pop(0)
    ans += c
    if h != 1:
        A.append((h//2, c*2))
print(ans)

Buggy submission (verdict: Runtime Error):
H = int(input())
A = []
A.append((A, 1))
ans = 0
while len(A) > 0:
  h, c = A[0]
  A.pop(0)
  ans += c
  A.append((h//2, c*2))
print(ans)
Problem p03436 (python)

Fixed submission:
import queue
H, W = list(map(int, input().split()))
S = list()
for i in range(H) :
    t = input()
    S.append(t)
dist = [[3000 for j in range(W)] for i in range(H)]
dx = [-1, 0, 1, 0]
dy = [0, -1, 0, 1]
q = queue.Queue()
dist[0][0] = 0
q.put([0, 0])
while q.empty() == False:
    x, y = q.get()
    for i in range(4) :
        nx = x + dx[i]
        ny = y + dy[i]
        if nx >= 0 and ny >= 0 and nx < W and ny < H :
            if S[ny][nx] == '.' and dist[ny][nx] > dist[y][x] + 1 :
                dist[ny][nx] = dist[y][x] + 1
                q.put([nx, ny])
cnt = 0
for i in range(H) :
    for j in range(W) :
        if S[i][j] == '.' :
            cnt += 1
print(-1 if dist[H-1][W-1] == 3000 else cnt - dist[H-1][W-1] - 1)

Buggy submission (verdict: Runtime Error):
import queue
H, W = list(map(int, input().split()))
S = list()
S.append(input() for i in range(H))
dist = [[3000 for j in range(W)] for i in range(H)]
dx = [-1, 0, 1, 0]
dy = [0, -1, 0, 1]
q = queue.Queue()
dist[0][0] = 0
q.put([0, 0])
while q.empty() == False:
    x, y = q.get()
    for i in range(4) :
        nx = x + dx[i]
        ny = y + dy[i]
        if nx >= 0 and ny >= 0 and nx < W and ny < H :
            if S[ny][nx] == '.' and dist[ny][nx] > dist[y][x] + 1 :
                dist[ny][nx] = dist[y][x] + 1
                q.put([nx, ny])
cnt = 0
for i in range(H) :
    for j in range(W) :
        if S[i][j] == '.' :
            cnt += 1
print(-1 if dist[H-1][W-1] == 3000 else cnt - dist[H-1][W-1] - 1)