Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int h, w; cin >> h >> w;
  vector<string> board(h);
  for (auto& e: board) cin >> e;

  vector<bool> rowIncludeSharp(h), colIncludeSharp(w);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (board[i][j] == '#') {
        rowIncludeSharp[i] = true;
        colIncludeSharp[j] = true;
      }
    }
  }
  for (int i = 0; i < h; i++) {
    if (rowIncludeSharp[i]) {
      for (int j = 0; j < w; j++) {
        if (colIncludeSharp[j]) {
          cout << board[i][j];
        }
      }
      cout << endl;;
    }
  }
}

Fixed submission:
h,w=map(int,input().split());print(*["".join(e)for e in zip(*["".join(e)for e in zip(*[e for e in[input()for _ in[0]*h]if"#"in e])if"#"in e])],sep="\n")
Buggy python submission (verdict: Runtime Error):
print(abs(1-input()))


Fixed submission:
print(abs(1-int(input())))
Buggy python submission (verdict: Time Limit Exceeded):
x, k, d = map(int, input().split())
x = abs(x)
while k > 0:
    x = min(abs(x + d), abs(x - d))
    k -= 1
print(x)


Fixed submission:
x, k, d = map(int, input().split())
x = abs(x)

k_ = min(k, x // d)
k = k - k_
x = x-k_*d

if k % 2 != 0:
    x = abs(x-d)
print(x)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
A = (a*c)
B = (a*d)  
C = (b*c)
D = (c*d)
MAX = A

if MAX < B:
    MAX = B
elif MAX < C:
    MAX = C
elif MAX < D:
    MAX = D

print(MAX)

Fixed submission:
a = int(input())
if a == 0:
    print('1')
else:
    print('0')
Buggy python submission (verdict: Runtime Error):
d,t,s = map(double, input().split())  
time = d/s
if time > t:
    print("Yes")
else:
    print("No")

Fixed submission:
d,t,s = map(int, input().split())  
time = d/s
if time <= t:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,x,t = map(int, input().split())
Y = X
ans = 0
cnt = 1

while X < N:
    X = X + Y
    cnt = cnt + 1
	ans = T * cnt
	print(ans)

Fixed submission:
n, x, t = map(int, input().split())
tm = (n // x) * t 
if (n % x) != 0:
    tm += t
print(tm)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
X = int(input())
T = int(input())
N = int(input())
Y = X
ans = 0
cnt = 1

while X < N:
    X = X + Y
    cnt = cnt + 1

ans = T * cnt
print(ans)


Fixed submission:
n, x, t = map(int, input().split())
tm = (n // x) * t 
if (n % x) != 0:
    tm += t
print(tm)

Buggy python submission (verdict: Runtime Error):
X = int(input())
T = int(input())
N = int(input())
Y = X
ans = 0
cnt = 1

while X < N:
    X = X + Y
    cnt = cnt + 1

ans = T * cnt
print(ans)


Fixed submission:
n, x, t = map(int, input().split())
tm = (n // x) * t 
if (n % x) != 0:
    tm += t
print(tm)

Buggy python submission (verdict: Runtime Error):
X = int(input())
T = int(input())
N = int(input())
Y = X
ans = 0
cnt = 1

while X < N:
    X = X + Y
    cnt = cnt + 1

ans = T * cnt
print(ans)


Fixed submission:
n, x, t = map(int, input().split())
tm = (n // x) * t 
if (n % x) != 0:
    tm += t
print(tm)
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int, input().split()))

su = sum(arr)

q = int(input())
for i in range(q):
	b,c = map(int, input().split())
    si = su -b + c
    print(si)


Fixed submission:
def ad(a,bank):
	if a not in bank:
		bank[a] = 1
	else:
		bank[a] += 1

def rp(a,b,bank):
	ans = 0
	if a in bank:
		t = bank[a]
		ans = t
		bank[a] = 0
		if b not in bank:
			bank[b] = t
		else:
			bank[b] += t
		
	return ans
# your code goes here
n = int(input())
arr = list(map(int, input().split()))

bank = dict()
su = 0

for a in arr:
	ad(a,bank)
	su += a

q = int(input())
for i in range(q):
	b,c = map(int, input().split())
	t = rp(b,c,bank)
	if b in bank:
		su = su - (t*b) + (t*c)
	
	print(su)
Buggy python submission (verdict: Runtime Error):
arr = map(int, input().split())
print(arr[2], arr[0], arr[1])

Fixed submission:
arr = list(map(int, input().split()))
print(arr[2], arr[0], arr[1])

Buggy python submission (verdict: Runtime Error):
arr = map(int, input().split())
print(arr[2], arr[0], arr[1])

Fixed submission:
arr = list(map(int, input().split()))
print(arr[2], arr[0], arr[1])
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())

rem = n % k
a = rem - k
ans = min(abs(a)


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

if k == 0:
	ans = n
else:
	rem = n % k
	a = rem - k
	ans = min(abs(a), rem)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = 0
while(n > 4):
  if n >= 500:
    h += 1000
  elif n >= 5:
    h += 5
    
print(h)

Fixed submission:
n = int(input())
h = 0
while(n > 4):
    if n >= 500:
        h += 1000
        n -= 500
    elif n >= 5:
        h += 5
        n -= 5
    

    
print(h)
Buggy python submission (verdict: Time Limit Exceeded):
#MSOL C 修正

N,K = map(int,input().split())
A = list(map(int,input().split()))
ynlist = []

def checker(i):
  l1 = A[i-K+1:i:]
  i1 = A[i-K]
  i2 = A[i]
  if i1 < i2:
    return "Yes"
  else:
    return "No"

for i in range(K,N):
  print(checker(i))

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

for i in range(K,N):
  if A[i-K] < A[i]:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
sys.setrecursionlimit(10**5+10)

N,K = map(int,input().split())
A = list(map(int,input().split()))
ynlist = []

def checker(i):
  try:
    l1 = A[i-K+1:i:]
    b = np.prod(l1)
    i1 = A[i-K]
    i2 = A[i]
    score1 = b * i1
    score2 = b * i2
    if score1 < score2:
      ynlist.append("Yes")
    else:
      ynlist.append("No")
    checker(i + 1)
  except IndexError:
    pass

checker(K)
for i in ynlist:
  print(i)

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

for i in range(K,N):
  if A[i-K] < A[i]:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
import numpy as np

n = int(input())
numlist = list(map(int, input().split()))
ans = 1;

for i in numlist:
    if i == 0:
        ans = 0
        break
    ans *= i
    
if ans > 10**18:
    ans = -1

print(ans)

Fixed submission:
# coding: utf-8
import numpy as np
 
n = int(input())
numlist = list(map(int, input().split()))
ans = 1;

if 0 in numlist:
    ans = 0
else:
    for i in numlist:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
import numpy as np

n = int(input())
numlist = list(map(int, input().split()))
ans = 1;

for i in numlist:
    ans *= i
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
# coding: utf-8
import numpy as np
 
n = int(input())
numlist = list(map(int, input().split()))
ans = 1;

if 0 in numlist:
    ans = 0
else:
    for i in numlist:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
 
print(ans)
Buggy python submission (verdict: Runtime Error):
x = list(map(int,input().split()))
for i in x:
  if x[i] == 0:
    print(i+1)
    

Fixed submission:
x = list(map(int,input().split()))
for i in range(len(x)):
  if x[i] == 0:
    print(i + 1)
Buggy python submission (verdict: Runtime Error):
def base3(K):
    tmp=K
    S=""
    while(True):
        S=str(tmp%3)+S
        tmp=tmp//3
        if tmp==0:
            break
    return S
L=int(input())
T=base3(L)[::-1]
N=len(T)
A=[]
for i in range(N-1):
    tmp=3**i
    for k in range(3):
        A.append((i+1,i+2,k*tmp))
bef=0
for i in range(N)[::-1]:
    tmp=3**i
    for k in range(int(T[i])):
        A.append((i+1,N+1,bef+k*tmp))
    bef+=int(T[i])*tmp
print(N+1,len(A))
for p in A:
    print(p[0],p[1],p[2])ans=(n//k)**3


Fixed submission:
n,k=map(int,input().split())
ans=(n//k)**3
if(k%2==0):
    ans+=(n//(k//2)-n//k)**3
print(ans)

Buggy python submission (verdict: Runtime Error):
    def base3(K):
        tmp=K
        S=""
        while(True):
            S=str(tmp%3)+S
            tmp=tmp//3
            if tmp==0:
                break
        return S
    L=int(input())
    T=base3(L)[::-1]
    N=len(T)
    A=[]
    for i in range(N-1):
        tmp=3**i
        for k in range(3):
            A.append((i+1,i+2,k*tmp))
    bef=0
    for i in range(N)[::-1]:
        tmp=3**i
        for k in range(int(T[i])):
            A.append((i+1,N+1,bef+k*tmp))
        bef+=int(T[i])*tmp
    print(N+1,len(A))
    for p in A:
        print(p[0],p[1],p[2])

Fixed submission:
n,k=map(int,input().split())
ans=(n//k)**3
if(k%2==0):
    ans+=(n//(k//2)-n//k)**3
print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
if n == 1 or m == 1:
    print(1)
else:
    r = (n * m) // 2
    if (n * m) % 2 == 0:
        print(r)
    else:
        print(r+1)


Fixed submission:
t = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(t[int(input()) - 1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans = 0
for i in range(1, n+1):
    ans += (n//i) * (int(n/i)+1))//2*i;
print(ans)

Fixed submission:
n=int(input())
ans = 0
for i in range(1, n+1):
    ans += (n//i) * ((n//i)+1)//2*i;
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans = 0
for i in range(1, n+1):
    ans += int((int(n/i) * (int(n/i)+1))/2)*i;
print(ans)

Fixed submission:
n=int(input())
ans = 0
for i in range(1, n+1):
    ans += (n//i) * ((n//i)+1)//2*i;
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans = 0
for i in range(1, n+1):
    occ = int(n/i);
    val = int((occ * (occ+1))/2);
    ans += val*i;
print(ans)

Fixed submission:
n=int(input())
ans = 0
for i in range(1, n+1):
    ans += (n//i) * ((n//i)+1)//2*i;
print(ans)
Buggy python submission (verdict: Runtime Error):
s = str(input())
first = s[0] + s[1]
second = s[2] + s[3]
if int(first) <= 12 and int(first) > 0 and (int(second) > 12 or int(second) == 0):
    print("MMYY")
elif int(second) <= 12 and int(second) > 0 and (int(first) > 12 or int(first) == 0):
    print("YYMM")
elif int(second) <= 12 and int(second) > 0 and int(first) <= 12 and int(first) > 0:
    print("AMBIGUOUS")
else:
    print("NA")


Fixed submission:
n,k = input().split()
s = input()
n = int(n)
k = int(k)
a = list(s)
a[k-1] = a[k-1].lower()
print(''.join(a))
Buggy python submission (verdict: Time Limit Exceeded):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
import random

N = int(input())
A_s = list(map(int, input().split()))
pc = True
sc = True
M = {}
MAX = 0

for i,A in enumerate(A_s):
    for p in factorization(A):
        if p[0] == 1:
            continue
        if p[0] in M:
            # print()
            M[p[0]] += 1
            pc = False
        else:
            M[p[0]] = 1
        MAX = max(MAX, M[p[0]])
    if not pc and MAX <= i:
        break
else:
    sc = False

if pc:
    print('pairwise coprime')
elif sc:
    print('setwise coprime')
else:
    print('not coprime')

Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

import itertools
import collections
def prime_factor_table(n):
    table = [0] * (n + 1)
    
    for i in range(2, n + 1):
        if table[i] == 0:
            for j in range(i + i, n + 1, i):
                table[j] = i
    
    return table

def prime_factor(n, prime_factor_table):
    prime_count = collections.Counter()
    
    while prime_factor_table[n] != 0:
        prime_count[prime_factor_table[n]] += 1
        n //= prime_factor_table[n]
    prime_count[n] += 1
    
    return prime_count

N = int(input())
A_s = list(map(int, input().split()))
# A_s = [int(i+1) for i in range(N)]
pc = True
sc = True
M = {}
MAX = 0
TABLE = prime_factor_table(10**6+1)

for i,A in enumerate(A_s):
    L = prime_factor(A, TABLE)
    for l in L.keys():
        if l == 1:
            continue
        if l in M:
            # print()
            M[l] += 1
            pc = False
        else:
            M[l] = 1
        MAX = max(MAX, M[l])
    if not pc and MAX <= i:
        break
else:
    sc = False

if pc:
    print('pairwise coprime')
elif sc:
    print('setwise coprime')
else:
    print('not coprime')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N,M = map(int, input().split())
AB_s = [list(map(int, input().split())) for _ in range(M)]

answer = [0] * N
queue = deque([1])
answer[0] = N

while len(queue) > 0:
    P = queue.popleft()
    POPS = []
    for i, AB in enumerate(AB_s):
        # P の含まれるパスだったら
        if P in AB:
            # P じゃない方が Q
            Q = AB[0] if AB[1] == P else AB[1]
            # 到達してなかったら道標を置く
            if answer[Q-1] == 0:
                answer[Q-1] = P
                queue.append(Q)
            POPS.append(i)
    for POP in POPS[::-1]:
        AB_s.pop(POP)

if min(answer) == 0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(answer[i])


Fixed submission:
from collections import deque
N,M = map(int, input().split())
AB_s = [list(map(int, input().split())) for _ in range(M)]

MAP = [[] for _ in range(N)]
for AB in AB_s:
    A, B = map(int, AB)
    MAP[A-1].append(B)
    MAP[B-1].append(A)
answer = [0] * N
queue = deque([1])
answer[0] = N
while len(queue) > 0:
    P = queue.popleft()
    if True:
        for Q in MAP[P-1]:
            if answer[Q-1] == 0:
                answer[Q-1] = P
                queue.append(Q)
if min(answer) == 0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(answer[i])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N,M = map(int, input().split())
AB_s = sorted([sorted(list(map(int, input().split()))) for _ in range(M)])

answer = [0] * N
queue = deque([1])
answer[0] = N

while len(queue) > 0:
    P = queue.popleft()
    POPS = []
    for i, AB in enumerate(AB_s):
        # P の含まれるパスだったら
        if P in AB:
            # P じゃない方が Q
            Q = AB[0] if AB[1] == P else AB[1]
            # 到達してなかったら道標を置く
            if answer[Q-1] == 0:
                answer[Q-1] = P
                queue.append(Q)
            POPS.append(i)
    for i, POP in enumerate(POPS[::-1]):
        AB_s.pop(POP)

if min(answer) == 0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(answer[i])


Fixed submission:
from collections import deque
N,M = map(int, input().split())
AB_s = [list(map(int, input().split())) for _ in range(M)]

MAP = [[] for _ in range(N)]
for AB in AB_s:
    A, B = map(int, AB)
    MAP[A-1].append(B)
    MAP[B-1].append(A)
answer = [0] * N
queue = deque([1])
answer[0] = N
while len(queue) > 0:
    P = queue.popleft()
    if True:
        for Q in MAP[P-1]:
            if answer[Q-1] == 0:
                answer[Q-1] = P
                queue.append(Q)
if min(answer) == 0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(answer[i])
Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = map(int, input().split())
MOD = 998244353

fact = [1]
rfact = [1]
for i in range(1, N+1):
    fact.append(fact[i-1]*i%MOD)
    rfact.append(pow(fact[i], MOD-2, MOD))
 
def cmb(n, m):
    return fact[n]*rfact[m]*rfact[n-m]%MOD

answer = 0
for i in range(K+1):
    answer += M*cmb(N-1,i)*(M-1)**(N-1-i)*1**i
print(answer%MOD)

Fixed submission:
N,M,K = map(int, input().split())
MOD = 998244353

fact = [1]
rfact = [1]
for i in range(1, N+1):
    fact.append(fact[i-1]*i%MOD)
    rfact.append(pow(fact[i], MOD-2, MOD))
 
def cmb(n, m):
    return fact[n]*rfact[m]*rfact[n-m]%MOD

answer = 0
for i in range(K+1):
    answer += (M*cmb(N-1,i)*pow(M-1,N-1-i,MOD))%MOD
print(answer%MOD)

Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N,M,K = map(int, input().split())
answer = 0
for i in range(K+1):
    answer += M*comb(N-1,i, exact=True)*(M-1)**(N-1-i)*1**i
print(answer%998244353)

Fixed submission:
N,M,K = map(int, input().split())
MOD = 998244353

fact = [1]
rfact = [1]
for i in range(1, N+1):
    fact.append(fact[i-1]*i%MOD)
    rfact.append(pow(fact[i], MOD-2, MOD))
 
def cmb(n, m):
    return fact[n]*rfact[m]*rfact[n-m]%MOD

answer = 0
for i in range(K+1):
    answer += (M*cmb(N-1,i)*pow(M-1,N-1-i,MOD))%MOD
print(answer%MOD)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
K = int(input())
answer = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            answer += gcd(gcd(i,j),k)

print(answer)

Fixed submission:
from math import gcd
K = int(input())
answer = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            answer += gcd(gcd(i,j),k)

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = int(input())
is_inversed = False
for i in range(N):
    Q = input()
    if Q[0] == '1':
        is_inversed = not (is_inversed)
    else:
        if (Q[2] == '1' and is_inversed) or (Q[2] == '2' and not (is_inversed)):
            S = S + Q[4]
        else:
            S = Q[4] + S

if is_inversed:
    print(S[::-1])
else:
    print(S)

Fixed submission:
from collections import deque
S = deque(input())
N = int(input())
is_inversed = False
for i in range(N):
    Q = input()
    if Q[0] == '1':
        is_inversed = not (is_inversed)
    else:
        if (Q[2] == '1' and is_inversed) or (Q[2] == '2' and not (is_inversed)):
            S.append(Q[4])
        else:
            S.appendleft(Q[4])
if is_inversed:
    print(''.join(list(S)[::-1]))
else:
    print(''.join(S))
Buggy python submission (verdict: Runtime Error):
MOD = 1000000007
n,a,b = map(int,input().split())

def modpow(a, n, mod):
    res = 1
    while n > 0:
        if (n & 1): res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res
    

fac = [0]*(n+1)
finv = [0]*(n+1)
inv = [0]*(n+1)

# テーブルを作る前処理
def COMinit(n, MOD):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, n+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

# 二項係数計算
def COM(n, k):
    if (n < k): return 0
    if (n < 0 or k < 0): return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


COMinit(n, MOD)
answer = modpow(2, n, MOD) - 1 - COM(n, a) - COM(n, b)
print(answer)

Fixed submission:
mod = 10**9+7
 
def comb(n,m,p=10**9+7):
    if n < m : return 0
    if n < 0 or m < 0:return 0
    m = min(m, n-m)
    top = bot = 1
    for i in range(m):
        top = top*(n-i) % p
        bot = bot*(i+1) % p
    bot = pow(bot, p-2, p)
    return top*bot % p
 
n,a,b = map(int, input().split())
ans = pow(2, n, mod)-1 - comb(n,a) - comb(n, b)
ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

import heapq
a = []
heapq.heapify(a)  # リストを優先度付きキューへ
N,K = map(int,input().split())
A_s = list(map(int,input().split()))

for i in range(N-1):
    for j in range(i+1,N):
        heapq.heappush(a, A_s[i]*A_s[j])
        
for i in range(K-1):
    heapq.heappop(a)

print(heapq.heappop(a))

Fixed submission:
N,K = map(int,input().split())
A_s = list(map(int,input().split()))
minus = [-x for x in A_s if x < 0]
plus = [x for x in A_s if x >= 0]
minus.sort()
plus.sort()

def cnt(x):
    ans = 0
    if x < 0:
        r = 0
        x = -x
        for num in minus[::-1]:
            while r < len(plus) and plus[r] * num < x:
                r += 1
            ans += len(plus) - r
        return ans
        
    r = 0
    for num in minus[::-1]:
        if num * num <= x: ans -= 1
        while r < len(minus) and minus[r] * num <= x:
            r += 1
        ans += r
    r = 0
    for num in plus[::-1]:
        if num * num <= x: ans -= 1
        while r < len(plus) and plus[r] * num <= x:
            r += 1
        ans += r
    ans //= 2
    ans += len(minus) * len(plus)
    return ans


top = 2 * (10**18) + 2
bottom = 0

while top - bottom > 1:
    mid = (top + bottom) // 2
    if cnt(mid-10**18-1) < K:
        bottom = mid
    else:
        top = mid
print(int(top-10**18-1))
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(A-2*b if A-2*b > 0 else 0)

Fixed submission:
A, B = map(int, input().split())
print(A - 2 * B if A - 2 * B > 0 else 0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
A,B = map(int,input().split())
answer = 1 #１で割ることは絶対に可能
if A%2 == 0 and B%2 == 0:
    answer += 1

if min(A,B) == 2:
    print(answer)
    sys.exit(0)
sosuu = [2]
A = min(A,B)
for L in range(3, A, 2): # 2 以外の素数は奇数なので
    for L2 in sosuu:
        if L % L2 == 0:
            break # 素数でないことがわかったらそれ以上ループする必要はない
    else: # break で抜けることがなかったら L は素数（Python 特有の制御構文）
        sosuu.append(L)
        if A%L == 0 and B%L == 0:
            answer += 1
print(answer)


Fixed submission:
import sys
A,B = map(int,input().split())
def trial_division(n):
    if n < 2:
        return []

    prime_factors = []

    for i in range(2, int(n**0.5)+1):
        # nがi（の累乗）で割り切れるかを調べる
        while n % i == 0:
            # nがiで割り切れる場合、iを素因数としてリストに追加する
            prime_factors.append(i)
            # nをiで割った商で更新しておく
            n //= i
    # nの平方根より大きい素因数が存在する場合
    if n > 1:
        prime_factors.append(n)

    return prime_factors

A = set(trial_division(A))
B = set(trial_division(B))
print(len(A & B)+1)