Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
yakusuu_list = []
for i in range (1,N+1):
  if N % i == 0:
    yakusuu_list.append([i,N//i])
kyori_list =[]
for a in yakusuu_list:
  [i,j] = a
  kyori_list.append(i+j-2)
print(min(kyori_list))
  


Fixed submission:
N = int(input())
import math 
yakusuu_list = []
for i in range (int(math.sqrt(N)),0,-1):
  if N % i == 0:
    yakusuu = i
    break
print(i+ N//i -2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
yakusuu_list = []
for i in range (1,N+1):
  if N % i == 0:
    yakusuu_list.append([i,N/i])
kyori_list =[]
for a in yakusuu_list:
  [i,j] = a
  kyori_list.append(i+j-2)
print(min(kyori_list)
  

Fixed submission:
N = int(input())
import math 
yakusuu_list = []
for i in range (int(math.sqrt(N)),0,-1):
  if N % i == 0:
    yakusuu = i
    break
print(i+ N//i -2)

Buggy python submission (verdict: Runtime Error):
N = int(input())
yakusuu_list
for i in range (1,N+1):
  if N % i == 0:
    yakusuu_list.append([i,N/i])
kyori_list =[]
for a in yakusuu_list:
  [i,j] = a
  kyori_list.append(i+j-2)
print(min(kyori_list)
  

Fixed submission:
N = int(input())
import math 
yakusuu_list = []
for i in range (int(math.sqrt(N)),0,-1):
  if N % i == 0:
    yakusuu = i
    break
print(i+ N//i -2)
Buggy python submission (verdict: Runtime Error):
l,r = map(int, input().split())
if r-l+1>2019:
  print(0)
  exit()
L = []
for i in range(l,r):
  for j in range(i+1,r):
    a = i*j
    b = a%2019
    L.append(b)
print(min(L))


Fixed submission:
a,b,c = map(int,input().split())
train =a*b
if train > c:
  print(c)
else:
  print(train)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,d = map(int, input().split())
l=[]
for i in range(n):
  l.append(list(map(int, input().split())))
count = 0
for i in range(n):
  for j in range(i+1,n):
    distance_a = 0
    for k in range(d):
      distance_k= l[i][k]-l[j][k]
      distance_a +=distance_k**2
    distance = np.sqrt(distance_a)
    if distance = int:
      count += 1
print(count)
    
    
      

Fixed submission:
import numpy as np
n,d = map(int, input().split())
l=[]
for i in range(n):
  l.append(list(map(int, input().split())))
count = 0
for i in range(n):
  for j in range(i+1,n):
    distance_a = 0
    for k in range(d):
      distance_k= l[i][k]-l[j][k]
      distance_a +=distance_k**2
    distance = np.sqrt(distance_a)
    distance_int =int(distance)
    if distance == distance_int:
      count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
l,r = map(int, input().split())
if r-l+1>2019:
  print(0)
  exit()
L = []
for i in range(l,r-1):
  for j in range(i+1,r):
    a = i*j
    b = a%2019
    L.append(b)
print(min(L))


Fixed submission:
l,r = map(int, input().split())
if r-l+1>2019:
  print(0)
  exit()
L = []
for i in range(l,r):
  for j in range(i+1,r+1):
    a = i*j
    b = a%2019
    L.append(b)
print(min(L))

Buggy python submission (verdict: Runtime Error):
l,r = map(int, input().split())
L = []
for i in range(l,r-1):
  for j in range(i+1,r):
    a = i*j
    b = a%2019
    L.append(b)
print(min(L))


Fixed submission:
l,r = map(int, input().split())
if r-l+1>2019:
  print(0)
  exit()
L = []
for i in range(l,r):
  for j in range(i+1,r+1):
    a = i*j
    b = a%2019
    L.append(b)
print(min(L))

Buggy python submission (verdict: Runtime Error):
l,r = map(int, input().split())
L = []
for i in range(l,r-1):
  for j in range(i+1,r):
    a = i*j
    b = a%2019
    l.append(b)
print(min(l))

Fixed submission:
l,r = map(int, input().split())
if r-l+1>2019:
  print(0)
  exit()
L = []
for i in range(l,r):
  for j in range(i+1,r+1):
    a = i*j
    b = a%2019
    L.append(b)
print(min(L))
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())

ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem,A)
print(ans)

Fixed submission:
s = input()
if s == 'AAA' or s == 'BBB':
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
S = input()

if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print(Sunny)

Fixed submission:
S = input()

if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
Buggy python submission (verdict: Runtime Error):
import math

tmp = input().split()
A = int(tmp[0])
B = int(tmp[1])
eight_list = []
ten_list = []
eight_min = math.ceil(A/0.08)
ten_min = math.ceil(B/0.10)
eight_list.append(eight_min)
ten_list.append(ten_min)

eight_min += 1
while(math.floor(eight_min*0.08)==A):
    eight_list.append(eight_min)
    eight_min += 1

ten_min += 1
while(math.floor(ten_min*0.10)==B):
    ten_list.append(ten_min)
    ten_min += 1

#print(eight_list)
#print(ten_list)

print(min(set(eight_list)&set(ten_list)))


Fixed submission:
import math

tmp = input().split()
A = int(tmp[0])
B = int(tmp[1])
eight_list = []
ten_list = []
eight_min = math.ceil(A/0.08)
ten_min = math.ceil(B/0.10)
eight_list.append(eight_min)
ten_list.append(ten_min)

eight_min += 1
while(math.floor(eight_min*0.08)==A):
    eight_list.append(eight_min)
    eight_min += 1

ten_min += 1
while(math.floor(ten_min*0.10)==B):
    ten_list.append(ten_min)
    ten_min += 1

#print(eight_list)
#print(ten_list)
try:
    print(min(set(eight_list)&set(ten_list)))
except ValueError:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q) ]

for i in range(1,N+1):
    if K-Q+A.count(i)<=0:
        print("No")
    else:
        print("Yes")


Fixed submission:
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q) ]
point = [0]*(N+1)
for i in range(Q):
    point[A[i]] += 1
for i in range(N):
    if K-Q+point[i+1]<=0:
        print("No")
    else:
        print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
s = list(map(int,input().split()))
N = s[0]
K = s[1]
Q = s[2]
A = [int(input()) for i in range(Q)]

for i in range(1,N+1):
    if K-Q+A.count(i)<=0:
        print("No")
    else:
        print("Yes")


Fixed submission:
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q) ]
point = [0]*(N+1)
for i in range(Q):
    point[A[i]] += 1
