Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
[n,a,b] = list(map(int,input().split()))
mod = 10**9+7

def ore_comb(n,r,mod):
    '''
    return nCr
    O(min{n-r, r})
    '''
    bunsi=1 
    bunbo=1 
    for i in range(n,n-r,-1):#分子
      bunsi = bunsi*i%mod
    for i in range(r):#分母
      bunbo = bunbo*(i+1)%mod

    ans = (bunsi*pow(bunbo,mod-2,mod))%mod
    return ans

ans = ( (pow(2,n)-1)  - ore_comb(n,a,mod) -ore_comb(n,b,mod) )%mod
if ans != 0:
  print(ans)
else:
  print(0)   

Fixed submission:
def ore_comb(n,r,mod):
    '''
    return nCr
    O(min{n-r, r})
    '''
    bunsi=1 
    bunbo=1 
    r = min(r,n-r)
    for i in range(r):#分子
      bunsi = bunsi*(n-i)%mod
      bunbo = bunbo*(i+1)%mod

    ans = (bunsi*pow(bunbo,mod-2,mod))%mod
    return ans

[N,a,b] = list(map(int,input().split()))

mod = 10**9+7

ans = pow(2, N, mod) -1
ans -= ore_comb(N,a,mod)
if ans<0:
    ans += mod
ans -= ore_comb(N,b,mod)
if ans<0:
    ans += mod

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

kbs = A[0]
for i in range(1,N):
  kbs = kbs*A[i]*pow(math.gcd(kbs,A[i]),mod-2,mod)
  kbs %= mod
  
ans = 0
for i in range(N):
  ans += kbs*pow(A[i],mod-2,mod)
  ans %= mod
print(ans)    

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)

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

L = 1
for a in A:
    L = lcm(L, a)

L %= MOD
coef = 0
for a in A:
    coef += pow(a, MOD - 2, MOD)
print((L * coef) % MOD)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

kbs = A[0]
for i in range(1,N):
  kbs = kbs*A[i]*pow(math.gcd(kbs,A[i]),mod-2,mod)
  kbs %= mod
  
ans = 0
for i in range(N):
  ans += kbs*pow(A[i],mod-2,mod)
  ans %= mod
print(ans)    

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)

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

L = 1
for a in A:
    L = lcm(L, a)

L %= MOD
coef = 0
for a in A:
    coef += pow(a, MOD - 2, MOD)
print((L * coef) % MOD)
Buggy python submission (verdict: Runtime Error):
num = input()
moji_list = input().split()
new_moji = ""
for i in range(num):
	new_moji = moji_list[0][i]+moji_list[1][i]
print(new_moji)

Fixed submission:
num = input()
moji_list = input().split()
new_moji = ""
for i in range(int(num)):
	new_moji += moji_list[0][i]+moji_list[1][i]
print(new_moji)
Buggy python submission (verdict: Runtime Error):
[A,B] = input().split()
max_ab = max(A,B)
min_ab = min(A,B)

r = max_ab
s = min_ab

while s != 0:
  r,s = s,r % s
  if s == 0:
    break
print(int(r*(A/r)*(B/r)))

Fixed submission:
[A,B] = map(int,input().split())
max_ab = max(A,B)
min_ab = min(A,B)

r = max_ab
s = min_ab

while s != 0:
  r,s = s,r % s
  if s == 0:
    break
print(int(r*(A/r)*(B/r)))

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
max_ab = max(A,B)
min_ab = min(A,B)

r = max_ab
s = min_ab

while s != 0:
  r,s = s,r % s
  if s == 0:
    break
print(int(r*(A/r)*(B/r)))

Fixed submission:
[A,B] = map(int,input().split())
max_ab = max(A,B)
min_ab = min(A,B)

r = max_ab
s = min_ab

while s != 0:
  r,s = s,r % s
  if s == 0:
    break
print(int(r*(A/r)*(B/r)))
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
if N % 2 == 1:
  print(0)
