Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
MAXN = 2*10**6+2
p = 10**9 + 7

fact = [1] * MAXN
invfact = [1] * MAXN
for i in range(1, MAXN):
    fact[i] = fact[i-1] * i % p
invfact[MAXN-1] = pow(fact[MAXN-1], p-2, p)
for i in range(MAXN-1, 0, -1):
    invfact[i-1] = invfact[i] * i % p
    
def nCk(n, k):
    return fact[n] * invfact[n-k] * invfact[k] % p

K = int(input())
N = len(input())

ans = 0
for i in range(N, N+K+1):
    ans += pow(25, i-N, p) * nCk(i-1, N-1) * pow(26, N+K-i, p) % p
    ans %= p
print(ans)


Fixed submission:
MAXN = 2*10**6+2
p = 10**9 + 7

fact = [1] * MAXN
invfact = [1] * MAXN
for i in range(1, MAXN):
    fact[i] = fact[i-1] * i % p
invfact[MAXN-1] = pow(fact[MAXN-1], p-2, p)
for i in range(MAXN-1, 0, -1):
    invfact[i-1] = invfact[i] * i % p
    
def nCk(n, k):
    return fact[n] * invfact[n-k] * invfact[k] % p

K = int(input())
N = len(input())

ans = 0
for i in range(N, N+K+1):
    ans += pow(25, i-N, p) * nCk(i-1, N-1) * pow(26, N+K-i, p) % p
    ans %= p
print(ans)

Buggy python submission (verdict: Runtime Error):
MAXN = 10**6+1
p = 10**9 + 7

fact = [1] * MAXN
invfact = [1] * MAXN
for i in range(1, MAXN):
    fact[i] = fact[i-1] * i % p
invfact[MAXN-1] = pow(fact[MAXN-1], p-2, p)
for i in range(MAXN-1, 0, -1):
    invfact[i-1] = invfact[i] * i % p
    
def nCk(n, k):
    return fact[n] * invfact[n-k] * invfact[k] % p

K = int(input())
N = len(input())

ans = 0
for i in range(N, N+K+1):
    ans += pow(25, i-N, p) * nCk(i-1, N-1) * pow(26, N+K-i, p) % p
    ans %= p
print(ans)

Fixed submission:
MAXN = 2*10**6+2
p = 10**9 + 7

fact = [1] * MAXN
invfact = [1] * MAXN
for i in range(1, MAXN):
    fact[i] = fact[i-1] * i % p
invfact[MAXN-1] = pow(fact[MAXN-1], p-2, p)
for i in range(MAXN-1, 0, -1):
    invfact[i-1] = invfact[i] * i % p
    
def nCk(n, k):
    return fact[n] * invfact[n-k] * invfact[k] % p

K = int(input())
N = len(input())

ans = 0
for i in range(N, N+K+1):
    ans += pow(25, i-N, p) * nCk(i-1, N-1) * pow(26, N+K-i, p) % p
    ans %= p
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))

room_dict = {i+1:[] for i in range(N)}
for _ in range(N):
  _a, _b = list(map(int, input().split()))
  room_dict[_a].append(_b)
  room_dict[_b].append(_a)

rooms = set(room_dict.keys())
s_dict = {i+1:None for i in range(1, N)}
traversed_rooms = set([1])

now_rooms = [1]
from operator import add
while now_rooms:
    next_rooms = set()
    for _room in now_rooms:
        traversed_rooms.add(_room) # 訪問済みを保存
        _n_rooms  = [i for i in room_dict[_room] 
                         if (not i in traversed_rooms) and (s_dict[i] is None)]
        for n_room in _n_rooms:
            next_rooms.add(n_room) # 今の次の階層を、次のiteration用に入れる
            s_dict[n_room] = _room # 次の階層は、今の階層への道標を置けば十分
    now_rooms = [i for i in next_rooms if not i in traversed_rooms] # まだ訪れてない部屋を探す
    
print('Yes') # 常に答えは存在する

for i in range(2, N+1):
    print(s_dict[i])

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

room_dict = {i+1:[] for i in range(N)}
for _ in range(M):
  _a, _b = list(map(int, input().split()))
  room_dict[_a].append(_b)
  room_dict[_b].append(_a)

rooms = set(room_dict.keys())
s_dict = {i+1:None for i in range(1, N)}
traversed_rooms = set([1])