for i in range(N):
    if K-Q+point[i+1]<=0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

sat = sum(B)
for i in range(N-1):
    if A[i]+1==A[i+1]:
        sat += C[A[i-1]]
print(sat)


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

sat = sum(B)
for i in range(N-1):
    if A[i]+1==A[i+1]:
        sat += C[A[i]-1]
print(sat)
Buggy python submission (verdict: Runtime Error):
def culc(n):
    if n%2==0:
        return (n+1)*(n/2)-n
    if n%2==1:
        return (n+1)*((n-1)/2)+(n+1)/2-n

N = int(input())
if N == 1:
    print(0)
else:
    print(int(culc(N)))

Fixed submission:
S = input()
T = input()
count = 0
for i in range(3):
    if S[i]==T[i]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
def culc(n):
    if n%2==0:
        return (n+1)*(n/2)-n
    if n%2==1:
        return (n+1)*((n-1)/2)+(n+1)/2-n

N = int(input())
if N == 1:
    print(0)
else:
    print(culc(N))

Fixed submission:
S = input()
T = input()
count = 0
for i in range(3):
    if S[i]==T[i]:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(float, input().split()))
deno = 1
for i in range(N):
    deno += 1/A[i]
print(1/deno)


Fixed submission:
N = int(input())
A = list(map(float, input().split()))
deno = 0
for i in range(N):
    deno += 1/A[i]
print(1/deno)
Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int,input().split()))
ans = h[0]
for i in range(1,N):
    if h[i]-h[i-1]>0:
        ans += h[i]-h[i-1]
