Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
listNums = list(map(int,input().split()))
listSadness = []
b = 0
c = 1000000000
for b in range(min(listNums) - N, max(listNums) + N):
    for i in range(len(listNums)):
        listSadness.append(abs(listNums[i] - (b + 1 + i)))
    if sum(listSadness) < c:
        c = sum(listSadness)
    listSadness = []
print(c)

Fixed submission:
# median を import する
from statistics import median

# N と Ai を標準入力
N = int(input())
listNumsAs = list(map(int,input().split()))

# 空のリスト listNumsBs を用意
listNumsBs = []

# listNumAs の各要素から、その (index + 1) の数を引いた (Ai - (i + 1)) をリスト listNumsBs に順番に代入
for index in range(len(listNumsAs)):
    listNumsBs.append(listNumsAs[index] - index - 1)

# listNumsBs を昇順にソートする
listNumsBs.sort()

# listNumsBs の中央値を med に代入する
med = int(median(listNumsBs))

listSadnessA1 = [abs(s - med - N) for s in listNumsBs]
minimumSum = sum(listSadnessA1)

# listNumsBs の中央値 ± N の範囲の変数 b で処理を繰り返す
for b in range(med - 10, med + 10):
    
    # 悲しさ指数のリスト listSadness に (Bi - b) の絶対値の計算結果を順番に代入する
    listSadness = [abs(s - b) for s in listNumsBs]
       
    if sum(listSadness) < minimumSum:
        minimumSum = sum(listSadness)
        listTruthSadness = listSadness
        truthB = b

