Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

setA = set(A)

ans = 0
c = 0
for x in setA:
    for a in A:
        if a == x-1 or a == x or a == x+1:
            c += 1
    ans = max(ans, c)
    c = 0
print(ans)

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

DA = {}
for a in A:
    if a in DA.keys():
        DA[a] += 1
    else:
        DA[a] = 1

ans = 0
c = 0
for k, v in DA.items():
    c += v
    if k+1 in DA:
        c += DA[k+1]
    if k-1 in DA:
        c += DA[k-1]
    ans = max(ans, c)
    c = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

if B < C or D < A:
    print(0)
elif A < C and B < D:
    print(B-C)
elif A < C and B > D:
    print(D-C)
elif C < A and B < D:
    print(B-A)
elif A < D and B > D:
    print(D-A)

Fixed submission:
N = input()
if N[0] != N[len(N)-1]:
    print('No')
    quit()
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
edge1 = []
edgeN = []
for _ in range(M):
    s, n = map(int, input().split())
    if s == 1:
        edge1.append(n)
    elif n == N:
        edgeN.append(s)
for e1 in edge1:
    if e1 in edgeN:
        print('POSSIBLE')
        quit()
print('IMPOSSIBLE')

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

N, M = map(int, input().split())
edge1 = []
edgeN = []
for _ in range(M):
    s, n = map(int, input().split())
    if s == 1:
        edge1.append(n)
    elif n == N:
        edgeN.append(s)
if len(set(edge1) & set(edgeN)) > 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
edge1 = []
edgeN = []
for _ in range(M):
    e = list(map(int, input().split()))
    if e[0] == 1:
        edge1.append(e[1])
    elif e[1] == N:
        edgeN.append(e[0])
for e1 in edge1:
    if e1 in edgeN:
        print('POSSIBLE')
        quit()
print('IMPOSSIBLE')

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

N, M = map(int, input().split())
edge1 = []
edgeN = []
for _ in range(M):
    s, n = map(int, input().split())
    if s == 1:
        edge1.append(n)
    elif n == N:
        edgeN.append(s)
if len(set(edge1) & set(edgeN)) > 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 10**20
for i in range(N-1):
    p = abs(sum(A[:i+1])-sum(A[i+1:]))
    if ans > p:
        ans = p
print(ans)

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

nums = [0]
for a in A:
    nums.append(nums[-1]+a)

sumA = nums[-1]
ans = 10**20
for a in nums[1:-1]:
    p = abs(2*a-sumA)
    ans = min(ans, p)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = []
flg = False
if n % 2 == 0:
    flg = True
for e in a:
    if flg:
        b.append(e)
        flg = False
    else:
        b.insert(0, e)
        flg = True
print(' '.join(map(str, b)))


Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = deque([])
flg = False
if n % 2 == 0:
    flg = True
for e in a:
    if flg:
        b.append(e)
        flg = False
    else:
        b.appendleft(e)
        flg = True
print(' '.join(map(str, b)))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = []
flg = True
for e in a:
    if flg:
        b.append(e)
        flg = False
    else:
        b.insert(0, e)
        flg = True
if n % 2 == 1:
    b.reverse()
print(' '.join(map(str, b)))


Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = deque([])
flg = False
if n % 2 == 0:
    flg = True
for e in a:
    if flg:
        b.append(e)
        flg = False
    else:
        b.appendleft(e)
        flg = True
print(' '.join(map(str, b)))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]
C = [list(map(int, input().split())) for _ in range(N)]

for s in S:
    minC = 10**10
    idx = 0
    for i, c in enumerate(C):
        d = abs(s[0]-c[0]) + abs(s[1]-c[1])
        if d < minC:
            minC = d
            idx = i + 1
    print(idx)




Fixed submission:
N, M = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]
C = [list(map(int, input().split())) for _ in range(M)]

for s in S:
    minC = 10**10
    idx = 0
    for i, c in enumerate(C):
        d = abs(s[0]-c[0]) + abs(s[1]-c[1])
        if d < minC:
            minC = d
            idx = i + 1
    print(idx)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = N