print(ans)


Fixed submission:
s = list(map(int,input().split()))
s.sort()
print(int(s[0]*s[1]/2))
Buggy python submission (verdict: Runtime Error):
s = int(input())
if s==1:
    print(4)
elif s==2:
    print(4)
else:
    print(func(s))

Fixed submission:
def func(n):
    count = 1
    while(n!=4):
        if n%2==0:
            n = n // 2
        else:
            n = 3*n + 1
        count += 1
    return count + 3


s = int(input())
if s==1:
    print(4)
elif s==2:
    print(4)
elif 3<=s and s<=100:
    print(func(s))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
S = input()
if S[0] == 'A' and S[2:-1].count('C')==1 and sum([for c in S c.isupper()])==2 :
  print('AC')
else:
  print('WA')

Fixed submission:
S = input()
if S[0] == 'A' and S[2:-1].count('C')==1 and sum([c.isupper() for c in S])==2 :
  print('AC')
else:
  print('WA')
Buggy python submission (verdict: Runtime Error):

def fact(n):
  if 1<n:
    return n + fact(n-1)
  else:
    return n


N = int(input())
A = list(map(int,input().split()))
b = int(round(float((sum(A)-fact(N)))/N))
if b<0:
    b -= 1

ans = 0

for i in range(N):
    ans += abs(A[i]-(b+i+1))

print(ans)

Fixed submission:
N = int(input())
if N%2==0:
  print(N)
else:
  print(N*2)
Buggy python submission (verdict: Runtime Error):
K = int(input())
ans = [1,2,3,4,5,6,7,8]
num = 9
while(len(ans)<K):
    if str(num)[-1]=="9":
        if str(num)[1:].count("9")==len(str(num)[1:]):
            ans.append(num)
    num += 1

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

Fixed submission:
S = input()
ans = 0
for char in S:
    if char == "+":
        ans += 1
    else:
        ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a%2==1&&b%2==1:
    print("Odd")
else:
    print("Even")

Fixed submission:
a,b = map(int,input().split())
if a%2==1&b%2==1:
    print("Odd")
else:
    print("Even")
Buggy python submission (verdict: Runtime Error):
N,Y = int(input().split())
for x in range(1,N+1):
    for y in range(1,N-x+1):
        for z in range(1,N-x-y+1):
            if 10000*x+5000*y+1000*z==Y:
                print(x,y,z)
                exit()
print("-1 -1 -1")

Fixed submission:
N,Y = map(int,input().split())
for x in range(N+1):
    for y in range(N-x+1):
        if 10000*x+5000*y+1000*(N-x-y)==Y:
            print(x,y,N-x-y)
            exit()
x = -1
print(x,x,x)
Buggy python submission (verdict: Runtime Error):
a = input().split()

N = int(a[0])
A = int(a[1])
B = int(a[2])

i = int(N/(A+B))

cut = N - (A+B)*i
if n < A:
  Blue_Ball_Num = N
elif N < A+B:
  Blue_Ball_Num = A
elif cut > A:
  Blue_Ball_Num = A*i
else:
  Blue_Ball_Num = A*i + (N - (A+B)*i)
  
print(Blue_Ball_Num)

Fixed submission:
a = input().split()

N = int(a[0])
A = int(a[1])
B = int(a[2])

i = int(N/(A+B))

cut = N - (A+B)*i

if N < A:
  Blue_Ball_Num = N
elif N < A+B:
  Blue_Ball_Num = A
elif cut > A:
  Blue_Ball_Num = A*(i+1)
else:
  Blue_Ball_Num = A*i + (N - (A+B)*i)
  
print(Blue_Ball_Num)

Buggy python submission (verdict: Runtime Error):
N = input()
A = input()
B = input()

N = int(N)
A = int(A)
B = int(B)

count = 0
i = 0

while 1:
  count = count + A + B
  i += 1
  if count > N:
    break

cut = N - (A+B)*(i-1)
print(cut)

if cut > A:
  Blue_Ball_Num = A*i
