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

Fixed submission:
from fractions import gcd
A, B = map(int, input().split())
print(int(A*B/gcd(A, B)))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(int(A*B/math.gcd(A, B)))
Problem p03127 (python)

Fixed submission:
import fractions
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in a:
    ans = fractions.gcd(ans, i)
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
n = int(input())
a = list(map(int, input().split()))

print(sympy.gcd(a))
Problem p02897 (python)

Fixed submission:
N = int(input())
if N%2:
    print(((N+1)//2)/N)
else:
    print(0.5)

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

ans = 0
for i in range(N):
    if H[i] >= K:
        ans += 1
print(ans)
Problem p03053 (python)

Fixed submission:
from collections import deque
H, W = map(int ,input().split())
A = [input() for _ in range(H)]
dxy = [(1, 0), (-1, 0), (0, 1), (0, -1)]
inf = float("inf")

dp = [[inf]*W for _ in range(H)]
q = deque()
for y, row in enumerate(A):
    for x, c in enumerate(row):
        if c == "#":
            dp[y][x] = 0
            q.append((x, y))

while q:
    x, y = q.popleft()
    d = dp[y][x]
    for dx, dy in dxy:
        nx, ny = x+dx, y+dy
        if (not 0 <= nx < W) or (not 0 <= ny < H):
            continue
        if dp[ny][nx] <= d+1:
            continue
        dp[ny][nx] = d+1
        q.append((nx, ny))

print(max(max(row) for row in dp))

Buggy submission (verdict: Runtime Error):
from collections import deque
H, W = map(int ,input().split())
A = [input() for _ in range(H)]
dxy = [(1, 0), (-1, 0), (0, 1), (0, -1)]
inf = float("inf")

dp = [[inf]*W for _ in range(H)]
q = deque()
for y, row in enumerate(A):
    for x, c in enumerate(row):
        if c == "#":
            dp[y][x] = 0
            q.append((x, y))

while q:
    x, y = q.popleft()
    d = dp[x][y]
    for dx, dy in dxy:
        nx, ny = x+dx, y+dy
        if (not 0 <= nx < W) or (not 0 <= ny < H):
            continue
        if dp[ny][nx] <= d+1:
            continue
        dp[ny][nx] = d+1
        q.append((nx, ny))

print(max(max(row) for row in dp))

Buggy submission (verdict: Runtime Error):
from collections import deque
H, W = map(int ,input().split())
A = [input() for _ in range(H)]
dxy = [(1, 0), (-1, 0), (0, 1), (0, -1)]
inf = float("inf")

dp = [[inf]*W for _ in range(H)]
q = deque()
for y, row in enumerate(A):
    for x, c in enumerate(row):
        if c == "#":
            dp[y][x] = 0
            q.append((x, y))

while q:
    x, y = q.popleft()
    d = dp[x][y]
    for dx, dy in dxy:
        nx, ny = x+dx, y+dy
        if (not 0 <= nx < W) or (not 0 <= ny < H):
            continue
        if dp[ny][nx] <= d+1:
            continue
        dp[ny][nx] = d+1
        q.append((nx, ny))

print(max(max(row) for row in dp))
Problem p03104 (python)

Fixed submission:
from math import log2
a, b = map(int, input().split())
p, q = a, b
a -= 1
if a > 0:
    n = int(log2(a))
else:
    n = -1
if b > 0:
    m = int(log2(b))
else:
    print(0)
    exit()
a_cnt = [0]*(m+1)
b_cnt = [0]*(m+1)
for i in range(m, 0, -1):
    if i <= n:
        if a >= 2**i:
            a_cnt[i] = a-2**i+1
            a -= 2**i
    if b >= 2**i:
        b_cnt[i] = b-2**i+1
        b -= 2**i

ans = [0]*(m+1)
for i in range(m+1):
    ans[i] = (b_cnt[i]-a_cnt[i])%2

tmp = 0
for i in range(1, m+1):
    if ans[i]:
        tmp += 2**i

tmp += ((q+1)//2-p//2)%2
print(tmp)

Buggy submission (verdict: Runtime Error):
from math import log2
a, b = map(int, input().split())
p, q = a, b
a -= 1
if a > 0:
    n = int(log2(a))
else:
    n = -1
m = int(log2(b))
a_cnt = [0]*(m+1)
b_cnt = [0]*(m+1)
for i in range(m, 0, -1):
    if i <= n:
        if a >= 2**i:
            a_cnt[i] = a-2**i+1
            a -= 2**i
    if b >= 2**i:
        b_cnt[i] = b-2**i+1
        b -= 2**i

ans = [0]*(m+1)
for i in range(m+1):
    ans[i] = (b_cnt[i]-a_cnt[i])%2

tmp = 0
for i in range(1, m+1):
    if ans[i]:
        tmp += 2**i

tmp += ((q+1)//2-p//2)%2
print(tmp)
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce
n = int(input())
a = list(map(int, input().split()))

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

print(gcd(*a))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n = int(input())
a = list(map(int, input().split()))

def gcd(*num):
    return reduce(math.gcd, num)

print(gcd(*a))
Problem p03201 (python)

Fixed submission:
from collections import Counter
n = int(input())
A = sorted(list(map(int, input().split())))[-1::-1]
c = Counter(A)
ans = 0
for a in A:
    b = (1<<a.bit_length()) - a
    if a == b and c[a] > 1:
        c[a] -= 2
        ans += 1
    elif a != b and c[a] > 0 and c[b] > 0:
        c[a] -= 1
        c[b] -= 1
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
A = sorted(list(map(int, input().split())))[-1::-1]
c = Counter(A)
ans = 0
for a in A:
    b = (1<<m.bit_length()) - a
    if a == b and c[a] > 1:
        c[a] -= 2
        ans += 1
    elif a != b and c[a] > 0 and c[b] > 0:
        c[a] -= 1
        c[b] -= 1
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from math import log2
n = int(input())
a = sorted(list(map(int, input().split())))
ans = 0
while a:
    m = a.pop()
    k = (1<<m.bit_length()) - m
    if k in a:
        a.remove(k)
        ans += 1
print(ans)
Problem p03242 (python)

Fixed submission:
s = input()
s = s.replace("1","2")

s = s.replace("9","1")

s = s.replace("2","9")

print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
mod = sum(XY[0])%2
for x, y in XY:
    if mod != (x+y)%2:
        print(-1)
        exit()

m = 33-mod
print(m)
D = [2**i for i in range(31, -1, -1)]
if mod:
    D.append(1)

print(" ".join(map(str, D)))
for x, y in XY:
    w = " "
    for d in D:
        if x-y >= 0 and x+y >= 0:
            w += "R"
            x -= d
        elif x-y < 0 and x+y >= 0:
            w += "U"
            y -= d
        elif x-y >= 0 and x+y < 0:
            w += "D"
            y += d
        else:
            w += "L"
            x += d
    print(w)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
k = n//2
a = list(map(int, input().split()))
p = []
q = []
for i in range(k):
    p.append(a[2*i])
    q.append(a[2*i+1])
s = Counter(p).most_common()
t = Counter(q).most_common()
u, v = len(s), len(t)
ans = 0
if s[0][0] == t[0][0]:
    if u == 1 and v == 1:
        ans = k
    elif u == 1:
        ans = k - t[1][1]
    elif v == 1:
        ans = k - s[1][1]
    else:
        comp = max(s[1][1], t[1][1])
        ans = n - s[0][1] - comp
else:
    ans = n - s[0][1] - t[0][1]
print(ans)
Problem p03250 (python)

Fixed submission:
a = list(map(int, input().split()))
d = max(a)
a.remove(d)
print(d*10+sum(a))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
dict_s = ["_"]*26
dict_t = ["_"]*26
alphabet = [chr(i) for i in range(97, 97 + 26)]
print(alphabet)
for i in range(len(s)):
    if dict_s[alphabet.index(s[i])] == "_":
        dict_s[alphabet.index(s[i])] = t[i]
    elif dict_s[alphabet.index(s[i])] != t[i]:
            print("No")
            exit()
    if dict_t[alphabet.index(t[i])] == "_":
        dict_t[alphabet.index(t[i])] = s[i]
    elif dict_t[alphabet.index(t[i])] != s[i]:
            print("No")
            exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
d = max(a)
a.remove(d)
ans(d*10+sum(a))

Buggy submission (verdict: Runtime Error):
a = map(int, input().split())
d = max(a)
a.remove(d)
ans(d*10+sum(a))
Problem p03317 (python)

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

if n == k:
    print(1)
    exit()

a = (n-k)//(k-1)
if (n-k)%(k-1):
    print(a+2)
else:
    print(a+1)

Buggy submission (verdict: Runtime Error):
from collections import deque
k = int(input())

digsum = lambda x: sum(map(int, list(str(x))))
dignorm = lambda x: x/digsum(x)

n = 1
order = 1
while k > 0:
    print(n)
    k -= 1
    if dignorm(n+10**(order-1)) > dignorm(n+10**order):
        order += 1
    n += 10**(order-1)
Problem p03426 (python)

Fixed submission:
import sys
input=sys.stdin.readline
h, w, d = map(int, input().split())
p = dict()

for i in range(h):
    for j, x in enumerate(map(int, input().split())):
        p[x] = (i, j)

dp = [0]*(h*w+1)
for i in range(h*w+1):
    if d < i:
        dp[i] = dp[i-d] + abs(p[i][0]-p[i-d][0])+abs(p[i][1]-p[i-d][1])

q = int(input())
for i in range(q):
    a, b = map(int, input().split())
    ans = dp[b]-dp[a]
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
h, w, d = map(int, input().split())
p = dict()
for i in range(h):
    for j, x in enumerate(map(int, input().split())):
        p[x] = (i, j)

dist = [[None]*(h*w) for _ in p.keys()]

def func(a, b):

    if a == b:
        dist[a][b] = 0
        return 0
    else:
        if dist[a][b]:
            return dist[a][b]
        else:
            x, y = p[b]
            s, t = p[b-d]
            dist[b-d][d] = abs(x-s)+abs(y-t)
            return func(a, b-d) + dist[b-d][d]


q = int(input())
for i in range(q):
    a, b = map(int, input().split())
    ans = func(a, b)
    print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
import sys
input=sys.stdin.readline
from collections import defaultdict
h, w, d = map(int, input().split())
p = dict()
D = defaultdict(list)
for i in range(h):
    for j, x in enumerate(map(int, input().split())):
        p[x] = (x, i, j)
        heapq.heappush(D[x%d], (x, i, j))

q = int(input())
for i in range(q):
    a, b = map(int, input().split())
    v = D[a%d]
    ans = 0
    for x, i, j in v:
        if x == a:
            s, t = i, j
        elif a < x <= b:
            ans += abs(s-i)+abs(t-j)
            s, t = i, j
            if x == b:
                break
    print(ans)
Problem p03705 (python)

Fixed submission:
n, a, b = map(int, input().split())
if a > b:
    print(0)
    exit()
if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
    exit()
print((n-1)*b+a-(n-1)*a-b+1)

Buggy submission (verdict: Runtime Error):
from itertools import combinations_with_replacement as h_func
n, a, b = map(int, input().split())
if a > b:
    print(0)
    exit()
if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
    exit()
x = [i for i in range(a, b+1)]
ans = set()
y = h_func(x, n-2)
for p in y:
    ans.add(sum(p))
print(len(ans))

Buggy submission (verdict: Runtime Error):
from itertools import combinations_with_replacement as h_func
n, a, b = map(int, input().split())
if a > b:
    print(0)
    exit()
if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
    exit()
x = [i for i in range(a, b+1)]
ans = set()
for p in h_func(x, n-2):
    ans.add(sum(p))
print(len(ans))
Problem p02735 (python)

Fixed submission:
from collections import deque

H, W = map(int,input().split())
S = [input() for i in range(H)]
dp = [[0 for _ in range(W)] for _ in range(H)]
dp[0][0] = 1 if S[0][0] == "#" else 0
for i in range(1, H):
    if S[i][0] == "#":
        if S[i-1][0] == "#":
            dp[i][0] =  dp[i-1][0]
        else:
             dp[i][0] = dp[i-1][0] + 1
    else:
        dp[i][0] =  dp[i-1][0]

for j in range(1, W):
    if S[0][j] == "#":
        if S[0][j-1] == "#":
            dp[0][j] =  dp[0][j-1]
        else:
             dp[0][j] = dp[0][j-1] + 1
    else:
        dp[0][j] =  dp[0][j-1]

for i in range(1,H):
    for j in range(1,W):
        up = dp[i-1][j] + (1 if S[i-1][j] != "#" and S[i][j] == "#" else 0) 
        left = dp[i][j-1] + (1 if S[i][j-1] != "#" and S[i][j] == "#" else 0)
        dp[i][j] = min(up, left)
print(dp[-1][-1])

Buggy submission (verdict: Runtime Error):
H, W = map(int,input().split())
S = [input() for i in range(H)]
dp = [[0 for _ in range(H)] for _ in range(W)]
dp[0][0] = 1 if S[0][0] == "#" else 0
for i in range(1, H):
    if S[i][0] == "#":
        if S[i-1][0] == "#":
            dp[i][0] =  dp[i-1][0]
        else:
             dp[i][0] = dp[i-1][0] + 1
    else:
        dp[i][0] =  dp[i-1][0]

for j in range(1, W):
    if S[0][j] == "#":
        if S[0][j-1] == "#":
            dp[0][j] =  dp[0][j-1]
        else:
             dp[0][j] = dp[0][j-1] + 1
    else:
        dp[0][j] =  dp[0][j-1]

for i in range(1,H):
    for j in range(1,W):
        up = dp[i-1][j] + (1 if S[i-1][j] != "#" and S[i][j] == "#" else 0) 
        left = dp[i][j-1] + (1 if S[i][j-1] != "#" and S[i][j] == "#" else 0)
        dp[i][j] = min(up, left)
print(dp[-1][-1])
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
A = [int(input()) for i in range(m)]
ls =[-1]*(n+1)
ls[0]=ls[1]=1
mod = 10**9+7
for a in A:
	ls[a]= 0

for i in range(2,n+1):
	if ls[i]==-1:
		ls[i]= ls[i-1]+ls[i-2]
print(ls[-1]%mod)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
from functools import lru_cache

@lru_cache(maxsize=10000000)
n,m=map(int,input().split())
A = [int(input()) for i in range(m)]
mod = 10**9+7
memo={}
memo[1]=1
memo[0]=1

def fib(n):
  if n in A:
  	memo[n]=0
  	return memo[n]
  if n not in memo:
    memo[n] = fib(n-1) + fib(n-2)
  return memo[n]

print(fib(n)%mod)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
A = [int(input()) for i in range(m)]
mod = 10**9+7
memo={}
memo[1]=1
memo[0]=1

def fib(n):
  if n in A:
  	memo[n]=0
  	return memo[n]
  if n not in memo:
    memo[n] = fib(n-1) + fib(n-2)
  return memo[n]

print(fib(n)%mod)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
A = [int(input()) for i in range(m)]
mod = 1000000007
memo={}
memo[1]=1

def fib(n):
  if n < 1:
    return 1
  if n in A:
  	memo[n]=0
  	return memo[n]
  if n not in memo:
    memo[n] = fib(n-1) + fib(n-2)
  return memo[n]

print(fib(n)%mod)
Problem p03137 (python)

Fixed submission:
n,m=map(int,input().split())
X=sorted(list(map(int,input().split())))
init=[]
tmp=0
i=1

if m<n:
  n=m

while i<len(X):
  init.append([X[i]-X[i-1],i])
  i+=1
init.sort(reverse=True,key=lambda x:x[0])
init=list(map(lambda x:x[1],init))
ans=0
init=sorted(init[:n-1])
if len(init)==0:
  print(X[-1]-X[0])
  exit()
tmp=0
for i in init:
  ans+=(X[i-1]-X[tmp])
  tmp=i
try:
  if i!=len(X)-1:
    ans+=X[-1]-X[i]
except IndexError:
  print(0)
  exit()
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
X=sorted(list(map(int,input().split())))
init=[]
mario=n
tmp=0
i=1

if m<n:
  n=m

while i<len(X):
  init.append([X[i]-X[i-1],i])
  i+=1
init.sort(reverse=True,key=lambda x:x[0])
ans=0

for i in range(n-1):
  X.insert(init[i][1]+i,"あ")
i=0
start=0
while i<len(X):
  if i+1<len(X):
    if X[i+1]=="あ":
      ans+=X[i]-X[start]
      start=i+2
      i+=1
  else:
    ans+=X[i]-X[start]
  i+=1
print(ans)
Problem p03209 (python)

Fixed submission:
n,x=map(int,input().split())
a,p=[1],[1]
for i in range(n):
  a.append(a[i]*2+3)
  p.append(p[i]*2+1)

def f(n,x):
  if n==0:
    return 0 if x<=0 else 1
  elif x<= 1 + a[n-1]:
    return f(n-1,x-1)
  else:
    return p[n-1]+1+f(n-1,x-2-a[n-1])


print(f(n,x))

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
X=[0,1,2,3,3]
a=0
print
if n==1:
  print(0)
if n >1:
  if x %2 ==0:
    tmp=int(x/2**(n-1))
    if tmp>=len(X):
      print((X[tmp-1]+1)*(2**(n-1))-1)
    else:
      print(X[tmp]*(2**(n-1))-1)
  else:
    tmp=int(x/2**(n-1))
    print(X[tmp]*(2**(n-1))+1)
Problem p03286 (python)

Fixed submission:
n = int(input())
if n ==0:
  print(0)
s=''
while n !=0:
  if n%2==1:
    s="1"+s
    n-=1
  else:
    s='0'+s
  n=-n//2
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n ==0:
  print(0)
s=''
while n !=0:
  if n%2==1:
    s="1"+
    n-=1
  else:
    s='0'+s
  n-=n//2
print(s)
Problem p03329 (python)

Fixed submission:
n = int(input())
max_n = 100000
dp = [10000 for i in range(max_n+1)]
dp[0] = 0

for i in range(n+1):
  k = 1
  while k <= n:
    dp[i] = min(dp[i],dp[i-k]+1)
    k *=6
  k = 1
  while k <= n:
    dp[i] = min(dp[i],dp[i-k]+1)
    k*=9
print(dp[n])

Buggy submission (verdict: Runtime Error):
n = int(input())
max_n = 100000
dp = [10000 for i in range(max_n)]
dp[0] = 0

for i in range(n+1):
  k = 1
  while k <= n:
    dp[i] = min(dp[i],dp[i-k]+1)
    k *=6
  k = 1
  while k <= n:
    dp[i] = min(dp[i],dp[i-k]+1)
    k*=9
print(dp[n])

Buggy submission (verdict: Runtime Error):
n = int(input())
max_n = 10000
dp = [10000 for i in range(max_n)]
dp[0] = 0

for i in range(n+1):
  k = 1
  while i + k <= n:
    dp[i+k] = min(dp[i+k],dp[i]+1)
    k *=6
  k = 1
  while i + k <= n:
    dp[i+k] = min(dp[i+k],dp[i]+1)
    k*=9

print(dp[n])
Problem p03804 (python)

Fixed submission:
n,m=map(int,input().split())
A=[input() for i in range(n)]
B=[input() for i in range(m)]

for i in range(n):
  for j in range(n):
    k=j+m
    if k <= n:
      if A[i][j:k]== B[0]:
        o=1
        for l in range(i+1,i+m):
          if l<n:
            if A[l][j:k]!=B[o]:
              break
            else:
              o+=1
        if o==m:
          print('Yes')
          exit()
print('No')

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
A=[input() for i in range(n)]
B=[input() for i in range(m)]

for i in range(n):
  for j in range(n):
    k=j+m
    if k <= n:
      if A[i][j:k]== B[0]:
        o=1
        for l in range(i+1,i+m):
          if A[l][j:k]!=B[o]:
            break
          else:
            o+=1
        if o==m:
          print('Yes')
          exit()
print('No')
Problem p02729 (python)

Fixed submission:
n,m = map(int,input().split())
if n <= 1:
  n = 0
else:
  n = n * (n-1) / 2
if m <= 1:
  m = 0
else:
  m = m * (m-1) / 2
print(int(n+m))

Buggy submission (verdict: Runtime Error):
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")
Problem p02912 (python)

Fixed submission:
import heapq

n,m = map(int,input().split())
li = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(li)
for _ in range(m):
    tmp_min = heapq.heappop(li)
    heapq.heappush(li, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(li))

Buggy submission (verdict: Runtime Error):
import heapq

n,m = map(int,input().split())
li = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(li)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))
Problem p02916 (python)

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

total = 0
for i in range(n):
    total += b[a[i] - 1]
    if i < n-1:
        if a[i] + 1 == a[i+1]:
            total += c[a[i]-1]
print(total)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
n = 1
if b == 1:
    print(0)
else:
    while a*n-(n-1) < b:
        n += 1
    print(n)
Problem p03073 (python)

Fixed submission:
s = input()
cnt1 = 0
cnt2 = 0
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == "0":
            cnt1 += 1
        else:
            cnt2 += 1
    else:
        if s[i] == "1":
            cnt1 += 1
        else:
            cnt2 += 1
print(min(cnt1,cnt2))

Buggy submission (verdict: Runtime Error):
s = input()
cnt1 = 0
cnt2 = 0
for i in range(len(s)):
    if i%s == 0:
        if s[i] == "0":
            cnt1 += 1
        else:
            cnt2 += 1
    else:
        if s[i] == "1":
            cnt1 += 1
        else:
            cnt2 += 1
print(min(cnt1,cnt2))

Buggy submission (verdict: Runtime Error):
num = input()
num_char = list(num)
num_char2 = list(num)
if num_char[0] == "0":
	for i in range(0, int(len(num_char)),2):
		num_char[i] = 0
		num_char[i + 1] = 1
else:
	for i in range(0, int(len(num_char)),2):
		num_char[i] = 1
		num_char[i + 1] = 0
        
cnt = 0
for i in range(len(num_char)):
  if str(num_char[i]) != num_char2[i]:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
num = input()
num_char = list(num)
if num_char[0] == "0":
	for i in range(0, int(len(num_char)),2):
		num_char[i] = 0
		num_char[i + 1] = 1
else:
	for i in range(0, int(len(num_char)),2):
		num_char[i] = 1
		num_char[i + 1] = 0
for i in num_char:
	print(i, end = "")

Buggy submission (verdict: Runtime Error):
num = input()
num_char = list(num)
if num_char[0] == "0":
	for i in range(0, int(len(num_char)),2):
		num_char[i] = 0
		num_char[i + 1] = 1
else:
	for i in range(0, int(len(num_char)),2):
		num_char[i] = 1
		num_char[i + 1] = 0
for i in num_char:
  print(i, end = "")
Problem p03127 (python)

Fixed submission:
import fractions
N = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = fractions.gcd(ans, a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = fractions.gcd(ans, a[i])
print(ans)
Problem p03207 (python)

Fixed submission:
n = int(input())
p = [int(input()) for _ in range(n)]
print(int(sum(p) - max(p)/2))

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(input()) for _ in range(n)]
print(int(sum(p) - max(p)/2)
Problem p03242 (python)

Fixed submission:
a = input()
b= ""
for i in range(len(a)):
  if a[i] == "1":
    b += "9"
  else:
    b += "1"
print(b)

Buggy submission (verdict: Runtime Error):
a = input()
for i in range(len(a)):
  if a[i] == "1":
    a[i] = "9"
  else:
    a[i] = "1"
print(a)

Buggy submission (verdict: Runtime Error):
a = input()
for i in range(a):
  if a[i] == "1":
    a[i] = "9"
  else:
    a[i] = "1"
print(a)

Buggy submission (verdict: Runtime Error):
a = input()
for i in range(a):
  if a[i] == 1:
    a[i] = 9
  else:
    a[i] = 1
print(a)
Problem p02831 (python)

Fixed submission:
from fractions import gcd

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

def lcm(a,b):
    return a * b // gcd(a,b)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
from math import gcd
from fractions import gcd

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

def lcm(a,b):
    return a * b // gcd(a,b)

print(lcm(a, b))
Problem p02912 (python)

Fixed submission:
n, m = map(int, input().split())
a = sorted(map(int, input().split()), reverse=True)

while m > 0:
    a = sorted(a, reverse=True)
    temp = a[0] // 2
    for i in range(n):
        if a[i] >= temp:
            a[i] = a[i]//2
            m -= 1
            if m <= 0:
                break
        else:
            break

count = 0
for i in a:
    count += i
print(count)

Buggy submission (verdict: Runtime Error):
from heapq import _heapify_max, _heapreplace_max

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

_heapify_max(a)

for i in range(m):
    _heapreplace_max(a, a[0] // 2)
    
print(sum(a))
Problem p03038 (python)

Fixed submission:
from collections import Counter

n, m = map(int, input().split())
a = map(int, input().split())

abc = Counter(a).most_common()
for i in range(m):
    b, c = map(int, input().split())
    abc.append((c, b))

abc.sort(reverse=True)

ans = 0
count = n
for c, b in abc:
    rep = min(count, b)
    ans += c * rep
    count -= rep
print(ans)

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

abc = Counter(a).most_common()
for i in range(m):
    b, c = map(int, input().split())
    abc.append((c, b))

abc.sort(reverse=True)

ans = 0
count = n
for c, b in abc:
    rep = min(count, b)
    ans += c * rep
    count -= rep
print(ans)
Problem p03072 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
highest = 0
counter = 0

for i in range(n):
    if h[i] >= highest:
        counter += 1
        highest = h[i]

print(counter)

Buggy submission (verdict: Runtime Error):
n = int(input().split())
h = list(map(int, input().split()))
height = h[0]
counter = 0
for i in h:
    if h[i] >= height:
        counter += 1
        height = h[i]

print(counter)

Buggy submission (verdict: Runtime Error):
n = int(input().split())
h = list(map(int, input(.split()))
height = h[0]
counter = 0
for i in h:
    if h[i] >= height:
        counter += 1
        height = h[i]

print(counter)