now_rooms = [1]
from operator import add
while now_rooms:
    next_rooms = set()
    for _room in now_rooms:
        traversed_rooms.add(_room) # 訪問済みを保存
        _n_rooms  = [i for i in room_dict[_room] 
                         if (not i in traversed_rooms) and (s_dict[i] is None)]
        for n_room in _n_rooms:
            next_rooms.add(n_room) # 今の次の階層を、次のiteration用に入れる
            s_dict[n_room] = _room # 次の階層は、今の階層への道標を置けば十分
    now_rooms = [i for i in next_rooms if not i in traversed_rooms] # まだ訪れてない部屋を探す
    
print('Yes') # 常に答えは存在する

for i in range(2, N+1):
    print(s_dict[i])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

m_1 = n % k
m_2 = k - m_1
print(min(m_1, m_2))

Fixed submission:
x, y, z = map(int, input().split())
print(z, x, y)
Buggy python submission (verdict: Runtime Error):
x = input()

print(x//500*1000 + (x%500)//5*5)

Fixed submission:
x = int(input())
 
print(x//500*1000 + (x%500)//5*5)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
m_list = []
for _ in range(n):
  m_list.append(int(input()))

print(n + (x - sum(x_list))//min(x_list))


Fixed submission:
n, x = map(int, input().split())
m_list = []
for _ in range(n):
  m_list.append(int(input()))

print(n + (x - sum(m_list))//min(m_list))

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
m_list = []
for _ in range(n):
  m_list.append(int(input())

print(n + (x - sum(x_list))//min(x_list))

Fixed submission:
n, x = map(int, input().split())
m_list = []
for _ in range(n):
  m_list.append(int(input()))

print(n + (x - sum(m_list))//min(m_list))
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

from itertools import product

k_list = list(range(k+1))
count = 0
for x, y, z in product(k_list, k_list, k_list):
  if x+y+z==s:
    count+=1
print(count)

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

from itertools import product

k_list = list(range(k+1))
count = 0
for x, y in product(k_list, k_list):
  # print(x, y, s-x-y)
  if 0<=s-x-y<=k:
    count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import math
N=int(input())
for n in range(1,N+1):
  tmp=0
  for x in range(1,100):
    for y in range(1,100):
      if 4*n-3*x**2-2*x*y-3*y**2<0:continue
      z=0.5*(math.sqrt(4*n-3*x**2-2*x*y-3*y**2)-x-y)
      if z.is_integer() and z>=1:
        tmp+=1
      z=0.5*(math.sqrt(4*n-3*x**2-2*x*y-3*y**2)*(-1)-x-y)
      if z.is_integer() and z>=1:
        tmp+=1
  print(tmp)

Fixed submission:
import math
N=int(input())
for n in range(1,N+1):
  tmp=0
  for x in range(1,100):
    for y in range(1,100):
      if 4*n-3*x**2-2*x*y-3*y**2<0:continue
      z=0.5*(math.sqrt(4*n-3*x**2-2*x*y-3*y**2)-x-y)
      if z.is_integer() and z>=1:
        tmp+=1
      z=0.5*(math.sqrt(4*n-3*x**2-2*x*y-3*y**2)*(-1)-x-y)
      if z.is_integer() and z>=1:
        tmp+=1
  print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans=0
li=[A[0]]
for i in range(1,N):
  ans+=li[0]
  li.pop(0)
  li.append(A[i])
  li.append(A[i])
print(ans)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans=0
li=[A[0]]
for i in range(1,N):
  ans+=li[i-1]
  li.append(A[i])
  li.append(A[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans=0
li=[A[0]]
for i in range(1,N):
  ans+=li[0]
  li.pop(0)
  li.append(A[i])
  li.append(A[i])
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans=0
li=[A[0]]
for i in range(1,N):
  ans+=li[i-1]
  li.append(A[i])
  li.append(A[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect, numpy
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
B=numpy.cumsum(B)
ans=0
for i in range(1,N+1):
  books=0
  tmp=sum(A[:i])
  K-=tmp
  if K>0:
    if i>0:books+=i
    else:books=0
    books+=bisect.bisect_right(B,K)+1
    ans=max(ans,books)
print(ans)

Fixed submission:
import bisect, numpy
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A=numpy.cumsum(A)
B=numpy.cumsum(B)
ans=bisect.bisect_right(B,K)
for i in range(N):
  if K-A[i]>=0:
    ans=max(ans,i+1+bisect.bisect_right(B,K-A[i]))
print(ans)
Buggy python submission (verdict: Runtime Error):
N=list(input())
if N[-1]=="2","4","5","7","9":
  print("hon")
elif N[-1]=="3":
  print("bon")
else:
  print("pon")

Fixed submission:
N=str(input())
a=list(map(int,N))
A=a[-1]
if A==3:
  print("bon")
  exit()
if A==2 or A==4 or A==5 or A==7 or A==9:
  print("hon")
  exit()
print("pon")
Buggy python submission (verdict: Runtime Error):
K=int(input())
S=list(input())
if len(S)<=K:
  print(S)
else:
  print(S[:K]+"...")

Fixed submission:
K=int(input())
S=list(input())
if len(S)<=K:
  print("".join(S))
else:
  print("".join(S[:K])+"...")
Buggy python submission (verdict: Runtime Error):
import math
X=int(input())
a=0
o=100
while True:
  o*=1.01
  o=math.floor()
  a+=1
  if o>=X:
    print(a)
    break

Fixed submission:
import math
X=int(input())
a=0
o=100
while True:
  o*=1.01
  o=math.floor(o)
  a+=1
  if o>=X:
    print(a)
    break
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input()) 
num=0
a=1
cnt=0
while True:
  num+=1
  s=str(num)
  l=len(s)
  array=list(map(int,s))
  if l==1:
    a=num
    cnt+=1
  elif all(abs(array[j+1]-array[j])<=1 for j in range(l-1)):
    a=num
    cnt+=1
  if cnt==K:
    break
print(a)

Fixed submission:
K=int(input())
a=set([1,2,3,4,5,6,7,8,9])
prev=set([1,2,3,4,5,6,7,8,9])

while len(a)<K:
  temp=set()
  for now in prev:
    c=now%10
    if c==0:
      temp.add(now*10)
      temp.add(now*10+1)
    elif c==9:
      temp.add(now*10+9)
      temp.add(now*10+8)
    else:
      temp.add(now*10+c-1)
      temp.add(now*10+c)
      temp.add(now*10+c+1)
  prev=temp
  a=a|temp
print(sorted(list(a))[K-1])
Buggy python submission (verdict: Runtime Error):
H,W,N=map(int,input().split())
B=max(H,W)
ans=(N+B-1)//B
print(ans)

Fixed submission:
H=int(input())
W=int(input())
N=int(input())
B=max(H,W)
ans=(N+B-1)//B
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
mod=10**9+7
def pairORSum(arr, n) : 
    ans = 0     # Initialize result 
  
    # Consider all pairs (arr[i], arr[j)  
    # such that i < j 
    for i in range(0, n) : 
          
        for j in range(i + 1, n) : 
              
            ans = ans + (arr[i] ^ arr[j]) 
              
    return ans 
      
  
# Driver Code 
n=int(input())
arr=list(map(int,input().split()))
print(pairORSum(arr, n)%mod) 

Fixed submission:
N=int(input())
bin_a="".join(["{:060b}".format(a) for a in map(int, input().split())])
mod=10**9+7
xor=0
for d in range(60):
  ones=bin_a[59-d::60].count('1')
  xor+=2**d*ones*(N-ones)    
print(xor%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
A=list(map(int,input().split()))
S=0
mod=10**9+7
for v in itertools.combinations(A,2):
    S+=v[0]^v[1]
print(S%mod)

Fixed submission:
N=int(input())
bin_a="".join(["{:060b}".format(a) for a in map(int, input().split())])
mod=10**9+7
xor=0
for d in range(60):
  ones=bin_a[59-d::60].count('1')
  xor+=2**d*ones*(N-ones)    
print(xor%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
A=list(map(int,input().split()))
S=0
mod=10**9+7
for v in itertools.combinations(A,2):
    S+=v[0]^v[1]
print(S%mod)

Fixed submission:
N=int(input())
bin_a="".join(["{:060b}".format(a) for a in map(int, input().split())])
mod=10**9+7
xor=0
for d in range(60):
  ones=bin_a[59-d::60].count('1')
  xor+=2**d*ones*(N-ones)    
print(xor%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
S=0
mod=10**9+7
for i in range(N-1):
  for j in range(i+1,N):
    S+=A[i]^A[j]
print(S%mod)

Fixed submission:
N=int(input())
bin_a="".join(["{:060b}".format(a) for a in map(int, input().split())])
mod=10**9+7
xor=0
for d in range(60):
  ones=bin_a[59-d::60].count('1')
  xor+=2**d*ones*(N-ones)    
print(xor%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
S=0
mod=10**9+7
for i in range(N-1):
  for j in range(i+1,N):
    S+=A[i]^A[j]
print(S%mod)

Fixed submission:
N=int(input())
bin_a="".join(["{:060b}".format(a) for a in map(int, input().split())])
mod=10**9+7
xor=0
for d in range(60):
  ones=bin_a[59-d::60].count('1')
  xor+=2**d*ones*(N-ones)    
print(xor%mod)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
X=int(input())
l=[100,101,102,103,104,105]
for i in range(1,X//100+1):
  for v in itertools.combinations_with_replacement(l,i):
    if sum(v)==X:
      print(1)
      exit()
print(0)

Fixed submission:
N=int(input())
n=N//100
if n>0:
  m=N%100
  if m/n<=5:
    print(1)
  else:
    print(0)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
X=int(input())
l=[100,101,102,103,104,105]
for i in range(1,X//100+1):
  for v in itertools.combinations_with_replacement(l,i):
    if sum(v)==X:
      print(1)
      exit()
print(0)

Fixed submission:
N=int(input())
n=N//100
if n>0:
  m=N%100
  if m/n<=5:
    print(1)
  else:
    print(0)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
dif=9999999999999999999
x=-1
ans=0
for i in range(N):
  long=abs(sum(A[i+1:])-sum(A[:i+1]))
  if long<dif:
    dif=long
    x=i+1
pl=max(sum(A[:x]),sum(A[x:]))
mi=min(sum(A[:x]),sum(A[x:]))
while mi<pl:
  mi+=1
  ans+=1
  if mi==pl:
    break
print(ans)


Fixed submission:
X,Y=map(int,input().split())
ans=0
if X==1:
  ans+=300000
if X==2:
  ans+=200000
if X==3:
  ans+=100000
if Y==1:
  ans+=300000
if Y==2:
  ans+=200000
if Y==3:
  ans+=100000
if X==1 and Y==1:
  ans+=400000
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy
N=int(input())
A=list(map(int,input().split()))
Ap=numpy.cumsum(A)
A2=[abs(sum(A)-n*2) for n in Ap]
ans=0
x=A2.index(min(A2))+1
pl=max(sum(A[:x]),sum(A[x:]))
mi=min(sum(A[:x]),sum(A[x:]))
while mi<pl:
  mi+=1
  ans+=1
  if mi==pl:
    break
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
p=q=sum(A)
for i in range(N):
  p-=2*A[i]
  q=min(abs(p),q)
print(q)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
dif=9999999999999999999
x=-1
ans=0
for i in range(N):
  long=abs(sum(A[i+1:])-sum(A[:i+1]))
  if long<dif:
    dif=long
    x=i+1
pl=max(sum(A[:x]),sum(A[x:]))
mi=min(sum(A[:x]),sum(A[x:]))
while mi<pl:
  mi+=1
  ans+=1
  if mi==pl:
    break
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
p=q=sum(A)
for i in range(N):
  p-=2*A[i]
  q=min(abs(p),q)
print(q)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy
N=int(input())
A=list(map(int,input().split()))
Ap=numpy.cumsum(A)
A2=[n*2 for n in Ap]
X=[sum(A)]*N
ans=0
C=[abs(x-y) for (x,y) in zip(X,A2)]
x=C.index(min(C))+1
pl=max(sum(A[:x]),sum(A[x:]))
mi=min(sum(A[:x]),sum(A[x:]))
while mi<pl:
  mi+=1
  ans+=1
  if mi==pl:
    break
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
p=q=sum(A)
for i in range(N):
  p-=2*A[i]
  q=min(abs(p),q)
print(q)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
X=sum(A)
ans=0
long=[abs(X-sum(A[:i+1])*2) for i in range(N)]
x=long.index(min(long))+1
pl=max(sum(A[:x]),sum(A[x:]))
mi=min(sum(A[:x]),sum(A[x:]))
while mi<pl:
  mi+=1
  ans+=1
  if mi==pl:
    break
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
p=q=sum(A)
for i in range(N):
  p-=2*A[i]
  q=min(abs(p),q)
print(q)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
ans=0
long=[abs(sum(A[i+1:])-sum(A[:i+1])) for i in range(N)]
x=long.index(min(long))+1
pl=max(sum(A[:x]),sum(A[x:]))
mi=min(sum(A[:x]),sum(A[x:]))
while mi<pl:
  mi+=1
  ans+=1
  if mi==pl:
    break
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
p=q=sum(A)
for i in range(N):
  p-=2*A[i]
  q=min(abs(p),q)
print(q)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
dif=9999999999999999999
x=-1
ans=0
for i in range(N):
  long=abs(sum(A[i+1:])-sum(A[:i+1]))
  if long<dif:
    dif=long
    x=i+1
pl=max(sum(A[:x]),sum(A[x:]))
mi=min(sum(A[:x]),sum(A[x:]))
while mi<pl:
  mi+=1
  ans+=1
  if mi==pl:
    break
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
p=q=sum(A)
for i in range(N):
  p-=2*A[i]
  q=min(abs(p),q)
print(q)
Buggy python submission (verdict: Runtime Error):
from math import atan2,degrees
a,b,x=map(int,input().split())
if 2*x<=b*a*a:
  print(90-degrees(atan2(2*x,a*b*b)))
else:
  print(90-degrees(atan2(a*a*a,2*(a*a*b-x)))


Fixed submission:
from math import atan2,degrees
a,b,x=map(int,input().split())
if 2*x<=b*a*a:
  print(90-degrees(atan2(2*x,a*b*b)))
else:
  print(90-degrees(atan2(a*a*a,2*(a*a*b-x))))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
L=list(map(int,input().split()))
ans=0
for x in itertools.combinations(L,3):
  if x[0]<x[1]+x[2] and x[1]<x[0]+x[2] and x[2]<x[0]+x[1]:
    ans+=1
print(ans)

Fixed submission:
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
  for j in range(N-i-2):        
    ans+=min(N-i-j-2,N-bisect.bisect_left(L,L[-j-1]-L[i]+1)-j-1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
L=list(map(int,input().split()))
C=[x for x in itertools.combinations(L,3) if x[0]<x[1]+x[2] and x[1]<x[0]+x[2] and x[2]<x[0]+x[1]]
print(len(C))

Fixed submission:
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
  for j in range(N-i-2):        
    ans+=min(N-i-j-2,N-bisect.bisect_left(L,L[-j-1]-L[i]+1)-j-1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
L=list(map(int,input().split()))
C=list(itertools.combinations(L,3))
ans=0
for i in range(len(C)):
  if C[i][0]<C[i][1]+C[i][2] and C[i][1]<C[i][0]+C[i][2] and C[i][2]<C[i][1]+C[i][0]:
    ans+=1
print(ans)

Fixed submission:
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
  for j in range(N-i-2):        
    ans+=min(N-i-j-2,N-bisect.bisect_left(L,L[-j-1]-L[i]+1)-j-1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
keys=[i+1 for i in range(N)]
dic=dict(zip(keys,L))
OK=[(x,y,z) for x in dic.values() for y in dic.values() for z in dic.values() if(x<y+z and y<x+z and z<x+y and [k for k, v in dic.items() if v ==x][0]!=[k for k, v in dic.items() if v ==y][0] and [k for k, v in dic.items() if v ==y][0]!=[k for k, v in dic.items() if v ==z][0] and [k for k, v in dic.items() if v ==x][0]!=[k for k, v in dic.items() if v ==z][0])]
print(len(OK)//6)

Fixed submission:
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
  for j in range(N-i-2):        
    ans+=min(N-i-j-2,N-bisect.bisect_left(L,L[-j-1]-L[i]+1)-j-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
def cf(a,b):
  cf=[]
  for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
      cf.append(i)
  return cf
x=[x for x in cf(A,B) if all(x%y!=0 for y in cf(A,B))]
print(len(x))

Fixed submission:
N=int(input())
A=list(range(1,N+1))
B=list(range(1,N+1,2))
print(len(B)/len(A))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
a,i,j=0
while j<N:
  t=S[i:j]
  if t in S[j:]:
    a=max(a,len(t))
    j+=1
  else:
    i+=1
print(a)

Fixed submission:
N=int(input())
S=input()
a=i=j=0
while j<N:
  t=S[i:j]
  if t in S[j:]:
    a=max(a,len(t))
    j+=1
  else:
    i+=1
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
d={}
for i in range(N):
  for j in range(i,N+1):
    now=S[i:j]
    if now in d:
      d[now]+=1
    else:
      d.setdefault(now,1)
twice={k:v for k, v in d.items() if v>=2}
v1=sorted(twice.keys(), key=len)[::-1] 
for v in v1:
    f=S.find(v)+len(v)
    if v in S[f:]:
        break
print(len(v))

Fixed submission:
N=int(input())
S=input()
a=i=j=0
while j<N:
  t=S[i:j]
  if t in S[j:]:
    a=max(a,len(t))
    j+=1
  else:
    i+=1
print(a)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
x=((B-1)//A+1)
all=A*x
use=x
notuse=all-use
if notuse<B:
    add=(B-notuse-1)//A+1
print(x+add)

Fixed submission:
A,B=map(int,input().split())
print((B-2)//(A-1)+1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
ans=0
for i in range(N):
  ans+=i
print(ans)

Fixed submission:
N=int(input())
print((N-1)*N//2)
Buggy python submission (verdict: Runtime Error):
S=input()
l=len(S)

C=[]
for i in range(l):
  for j in range(l+1):
    C.append(S[i:j])
C2=[x for x in C if x]
li=[]
s=0
for k in range(l):
  g=s+l-k
  li.append(C2[s:g])
  s=g
print(l)
    

Fixed submission:
S = input()

if len(S) == 1:
    print(1)
    exit(0)

now = S[0]
k = 1
l = 2
ans = 1
while k < len(S) and l <= len(S):
    while S[k:l] == now:
        l += 1
        if l == len(S)+1:
            if now == S[k:l]:
                ans -= 1
            break
    now = S[k:l]
    k = l
    l = k+1
    ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
ans="Yes"
for i in range(N):
  if H[i+1]-H[i]>=0:
    continue
  elif H[i+1]-H[i]==-1:
    if H[i]-1>=H[i-1]:
      H[i]-=1
      continue
    else:
      ans="No"
      break
  else:
    ans="No"
    break
print(ans)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))[::-1]
ans="Yes"
for i in range(N-2):
  if H[i]-H[i+1]>=0:
    continue
  elif H[i]-H[i+1]==-1:
    H[i+1]-=1
  else:
    ans="No"
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
li=[]
for i in range(N):
  if A[i]!=AA[i]:
    li.append(A[i])
if len(li)>2:
  print("NO")
else:
  print("YES")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
AA=sorted(A)
li=[]
for i in range(N):
  if A[i]!=AA[i]:
    li.append(A[i])
if len(li)>2:
  print("NO")
else:
  print("YES")

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
AA=sorted(A)
li=[]
li_i=[]
for i in range(len(A)):
  if A[i]!=AA[i]:
    li_i.append(i)
    li.append(A[i])
    if len(li_i)>2:
      ans="NO"
      break
s=li_i[0]
t=li_i[1]
A[s]=li[1]
A[t]=li[0]
if A==AA:
  ans="YES"
else:
  ans="NO"
print(ans)
    
    
    
    

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
AA=sorted(A)
li=[]
for i in range(N):
  if A[i]!=AA[i]:
    li.append(A[i])
if len(li)>2:
  print("NO")
else:
  print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[int(input()) for i in range(N)]
for i in range(N):
  if i==0:
    print(sorted(A[i+1:])[-1])
  if i!=0 and i!=N-1:
    li1=sorted(A[:i])[-1]
    li2=sorted(A[i+1:])[-1]
    print(max(li1,li2))
  if i==N-1:
    print(sorted(A[:i])[-1])

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
AA=sorted(A,reverse=True)
for i in range(N):
  if AA[0]!=A[i]:
    print(AA[0])
  else:
    print(AA[1])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[int(input()) for i in range(N)]
for i in range(N):
  if i==0:
    print(sorted(A[i+1:])[-1])
  if i!=0 and i!=N-1:
    li1=sorted(A[:i])[-1]
    li2=sorted(A[i+1:])[-1]
    print(max(li1,li2))
  if i==N-1:
    print(sorted(A[:i])[-1])
  

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
AA=sorted(A,reverse=True)
for i in range(N):
  if AA[0]!=A[i]:
    print(AA[0])
  else:
    print(AA[1])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[int(input()) for i in range(N)]
for i in range(N):
  if i==0:
    print(max(A[i+1:]))
  if i!=0 and i!=N-1:
    li1=max(A[:i])
    li2=max(A[i+1:])
    print(max(li1,li2))
  if i==N-1:
    print(max(A[:i]))
  

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
AA=sorted(A,reverse=True)
for i in range(N):
  if AA[0]!=A[i]:
    print(AA[0])
  else:
    print(AA[1])