else:
  Blue_Ball_Num = A*i + ((A+B)*i - N)
  
print(Blue_Ball_Num)

Fixed submission:
a = input().split()

N = int(a[0])
A = int(a[1])
B = int(a[2])

i = int(N/(A+B))

cut = N - (A+B)*i

if N < A:
  Blue_Ball_Num = N
elif N < A+B:
  Blue_Ball_Num = A
elif cut > A:
  Blue_Ball_Num = A*(i+1)
else:
  Blue_Ball_Num = A*i + (N - (A+B)*i)
  
print(Blue_Ball_Num)
Buggy python submission (verdict: Runtime Error):
loopin=input()

bingolist = []



A11,A12,A13,A21,A22,A23,A31,A32,A33=0,0,0,0,0,0,0,0,0


for i in range(int(loopin)):
	bingo = input()
	if bingo==a:
		A11=1
	elif bingo==b:
		A12=1	
	elif bingo==c:
		A13=1	
	elif bingo==d:
		A21=1	
	elif bingo==e:
		A22=1	
	elif bingo==f:
		A23=1	
	elif bingo==g:
		A31=1	
	elif bingo==h:
		A32=1	
	elif bingo==i:
		A33=1	

if (A11+A12+A13)==3:
	print("Yes")
elif (A21+A22+A23)==3:
	print("Yes")
elif (A31+A32+A33)==3:
	print("Yes")
elif (A11+A22+A33)==3:
	print("Yes")
elif (A13+A22+A31)==3:
	print("Yes")
else:
	print("No")


Fixed submission:
a,b,c=input().split()
d,e,f=input().split()
g,h,i=input().split()

loopin=input()

A11,A12,A13,A21,A22,A23,A31,A32,A33=0,0,0,0,0,0,0,0,0


for x in range(int(loopin)):
	bingo = input()
	if bingo==a:
		A11=1
	elif bingo==b:
		A12=1	
	elif bingo==c:
		A13=1	
	elif bingo==d:
		A21=1	
	elif bingo==e:
		A22=1	
	elif bingo==f:
		A23=1	
	elif bingo==g:
		A31=1	
	elif bingo==h:
		A32=1
	elif bingo==i:
		A33=1


if (A11+A12+A13)==3:
	print("Yes")
elif (A21+A22+A23)==3:
	print("Yes")
elif (A31+A32+A33)==3:
	print("Yes")
elif (A11+A21+A31)==3:
	print("Yes")
elif (A12+A22+A32)==3:
	print("Yes")
elif (A13+A23+A33)==3:
	print("Yes")
elif (A11+A22+A33)==3:
	print("Yes")
elif (A13+A22+A31)==3:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
a,b= map.(int, input().split())
ans=a*b
if ans=>81:
  print('Yes')
else:
  print('No')

Fixed submission:
a, b = map (int, input().split())
if a<10 and b<10:
  print(a*b)
else:
  print('-1')
Buggy python submission (verdict: Runtime Error):
s=input().split()
if s=='Sunny':
  print('Cloudy')
ifelse s=='Cloudy':
  print('Rainy')
else:
  print('Sunny')

Fixed submission:
s=input()
if s=='Sunny':
  print('Cloudy')
elif s=='Cloudy':
  print('Rainy')
else:
  print('Sunny')

Buggy python submission (verdict: Runtime Error):
s=input()
if s=='Sunny':
  print('Cloudy')
ifelse s=='Cloudy':
  print('Rainy')
else:
  print('Sunny')


Fixed submission:
s=input()
if s=='Sunny':
  print('Cloudy')
elif s=='Cloudy':
  print('Rainy')
else:
  print('Sunny')
Buggy python submission (verdict: Runtime Error):
=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')

Fixed submission:
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')

Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  input('red')

Fixed submission:
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')

Buggy python submission (verdict: Runtime Error):
=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')

Fixed submission:
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')

Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  input('red')

Fixed submission:
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')

Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
if a>=3200:
  print(a)
else:
  input('red')

Fixed submission:
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int, input().split())
if a-b>=c:
  print(0)
