Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def search(i, total):
  for dist, to in edges[i]:
    if dists[to] == None:
      dists[to] = total + dist
      if not search(to, total + dist):
        return False
    else:
      if dists[to] == total + dist:
        continue
      else:
        return False
  return True

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
  l, r, d = map(int, input().split())
  l -= 1
  r -= 1
  edges[l].append((d, r))
  edges[r].append((-d, l))

dists = [None] * n

for i in range(n):
  if dists[i] == None:
    dists[i] = 0
    if not search(i, 0):
      print("No")
      break
else:
  print("Yes")

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
def search(i, total):
  for dist, to in edges[i]:
    if dists[to] == None:
      dists[to] = total + dist
      if not search(to, total + dist):
        return False
    else:
      if dists[to] == total + dist:
        continue
      else:
        return False
  return True

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
  l, r, d = map(int, input().split())
  l -= 1
  r -= 1
  edges[l].append((d, r))
  edges[r].append((-d, l))

dists = [None] * n

for i in range(n):
  if dists[i] == None:
    dists[i] = 0
    if not search(i, 0):
      print("No")
      break
else:
  print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
mp1 = [[0] * k for _ in range(k)]
mp2 = [[0] * k for _ in range(k)]
for _ in range(n):
  x, y, c = input().split()
  t = int(x) // k + int(y) // k
  x = int(x) % k
  y = int(y) % k
  if c == "B":
    t += 1
  if t % 2:
    mp1[y][x] += 1
  else:
    mp2[y][x] += 1

for x in range(1, k):
  mp1[0][x] += mp1[0][x - 1]
  mp2[0][x] += mp2[0][x - 1]

for y in range(1, k):
  acc1 = 0
  acc2 = 0
  for x in range(k):
    acc1 += mp1[y][x]
    mp1[y][x] = acc1 + mp1[y - 1][x]
    acc2 += mp2[y][x]
    mp2[y][x] = acc2 + mp2[y - 1][x]

ans = 0
sum1 = mp1[k - 1][k - 1]
sum2 = mp2[k - 1][k - 1]
mp1k = mp1[k - 1]
mp2k = mp2[k - 1]
for y in range(k):
  mp1y = mp1[y]
  mp1yk = mp1y[k - 1]
  mp2y = mp2[y]
  mp2yk = mp2y[k - 1]
  for x in range(k):
    mp1yx = mp1y[x]
    mp2yx = mp2y[x]
    mp1kx = mp1k[x]
    mp2kx = mp2k[x]

    ans = max(ans, 2 * mp1yx + sum1 - mp1yk - mp1kx + mp2kx + mp2yk - 2 * mp2yx)
    ans = max(ans, 2 * mp2yx + sum2 - mp2yk - mp2kx + mp1kx + mp1yk - 2 * mp1yx)

print(ans)

Fixed submission:
n, k = map(int, input().split())
mp1 = [[0] * k for _ in range(k)]
mp2 = [[0] * k for _ in range(k)]
for _ in range(n):
  x, y, c = input().split()
  t = int(x) // k + int(y) // k
  x = int(x) % k
  y = int(y) % k
  if c == "B":
    t += 1
  if t % 2:
    mp1[y][x] += 1
  else:
    mp2[y][x] += 1

for x in range(1, k):
  mp1[0][x] += mp1[0][x - 1]
  mp2[0][x] += mp2[0][x - 1]

for y in range(1, k):
  acc1 = 0
  acc2 = 0
  for x in range(k):
    acc1 += mp1[y][x]
    mp1[y][x] = acc1 + mp1[y - 1][x]
    acc2 += mp2[y][x]
    mp2[y][x] = acc2 + mp2[y - 1][x]

ans = 0
sum1 = mp1[k - 1][k - 1]
sum2 = mp2[k - 1][k - 1]
mp1k = mp1[k - 1]
mp2k = mp2[k - 1]
for y in range(k):
  mp1y = mp1[y]
  mp1yk = mp1y[k - 1]
  mp2y = mp2[y]
  mp2yk = mp2y[k - 1]
  for x in range(k):
    mp1yx = mp1y[x]
    mp2yx = mp2y[x]
    mp1kx = mp1k[x]
    mp2kx = mp2k[x]

    ans = max(ans, 2 * mp1yx + sum1 - mp1yk - mp1kx + mp2kx + mp2yk - 2 * mp2yx)
    ans = max(ans, 2 * mp2yx + sum2 - mp2yk - mp2kx + mp1kx + mp1yk - 2 * mp1yx)