else:
  zero_count = 0
  for i in range(1,1+int(math.log(N//2,5)//1)):#ここのN//2がN/2にしてただけで計算が狂った。floatの扱いの問題か
    zero_count += (N//2)//(5**i)
  print(int(zero_count))

Fixed submission:
import math

N = int(input())
if N % 2 == 1:
  print(0)
else:
  zero_count = 0
  if N == 0:
    print(0)
  else:  
    for i in range(1,1+int(math.log(N//2,5)//1)):#ここのN//2がN/2にしてただけで計算が狂った。floatの扱いの問題か
      zero_count += (N//2)//(5**i)
    print(int(zero_count))

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
if N % 2 == 1:
  print(0)
else:
  zero_count = 0
  for i in range(1,1+int(math.log(N/2,5)//1)):
    zero_count += (N/2)//5**i
  print(int(zero_count))

Fixed submission:
import math

N = int(input())
if N % 2 == 1:
  print(0)
else:
  zero_count = 0
  if N == 0:
    print(0)
  else:  
    for i in range(1,1+int(math.log(N//2,5)//1)):#ここのN//2がN/2にしてただけで計算が狂った。floatの扱いの問題か
      zero_count += (N//2)//(5**i)
    print(int(zero_count))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7 

lb0 = [0]*60
lb1 = [0]*60
for i in range(N):
  bs = format(A[i],"060b")
  for j in range(60):
    if bs[j] == "0":
      lb0[j] += 1
    if bs[j] == "1":
      lb1[j] += 1  
###
ans = 0
for i in range(60):
  ans += ((lb0[i]*lb1[i] %mod)*(2**(59-i) %mod)) %mod
  ans %= mod
print(ans)  

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7 

lb0 = [0]*60
lb1 = [0]*60
for i in range(N):
  bs = format(A[i],"060b")
  for j in range(60):
    if bs[j] == "0":
      lb0[j] += 1
    if bs[j] == "1":
      lb1[j] += 1  
###
ans = 0
for i in range(60):
  ans += ((lb0[i]*lb1[i] %mod)*(2**(59-i) %mod)) %mod
  ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
l = []
for i in range(N):
  s = input()
  ls = []
  for j in range(10):
    ls.append(s[j])
  c = collections.Counter(ls)
  l.append(c)
cnt = 0
for i in range(N):
  for j in range(i+1,N):
    if l[i] == l[j]:
      cnt += 1
print(cnt)        

Fixed submission:
import collections
N = int(input())
l = []
for i in range(N):
  s = input()
  ls = []
  for j in range(10):
    ls.append(s[j])
  ls.sort()
  sm = ""
  for j in range(10):
    sm += ls[j]
  l.append(sm)

cnt = 0
c = collections.Counter(l)
for i in c.values():
  cnt += i*(i-1)//2
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = []
for i in range(N):
  s = input()
  ls = []
  for j in range(10):
    ls.append(s[j])
  ls.sort()
  l.append(ls)
cnt = 0
for i in range(N):
  for j in range(i+1,N):
    if l[i] == l[j]:
      cnt += 1
print(cnt)

Fixed submission:
import collections
N = int(input())
l = []
for i in range(N):
  s = input()
  ls = []
  for j in range(10):
    ls.append(s[j])
  ls.sort()
  sm = ""
  for j in range(10):
    sm += ls[j]
  l.append(sm)

cnt = 0
c = collections.Counter(l)
for i in c.values():
  cnt += i*(i-1)//2
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = []
for i in range(N):
  s = input()
  ls = []
  for j in range(10):
    ls.append(s[j])
  ls.sort()
  l.append(ls)
cnt = 0
for i in range(N):
  for j in range(i+1,N):
    if l[i] == l[j]:
      cnt += 1
print(cnt)

Fixed submission:
import collections
N = int(input())
l = []
for i in range(N):
  s = input()
  ls = []
  for j in range(10):
    ls.append(s[j])
  ls.sort()
  sm = ""
  for j in range(10):
    sm += ls[j]
  l.append(sm)

cnt = 0
c = collections.Counter(l)
for i in c.values():
  cnt += i*(i-1)//2
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = [-1 for i in range(N)]
for i in range(N):
  A = int(input())
  for j in range(N):
    if l[j] < A:
      l[j] = A
      break
###
for i in range(N):
  if l[i] == -1:
    ans = i
    break
  #出会わなかったパターンを忘れ気味
  if i == N-1:
    ans = N  
print(ans)    

Fixed submission:
N = int(input())
l = [-1 for i in range(N)]
for i in range(N):
  A = int(input())
  ok = N-1
  ng = -1
  while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if l[mid] < A:
      ok = mid
    else:
      ng = mid  
  l[ok] = A
###
for i in range(N):
  if l[i] == -1:
    ans = i
    break
  #出会わなかったパターンを忘れ気味
  if i == N-1:
    ans = N  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
S = []
for i in range(H):
  S.append(input())

m = [[0 for i in range(W)] for j in range(H)]
#yoko
for i in range(H):
  s = S[i]
  mar = 0
  cnt = 0
  for j in range(W):
    if s[j] == ".":
      cnt += 1
    if s[j] == "#":
      for k in range(mar,j):
        m[i][k] += cnt
      cnt = 0
      mar = j+1    
    #グリッドの端の処理
    if j == W-1 and s[j] == ".":
      for k in range(mar,j+1):
        m[i][k] += cnt


#tate      
for i in range(W):
  mar = 0
  cnt = 0
  for j in range(H):
    if S[j][i] == ".":
      cnt += 1
    if S[j][i] == "#":
      for k in range(mar,j):
        m[k][i] += cnt
      cnt = 0
      mar = j+1 
    #グリッドの端の処理
    if j == H-1 and S[j][i] == ".":
      for k in range(mar,j+1):
        m[k][i] += cnt


ans = 0
for i in range(H):
  ans = max(ans,max(m[i]))
print(ans-1)  

Fixed submission:
H,W = map(int,input().split())
S = []
for i in range(H):
  S.append(input())

m = [[0 for i in range(W)] for j in range(H)]
#yoko
for i in range(H):
  s = S[i]
  mar = 0
  cnt = 0
  for j in range(W):
    if s[j] == ".":
      cnt += 1
    if s[j] == "#":
      for k in range(mar,j):
        m[i][k] += cnt
      cnt = 0
      mar = j+1    
    #グリッドの端の処理
    if j == W-1 and s[j] == ".":
      for k in range(mar,j+1):
        m[i][k] += cnt


#tate      
for i in range(W):
  mar = 0
  cnt = 0
  for j in range(H):
    if S[j][i] == ".":
      cnt += 1
    if S[j][i] == "#":
      for k in range(mar,j):
        m[k][i] += cnt
      cnt = 0
      mar = j+1 
    #グリッドの端の処理
    if j == H-1 and S[j][i] == ".":
      for k in range(mar,j+1):
        m[k][i] += cnt


ans = 0
for i in range(H):
  ans = max(ans,max(m[i]))
print(ans-1)
Buggy python submission (verdict: Runtime Error):
[N,K] = list(map(int,input().split()))
l_h = list(map(int,input().split()))

l_cost = [0]+[float("inf") for i in range(N-1)]

for i in range(N): #ノードを全土に渡り更新する
  for k in range(1,K+1):#1ノードにつきKこ先のコストを更新する
    if (k+i>N-1):
      break
    else:
      min_cost=min(abs(l_h[k+i]-l_h[i]) + l_cost[i] ,l_cost[k+i])  
      l_cost[k+i] = min_cost

print(l_cost[-1])

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

l_cost = [0,abs(l_h[1]-l_h[0])]

for i in range(2,N):
  min_cost=min(abs(l_h[i]-l_h[i-1]) + l_cost[i-1] , abs(l_h[i]-l_h[i-2]) + l_cost[i-2])
  l_cost.append(min_cost) 

print(l_cost[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())

ave = M//N
amari = M%N
while True:
  if amari%ave == 0:
    ans = ave
    break
  else:
    ave -= 1
    amari = M%ave
print(ans)  

Fixed submission:
N,M = map(int,input().split())
ave = M//N
amari = M%N
while True:
  if amari%ave == 0:
    ans = ave
    break
  else:
    ave -= 1
    amari = M%ave
print(ans)
Buggy python submission (verdict: Runtime Error):
d,g = map(int,input().split() )
l = [list(map(int,input().split() ))+[100*(x+1)] for x in range(d) ] 

mondai_num = []

for k in range(2**d):

  #先に全完するカテゴリ(何百点問題を全完するか)を決め、回す
  bin_str = format(k, "0{}b".format(d) )#二進数の文字列を取得
  #これが全完する問題のリスト
  zenkan_list = [ x.start() for x in re.finditer("1",bin_str)  ] 
  

  #0~9のリストと和の初期化
  d_list = [i for i in range(d)]
  wa = 0
  cnt = 0
  #全完した点数のみ先に足す
  for i in zenkan_list:
    wa = wa+(l[i][0])*((i+1)*100)
    wa = wa + l[i][1]  
    cnt = cnt + l[i][0]
  #全完したやつだけで目標を超えたらそこでストップ
  if wa>=g:
    mondai_num.append( cnt )

  #全完したやつだけでたらなかったら素点が大きいやつを全完一歩手前まで足す
  else:
    #全完したカテゴリを除外
    for i in zenkan_list:
      d_list.remove(i)
    #残ったカテゴリの中で最大の点数のカテゴリを探す
    max_set = l[max(d_list)]

    for i in range( max_set[0]  ):
      wa = wa + max_set[2]
      if wa >= g:
        mondai_num.append(cnt + i+1 )
        break
print(min(mondai_num))

Fixed submission:
import re

d,g = map(int,input().split() )
l = [list(map(int,input().split() ))+[100*(x+1)] for x in range(d) ] 

mondai_num = []

for k in range(2**d):

  #先に全完するカテゴリ(何百点問題を全完するか)を決め、回す
  bin_str = format(k, "0{}b".format(d) )#二進数の文字列を取得
  #これが全完する問題のリスト
  zenkan_list = [ x.start() for x in re.finditer("1",bin_str)  ] 
  

  #0~9のリストと和の初期化
  d_list = [i for i in range(d)]
  wa = 0
  cnt = 0
  #全完した点数のみ先に足す
  for i in zenkan_list:
    wa = wa+(l[i][0])*((i+1)*100)
    wa = wa + l[i][1]  
    cnt = cnt + l[i][0]
  #全完したやつだけで目標を超えたらそこでストップ
  if wa>=g:
    mondai_num.append( cnt )

  #全完したやつだけでたらなかったら素点が大きいやつを全完一歩手前まで足す
  else:
    #全完したカテゴリを除外
    for i in zenkan_list:
      d_list.remove(i)
    #残ったカテゴリの中で最大の点数のカテゴリを探す
    max_set = l[max(d_list)]

    for i in range( max_set[0]  ):
      wa = wa + max_set[2]
      if wa >= g:
        mondai_num.append(cnt + i+1 )
        break
print(min(mondai_num))
Buggy python submission (verdict: Runtime Error):
N,A = map(int,input().split())
if N%500 <= A:
        print("YES")
else:
        print("NO") 
                     

Fixed submission:
N = int(input())
A = int(input())

if N % 500 <= A:
        print("Yes")
else:
        print("No")

Buggy python submission (verdict: Runtime Error):
N,A = map(int,input().split())
if N%500 < A:
        print("YES")
else:
        print("NO")

Fixed submission:
N = int(input())
A = int(input())

if N % 500 <= A:
        print("Yes")
else:
        print("No")

Buggy python submission (verdict: Runtime Error):
A,N = map(int,input().split())
if N%500 < A:
        print("YES")
else:
        print("NO")

Fixed submission:
N = int(input())
A = int(input())

if N % 500 <= A:
        print("Yes")
else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [0]+list(map(int,input().split()))
A.sort()
B = [0]+list(map(int,input().split()))
B.sort()
C = [0]+list(map(int,input().split()))
C.sort()

bko = [0 for i in range(N+1)]
for i in range(1,N+1):
  b = B[i]
  cnt = 1
  for j in range(cnt,N+1):
    if A[j] >= b:
      bko[i] = j-1
      cnt = j-1
      break
    if j == N:
      bko[i] = N
      cnt = N+1

#bkoを累積和にする
for i in range(N):     
  bko[i+1] += bko[i]

cko = [0 for i in range(N+1)]
for i in range(1,N+1):
  c = C[i]
  cnt = 0
  for j in range(cnt,N+1):
    if B[j] >= c:
      cko[i] = bko[j-1]
      cnt = j-1
      break
    if j == N:
      cko[i] = bko[N]
      cnt = N+1
###
print(sum(cko))        

Fixed submission:
N = int(input())
A = [0]+list(map(int,input().split()))
A.sort()
B = [0]+list(map(int,input().split()))
B.sort()
C = [0]+list(map(int,input().split()))
C.sort()

bko = [0 for i in range(N+1)]
cnt = 1
for i in range(1,N+1):
  b = B[i]
  for j in range(cnt,N+1):
    if A[j] >= b:
      bko[i] = j-1
      cnt = j
      break
    if j == N:
      bko[i] = N
      cnt = N

#bkoを累積和にする
for i in range(N):     
  bko[i+1] += bko[i]

cko = [0 for i in range(N+1)]
cnt = 1
for i in range(1,N+1):
  c = C[i]
  for j in range(cnt,N+1):
    if B[j] >= c:
      cko[i] = bko[j-1]
      cnt = j
      break
    if j == N:
      cko[i] = bko[N]
      cnt = N
###
print(sum(cko))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [0]+list(map(int,input().split()))
A.sort()
B = [0]+list(map(int,input().split()))
B.sort()
C = [0]+list(map(int,input().split()))
C.sort()

bko = [0 for i in range(N+1)]
for i in range(1,N+1):
  b = B[i]
  cnt = 1
  for j in range(cnt,N+1):
    if A[j] >= b:
      bko[i] = j-1
      cnt = j-1
      break
    if j == N:
      bko[i] = N

#bkoを累積和にする
for i in range(N):     
  bko[i+1] += bko[i]

cko = [0 for i in range(N+1)]
for i in range(1,N+1):
  c = C[i]
  cnt = 0
  for j in range(cnt,N+1):
    if B[j] >= c:
      cko[i] = bko[j-1]
      cnt = j-1
      break
    if j == N:
      cko[i] = bko[N]
###
print(sum(cko))        

Fixed submission:
N = int(input())
A = [0]+list(map(int,input().split()))
A.sort()
B = [0]+list(map(int,input().split()))
B.sort()
C = [0]+list(map(int,input().split()))
C.sort()

bko = [0 for i in range(N+1)]
cnt = 1
for i in range(1,N+1):
  b = B[i]
  for j in range(cnt,N+1):
    if A[j] >= b:
      bko[i] = j-1
      cnt = j
      break
    if j == N:
      bko[i] = N
      cnt = N

#bkoを累積和にする
for i in range(N):     
  bko[i+1] += bko[i]

cko = [0 for i in range(N+1)]
cnt = 1
for i in range(1,N+1):
  c = C[i]
  for j in range(cnt,N+1):
    if B[j] >= c:
      cko[i] = bko[j-1]
      cnt = j
      break
    if j == N:
      cko[i] = bko[N]
      cnt = N
###
print(sum(cko))
Buggy python submission (verdict: Runtime Error):
S = input()
l = []
def dfs(n):
  print(n)
  if n == len(S):
    l.append("Yes")
  if S[n:n+5] == "dream":
    dfs(n+5)
  if S[n:n+7] == "dreamer":
    dfs(n+7)
  if S[n:n+5] == "erase":
    dfs(n+5)
  if S[n:n+6] == "eraser":
    dfs(n+6)   
dfs(0)
if len(l) == 0:
  l.append("No")
print(l[0])    

Fixed submission:
import sys
import resource
sys.setrecursionlimit(10 ** 9)

S = input()
l = []
def dfs(n):
  if n == len(S):
    l.append("YES")
  if n < len(S):
    if S[n:n+5] == "erase":
      dfs(n+5)    
    if S[n:n+5] == "dream":
      dfs(n+5)  
    if S[n:n+6] == "eraser":
      dfs(n+6)              
    if S[n:n+7] == "dreamer":
      dfs(n+7)
dfs(0)
if len(l) == 0:
  l.append("NO")
print(l[0])
Buggy python submission (verdict: Runtime Error):
####################################### Define
maxN = int(2e5 + 100)
a = [0] * maxN
b = [0] * maxN
ans = [0] * maxN
####################################### Functions
def solve() :
    L = R = -1
    for i in range(1, n + 1) :
        if i > R :
            L = R = i
            while R + 1 <= 2 * n and a[i] ^ b[1] == a[R + 1] ^ b[R - L + 2]: R += 1
#            print(a[i] ^ b[1], a[R + 1] ^ b[R - L + 2], "\n")
            ans[i] = R - L + 1
        else :
            k = i - L
            if ans[k] < R - i + 1 : ans[i] = ans[k]
            else :
                L = i
                while R + 1 <= 2 * n and a[i] ^ b[1] == a[R + 1] ^ b[R - L + 2]: R += 1
                ans[i] = R - L + 1
####################################### Main
n = int(input())
inp = input().split()
for i in range(1, n + 1) : a[i] = int(inp[i - 1])
for i in range(n + 1, 2 * n + 1) : a[i] = a[i - n]
inp = input().split()
for i in range(1, n + 1) : b[i] = int(inp[i - 1])
for i in range(n + 1, 2 * n + 1) : b[i] = b[i - n]

solve()

for i in range(1, n + 1):
    if ans[i] >= n:
        print(i - 1, a[i] ^ b[1])


Fixed submission:
####################################### Define
maxN = int(6e5 + 100)
a = [0] * maxN
b = [0] * maxN
ans = [0] * maxN
####################################### Functions
def solve() :
    L = R = 0
    for i in range(2, 3 * n + 1) :
        if i > R :
            L = R = i
            while R + 1 <= 3 * n and (a[i] ^ a[1]) == (a[R + 1] ^ a[R - L + 2]): R += 1
#            print(a[i] ^ a[1], a[R + 1] ^ b[R - L + 2], R, L, "\n")
            ans[i] = R - L + 1
        else :
            k = i - L + 1
            if ans[k] < R - i + 1 : ans[i] = ans[k]
            else :
                L = i
                while R + 1 <= 3 * n and (a[i] ^ a[1]) == (a[R + 1] ^ a[R - L + 2]): R += 1
                ans[i] = R - L + 1
####################################### Main
n = int(input())
inp = input().split()
for i in range(n + 1, 2 * n + 1) : a[i] = int(inp[i - n - 1])
for i in range(2 * n + 1, 3 * n + 1) : a[i] = a[i - n]
inp = input().split()
for i in range(1, n + 1) : a[i] = int(inp[i - 1])

solve()

for i in range(n + 1, 2 * n + 1):
    if ans[i] >= n:
        print(i - n - 1, (a[i] ^ a[1]))
Buggy python submission (verdict: Runtime Error):
X,N = map(int,input().split())
P = list(map(int,input().split()))

num = sorted([[abs(X - i),i] for i in range(1,101) if i not in P],key = lambda x: x[0])

print(num[0][1])

Fixed submission:
X,N = map(int,input().split())
P = list(map(int,input().split()))
num = sorted([[abs(X - i),i] for i in range(-200,200) if i not in P],key = lambda x: x[0])

inf = 10 ** 3
inf2 = 10 ** 3 * -1

for i in range(X,inf):
  if i in P:
    continue
  plus = abs(X - i)
  break

for j in range(X,inf * -1,-1):
  if j in P:
    continue
  minus = abs(X - j)
  break

if plus < minus:
  print(i)

else:
  print(j)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce 
from operator import mul
N = int(input())
A = sorted(list(map(int,input().split())),reverse = True)

lim = 10 ** 18
ans = 1

for i in A:
  ans *= i
  if ans > lim and A[-1] > 0:
    ans = -1
    break
    
print(ans)

Fixed submission:
from functools import reduce 
from operator import mul
N = int(input())
A = sorted(list(map(int,input().split())),reverse = True)

lim = 10 ** 18
ans = 1

if A[-1] == 0:
  print(0)
else:
  for i in A:
    ans *= i
    if ans > lim:
      ans = -1
      break
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce 
from operator import mul
N = int(input())
A = list(map(int,input().split()))

ans = reduce(mul,A)
lim = 10 ** 18
if ans > lim:
  print(-1)
else:
  print(ans)

Fixed submission:
from functools import reduce 
from operator import mul
N = int(input())
A = sorted(list(map(int,input().split())),reverse = True)

lim = 10 ** 18
ans = 1

if A[-1] == 0:
  print(0)
else:
  for i in A:
    ans *= i
    if ans > lim:
      ans = -1
      break
  print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())

L = [1] * A + [0] * B + [-1] * C

ans = 0

AB = A + B

if AB > K:
  print(A)
else:
  print(A + (K - AB) * -1)

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

aa = min(a,k)
bb = min(b,k - aa)
cc = min(c,k - aa - bb)

print(aa - cc)

Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())

L = [1] * A + [0] * B + [-1] * C

ans = 0

for i in range(K):
  ans += L[i]
  
print(ans)

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

aa = min(a,k)
bb = min(b,k - aa)
cc = min(c,k - aa - bb)

print(aa - cc)
Buggy python submission (verdict: Runtime Error):
import bisect

X = int(input())
five = [i ** 5 for i in range(0,1000)]

left = bisect.bisect_left(five, X) - 1
right = bisect.bisect(five, X)

if abs(five[left]  - X) < abs(five[right]  - X):
  dif = X - five[left]
  b = five.index(dif) * -1
  a = left
else:
  dif = five[right] - X
  b = five.index(dif)
  a = right
  
print(a,b)

Fixed submission:
X = int(input())

ans = []

for i in range(-118,120):
  for j in range(-119,119):
    if i ** 5 - j ** 5 == X:
      ans = [i,j]
      break

print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y = map(int,input().split())
X -= 1
Y -= 1
aggre= [0] * (N - 1)

for i in range(N):
  for j in range(N):
    if i == j:
      continue
    dist = min(abs(j - i),abs(X - i) + abs(Y - j) + 1,abs(Y - i) + abs(X - j) + 1)
    #if dist >= N // 2:
      #print("dist i j",dist,i,j)
    aggre[dist - 1] += 1
    
#ans = [i // 2 for i in aggre]
for a in aggre:
  print(a // 2)

Fixed submission:
N,X,Y = map(int,input().split())
X -= 1
Y -= 1
aggre= [0] * (N - 1)

for i in range(N):
  for j in range(N):
    if i == j:
      continue
    dist = min(abs(j - i),abs(X - i) + abs(Y - j) + 1,abs(Y - i) + abs(X - j) + 1)
    #if dist >= N // 2:
      #print("dist i j",dist,i,j)
    aggre[dist - 1] += 1
    
#ans = [i // 2 for i in aggre]
for a in aggre:
  print(a // 2)

Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y = map(int,input().split())
X -= 1
Y -= 1
aggre= [0] * (N - 1)

for i in range(N):
  for j in range(N):
    if i == j:
      continue
    dist = min(abs(j - i),abs(X - i) + abs(Y - j) + 1,abs(Y - i) + abs(X - j) + 1)
    #if dist >= N // 2:
      #print("dist i j",dist,i,j)
    aggre[dist - 1] += 1
    
ans = [i // 2 for i in aggre]
for a in ans:
  print(a)

Fixed submission:
N,X,Y = map(int,input().split())
X -= 1
Y -= 1
aggre= [0] * (N - 1)

for i in range(N):
  for j in range(N):
    if i == j:
      continue
    dist = min(abs(j - i),abs(X - i) + abs(Y - j) + 1,abs(Y - i) + abs(X - j) + 1)
    #if dist >= N // 2:
      #print("dist i j",dist,i,j)
    aggre[dist - 1] += 1
    
#ans = [i // 2 for i in aggre]
for a in aggre:
  print(a // 2)