pred = N
for i in range(1, N//2):
    d = 0
    if N % i == 0:
        d = max(len(str(i)), len(str(N//i)))
        ans = min(ans, d)
        if d > pred:
            break
        pred = d
print(ans)

Fixed submission:
N = int(input())
ans = N
for i in range(1, N):
    if i**2 > N:
        break
    d = 0
    if N % i == 0:
        d = max(len(str(i)), len(str(N//i)))
        ans = min(ans, d)
print(ans)
Buggy python submission (verdict: Runtime Error):
H H


Fixed submission:
a, b = map(str, input().split())
if a == 'H':
    print(b)
else:
    if b == 'H':
        print('D')
    else:
        print('H')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

if N % 2 == 1:
    if A.count(0) != 1:
        print(0)
        quit()
    s = 2
else:
    s = 1

for i in range(s, N, 2):
    if A.count(i) != 2:
        print(0)
        quit()
print(2**(N//2)%(10**9+7))


Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

if N % 2 == 1:
    if A.count(0) != 1:
        print(0)
        quit()

c = {}
for e in A:
    if e == 0:
        continue
    if e in c.keys():
        c[e] += 1
    else:
        c[e] = 1
if all([x == 2 for x in c.values()]):
    print(2**(N//2)%(10**9+7))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if N % 2 == 1:
    if A.count(0) != 1:
        print(0)
        quit()
    s = 2
else:
    s = 1

for i in range(s, N, 2):
    if A.count(i) != 2:
        print(0)
        quit()
print(2**(N//2))


Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

if N % 2 == 1:
    if A.count(0) != 1:
        print(0)
        quit()

c = {}
for e in A:
    if e == 0:
        continue
    if e in c.keys():
        c[e] += 1
    else:
        c[e] = 1
if all([x == 2 for x in c.values()]):
    print(2**(N//2)%(10**9+7))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A.sort()
if N % 2 == 1:
    if A.count(0) != 1:
        print(0)
        quit()
    s = 2
else:
    s = 1

for i in range(s, N, 2):
    if A.count(i) != 2:
        print(0)
        quit()
print(2**(N//2))


Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

if N % 2 == 1:
    if A.count(0) != 1:
        print(0)
        quit()

c = {}
for e in A:
    if e == 0:
        continue
    if e in c.keys():
        c[e] += 1
    else:
        c[e] = 1
if all([x == 2 for x in c.values()]):
    print(2**(N//2)%(10**9+7))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
S = input()
P = ['dream', 'dreamer', 'erase', 'eraser']

def makeS(T, flg):
    if len(T) > len(S):
        return 0
    
    for p in P:
        T += p
        if T == S:
            return 1
        else:
            flg += makeS(T, flg)
            T = T[:len(T)-len(p)]
    return flg

if makeS('', 0):
    print('YES')
else:
    print('NO')

Fixed submission:
S = input()
P = ['dream', 'dreamer', 'erase', 'eraser']
s = S
for i in range(10**5):
    flg = True
    for p in P:
        if s[len(s)-len(p):] == p:
            s = s[:len(s)-len(p)]
            flg = False
            break
    if flg:
         print('NO')
         quit()
    if len(s) == 0:
        break
print('YES')
Buggy python submission (verdict: Runtime Error):
9 9 2


Fixed submission:
a, b, x = map(int, input().split())
print(b//x-(a-1)//x)
Buggy python submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print((a+b)*h//2)

Fixed submission:
a = int(input()) 
b = int(input())
h = int(input())
print((a+b)*h//2)
Buggy python submission (verdict: Runtime Error):
while(True):
    a = int(input())
    b = a // 1000
    c = (a - 1000 * b) // 100
    d = a % 100 // 10
    e=a%10
    if ( b == c and c==d ):
        print('Yes')
    elif(c==d and d==e):
        print('Yes')
    else:
        print('No')

Fixed submission:
a = int(input())
b = a // 1000
c = (a - 1000 * b) // 100
d = a % 100 // 10
e=a%10
if ( b == c and c==d ):
        print('Yes')
elif(c==d and d==e):
        print('Yes')
else:
        print('No')

Buggy python submission (verdict: Runtime Error):
while(True):
    a = int(input())
    b = a // 1000
    c = (a - 1000 * b) // 100
    d = a % 100 // 10
    e=a%10
    if (d == b == c or c==d==e):
        print('Yes')
    else:
        print('No')


Fixed submission:
a = int(input())
b = a // 1000
c = (a - 1000 * b) // 100
d = a % 100 // 10
e=a%10
if ( b == c and c==d ):
        print('Yes')
elif(c==d and d==e):
        print('Yes')
else:
        print('No')

Buggy python submission (verdict: Runtime Error):
while(True):
    a = int(input())
    b = a // 1000
    c = (a - 1000 * b) // 100
    d = a % 100 // 10

    if (d == b == c):
        print('Yes')
    else:
        print('No')


Fixed submission:
a = int(input())
b = a // 1000
c = (a - 1000 * b) // 100
d = a % 100 // 10
e=a%10
if ( b == c and c==d ):
        print('Yes')
elif(c==d and d==e):
        print('Yes')
else:
        print('No')

Buggy python submission (verdict: Runtime Error):
while(True):
    a = int(input("Enter a number"))
    b = a // 1000
    c = (a - 1000 * b) // 100
    d = a % 100 // 10

    if (d == b == c):
        print('Yes')
    else:
        print('No')

Fixed submission:
a = int(input())
b = a // 1000
c = (a - 1000 * b) // 100
d = a % 100 // 10
e=a%10
if ( b == c and c==d ):
        print('Yes')
elif(c==d and d==e):
        print('Yes')
else:
        print('No')

Buggy python submission (verdict: Runtime Error):
while(True):
    a = int(input("Enter a number"))
    b = a // 1000
    c = (a - 1000 * b) // 100
    d = a % 100 // 10

    if (d == b == c):
        print('Yes')
    else:
        print('No')

Fixed submission:
a = int(input())
b = a // 1000
c = (a - 1000 * b) // 100
d = a % 100 // 10
e=a%10
if ( b == c and c==d ):
        print('Yes')
elif(c==d and d==e):
        print('Yes')
else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
def getLunum(n):
    if(n==0):
        return 2
    elif(n==1):
        return 1
    else:
        return getLunum(n-1)+getLunum(n-2)
a=int(input())
print(getLunum(a))

Fixed submission:
b=[]
a=int(input())
b.append(2)
b.append(1)
for i in range(2,87):
    b.append(b[i-1]+b[i-2])
print(b[a])
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]
count=0
flag=0
b=[]
for i in range(len(a)-1):
  if(a[i]<=a[i+1]):
    flag=1
    count+=1
  else:
    flag=0
    b.append(count)
    count=0
print(max(b))

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
count=0
flag=0
b=[]
maxi=0
for i in range(len(a)-1):
  if(a[i]>=a[i+1] and flag==0):
      count=1
      flag=1
      
  elif(a[i]>=a[i+1] and flag==1):
    count+=1
    if(maxi<count):
        maxi=count
        
  else:
    count=0
    flag=0
      
print(maxi)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a,b,c=[map(list,map(int,input().split())) for _ in range(3)] 
x=0
for i,_ in enumerate(a):
  if(i==len(a)-1):
    break
  elif(a[i]+1==a[i+1]):
    x+=c[a[i]-1]
print(sum(b)+x)

Fixed submission:
n=int(input())
a,b,c=[list(map(int,input().split())) for _ in range(3)] 
x=0
for i,_ in enumerate(a):
  if(i==len(a)-1):
    break
  elif(a[i]+1==a[i+1]):
    x+=c[a[i]-1]
print(sum(b)+x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a,b,c=[map(list,map(int,input().split())) for _ in range(3)] 
x=0
for i,_ in enumerate(a):
  if(i==len(a)-1):
    break
  elif(a[i]+1==a[i+1]):
    x+=c[a[i]-1]
print(sum(b)+x)

Fixed submission:
n=int(input())
a,b,c=[list(map(int,input().split())) for _ in range(3)] 
x=0
for i,_ in enumerate(a):
  if(i==len(a)-1):
    break
  elif(a[i]+1==a[i+1]):
    x+=c[a[i]-1]
print(sum(b)+x)
Buggy python submission (verdict: Runtime Error):
S=input()
m=0
count=0
for s in S:
    if(s=="A" OR s=="C" OR s=="G" OR s=="T"):count+=1
    else:count=0
    m=max(m,count)
print(m)

Fixed submission:
S=input()
m=0
count=0
for s in S:
    if(s=="A" or s=="C" or s=="G" or s=="T"):count+=1
    else:count=0
    m=max(m,count)
print(m)

Buggy python submission (verdict: Runtime Error):
S=input()
m=0
count=0
for s in S:
    if(s=="A" OR s=="C" OR s=="G" or s=="T"):count+=1
    else:count=0
    m=max(m,count)
print(m)

Fixed submission:
S=input()
m=0
count=0
for s in S:
    if(s=="A" or s=="C" or s=="G" or s=="T"):count+=1
    else:count=0
    m=max(m,count)
print(m)
Buggy python submission (verdict: Runtime Error):
a=input()
cnt=1
while a!=1
  if(a%2==0):
    a//=2
    cnt+=1
  else:
    a=3a+1
    cnt+=1
print(cnt=+3)

Fixed submission:
s=[int(input())]
while len(s)==len(set(s)):
  if(s[-1]%2==0):
    s.append(s[-1]//2)
  else:
    s.append(3*s[-1]+1)
print(len(s))
Buggy python submission (verdict: Runtime Error):
*a=list(map(int, input());
print(a)

Fixed submission:
a=list(int(input()) for _ in range(4))
print(min([a[0]+a[2],a[1]+a[2],a[0]+a[3],a[1]+a[3]]))
Buggy python submission (verdict: Runtime Error):
s=input()
l=len(s)
for _ in range(l)
  s.pop(l-1)
  if(s[:l//2]*2==s)
  print(l)

Fixed submission:
s=input()
l=len(s)
for _ in range(l):
  s=s[:-1]
  if(len(s)%2==1):
    continue
  if(s[:len(s)//2]*2==s):
    print(len(s))
    break
Buggy python submission (verdict: Runtime Error):
l=[int(input()) for _ in range(int(input()))]
x=l[0]
cnt=1
while l[x]!=2:
  if(l[x]==0 or len(l)==cnt):
    print(-1)
    exit()
  index=l[x]
  l[x]=0
  x=int(index-1)
  cnt+=1
print(cnt)

Fixed submission:
n=int(input())
A=list(int(input()) for i in range(n))
a=0
for x in range(n):
  a=A[a]-1
  if a==1:
    print(x+1)
    break
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
print('GREATER' if(a>b) else 'LESS' if(b<a) else 'EQUAL')

Fixed submission:
a,b=map(int, open(0))
print('GREATER' if(a>b) else 'LESS' if(b>a) else 'EQUAL')
Buggy python submission (verdict: Runtime Error):
n=int(input().split()[0])
print(join(sorted([input()for _ in[0]*n])))

Fixed submission:
n=int(input().split()[0])
print(''.join(sorted([input()for _ in[0]*n])))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]
sum1=0
for i in range(n):
  sum1+=b[a[i]-1]
  if(i!=n-1):
	if(a[i+1]-a[i]==1):
      sum1+=c[a[i]-1]
print(sum1)      

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]
sum1=0
for i in range(n):
	sum1+=b[a[i]-1]
	if(i!=n-1):
		if(a[i+1]-a[i]==1):
			sum1+=c[a[i]-1]
print(sum1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[1]
    else:    
      if(b[i]>=b[i-1]):
          a[i+1]=b[i]
      if(b[i]<b[i-1]):		
          a[i]=b[i]
          a[i+1]=b[i]
print(sum(a))

Fixed submission:
n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[0]
	else:	
		if(b[i]>=b[i-1]):
			a[i+1]=b[i]
		if(b[i]<b[i-1]):		
			a[i]=b[i]
			a[i+1]=b[i]
print(sum(a))

Buggy python submission (verdict: Runtime Error):
n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[1]
	elif(b[i]>=b[i-1]):
		a[i+1]=b[i]
	elif(b[i]<b[i-1]):		
		a[i]=b[i]
		a[i+1]=b[i]
print(sum(a))

Fixed submission:
n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[0]
	else:	
		if(b[i]>=b[i-1]):
			a[i+1]=b[i]
		if(b[i]<b[i-1]):		
			a[i]=b[i]
			a[i+1]=b[i]
print(sum(a))

Buggy python submission (verdict: Runtime Error):
n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[1]
	if(b[i]>=b[i-1]):
		a[i+1]=b[i]
	if(b[i]<b[i-1]):		
		a[i]=b[i]
		a[i+1]=b[i]
print(sum(a))

Fixed submission:
n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[0]
	else:	
		if(b[i]>=b[i-1]):
			a[i+1]=b[i]
		if(b[i]<b[i-1]):		
			a[i]=b[i]
			a[i+1]=b[i]
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split(" ")))
M = 0
m = 0

for i in range(len(H) - 1):
    m = 0
    for j in range(i, len(H) - 1):
        if (H[j] >= H[j+1]):
            m = m + 1
        else:
            break
    M = max(M, m)
print(M)

Fixed submission:
N = int(input())
H = list(map(int, input().split(" ")))
M = 0
i = 0

while i < (N - 1):
    m = 0
    j = i
    if (M > N - i):
        break
    while j < (N - 1):
        if H[j] >= H[j+1]:
            m = m + 1
            j = j + 1
        else:
            break
    M = max(M, m)
    i = j + 1

print(M)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()

H0 = 0
N_LR = 0
N_RL = 0

if S[0] == 'R' and S[1] == 'R':
    H0 += 1
if S[0] == 'R' and S[1] == 'L':
    N_RL += 1
if S[0] == 'L' and S[1] == 'R':
    N_LR += 1

if S[N-1] == 'L' and S[N-2] == 'L':
    H0 += 1

for i in range(1, N-1):
    if S[i] == 'L' and S[i-1] == 'L' or S[i] == 'R' and S[i+1] == 'R':
        H0 += 1
    if S[i] == 'R' and S[i+1] == 'L':
        N_RL += 1
    if S[i] == 'L' and S[i+1] == 'R':
        N_LR += 1

M = min(N_RL, N_LR, K)
H1 = H0 + 2 * M
K -= M
N_RL -= M
N_LR -= M

result = H1 + min(K, max(N_RL, N_LR))
print(result)


Fixed submission:
N = int(input())
print(N**3)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()

H0 = 0
N_LR = 0
N_RL = 0

if S[0] == 'R' and S[1] == 'R':
    H0 += 1
if S[0] == 'R' and S[1] == 'L':
    N_RL += 1
if S[0] == 'L' and S[1] == 'R':
    N_LR += 1

if S[N-1] == 'L' and S[N-2] == 'L':
    H0 += 1

for i in range(1, N-1):
    if S[i] == 'L' and S[i-1] == 'L' or S[i] == 'R' and S[i+1] == 'R':
        H0 += 1
    if S[i] == 'R' and S[i+1] == 'L':
        N_RL += 1
    if S[i] == 'L' and S[i+1] == 'R':
        N_LR += 1

M = min(N_RL, N_LR, K)
H1 = H0 + 2 * M
K -= M
N_RL -= M
N_LR -= M

result = H1 + min(K, max(N_RL, N_LR))
print(result)


Fixed submission:
N = int(input())
print(N**3)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split(' '))))

A_inv = 1 / A
print(1 / np.sum(A_inv))


Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split(' '))))

A_inv = 1 / A
print(1 / np.sum(A_inv))


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

inv_sum = 0
for a in A:
    inv_sum += 1 / a

print(1 / inv_sum)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

for i in range(N):
    m = max(A[:i] + A[(i+1):])
    print(m)


Fixed submission:
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

m1, m2, *_ = sorted(A, reverse=True)
for i in range(N):
    if A[i] == m1:
        print(m2)
    else:
        print(m1)
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()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a and prev != N:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Fixed submission:
N = int(input())
print(N*N*N)

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()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a and prev != 0:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Fixed submission:
N = int(input())
print(N*N*N)

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()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Fixed submission:
N = int(input())
print(N*N*N)

Buggy python submission (verdict: Runtime Error):
n = int(import())

print(n*n*n)

Fixed submission:
N = int(input())
print(N*N*N)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
 
print(math.factorial(n) // math.factorial(n - 3))

Fixed submission:
N = int(input())
print(N*N*N)

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

print(math.factorial(n) // math.factorial(n - 3))

Fixed submission:
N = int(input())
print(N*N*N)