print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
  s = input()
  x, y = map(int, input().split())
  lens = len(s)
  ind = 0
  if "T" in s:
    ind = s.index("T")
    x -= ind
  else:
    ind = lens
    x -= lens
  x_lst = []
  y_lst = []
  direct = 0
  while ind < lens:
    acc = 0
    if s[ind] == "F":
      while ind < lens and s[ind] == "F":
        ind += 1
        acc += 1
      if direct == 0:
        x_lst.append(acc)
      else:
        y_lst.append(acc)
  
    elif s[ind] == "T":
      while ind < lens and s[ind] == "T":
        ind += 1
        acc += 1
  
      direct = (direct + acc) % 2
  
  sumx = sum(x_lst)
  sumy = sum(y_lst)
  if sumx < x or (sumx - x) % 2 or sumy < y or (sumy - y) % 2:
    print("No")
  else:
    target_x = (sumx - x) // 2 + x
    target_y = (sumy - y) // 2 + y
    canx = [False] * (sumx + 1)
    canx[0] = True
    cany = [False] * (sumy + 1)
    cany[0] = True
  
    break_flag = False
    for v in x_lst:
      for i in range(sumx - v + 1):
        if canx[i]:
          canx[i + v] = True
          if i + v == target_x:
            break_flag = True
            break
      if break_flag:
        break
    
    break_flag = False
    for v in y_lst:
      for i in range(sumy - v + 1):
        if cany[i]:
          cany[i + v] = True
          if i + v == target_y:
            break_flag = True
            break
      if break_flag:
        break
  
    if canx[target_x] and cany[target_y]:
      print("Yes")
    else:
      print("No")

main()

Fixed submission:
def main():
  s = input()
  x, y = map(int, input().split())
  lens = len(s)
  ind = 0
  if "T" in s:
    ind = s.index("T")
    x -= ind
  else:
    ind = lens
    x -= lens
  x_lst = []
  y_lst = []
  direct = 0
  while ind < lens:
    acc = 0
    if s[ind] == "F":
      while ind < lens and s[ind] == "F":
        ind += 1
        acc += 1
      if direct == 0:
        x_lst.append(acc)
      else:
        y_lst.append(acc)
  
    elif s[ind] == "T":
      while ind < lens and s[ind] == "T":
        ind += 1
        acc += 1
      direct = (direct + acc) % 2
  x = abs(x)
  y = abs(y)  
  sumx = sum(x_lst)
  sumy = sum(y_lst)
  if sumx < x or (sumx - x) % 2 or sumy < y or (sumy - y) % 2:
    print("No")
  else:
    target_x = (sumx - x) // 2
    target_y = (sumy - y) // 2
    canx = [False] * (target_x + 1)
    canx[0] = True
    cany = [False] * (target_y + 1)
    cany[0] = True
  
    break_flag = False
    for v in x_lst:
      for i in range(target_x - v + 1):
        if canx[i]:
          canx[i + v] = True
          if i + v == target_x:
            break_flag = True
            break
      if break_flag:
        break
    
    break_flag = False
    for v in y_lst:
      for i in range(target_y - v + 1):
        if cany[i]:
          cany[i + v] = True
          if i + v == target_y:
            break_flag = True
            break
      if break_flag:
        break
  
    if canx[target_x] and cany[target_y]:
      print("Yes")
    else:
      print("No")

main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = []
for i in range(n):
  ls.append(int(input()) - 1)
count = 0
if (1 not in ls):
  count = -1
else:
  used = []
  x = 0
  count = 0
  while (x != 1):
    used.append(x)
    x = ls[x]
    count += 1
    if (x in used):
      count = -1
      break
print(count)


Fixed submission:
n = int(input())
ls = []
for i in range(n):
  ls.append([int(input())-1,False])
count = 0
x = 0
while (x != 1):
  if ls[x][1]:
    count = -1
    break
  else:
    count += 1
    ls[x][1] = True
    x = ls[x][0]
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = []
for i in range(n):
  ls.append(int(input()) - 1)
used = []
x = 0
count = 0
while (x != 1):
  used.append(x)
  x = ls[x]
  count += 1
  if (x in used):
    count = -1
    break
print(count)


Fixed submission:
n = int(input())
ls = []
for i in range(n):
  ls.append([int(input())-1,False])
count = 0
x = 0
while (x != 1):
  if ls[x][1]:
    count = -1
    break
  else:
    count += 1
    ls[x][1] = True
    x = ls[x][0]
