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

Fixed submission:
N = int(input())
ans = 0

for i in range(N + 1):
  if i % 3 == 0 or i % 5 == 0:
    ai = 0 
  else:
    ai = i
  
  ans = ans + ai

print(ans)

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

for i in range(N + 1):
  if i % 15 == 0:
    ai = 0
  if i % 3 == 0 and i % 5 =! 0:
    ai = 0
  if i % 3 =! 0 and i % 5 == 0:
    ai = 0
  else:
    ai = i
  
  ans = ans + ai

print(ans)

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

for i in range(N + 1):
  if i % 15 == 0:
    ai = FizzBuzz
  if i % 3 == 0 and i % 5 =! 0:
    ai = Fizz
  if i % 3 =! 0 and i % 5 == 0:
    ai = Buzz
  else:
    ai = i
  
  ans = ans + ai

print(ans)
Problem p02723 (python)

Fixed submission:
s = list(input())
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
if s[3] == s[4] and s[5] == s[6]:
  print('Yes')
else:
  print('No')
Problem p02729 (python)

Fixed submission:
n, m = map(int, input().split())

p = n * (n - 1) // 2 + m * (m - 1) // 2

print(p)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())

if n = 0:
  pn = 0
  
if m = 0:
  pm = 0

else:
  pn = n*(n-1) // 2
  pm = m*(m-1) // 2

p = pn + pm
print(p)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
import math
if n <= 1:
  pn = 0
  if m <= 1:
    pm = 0
  else:
    pm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))
elif m >= 2:
  pn = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))
  pm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))

p = pn + pm
print(p)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
import math
pn = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))
pm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))
p = pn + pm
print(p)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
import math
pn = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
pm = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(pn + pm)
Problem p02759 (python)

Fixed submission:
n = int(input())
if n % 2 == 0:
  ans = n // 2
else:
  ans = n // 2 + 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 = 0:
  ans = n // 2
if n % 2 = 1:
  ans = n // 2 + 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 = 0:
  ans = n // 2
if n % 2 = 1:
  ans = n //2 + 1
print(ans)
Problem p02859 (python)

Fixed submission:
n = int(input())
s = n*n
print(s)

Buggy submission (verdict: Runtime Error):
s = r*r
Problem p03723 (python)

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

if a==b==c and a%2==0:
    print(-1)
else:
    num=0
    while True:
        if a%2==1 or b%2==1 or c%2==1:
            break
        num+=1
        l0=(b+c)/2
        l1=(c+a)/2
        l2=(a+b)/2
        a,b,c=l0,l1,l2
    print(num)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,open(0).read().split())

if a==b==c and a%2==0:
    print(-1)
else:
    num=0
    while true:
        if a%2==1 or b%2==1 or c%2==1:
            break
        else:
            l=[(b+c)/2,(c+a)/2,(a+b)/2]
            num+=1
            l=[(l[1]+l[2])/2, (l[2]+l[0])/2, (l[0]+l[2])/2]
            a=l[0]
            b=l[1]
            c=l[2]
    else:
        print(num)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,open(0).read().split())

if a==b==c and a%2==0:
    print(-1)
else:
    num=0
    while true:
        if a%2==1 or b%2==1 or c%2==1:
            break
        else:
            l=[(b+c)/2,(c+a)/2,(a+b)/2]
            num+=1
            l=[(l[1]+l[2])/2, (l[2]+l[0])/2, (l[0]+l[2])/2]
            a,b,c=l[0],l[1],l[2]
    else:
        print(num)
Problem p02753 (python)

Fixed submission:
a=input()
flag=False
if a[0]!=a[1]:
    flag=True
if a[1]!=a[2]:
    flag=True

if flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
if (a=="AAA" || a=="BBB"):
    print("No")
else:
    print("Yes")
Problem p02701 (python)

Fixed submission:
def actual(N, s_list):
    return len(set(s_list))

N = int(input())

s_list = []

for _ in range(N):
  s = input()
  s_list.append(s)
    
print(actual(N, s_list))

Buggy submission (verdict: Runtime Error):
def actual(N, s_list):
    return len(set(s_list))