print(minimumSum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

ans_num = 1
ans_para = h[0]
for i, r in enumerate(h):
    deg = t - (r * 0.006)
    ans_para_deg = t - (ans_para * 0.006)
    if abs(a - ans_para_deg) >= abs(a - deg):
        ans_para = r
        ans_num = i+1
print(ans_num

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

ans_num = 1
ans_para = h[0]
for i, r in enumerate(h):
    deg = t - (r * 0.006)
    ans_para_deg = t - (ans_para * 0.006)
    if abs(a - ans_para_deg) >= abs(a - deg):
        ans_para = r
        ans_num = i+1
print(ans_num)
Buggy python submission (verdict: Runtime Error):
n = int(input())
is_equal = 'No'
for r_1 in range(n//4 + 1):
    sum_4 = r * 4
    for r_2 in range(n//7 + 1):
        sum_7 = r2 * 7
        if sum_4 + sum_7 == n:
            is_equal = 'Yes'
print(is_equal)

Fixed submission:
n = int(input())
for r_1 in range(n//4 + 1):
    sum_4 = r_1 * 4
    for r_2 in range(n//7 + 1):
        sum_7 = r_2 * 7
        if sum_4 + sum_7 == n:
            print('Yes')
            exit()
print('No')
Buggy python submission (verdict: Runtime Error):
print('Yes' if sorted(input()) < sorted(input(), reverse=True) else 'No')


Fixed submission:
a, b = map(int, input().split())
print((a+b+1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
c = 0
for i_x in range(k+1):
    for i_y in range(k+1):
        for i_z in range(k+1):
            if i_x + i_y + i_z == s:
                c += 1
print(c)

Fixed submission:
k, s = map(int, input().split())
c = 0
for i_x in range(k+1):
    for i_y in range(k+1):
        z = s - (i_x + i_y)
        if z >= 0 and z <= k:
            c += 1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

import collections

def parse_input():
    N = int(input())
    A = list(map(int, input().split()))
    return N, A

if __name__ == "__main__":
    N, A = parse_input()
    counts = collections.defaultdict(int)
    for i in range(N):
        counts[A[i]] += 1

    for i in range(N):
        num = 0
        for a, c in counts.items():
            if a == A[i]:
                c -= 1
            num += max((c * (c - 1)) // 2, 0)
        print(num)


Fixed submission:
#!/usr/bin/env python

import collections

def parse_input():
    N = int(input())
    A = list(map(int, input().split()))
    return N, A

if __name__ == "__main__":
    N, A = parse_input()
    counts = collections.defaultdict(int)
    for i in range(N):
        counts[A[i]] += 1

    total = 0
    subtracts = collections.defaultdict(int)
    for a, c in counts.items():
        num_patterns = max((c * (c - 1)) // 2, 0)
        subtracts[a] = num_patterns - max(((c - 1) * (c - 2)) // 2, 0)
        total += num_patterns

    for i in range(N):
        print(total - subtracts[A[i]])

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

import collections

def parse_input():
    N = int(input())
    A = list(map(int, input().split()))
    return N, A

if __name__ == "__main__":
    N, A = parse_input()
    for i in range(N):
        counts = collections.defaultdict(int)
        for j in range(N):
            if i == j: continue
            counts[A[j]] += 1
        num = 0
        for c in counts.values():
            num += max((c * (c - 1)) // 2, 0)
        print(num)

Fixed submission:
#!/usr/bin/env python

import collections

def parse_input():
    N = int(input())
    A = list(map(int, input().split()))
    return N, A

if __name__ == "__main__":
    N, A = parse_input()
    counts = collections.defaultdict(int)
    for i in range(N):
        counts[A[i]] += 1

    total = 0
    subtracts = collections.defaultdict(int)
    for a, c in counts.items():
        num_patterns = max((c * (c - 1)) // 2, 0)
        subtracts[a] = num_patterns - max(((c - 1) * (c - 2)) // 2, 0)
        total += num_patterns

    for i in range(N):
        print(total - subtracts[A[i]])
Buggy python submission (verdict: Time Limit Exceeded):
K, N = map(int, input().split())
A = list(map(int, input().split()))

ans = max(A) - min(A)

for i in range(N):
  A[-(i+1)] -= K
  if max(A) - min(A) < ans:
    ans = max(A) - min(A)

print(ans)

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

dist = [0] * (N)

for i in range(N-1):
  dist[i] = A[i+1] - A[i]
dist[N-1] = A[0] - A[-1] + K

print(K - max(dist))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def tri_check(a,b,c):
  if a<b+c and b<a+c and c<a+b:
    return True
  else:
    False

N = int(input())
L = list(map(int, input().split()))
ans = 0
for a,b,c in list(itertools.combinations(L, 3)):
  if tri_check(a,b,c):
    ans += 1
    
print(ans)

Fixed submission:
from collections import Counter
import bisect 

N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0

for i in range(N):
  for j in range(i+1, N):
    idx = bisect.bisect_right(L, L[i]+L[j]-1)
    ans += (idx-(j+1))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
ans = [0]*N
for n in range(N):
  chars = sorted(list(input()))

  if chars in s:
    ans[s.index(chars)] += 1
  else:
    s.append(chars)

for idx,x in enumerate(ans):
  ans[idx] = x * (x+1) // 2
print(sum(ans))

Fixed submission:
N = int(input())
s = {}
ans = 0
for n in range(N):
  chars = str(sorted(list(input())))

  if chars in s:
    s[chars] += 1
  else:
    s[chars] = 0
    
for value in s.values():
  ans += value * (value+1) // 2
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
ans = [0]*N
for n in range(N):
  chars = sorted(list(input()))

  if chars in s:
    ans[s.index(chars)] += 1
  else:
    s.append(chars)

for idx,x in enumerate(ans):
  ans[idx] = x * (x+1) // 2
print(sum(ans))

Fixed submission:
N = int(input())
s = {}
ans = 0
for n in range(N):
  chars = str(sorted(list(input())))

  if chars in s:
    s[chars] += 1
  else:
    s[chars] = 0
    
for value in s.values():
  ans += value * (value+1) // 2
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
ans = 0
for n in range(N):
  chars = sorted(list(input()))

  if chars in s:
    ans += s.count(chars)
  s.append(chars)

print(ans)

Fixed submission:
N = int(input())
s = {}
ans = 0
for n in range(N):
  chars = str(sorted(list(input())))

  if chars in s:
    s[chars] += 1
  else:
    s[chars] = 0
    
for value in s.values():
  ans += value * (value+1) // 2
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
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(reverse=True)
    return divisors

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

for d in make_divisors(sum(A)):
  if d==1:
    print(d)
    exit()
  A_ = [a%d for a in A if a%d]
  if max(A_)+K < d:
    continue  
  A_.sort()
  left, right = 0, len(A_)-1
  for k in range(K):    
    A_[left] -= 1
    if A_[left]==0:
      left += 1
    A_[right]+= 1
    if A_[right]==d:
      right-= 1
    if sum([a%d for a in A_]) == 0:
      print(d)
      exit()




Fixed submission:
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(reverse=True)
    return divisors

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

for d in make_divisors(sum(A)):
  if d==1:
    print(d)
    exit()
  A_ = [a%d for a in A if a%d]
  if max(A_)+K < d:
    continue  
  A_.sort()
  lSum, rSum = 0, 0
  K_need = 1e9
  for a in A_:
    rSum += d - a
  for a in A_:
    lSum += a
    rSum -= d - a
    K_need = min(K_need, max(lSum,rSum))
  if K_need <= K:
    print(d)
    exit()

Buggy python submission (verdict: Time Limit Exceeded):
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(reverse=True)
    return divisors

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

for d in make_divisors(sum(A)):
  if d==1:
    print(d)
    exit()
  A_ = [a%d for a in A if a%d]
  if max(A_)+K < d:
    continue  
  A_.sort()
  left, right = 0, len(A_)-1
  for k in range(K):    
    A_[left] -= 1
    if A_[left]==0:
      left += 1
    A_[right]+= 1
    if A_[right]==d:
      right-= 1
    if sum([a%d for a in A_]) == 0:
      print(d)
      exit()




Fixed submission:
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(reverse=True)
    return divisors

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

for d in make_divisors(sum(A)):
  if d==1:
    print(d)
    exit()
  A_ = [a%d for a in A if a%d]
  if max(A_)+K < d:
    continue  
  A_.sort()
  lSum, rSum = 0, 0
  K_need = 1e9
  for a in A_:
    rSum += d - a
  for a in A_:
    lSum += a
    rSum -= d - a
    K_need = min(K_need, max(lSum,rSum))
  if K_need <= K:
    print(d)
    exit()
Buggy python submission (verdict: Runtime Error):
import numpy as np

s = input()
mod = 10**9+7

dp = np.zeros((len(s)+1, 13))
dp[0][0] = 1

for i in range(len(s)):
  c = -1 if s[i] == '?' else int(s[i])
  for j in range(10):
    if (c != -1 and c != j):
      continue
    for k in range(13):
      dp[i+1][(k * 10 + j) % 13] += dp[i][k]
      dp[i+1][(k * 10 + j) % 13] %= mod
		
  for j in range(13):
    dp[i+1][j] %= mod    
  
print(int(dp[len(s)][5]))



Fixed submission:
s = input()
mod = 10**9+7

dp = [[0 for j in range(13)] for i in range(len(s)+1)]
dp[0][0] = 1
for i in range(len(s)):
  c = -1 if s[i] == '?' else int(s[i])
  for j in range(10):
    if (c != -1 and c != j):
      continue
    for k in range(13):
      dp[i+1][(k * 10 + j) % 13] += dp[i][k]
      dp[i+1][(k * 10 + j) % 13] %= mod
		
  for j in range(13):
    dp[i+1][j] %= mod    
  
print(int(dp[len(s)][5]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

s = input()
mod = 10**9+7

dp = np.zeros((len(s)+1, 13))
dp[0][0] = 1

for i in range(len(s)):
  c = -1 if s[i] == '?' else int(s[i])
  for j in range(10):
    if (c != -1 and c != j):
      continue
    for k in range(13):
      dp[i+1][(k * 10 + j) % 13] += dp[i][k]

  for j in range(13):
    dp[i+1][j] %= mod    
  
print(int(dp[len(s)][5]))



Fixed submission:
s = input()
mod = 10**9+7

dp = [[0 for j in range(13)] for i in range(len(s)+1)]
dp[0][0] = 1
for i in range(len(s)):
  c = -1 if s[i] == '?' else int(s[i])
  for j in range(10):
    if (c != -1 and c != j):
      continue
    for k in range(13):
      dp[i+1][(k * 10 + j) % 13] += dp[i][k]
      dp[i+1][(k * 10 + j) % 13] %= mod
		
  for j in range(13):
    dp[i+1][j] %= mod    
  
print(int(dp[len(s)][5]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for n in range(N)]

for n in range(N):
  tmp = A.copy()
  tmp.pop(n)
  print(max(tmp))

Fixed submission:
N = int(input())
A = [int(input()) for n in range(N)]
tmp = A.copy()
A.sort()
fir, sec = A[N-1], A[N-2]
for n in range(N):
  if tmp[n] == fir:
    print(sec)
  else:
    print(fir)
Buggy python submission (verdict: Runtime Error):
from math import factorial

def nCr(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))
  
mod = 10**9 + 7 
 
N,K = map(int,input().split())

for i in range(K):
  # 赤を仕切りと考える、仕切りの左右には箱(N-K+1個)がある、その中のどの箱(i+1個)を用いるか
  box_comb = nCr(N-K+1, i+1) % mod
  # 各箱にK個の青を入れる組み合わせ、空箱はナシ→K個の青の間(K-1)に仕切りをi個入れる
  blue_comb = nCr(K-1, i) % mod
  print((box_comb * blue_comb) % mod)

Fixed submission:
from math import factorial

def nCr(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))
  
mod = 10**9 + 7 
 
N,K = map(int,input().split())

for i in range(K):
  if (N - K - i) < 0:
    print(0)
  else:
    # 赤を仕切りと考える、仕切りの左右には箱(N-K+1個)がある、その中のどの箱(i+1個)を用いるか
    box_comb = nCr(N-K+1, i+1) % mod
    # 各箱にK個の青を入れる組み合わせ、空箱はナシ→K個の青の間(K-1)に仕切りをi個入れる
    blue_comb = nCr(K-1, i) % mod
    print((box_comb * blue_comb) % mod)
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
  if a == b:
    return b
  if a < b:
    a, b = b, a
  return gcd(a-b, b)

N, X = map(int, input().split())
x = list(map(int,input().split()))
ans = max(x)
if N==1:
  ans = abs(X-x[0])
else:
  for i in range(N-1):
  	ans = min(ans, gcd(abs(x[i]-X), abs(x[i+1]-X)))

print(ans)



Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N, X = map(int, input().split())
x = list(map(int,input().split()))
ans = max(x)
if N==1:
  ans = abs(X-x[0])
else:
  for i in range(N-1):
  	ans = min(ans, gcd(abs(x[i]-X), abs(x[i+1]-X)))

print(ans)
Buggy python submission (verdict: Runtime Error):
a = map(int, input().split())
print(max(a)-min(a))

Fixed submission:
a = list(map(int, input().split()))
print(max(a)-min(a))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from itertools import permutations
from math import factorial

N = int(input())

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

p = permutations(points,N)

average = 0
for j in p:
    for k in range(0,len(j)-1):
        average += np.linalg.norm(np.array(j[k+1])-np.array(j[k]))

print('{:.10f}'.format(average/factorial(N)))

Fixed submission:
from itertools import permutations
from math import factorial

N = int(input())

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

p = permutations(points,N)

average = 0

for j in p:
    for k in range(0,len(j)-1):
        average += ((j[k+1][0] -j[k][0])**2 + (j[k+1][1] -j[k][1])**2)**0.5

print('{:.10f}'.format(average/factorial(N)))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools
from math import factorial

N = int(input())

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

p = itertools.permutations(points,N)

average = 0
for j in p:
    for k in range(0,len(j)-1):
        average += np.linalg.norm(np.array(j[k+1])-np.array(j[k]))

print('{:.10f}'.format(average/factorial(N)))

Fixed submission:
from itertools import permutations
from math import factorial

N = int(input())

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

p = permutations(points,N)

average = 0

for j in p:
    for k in range(0,len(j)-1):
        average += ((j[k+1][0] -j[k][0])**2 + (j[k+1][1] -j[k][1])**2)**0.5

print('{:.10f}'.format(average/factorial(N)))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
i_str = input()
N,A,B = map(int,i_str.split())


all_count = 0
b_count = 0
maxnum =pow(10,100) 
for i in range(maxnum):
    if all_count + A >= N:
        tmp_b = b_count + (N - all_count)
        print(tmp_b)
        break
    all_count += A
    b_count += A
    all_count += B
    if all_count >= N:
        print(b_count)
        break

Fixed submission:
# -*- coding: utf-8 -*-
i_str = input()
N,A,B = map(int,i_str.split())

import sys
AB = A+B
maxnum = pow(10,100)
if A == 0:
    print(0)
    sys.exit()
if N <= A:
    print(N)
    sys.exit()
waru,amari = divmod(N,AB)
#waru = (N // AB)
#amari = N % AB
if amari > A:
    amari = A
answer = waru * A + amari
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = list(map(int, input().split()))
S = input()
for q in range(Q):
    l, r = list(map(int, input().split()))
    print(S[l-1:r].count('AC'))

Fixed submission:
N, Q = list(map(int, input().split()))
S = input()
pre = [0]*N
for i in range(1, len(S)):
    if S[i] == 'C' and S[i-1] == 'A':
        pre[i] = pre[i-1] + 1
    else:
        pre[i] = pre[i-1]
for q in range(Q):
    l, r = list(map(int, input().split()))
    l-=1
    r-=1
    print(pre[r] - pre[l])
Buggy python submission (verdict: Runtime Error):
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))
ex = []
exsum = [0] *20000

tmpmax = 0
for i in range(n):
  ex.append(E(l[i]))

for i in range(n-k+1):
  if i == 0:
    for j in range(k):
      tmpmax += ex[i+j]
      exsum[i] = tmpmax
  else:
    exsum[i] = exsum[i-1] - ex[i-1] + ex[i+k-1]
  
a = exsum.index(max(exsum))

print(exsum[a])



Fixed submission:
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))
ex = []
exsum = [0] *300000

tmpmax = 0
for i in range(n):
  ex.append(E(l[i]))

for i in range(n-k+1):
  if i == 0:
    for j in range(k):
      tmpmax += ex[i+j]
      exsum[i] = tmpmax
  else:
    exsum[i] = exsum[i-1] - ex[i-1] + ex[i+k-1]
  
a = exsum.index(max(exsum))

print(exsum[a])

Buggy python submission (verdict: Runtime Error):
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))
ex = []
exsum = [0] *20000

tmpmax = 0
for i in range(n):
  ex.append(E(l[i]))

for i in range(n-k+1):
 for j in range(k):
  if i == 0:
    tmpmax += ex[i+j]
    exsum[i] = tmpmax
  else:
    exsum[i] = exsum[i-1] - ex[i-1] + ex[i+k-1]
a = exsum.index(max(exsum))

print(exsum[a])



Fixed submission:
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))
ex = []
exsum = [0] *300000

tmpmax = 0
for i in range(n):
  ex.append(E(l[i]))

for i in range(n-k+1):
  if i == 0:
    for j in range(k):
      tmpmax += ex[i+j]
      exsum[i] = tmpmax
  else:
    exsum[i] = exsum[i-1] - ex[i-1] + ex[i+k-1]
  
a = exsum.index(max(exsum))

print(exsum[a])

Buggy python submission (verdict: Time Limit Exceeded):
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))

tmpmax = 0
for i in range(n-k+1):
  s = 0
  for j in range(k):
    s += E(l[i + j])
  if s >= tmpmax:
    tmpmax = s

print(tmpmax)
  

Fixed submission:
def E(n):
  return n*(1+n)/2/n

n, k = map(int, input().split())
l = list(map(int, input().split()))
ex = []
exsum = [0] *300000

tmpmax = 0
for i in range(n):
  ex.append(E(l[i]))

for i in range(n-k+1):
  if i == 0:
    for j in range(k):
      tmpmax += ex[i+j]
      exsum[i] = tmpmax
  else:
    exsum[i] = exsum[i-1] - ex[i-1] + ex[i+k-1]
  
a = exsum.index(max(exsum))

print(exsum[a])
Buggy python submission (verdict: Runtime Error):
h = int(input())
mem = [0] * 100
cnt = 0
 
def atk(k):
    if k == 1:
        mem[1] = 1
        return 1
    else:
        j = int(k // 2)
        l = 0
        while k / ( 2 ** l) >1:
            l += 1
 
        if mem[l] == 0:
            mem[l] = atk(j) * 2 + 1
            return mem[l]
        else:        
            return mem[l]

atk(h)
mem.sort(reverse = True)
print(mem[0])


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

h.sort(reverse = True)

if k > n:
  k = n

for i in range(k):
  h[i] = 0

ans = 0
for i in range(n):
  ans += h[i]
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

i = 0
j = 0
bt = 0

while i < n:
  while j < n - i:
    if a[i+j] == i+1:
      bt += 1
      break
    if j + i == n-1:
      if i == 0:
        bt = -1
      j = n + 1
      i = n + 1
      
    j += 1
  i += 1
  
if bt != -1:
  bt = n - bt
  
print(bt)

Fixed submission:
Answer = [1, 2, 3]

A = int(input())
B = int(input())

Answer.remove(A)
Answer.remove(B)

print(Answer[0])

Buggy python submission (verdict: Runtime Error):
ans = [1, 2, 3]
ans.romove(int(input()))
ans.romove(int(input()))

print(ans)

Fixed submission:
Answer = [1, 2, 3]

A = int(input())
B = int(input())

Answer.remove(A)
Answer.remove(B)

print(Answer[0])

Buggy python submission (verdict: Runtime Error):
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
 
  while x % y != 0:
    z = y
    y = x % y
    x = z
  return y
 
def lcm(m,n):
  return int(m * n / gcd(m,n))
 
inputNum = list(map(int, input().split()))
a = inputNum[0]
b = inputNum[1]
 
print(lcm(a,b))

Fixed submission:
Answer = [1, 2, 3]

A = int(input())
B = int(input())

Answer.remove(A)
Answer.remove(B)

print(Answer[0])

Buggy python submission (verdict: Runtime Error):
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
 
  while x % y != 0:
    z = y
    y = x % y
    x = z
  return y
 
def lcm(m,n):
  return int(m * n / gcd(m,n))
 
inputNum = list(map(int, input().split()))
a = inputNum[0]
b = inputNum[1]
 
print(gcd(a,b))
print(lcm(a,b))

Fixed submission:
Answer = [1, 2, 3]

A = int(input())
B = int(input())

Answer.remove(A)
Answer.remove(B)

print(Answer[0])
Buggy python submission (verdict: Runtime Error):
N = int(input()) - 1
array = list(map(int, input().split()))

breaktime = 0
i = 0
while i <= N:
  for j in range(N+1):
    if array[j] == i+1:
      del array[i:j]
      N = N - (j - i)
      breaktime += j-i
      break
    if j==N and array[j] != i+1:
      if i == 0:
        breaktime = -1
      else:
        del array[i:]
        breaktime += N-i+1
        break
  if breaktime == -1:
    break
  i += 1

print(breaktime)


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

bt = 0 #break times
i = 0  
j = 0  #iterator

while i < n:
  while j < n:
    if array[j] == i+1:
      bt += 1
      break
      
    else:
      if j == n-1:
        if i == 0:
          bt = -1
          i = n+1
          j = n+1
          break
        else:
          i = n+1
          j = n+1
          break
          
    j += 1
  i +=1
  
if bt != -1:
  bt = n - bt
  
print(bt)
Buggy python submission (verdict: Runtime Error):
n, u, v = int(input())
print(n, u, v)

Fixed submission:
#読み込み部
N, u, v = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N-1)]

#グラフ作成部
graph = [[] for i in range(N+1)]
for i,j in AB:
    graph[i].append(j)
    graph[j].append(i)

#深さ優先探索
def dfs(v):
    dist = [-1] * (N+1)
    stack = [v]
    dist[v] = 0
    while stack:
        v = stack.pop()
        dw = dist[v] + 1
        for w in graph[v]:
            if dist[w] >= 0:
                continue
            dist[w] = dw
            stack.append(w)
    return dist

DU,DV = dfs(u),dfs(v)
 
answer = 0
for u,v in zip(DU[1:],DV[1:]):
    if u < v:
        x = v - 1
        if answer < x:
            answer = x

print(answer)