print(count)
Buggy python submission (verdict: Runtime Error):
def kaijou2(num):
  return kaijou(num,1)
def kaijou(num,ac):
  if (num == 0):
    return ac
  else:
    return kaijou(num - 1,(ac * num) % (10 ** 9 + 7))

[n,m] = list(map(int,input().split()))
x = abs(n - m)
ans = 0
if (x >= 2):
  ans = 0
elif (x == 1):
  ans = (kaijou2(m) * kaijou2(n)) % (10 ** 9 + 7)
elif (x == 0):
  ans = (kaijou2(m) * kaijou2(n) * 2) % (10 ** 9 + 7)
print(ans)


Fixed submission:
def kaijou(num):
  ac = 1
  for i in range(num):
    ac = ((i + 1) * ac) % (10 ** 9 + 7)
  return ac
[n,m] = list(map(int,input().split()))
x = abs(n - m)
ans = 0
if (x >= 2):
  ans = 0
elif (x == 1):
  ans = (kaijou(m) * kaijou(n)) % (10 ** 9 + 7)
elif (x == 0):
  ans = (kaijou(m) * kaijou(n) * 2) % (10 ** 9 + 7)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
xys = [list(map(int, input().split())) + [i] for i in range(n)]
edges = []
xys.sort()
for i in range(n - 1):
    x1, y1, index1 = xys[i]
    x2, y2, index2 = xys[i + 1]
    edges.append((x2 - x1, index1, index2))

xys.sort(key=lambda x:x[1])
for i in range(n - 1):
    x1, y1, index1 = xys[i]
    x2, y2, index2 = xys[i + 1]
    edges.append((y2 - y1, index1, index2))

parent = [i for i in range(n)]
def find(x):
    if x == parent[x]:return x
    parent[x] = find(parent[x])
    return parent[x]

edges.sort()
ans = 0
for cost, index1, index2 in edges:
    p1, p2 = find(index1), find(index2)
    if p1 != p2:
        parent[p1] = p2
        ans += cost
print(ans)

Fixed submission:
n = int(input())
xys = [list(map(int, input().split())) + [i] for i in range(n)]
edges = []
xys.sort()
for i in range(n - 1):
    x1, y1, index1 = xys[i]
    x2, y2, index2 = xys[i + 1]
    edges.append((x2 - x1, index1, index2))

xys.sort(key=lambda x:x[1])
for i in range(n - 1):
    x1, y1, index1 = xys[i]
    x2, y2, index2 = xys[i + 1]
    edges.append((y2 - y1, index1, index2))

parent = [i for i in range(n)]
def find(x):
    if x == parent[x]:return x
    parent[x] = find(parent[x])
    return parent[x]

edges.sort()
ans = 0
for cost, index1, index2 in edges:
    p1, p2 = find(index1), find(index2)
    if p1 != p2:
        parent[p1] = p2
        ans += cost
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    INF = 10 ** 20
    n, ma, mb = map(int, input().split())
    dp = [[INF] * 401 for _ in range(401)]
    dp[0][0] = 0
    for _ in range(n):
        a, b, c = map(int, input().split())
        for i in range(400 - a, -1, -1):
            for j in range(400 - b, -1, -1):
                dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)
    
    ans = INF
    for i in range(1, 400):
        if ma * i > 400 or mb * i > 400:
            break
        ans = min(ans, dp[ma * i][mb * i])
    if ans >= INF:
        print(-1)
    else:
        print(ans)

main()

Fixed submission:
def main():
    INF = 10 ** 5
    n, ma, mb = map(int, input().split())
    dp = [[INF] * 401 for _ in range(401)]
    dp[0][0] = 0
    for _ in range(n):
        a, b, c = map(int, input().split())
        for i in range(400 - a, -1, -1):
            dpi = dp[i]
            dpia = dp[i + a]
            for j in range(400 - b, -1, -1):
                if dpia[j + b] > dpi[j] + c:
                    dpia[j + b] = dpi[j] + c
    
    ans = INF
    for i in range(1, 400):
        if ma * i > 400 or mb * i > 400:
            break
        ans = min(ans, dp[ma * i][mb * i])
    if ans >= INF:
        print(-1)
    else:
        print(ans)