N = int(input())

s_list = []

for _ in range(N)
	s = input()
  	s_list.append(s)
    
print(actual(N, s_list))
Problem p02954 (python)

Fixed submission:
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  s = input()
  n = len(s)
  ans = [1]*n
  for i in range(0, n-2):
    if s[i] == "R" and s[i+1] == "R":
      ans[i+2] += ans[i]
      ans[i] = 0
  for i in range(n-1, -1, -1):
    if s[i] == "L" and s[i-1] == "L":
      ans[i-2] += ans[i]
      ans[i] = 0
  print(*ans)
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

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


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    s = input()
    n = len(s)
    cnt = 0
    ans = [0] * n
    for i, moji in enumerate(s):
        if moji == "R":
            cnt += 1
            continue
        else:
            even_num = cnt//2
            odd_num = cnt - even_num
            ans[i] += even_num
            ans[i-1] += odd_num
            cnt = 0

    cnt = 0
    for i in range(n-1, -1, -1):
        if s[i] == "L":
            cnt += 1
            continue
        else:
            even_num = cnt // 2
            odd_num = cnt - even_num
            ans[i] += even_num
            ans[i+1] += odd_num
            cnt = 0
    print(*ans)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
#SA = sorted(A)

D = []
for _ in range(M):
  B, C = map(int, input().split())
  D.append([B, C])

SD = sorted(D, key=lambda x:x[1], reverse=True)

for b, c in SD:
  A += b * [c]
  if len(A) > N*2:
    break

SA = sorted(A, reverse=True)
#X = min(N, len(SD))
#SD = SD[:X]

print(sum(SA[:N]))

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

D = []
for _ in range(M):
  B, C = map(int, input().split())
  D += B * [C]
SD = sorted(D, reverse=True)
SD = SD[:min(N, len(SD))]

for i in range(N):
  if SD[i] > SA[i]:
    SA[i] = SD[i]
print(sum(SA))

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

D = []
for _ in range(M):
  B, C = map(int, input().split())
  D += B * [C]
SD = sorted(D, reverse=True)
SD = SD[:min(N, len(SD))]

for i, s in enumerate(SA):
  if SD[i] > s:
    SA[i] = SD[i]
print(sum(SA))
Problem p03077 (python)

Fixed submission:
N = int(input())

A = []
for _ in range(5):
  A.append(int(input()))
  
import math
L = math.ceil(N/min(A))

print(5 + L - 1)

Buggy submission (verdict: Runtime Error):
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n = int(input())
  nums = []
  for i in range(n):
    nums.append(int(input()))
  
  min_num = min(nums)
  print(math.ceil(n/min_num)+4)
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()
Problem p03821 (python)

Fixed submission:
def count_baisuu(a, b):
  return b - (a % b)
  
def main():
  n = int(input())
  alist = []
  blist = []
  ab = []
  for i in range(n):
    a, b = input_list()
    ab.append((a, b))
    alist.append(a)
    blist.append(b)
  
  s = 0
  res = 0
  for i in range(n-1, -1, -1):
    alist[i] += res
    
    if alist[i] % blist[i] == 0:
      continue
    res += blist[i] - (alist[i]%blist[i])
  print(res)
  exit()
  dp = [0]*n
  i = n - 1
  res = 0
  for a, b in reversed(ab):
    if i != n-1:
      res += dp[i]
    a += res
    if a % b == 0:
      continue
    if a < b:
      dp[i] = b - a
    else:
      dp[i] = count_baisuu(a, b)
    i -= 1
  print(dp)
  
  

import math
import fractions
from functools import reduce