else:
  print(c-a+b

Fixed submission:
a,b,c=map(int, input().split())
if a-b>=c:
  print(0)
else:
  print(c-a+b)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
if (a+b)%2==1:
  print('IMPOSSIBLE')
else:
  print(int(a+b)/2))

Fixed submission:
a,b=map(int, input().split())
if (a+b)%2==1:
  print('IMPOSSIBLE')
else:
  k=int((a+b)/2)
  print(k)
Buggy python submission (verdict: Runtime Error):
a=int
b=int
c=a*b%2

if c==0:
  print(even)
else:
  print(odd)
  

Fixed submission:
a,b=input().split()
aa=int(a)
bb=int(b)
if aa*bb%2==0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Runtime Error):
r,g,b=map(int, input.split())
x=100*r+10*g+b
if x%4==0:
 print('YES')
else:
  print('NO')

Fixed submission:
r,g,b=map(int, input().split())
x=100*r+10*g+b
if x%4==0:
 print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
import math

A,B = map(int, input().split())
print(A * B // math.gcd(A, B))

Fixed submission:
import fractions

A,B = map(int, input().split())
print(A * B // fractions.gcd(A, B))

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

A,B = map(int, input().split())
print(A * B // math.gcd(A, B))

Fixed submission:
import fractions

A,B = map(int, input().split())
print(A * B // fractions.gcd(A, B))
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import add

A = list(map(int, input().split()))
print("Yes" if max(A) == reduce(add, [i for i in A if i != max(A)]) else "No")


Fixed submission:
from functools import reduce
from operator import add

A = list(map(int, input().split()))
M = max(A)
T = [i for i in A if i != M]
if len(T) == 0:
    print("No")
else:
    print("Yes" if M==reduce(add, T) else "No")
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

if(500*K>=X):
  print("Yes")
else:
  print("No")

Fixed submission:
K,X = map(int,input().split())

if(500*K>=X):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

ans = A-B*2

if(x>=0):
  print(ans)
else:
  print("0")

Fixed submission:
A,B = map(int,input().split())

ans = A-B*2

if(ans>=0):
  print(ans)
else:
  print("0")
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N = int(input())
H = list(map(int,input().split()))

A = [ 0 for _ in range(N)]
tmp=0
N = N+1
H.insert(0,-100)

for i in range(N-1,0,-1):
    if(H[i] <= H[i-1]):
        tmp +=1
    else:
        A[i]= tmp
        tmp = 0

print(max(A))

Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
H = list(map(int,input().split()))


N = N+1
H.insert(0,-100)

A = [ 0 for _ in range(N)]
tmp=0

for i in range(N-1,0,-1):
    if(H[i] <= H[i-1]):
        tmp +=1
    else:
        A[i]= tmp
        tmp = 0

print(max(A))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N = int(input())

s = [ list(input()) for _ in range(N)]
for i in range(N):
    s[i].sort()
    s[i]=''.join(s[i])

s.sort()

ans_tmp = 0
ans = 0
for i in range(N-1):
    if(i == N-2):
        if(s[i]== s[i+1]):
            ans_tmp += 1
        ans+= cmb(ans_tmp+1, 2)
    if(s[i]== s[i+1]):
        ans_tmp += 1
    elif(ans_tmp>=1):
        ans+= cmb(ans_tmp+1, 2)
        ans_tmp=0


print(ans)


Fixed submission:
from collections import Counter
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N = int(input())

s = [ list(input()) for _ in range(N)]
for i in range(N):
    s[i].sort()
    s[i]=''.join(s[i])

s.sort()
s.append('0')
ans_tmp = 0
ans = 0
for i in range(N):
    if(s[i]== s[i+1]):
        ans_tmp += 1
    elif(ans_tmp>=1):
        ans+= cmb(ans_tmp+1, 2)
        ans_tmp=0


print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter


N = int(input())

s = [ input() for _ in range(N)]

ans = 0
for i in range(N-1):
    for j in range(i+1,N):
        if(Counter(s[i]) == Counter(s[j])):
            ans += 1

print(ans)


Fixed submission:
from collections import Counter
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N = int(input())

s = [ list(input()) for _ in range(N)]
for i in range(N):
    s[i].sort()
    s[i]=''.join(s[i])

s.sort()
s.append('0')
ans_tmp = 0
ans = 0
for i in range(N):
    if(s[i]== s[i+1]):
        ans_tmp += 1
    elif(ans_tmp>=1):
        ans+= cmb(ans_tmp+1, 2)
        ans_tmp=0


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

A = [int(input()) for _ in range(N)]

max_a = max(A)

for i in range(N):
    max_l=0
    max_R=0
    if(A[:i]!=[]):
        max_l = max(A[:i])
    if(A[i+1:]!=[]):
        max_r = max(A[i+1:])
    print(max(max_r,max_l))


Fixed submission:
import copy

N = int(input())

A = [int(input()) for _ in range(N)]
B = sorted(A)
max_1 = B[-1]
max_2 = B[-2]

for i in range(N):
    if(A[i]==max_1):
        print(max_2)
    else:
        print(max_1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

A = [int(input()) for _ in range(N)]

max_a = max(A)

for i in range(N):
    if(A[i] != max_a):
        print(max_a)
    else:
        B = copy.deepcopy(A)
        B.pop(i)
        print(max(B))


Fixed submission:
import copy

N = int(input())

A = [int(input()) for _ in range(N)]
B = sorted(A)
max_1 = B[-1]
max_2 = B[-2]

for i in range(N):
    if(A[i]==max_1):
        print(max_2)
    else:
        print(max_1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

A = [int(input()) for _ in range(N)]

for i in range(N):
    B = copy.deepcopy(A)
    B.pop(i)
    print(max(B))


Fixed submission:
import copy

N = int(input())

A = [int(input()) for _ in range(N)]
B = sorted(A)
max_1 = B[-1]
max_2 = B[-2]

for i in range(N):
    if(A[i]==max_1):
        print(max_2)
    else:
        print(max_1)
Buggy python submission (verdict: Time Limit Exceeded):
L,R = map(int,input().split())

ans = 10 ** 12
for i in range(L,R):
    for j in range(i+1,R+1):
        ans = min(ans,((i%2019) * (j%2019))%2019)

print(ans)


Fixed submission:
L,R = map(int,input().split())

ans = 10 ** 7

di = R//2019 - L//2019

L=L%2019
R=R%2019



if(di == 0):
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans = min(ans, (i*j)%2019)

else:
    ans = 0


print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
import copy 

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

if __name__ == '__main__':
	N=int(input())
	A=list(map(int,input().split()))

	ans=0
	for i in range(N):
		l=copy.deepcopy(A)
		l.pop(int(i))
		if(N>2):
			tmp_gcd=math.gcd(l[0],l[1])
			for j in range(2,len(l)):
				tmp_gcd=gcd(l[j],tmp_gcd)
			if(tmp_gcd > ans):
				ans=tmp_gcd
		else:
			ans=gcd(A[0],A[1])
	print(ans)



Fixed submission:
A,B,T=map(int,input().split())

print(B*(T//A))

Buggy python submission (verdict: Runtime Error):
N=int(input())

V=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=0
for i in range(N):
	if(V[i]-C[i]>0):
		ans+=V[i]-C[i]
print(ans)


Fixed submission:
A,B,T=map(int,input().split())

print(B*(T//A))

Buggy python submission (verdict: Runtime Error):
A,B,T=map(int,input())

print(B*(T//A))


Fixed submission:
A,B,T=map(int,input().split())

print(B*(T//A))
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))

ans = 1
if(N >= 2):
    if(H[1] > H[0]):
        ans += 1

if(N >= 3):
    for i in range(1,N):
        if(H[i] >= max(H[:i-1])):
            ans += 1

print(ans)


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

ans = 0

for i in range(N):
    count = 0
    for j in range(i):
        if(H[i] >= H[j]):
            count += 1
    if(count == i):
        ans += 1

print(ans)