main()
Buggy python submission (verdict: Runtime Error):
print( (int(input()) + int(input()) * int(input()) // 2)

Fixed submission:
print((int(input()) + int(input())) * int(input()) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
n, a = map(int, input().split())
xlst = list(map(int, input().split()))
xlst.insert(0, 0)
"""
dp[i][j][k] ... iまででj個使ってkを作る
dp[i][j][k] += dp[i - 1][j - 1][k - x]
"""

dp =  [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(n + 1):
  dp[i][0][0] = 1


for i in range(1, n + 1):
  x = xlst[i]
  for j in range(1, n + 1):
    for k in range(1, n * 50 + 1):
      if k >= x:
        dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
      else:
        dp[i][j][k] += dp[i - 1][j][k]
ans = 0
for j in range(1, n + 1):
  ans += dp[n][j][j * a]

print(ans)

Fixed submission:
def main():
  n, a = map(int, input().split())
  xlst = list(map(int, input().split()))
  xlst.insert(0, 0)
  """
  dp[i][j][k] ... iまででj個使ってkを作る
  dp[i][j][k] += dp[i - 1][j - 1][k - x]
  """
  
  dp =  [[[0] * (50 * n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
  for i in range(n + 1):
    dp[i][0][0] = 1
  
  
  for i in range(1, n + 1):
    x = xlst[i]
    dpi = dp[i]
    dpi_1 = dp[i - 1]
    for j in range(1, n + 1):
      dpij = dpi[j]
      dpi_1j = dpi_1[j]
      dpi_1j_1 = dpi_1[j - 1]
      for k in range(1, n * 50 + 1):
        if k >= x:
          #dp[i][j][k] += dp[i - 1][j - 1][k - x] + dp[i - 1][j][k]
          dpij[k] += dpi_1j_1[k - x] + dpi_1j[k]
        else:
          #dp[i][j][k] += dp[i - 1][j][k]
          dpij[k] += dpi_1j[k]
  
  ans = 0
  for j in range(1, n + 1):
    ans += dp[n][j][j * a]
  
  print(ans)

main()
Buggy python submission (verdict: Runtime Error):
import urllib.request
from bs4 import BeautifulSoup
import re
import sys
import os
import time
import subprocess
import datetime


def gcd(a, b):
    if a < b:
        c = a
        a = b
        b = c

    r = a % b

    while r > 0:
        a = b
        b = r
        r = a % b

    return b

    # ll gcd(ll a, ll b) {
    #   if (a < b)
    #     swap(a, b);
    #   ll r = a % b;
    #
    #   while (r) {
    #     a = b;
    #     b = r;
    #     r = a % b;
    #   }
    #
    #   return b;
    # }


N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
# a = list(map(int, input().split()))

ans = a[0]

for i in range(N):
    if i == 0:
        continue

    g = gcd(ans, a[i])
    ans = ans * a[i] // g

print(ans)


Fixed submission:

def gcd(a, b):
    if a < b:
        c = a
        a = b
        b = c

    r = a % b

    while r > 0:
        a = b
        b = r
        r = a % b

    return b

    # ll gcd(ll a, ll b) {
    #   if (a < b)
    #     swap(a, b);
    #   ll r = a % b;
    #
    #   while (r) {
    #     a = b;
    #     b = r;
    #     r = a % b;
    #   }
    #
    #   return b;
    # }


N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
# a = list(map(int, input().split()))

ans = a[0]

for i in range(N):
    if i == 0:
        continue

    g = gcd(ans, a[i])
    ans = ans * a[i] // g

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = [input() for i in range(5)]
s_min = min(s)

print(N//s_min + 5)

Fixed submission:
import math
N = int(input())
s = [input() for i in range(5)]
s = [int(i) for i in s]
s_min = min(s)
time = math.ceil(N/s_min) + 4
print(time)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [input() for i in range(5)]
s = [int(i) for i in  s]
time = 0
road = [0 for i in range(6)]
road[0] = N
while(True):
    for i in range(5)[::-1]:
        moving_people_num = len(set(range(road[i])) & set(range(s[i]))) 
        road[i] -= moving_people_num
        road[i+1] += moving_people_num
    time += 1
    if road[5] == N:
        break
print(time)

Fixed submission:
import math
N = int(input())
s = [input() for i in range(5)]
s = [int(i) for i in s]
s_min = min(s)
time = math.ceil(N/s_min) + 4
print(time)
Buggy python submission (verdict: Runtime Error):
N,Q =map(int,input().split())
S = input()
t = [0]* (N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2]=='AC' else 0)
for i in range(N):
    l,r =map(int,input().split())
    print(t[r-1]-t[l-1])


Fixed submission:
N,Q =map(int,input().split())
S = input()
t = [0]* (N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2]=='AC' else 0)
for i in range(Q):
    l,r =map(int,input().split())
    print(t[r-1]-t[l-1])
Buggy python submission (verdict: Runtime Error):
a,b = map(input().split())
print((a-1)*(b-1))

Fixed submission:
a,b = map(int,input().split())
print((a-1)*(b-1))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 0
teams = []
for i in range(N):
    teams.append([l[0],l[1],l[-1]])
    l.remove(l[0])
    l.remove(l[1])
    l.remove(l[-1])

print(sum([i[1] for i in teams]))

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = l[1::2]

print(sum(ans[:N]))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 0
teams = []
for i in range(N):
    teams.append([l[0],l[1],l[-1]])
    l.remove(l[0])
    l.remove(l[1])
    l.remove(l[-1])

print(sum([i[1] for i in teams]))

Fixed submission:
N = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = l[1::2]

print(sum(ans[:N]))
Buggy python submission (verdict: Runtime Error):
s = list(input())
s.reverse()
s = "".join(s)
before_s = s
for _ in range(10**5):
    if s[:5]=="maerd" or s[:5] =="esare":
        s = s[5:]
    elif s[:7]=="remaerd" :
        s = s[7:]
    elif s[:6] == "resare":
        s = s[6:]
    if s == "":
        ans = "YES"
        break
    if s == before_s:
        ans ="NO"
        break
print(ans)

Fixed submission:
s = list(input())
s.reverse()
s = "".join(s)

for _ in range(10**5):
    before_s = s
    if s[:5]=="maerd" or s[:5] =="esare":
        s = s[5:]
    elif s[:7]=="remaerd" :
        s = s[7:]
    elif s[:6] == "resare":
        s = s[6:]
    if s == "":
        ans = "YES"
        break
    if s == before_s:
        ans ="NO"
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split(" ")))

ans = 0
ans1 = 0
flag = False
for i in range(n, 0, -1):

    if(i >= k):
        ans1 += 1
        continue

    if(flag == False):
        flag = True
        j = 1
        while(i**(j+1) < k): j += 1

        tmp = j
        ans += 1
    else:
        while(i**(j+1) >= k): j -= 1
        j += 1

        if(tmp != j):
            ans *= 2
            ans += 1
            tmp = j
        else: ans += 1

print((ans+ans1*2**j) / (n*2**j))

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

ans = 0
ans1 = 0
j = 1
flag = False
for i in range(n, 0, -1):

    if(i >= k):
        ans1 += 1
        continue

    if(flag == False):
        flag = True
        while(i*2**j < k): j += 1

        tmp = j
        ans += 1
    else:
        while(i*2**j >= k): j -= 1
        j += 1

        if(tmp != j):
            ans *= 2
            ans += 1
            tmp = j
        else: ans += 1

print((ans+ans1*2**j) / (n*2**j))

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

ans = 0
ans1 = 0
flag = False
for i in range(n, 0, -1):
    if(k % n == 0): count = k // n
    else: count = k // n + 1

    if(i >= k):
        ans1 += 1
        continue

    if(flag is False):
        flag = True
        j = 1
        while(i**(j+1) < k): j += 1

        tmp = j
        ans += 1
    else:
        while(i**(j+1) >= k): j -= 1
        j += 1

        if(tmp != j):
            ans *= 2
            ans += 1
            tmp = j
        else: ans += 1

print((ans+ans1*2**j) / (n*2**j))

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

ans = 0
ans1 = 0
j = 1
flag = False
for i in range(n, 0, -1):

    if(i >= k):
        ans1 += 1
        continue

    if(flag == False):
        flag = True
        while(i*2**j < k): j += 1

        tmp = j
        ans += 1
    else:
        while(i*2**j >= k): j -= 1
        j += 1

        if(tmp != j):
            ans *= 2
            ans += 1
            tmp = j
        else: ans += 1

print((ans+ans1*2**j) / (n*2**j))
Buggy python submission (verdict: Time Limit Exceeded):
n, q = list(map(int, input().split(" ")))
s = input()
l = q*[0]
r = q*[0]
for i in range(q):
    l[i], r[i] = list(map(int, input().split(" ")))


AC = (n-1)*[0]
for i in range(len(s)-1):
    if(s[i:i+2] == "AC"): AC[i] = 1

for i in range(q):
    print(sum(AC[l[i]-1:r[i]-1]))

Fixed submission:
n, q = list(map(int, input().split(" ")))
s = input()
l = q*[0]
r = q*[0]
for i in range(q):
    l[i], r[i] = list(map(int, input().split(" ")))


AC = (n)*[0]
for i in range(len(s)-1):
    if(s[i:i+2] == "AC"): AC[i+1] += AC[i] + 1
    else: AC[i+1] = AC[i]

for i in range(q):
    print(AC[r[i]-1]-AC[l[i]-1])
Buggy python submission (verdict: Time Limit Exceeded):
import copy

s = input()

tmp = ""
count = 0
while(True):
    flag = False
    for i in range(len(s)-1):
        if(flag == True): flag = False
        elif(s[i] != s[i+1]):
            count += 2
            flag = True
        else: tmp += s[i]

    if(flag == False and len(s) != 0): tmp += s[len(s)-1]
    if(s == tmp): break

    s = copy.deepcopy(tmp)
    tmp = ""

print(count)

Fixed submission:
s = input()

count_0 = 0
count_1 = 0

for i in s:
    if(i == "0"): count_0 += 1
    else: count_1 += 1

print(min([count_0, count_1])*2)
Buggy python submission (verdict: Runtime Error):
import fraction

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

a_min = min(a)
ans = 1e10
for i in a:
    tmp = fraction.gcd(a_min, i)
    if(tmp < ans): ans = tmp

print(ans)

Fixed submission:
import fractions

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

a_min = min(a)
ans = 1e10
for i in a:
    tmp = fractions.gcd(a_min, i)
    if(tmp < ans): ans = tmp

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split(" ")))

v1 = {}
v2 = {}
for i in range(len(v)):
    if(i % 2 == 0):
        if((v[i] in v1) == True):
            v1[v[i]] += 1
        else:
            v1[v[i]] = 1
    else: 
        if((v[i] in v2) == True):
            v2[v[i]] += 1
        else:
            v2[v[i]] = 1


if(max_k1 == max_k2):
    if(v1[max_k1] > v2[max_k2]):
        v2[max_k2] = 0
        max_k2 = max(v2, key=v2.get)
    else:
        v1[max_k1] = 0
        max_k1 = max(v1, key=v1.get)


ans = n // 2 - v1[max_k1]
ans += n // 2 - v2[max_k2]

print(ans)

Fixed submission:
n = int(input())
v = list(map(int, input().split(" ")))

v1 = {}
v2 = {}
for i in range(n):
    if(i % 2 == 0):
        if((v[i] in v1) == True):
            v1[v[i]] += 1
        else:
            v1[v[i]] = 1
    else: 
        if((v[i] in v2) == True):
            v2[v[i]] += 1
        else:
            v2[v[i]] = 1

max_k1 = max(v1, key=v1.get)
max_k2 = max(v2, key=v2.get)

ans1 = 1e9
ans2 = 1e9
if(max_k1 == max_k2):
    tmp = v1[max_k1]
    v1[max_k1] = 0
    max_k1 = max(v1, key=v1.get)
    ans1 = n - v1[max_k1] - v2[max_k2]
    v1[max_k1] = tmp
    max_k1 = max(v1, key=v1.get)

    v2[max_k2] = 0
    max_k2 = max(v2, key=v2.get)
    ans2 = n - v1[max_k1] - v2[max_k2]
else: ans1 = n - v1[max_k1] - v2[max_k2]

print(min(ans1, ans2))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import math

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

min = 2
max = 2

for i in reversed(a):
    k = i
    while(min > k):
        k += i
    if(k <= max):
        min = math.ceil(min / i) * i
        max = math.floor(max / i) * i + i - 1
    else:
        print(-1)
        exit()

print("%d %d" %(min, max))

Fixed submission:
import numpy as np
import math

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

min = 2
max = 2

for i in reversed(a):
    min = math.ceil(min / i) * i
    max = math.floor(max / i) * i + i - 1
    if(min > max):
        print(-1)
        exit()

print("%d %d" %(min, max))
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m, k = map(int, input().split(" "))

flag = 0
for i in range(n + 1):
    for j in range(m + 1): 
        if(i * n - i * j + j * m - i * j == k):
            flag = 1

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

Fixed submission:
s = input()

txt = "YAKI"

for i in range(4):
    if(len(s) < 4):
        flag = 0
        break
    if(s[i] == txt[i]):
        flag = 1
    else:
        flag = 0
        break

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