def input_list():
  return map(int, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
main()

Buggy submission (verdict: Runtime Error):
def count_baisuu(a, b):
  return b - (a % b)
  
def main():
  n = int(input())
  alist = []
  blist = []
  ab = []
  for i in range(n):
    a, b = input_list()
    ab.append((a, b))
    alist.append(a)
    blist.append(b)
    
  dp = [0]*n
  i = n - 1
  for a, b in reversed(ab):
    if i != n-1:
      a += sum(dp)
    if a % b == 0:
      continue
    if a < b:
      dp[i] = b - a
    else:
      dp[i] = count_baisuu(a, b)
    i -= 1
  print(sump(dp))
  
  

import math
import fractions
from functools import reduce


def input_list():
  return map(int, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
main()
Problem p03011 (python)

Fixed submission:
p, q, r = map(int, input().split())

print(min(min(p+q, q+r), p+r))

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

w = list(map(int, input().split()))

subs = []
s = 0
for i in range(n):
    s += w[i]
    subs.append(s)

ans = 1000
for i in range(n-1):
    a = abs(subs[-1] - 2*subs[i])
    ans = min(ans, a)

print(ans)
Problem p03135 (python)

Fixed submission:
T, X = map(int, input().split())
  
ans = T / X
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
for i in range(M-1):
  dif = X[i+1] -X[i]
  diff.append(dif)
  
diff.sort()
 
for n in range(N):
  diff.pop(-1)
 
for i in range(len(diff)):
  ans += diff[i]

print(ans)
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
if (N < M): 
    for i in range(M-1):
        dif = X[i+1] - X[i]
        diff.append(dif)
    
    diff.sort()
    
    for i in range(M-N):
        ans += diff[i]
    # for n in range(N):
    #     diff.pop(-1)
   
    # for i in range(len(diff)):
    #     ans += diff[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
for i in range(M-1):
  dif = X[i+1] -X[i]
  diff.append(dif)
  
diff.sort()
 
for n in range(N):
  diff.pop(-1)
 
for i in range(len(diff)):
  ans += diff[i]

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
for i in range(M-1):
  dif = X[i+1] -X[i]
  diff.append(dif)
  
diff.sort()
 
for n in range(N):
  diff.pop(-1)
 
for i in range(len(diff)):
  ans += diff[i]

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []

X.sort()

for i in range(M-1):
  dif = X[i+1] -X[i]
  diff.append(dif)
  
diff.sort()

for n in range(N):
  diff.pop(-1)

for i in range(len(diff)):
  ans += diff[i]
Problem p03767 (python)

Fixed submission:
import sys 
n = int(input())

a = list(map(int, sys.stdin.readline().split()))

sorted_a = sorted(a)
reversed_a = sorted(a, reverse=True)

aa = []
for i in range(n):
    sorted_a.pop(-1)
    reversed_a.pop(-1)
    aa.append(sorted_a.pop(-1))

print(sum(aa))

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

a = list(map(int, input().split()))

sorted_a = sorted(a)
reversed_a = reversed(a)

aa = []
for i in range(3*n):
    sorted_a.pop(-1)
    reversed_a.pop(-1)
    aa.append(sorted_a.pop(-1))

print(sum(aa))
Problem p02762 (python)

Fixed submission:
n, m, k = map(int, input().split())

f_adj_list = [[] for i in range(n)]
b_adj_list = [[] for i in range(n)]

for i in range(m):
  _, __ = map(int, input().split())
  _ -= 1
  __ -= 1
  f_adj_list[_].append(__)
  f_adj_list[__].append(_)
  
for j in range(k):
  _, __ = map(int, input().split())
  _ -= 1
  __ -= 1
  b_adj_list[_].append(__)
  b_adj_list[__].append(_)
  
  
group_id = [None for i in range(n)]
for i in range(n):
  if group_id[i] is not None: continue
  # i から DFS
  newly_visited = [i]
  group_id[i] = i
  while len(newly_visited) > 0:
    now = newly_visited.pop()
    for j in f_adj_list[now]:
      if group_id[j] is not None: continue
      newly_visited.append(j)
      group_id[j] = i

# group_id
# print(group_id)

# 連結成分のサイズ
from collections import Counter
cnt = Counter(group_id)
# cnt[5] = 7

ans_list = []
for i in range(n):
  ans = cnt[group_id[i]]
  ans -= 1 # 自分自身
  ans -= len(f_adj_list[i]) # 直接の友達
  for j in b_adj_list[i]:
    if group_id[i] == group_id[j]:
      ans -= 1
  ans_list.append(ans)

print(" ".join(map(str, ans_list)))

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

f_adj_list = [[] for i in range(n)]
b_adj_list = [[] for i in range(n)]

for i in range(m):
  _, __ = map(int, input().split())
  _ -= 1
  __ -= 1
  f_adj_list[_].append(__)
  f_adj_list[__].append(_)
  
for j in range(k):
  _, __ = map(int, input().split())
  _ -= 1
  __ -= 1
  b_adj_list[_].append(__)
  b_adj_list[__].append(_)
  
  
group_id = [None for i in range(n)]
for i in range(n):
  # i から DFS
  newly_visited = [i]
  group_id[i] = i
  while len(newly_visited) > 0:
    now = newly_visited.pop()
    for j in f_adj_list[now]:
      if group_id[j] is not None: continue
      newly_visited.append(j)
      group_id[j] = i

# group_id
# print(group_id)

# 連結成分のサイズ
from collections import Counter
cnt = Counter(group_id)
# cnt[5] = 7

ans_list = []
for i in range(n):
  ans = cnt[group_id[i]]
  ans -= 1 # 自分自身
  ans -= len(f_adj_list[i]) # 直接の友達
  for j in b_adj_list[i]:
    if group_id[i] == group_id[j]:
      ans -= 1
  ans_list.append(ans)

print(" ".join(ans_list))
Problem p02880 (python)

Fixed submission:
n=int(input())
for i in range(1,10):
    for j in range(1,10):
        if n==i*j:
            print("Yes")
            exit()
print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1,10):
  for j in range(1,10):
    if n==i*j:
      print("Yes")
	  exit()
print("No")
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(input())
K -= 1
if S[K] == "A":
    S[K] = "a"
elif S[K] == "B":
    S[K] = "b"
elif S[K] == "C":
    S[K] = "c"


print("".join(S))

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    from collections import deque
    input = sys.stdin.readline
    N = int(input())
    color = [-1] * N
    color[0] = 0
    uvw = []
    edge = [[]for _ in range(N)]
    # append=uvw.append
    for i in range(N-1):
        ui, vi, wi = map(int, input().split())
        ui -= 1
        vi -= 1
        edge[ui].append((vi, wi))
        edge[vi].append((ui, wi))
    stack = [0]
    for i in range(N):
        tmp = deque()
        while stack:
            i = stack.pop()
            for e, w in edge[i]:
                if color[e] == -1:
                    stack.append(e)
                    if color[i] == 0:
                        if w % 2 == 0:
                            color[e] = 0
                        else:
                            color[e] = 1
                    else:
                        if w % 2 == 0:
                            color[e] = 1
                        else:
                            color[e] = 0
                # ここを追加--------------------------------------
                # 矛盾判定
                else:
                    if (color[i] == color[e]) != (w % 2 == 0):
                        print(-1)
                        exit()
                # ^^^^^^^^--------------------------------------
        # print(color)
        stack = tmp
    print(*color, sep="\n")


if __name__ == '__main__':
    main()
Problem p03053 (python)

Fixed submission:
def main():
    from collections import deque
    H, W = map(int, input().split())
    grid = [["#"] * (W + 2)] + [list("#" + input() + "#")
                                for i in range(H)] + [["#"]*(W+2)]
    # print(grid)
    stack = deque()
    for h in range(1, H+1):
        for w in range(1, W+1):
            # 黒ならスタックにpush
            if grid[h][w] == "#":
                stack.append([h, w])

    for i in range(h + w + 3):
        tmp = deque()
        while stack:
            h, w = stack.pop()
            for dh, dw in ([0, 1], [0, -1], [1, 0], [-1, 0]):
                if grid[h + dh][w + dw] == ".":
                    grid[h + dh][w + dw] = "#"
                    tmp.append([h + dh, w + dw])
        stack = tmp
        if not stack:
            print(i)
            break


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()

left = 1
right = W
up = 1
down = H

for i in reversed(range(N)):
    if i != N - 1:
        if T[i] == "U":
            if down != H:
                down -= 1
        elif T[i] == "D":
            if up != 1:
                up += 1
        elif T[i] == "L":
            if right != W:
                right += 1
        else:
            if left != 1:
                left -= 1
    if S[i] == "U":
        up -= 1
    elif S[i] == "D":
        down += 1
    elif S[i] == "L":
        left += 1
    else:
        right -= 1
    if left == right or up == down:
        print("NO")
        exit()
if left <= sr <= right and up <= sc <= down:
    print("YES")
else:
    print("NO")
Problem p03107 (python)

Fixed submission:
s = input()
S = [int(s[i]) for i in range(len(s))]
# print(S)
count = 0
before = 0
while 1:
    #print("S:", S)
    is_continue = False
    # print(len(S))
    #deleted = False
    for i in range(max([before, 0]), len(S) - 1):
        #print(before, i)
        #print(S[i], S[i + 1])
        # print(S)
        if S[i] != S[i + 1]:
            # print(count)
            del S[i]
            del S[i]
            count += 2
            is_continue = True
            before = i - 2
            #deleted = True
            break
    if not is_continue:
        break
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
S = [int(s[i]) for i in range(len(s))]
# print(S)
count = 0
before = 0
while 1:
    #print("S:", S)
    is_continue = False
    # print(len(S))
    deleted = False
    for i in range(before, len(S) - 1):
        #print(before, i)
        #print(S[i], S[i + 1])
        # print(S)
        if S[i] != S[i + 1]:
            # print(count)
            del S[i]
            del S[i]
            count += 2
            is_continue = True
            if deleted:
                pass
            else:
                before = i - 1
                deleted = True
            break
    if not is_continue:
        break
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
S = [int(s[i]) for i in range(len(s))]
# print(S)
count = 0
before = 0
while 1:
    #print("S:", S)
    is_continue = False
    # print(len(S))
    for i in range(before, len(S) - 1):
        #print(before, i)
        #print(S[i], S[i + 1])
        # print(S)
        if S[i] != S[i + 1]:
            # print(count)
            del S[i]
            del S[i]
            count += 2
            is_continue = True
            before = i-1
            break
    if not is_continue:
        break
print(count)
Problem p03127 (python)

Fixed submission:
from fractions import gcd
N = int(input())
list = [int(i) for i in input().split()]
gcd1 = list[0]
for i in list:
    gcd1 = gcd(i, gcd1)
print(gcd1)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N=int(input())
list=[int(i) for i in input().split()]
print(gcd(list))
Problem p03209 (python)

Fixed submission:
N, X = map(int, input().split())
x = X
nums = [1]
p_count = [1]
for i in range(N):
    nums.append(2 * nums[-1] + 3)
    p_count.append(2 * p_count[-1] + 1)


def solve_p(N, X):
    if X <= 0:
        return 0
    elif N == 0:
        return 1
    else:
        if X == (nums[N]+1) // 2:
            return (p_count[N]+1) // 2
        elif X < (nums[N]+1) // 2:
            return solve_p(N - 1, X - 1)
        else:
            #print("num", nums[N])
            return p_count[N-1]+1+solve_p(N-1, X-(nums[N]+1)//2)


print(solve_p(N, X))
"""
burger = ["P"]
for i in range(N):
    burger.append(("B"+burger[i]+"P"+burger[i]+"B"))
# print(burger)  # [N + 1])

# print(burger[N])

print(burger[N][:x].count("P"))
"""

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

burger = ["P"]
for i in range(1, N+1):
    burger.append("B"+burger[i-1]+"P"+burger[i-1]+"B")
#print(burger[N])
print(burger[N][0:X].count("P"))
Problem p03315 (python)

Fixed submission:
S = list(input())
print(S.count("+")-S.count("-"))

Buggy submission (verdict: Runtime Error):
S = list(input())
print(S.count("+")-S.count("-")
Problem p02835 (python)

Fixed submission:
v = list(map(int, input().split()))
if sum(v) >= 22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
v = list(map(int, input().split()))
if sum(v) >= 22:
  print("bust")
else
  print("win")