Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n

MOD = 10**9+7
n = int(input())
n, *a = map(int, sys.stdin.buffer.read().split())
l = a[0]
for x in a[1:]:
    l = lcm(x, l)

l %= MOD

ans = 0
for x in a:
    ans += l*pow(x, MOD-2, MOD)%MOD
print(ans%MOD)


Fixed submission:
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n
MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
l = a[0]
for x in a:
    l = lcm(x, l)
ans = 0
for x in a:
    ans += l*pow(x, MOD-2, MOD)%MOD
print(ans%MOD)

Buggy python submission (verdict: Runtime Error):
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n

MOD = 10**9+7
n, *a = map(int, sys.stdin.buffer.read().split())
l = a[0]
for x in a[1:]:
    l = lcm(x, l)
l %= MOD

ans = 0
for x in a:
    ans = (ans + l * pow(x, MOD-2, MOD)%MOD)%MOD
print(ans)


Fixed submission:
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n
MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
l = a[0]
for x in a:
    l = lcm(x, l)
ans = 0
for x in a:
    ans += l*pow(x, MOD-2, MOD)%MOD
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n
MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
l = a[0]
for i in range(1,n):
    l = lcm(a[i], l)
ans = 0
for x in a:
    ans = (ans + l//x)%MOD
print(ans)

Fixed submission:
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n
MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
l = a[0]
for x in a:
    l = lcm(x, l)
ans = 0
for x in a:
    ans += l*pow(x, MOD-2, MOD)%MOD
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n
MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
l = a[0]
for i in range(1,n):
    l = lcm(a[i], l)
ans = 0
for x in a:
    ans = (ans + l//x)%MOD
print(ans)

Fixed submission:
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n
MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
l = a[0]
for x in a:
    l = lcm(x, l)
ans = 0
for x in a:
    ans += l*pow(x, MOD-2, MOD)%MOD
print(ans%MOD)
Buggy python submission (verdict: Runtime Error):
n = int(input())
data = [[]]*(n+2)
data[0] = [-10**10, -10**10]
for i in range(1, n+1):
    x, l = map(int, input().split())
    data[i] = [x-l, x+l]
data[n+1] = [10**10, 10**10]
data.sort()
ans = n
if n == 2:
  if data[1][1] > data[2][0]:
    ans -= 1
else:
  for i in range(1, n):
    if data[i][1] > data[i+1][0] and data[i-1][1] > data[i][0]:
        ans -= 1
        data[i][0] = 0
        data[i][1] = 0
    
print(ans)


Fixed submission:
h = int(input())
w = int(input())
n = int(input())
print(-(-n//max(h,w)))

Buggy python submission (verdict: Runtime Error):
h = int(input())
w = int(input())
n = int(input())
ans(-(-n//max(h,w)))


Fixed submission:
h = int(input())
w = int(input())
n = int(input())
print(-(-n//max(h,w)))
Buggy python submission (verdict: Runtime Error):
from itertools
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))

l=list(itertools.permutations(list(range(1,n+1))))
print(abs(l.index(p)-L.index(q)))

Fixed submission:
import itertools
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))

l=list(itertools.permutations(list(range(1,n+1))))
print(abs(l.index(p) - l.index(q)))
Buggy python submission (verdict: Time Limit Exceeded):
m = 10**9+7
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
tmp = 0
for i in range(n):
  if a[i] != a[i-1]:
    tmp = 0
    for j in range(i+1,n):
      tmp += a[j]^a[i]
      tmp %= m
  ans += tmp
  ans %= m
print(ans)

Fixed submission:
import numpy as np

N = int(input())
mod = 10**9 + 7
A = np.array(input().split(), int)

ans = 0
for i in range(60):
    b = np.count_nonzero(A >> i & 1)
    ans += 2**i*(b*(N-b))
    ans %= mod
    c = np.count_nonzero(A >> i & 1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
m = 10**9+7
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
  for j in range(i+1,n):
    ans += a[j]^a[i]
    ans %= m
print(ans)

Fixed submission:
import numpy as np

N = int(input())
mod = 10**9 + 7
A = np.array(input().split(), int)

ans = 0
for i in range(60):
    b = np.count_nonzero(A >> i & 1)
    ans += 2**i*(b*(N-b))
    ans %= mod
    c = np.count_nonzero(A >> i & 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
n= int(input())
s = input()
ans = 0
for i in range(10):
  ii = s.find(str(i))
  if -1 == ii:
    continue
  for j in range(10):
    ij = s.find(str(j), ii+1)
    if -1 == ij:
      continue
    for k in range(10):
      ik = s.find(str(k), ij+1)
      if ik != -1:
        ans += 1
      
print(ans)

Fixed submission:
m_1, d_1 = map(int, input().split())
m_2, d_2 = map(int, input().split())

if m_1 != m_2:
    print(1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n= int(input())
s = input()
na = np.zeros(n)
for i in range(n):
  na[i] = int(s[i])
ans = set()
h = set()
for i in range(n-2):
  if na[i] not in h:
    h.add(na[i])
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        tmp = str(na[i]) + str(na[j]) + str(na[k])
        if tmp not in ans:
          ans.add(tmp)
print(len(ans))

Fixed submission:
n= int(input())
s = input()
ans = 0
h = set()
for i in range(n-2):
  ten = set()
  if s[i] not in h:
    h.add(s[i])
    for j in range(i+1,n-1):
      if s[j] not in ten:
        ten.add(s[j])
        ans += len(set(s[j+1:]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
s = input()
ans = set()
h = set()
for i in range(n-2):
  if s[i] not in h:
    h.add(s[i])
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        tmp = s[i]+s[j]+s[k]
        if tmp not in ans:
          ans.add(tmp)
print(len(ans))

Fixed submission:
n= int(input())
s = input()
ans = 0
h = set()
for i in range(n-2):
  ten = set()
  if s[i] not in h:
    h.add(s[i])
    for j in range(i+1,n-1):
      if s[j] not in ten:
        ten.add(s[j])
        ans += len(set(s[j+1:]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
s = input()
ans = set()
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      tmp = s[i]+s[j]+s[k]
      ans.add(tmp)
print(len(ans))

Fixed submission:
n= int(input())
s = input()
ans = 0
h = set()
for i in range(n-2):
  ten = set()
  if s[i] not in h:
    h.add(s[i])
    for j in range(i+1,n-1):
      if s[j] not in ten:
        ten.add(s[j])
        ans += len(set(s[j+1:]))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 100000000000000
for i in range(n):
  if sum(a[:i]) == sum(a[i:]):
    ans = 0
    break
  elif ans > abs(sum(a[:i]) - sum(a[i:])):
    ans = abs(sum(a[:i]) - sum(a[i:]))
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = sum(a)
al = ans
mod = 0
for i in range(n):
  if mod + a[i] == al - a[i]:
    ans = 0
    break
  elif ans > abs(mod - al + 2*a[i]):
    ans = abs(mod - al + 2*a[i])
    mod += a[i]
    al -= a[i]
  else:
    mod += a[i]
    al -= a[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
n = int(input())
s = input()
if s[:n//2] == s[n//2:]:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
s = input()
if s[:n//2] == s[n//2:]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[k] >= l[j] + l[i]:
                break
            if l[j] < l[k] + l[i] and l[i] < l[k] + l[j]:
                ans += 1
print(ans)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
    k = i+1
    for j in range(i+1, n):
        while k < n and l[k] < l[i] + l[j]:
            k += 1
            ans += k - (j+1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
l.sort()
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[k] >= l[j] + l[i]:
                break
            if l[j] < l[k] + l[i] and l[i] < l[k] + l[j]:
                ans += 1
print(ans)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
    k = i+1
    for j in range(i+1, n):
        while k < n and l[k] < l[i] + l[j]:
            k += 1
            ans += k - (j+1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[k] >= l[j] + l[i]:
                break
            if l[j] < l[k] + l[i] and l[i] < l[k] + l[j]:
                ans += 1
print(ans)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
    k = i+1
    for j in range(i+1, n):
        while k < n and l[k] < l[i] + l[j]:
            k += 1
            ans += k - (j+1)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
cnt = 0
flag = 0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
    if i-1 >=0 and s[i-1] == s[i] and flag == 0:
      cnt -= 1
      flag = 1
    else:
      flag = 0
  else:
    flag = 0
tmp = 0
if len(s)%2 and s.count(s[0]) == len(s):
  tmp = k//2
if s[0] == s[-1] and s[0] != s[1] and s[0] != s[-2]:
  tmp += k-1
print(cnt*k + tmp)

Fixed submission:
from itertools import groupby

s = input()
k = int(input())
a = [sum(1 for _ in g) for _, g in groupby(s)]
if len(a) == 1:
  print(len(s) * k // 2)
else:
  ans = sum(x // 2 for x in a) * k
  if s[0] == s[-1] and a[0] & a[-1] & 1:
    ans += k - 1
  print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
cnt = 0
flag = 0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
    if i-1 >=0 and s[i-1] == s[i] and flag == 0:
      cnt -= 1
      flag = 1
    else:
      flag = 0
  else:
    flag = 0
tmp = 0
if len(s)%2 and s.count(s[0]) == len(s):
  tmp = k//2

if s[0] == s[-1] and s[0] != s[1] and s[0] != s[-2]:
  tmp += k
print(cnt*k + tmp)


Fixed submission:
from itertools import groupby

s = input()
k = int(input())
a = [sum(1 for _ in g) for _, g in groupby(s)]
if len(a) == 1:
  print(len(s) * k // 2)
else:
  ans = sum(x // 2 for x in a) * k
  if s[0] == s[-1] and a[0] & a[-1] & 1:
    ans += k - 1
  print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
cnt = 0
flag = 0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
    if i-1 >=0 and s[i-1] == s[i] and flag == 0:
      cnt -= 1
      flag = 1
    else:
      flag = 0
  else:
    flag = 0
tmp = 0
if len(s)%2 and (s[0] == s[1] == s[-1] or s[0] == s[-2] == s[-1]):
  tmp = k//2
print(cnt*k + tmp)

Fixed submission:
from itertools import groupby

s = input()
k = int(input())
a = [sum(1 for _ in g) for _, g in groupby(s)]
if len(a) == 1:
  print(len(s) * k // 2)
else:
  ans = sum(x // 2 for x in a) * k
  if s[0] == s[-1] and a[0] & a[-1] & 1:
    ans += k - 1
  print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
cnt = 0
flag = 0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
    if s[i+1] == s[i+2] and flag == 0 :
      flag = 1
      cnt -= 1
    else:
      flag = 0
print(cnt*k)

Fixed submission:
from itertools import groupby

s = input()
k = int(input())
a = [sum(1 for _ in g) for _, g in groupby(s)]
if len(a) == 1:
  print(len(s) * k // 2)
else:
  ans = sum(x // 2 for x in a) * k
  if s[0] == s[-1] and a[0] & a[-1] & 1:
    ans += k - 1
  print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
for i in range(1, n+1):
  print(h.index(i)+1, end =  " ")

Fixed submission:
n = int(input())
print('{:0<10}'.format(((n+1)//2)/n))

Buggy python submission (verdict: Runtime Error):
n = unt(input())
print((n//2)//n)

Fixed submission:
n = int(input())
print('{:0<10}'.format(((n+1)//2)/n))
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(1, n+1):
  ans[h[i]-1] = i+1
print(*ans)

Fixed submission:
n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[h[i]-1] = i+1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = tuple(map(int, input().split()))
for i in range(1, n+1):
  print(h.index(i)+1, end =  " ")

Fixed submission:
n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[h[i]-1] = i+1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = tuple(map(int, input().split()))
for i in range(1, n+1):
  print(h.index(i)+1, end =  " ")

Fixed submission:
n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[h[i]-1] = i+1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int, input().split()))
for i in range(1, n+1):
  print(h.index(i)+1, end =  " ")

Fixed submission:
n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[h[i]-1] = i+1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int, input().split()))
cnt = [0]*n
for i in range(n):
  for j in range(n):
    if i+1 == h[j]:
      cnt[i] += j+1
      
print(*cnt)

Fixed submission:
n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[h[i]-1] = i+1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int, input().split()))
for i in range(1, n+1):
  for j in range(n):
    if i == h[j]:
      print(j+1, end = " ")

Fixed submission:
n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[h[i]-1] = i+1
print(*ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
cnt = h.sort()
for i in range(n):
  for j int range(j):
    if cnt[i] == h[j]:
      print(h[j], end = "")

Fixed submission:
n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[h[i]-1] = i+1
print(*ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
for j in range(m):
  a[0] //= 2
  a.sort(reverse=True)
print(sum(a))

Fixed submission:
s = input()
if s == "Sunny" :
  print("Cloudy")
elif s == "Cloudy" :
  print("Rainy")
else :
  print("Sunny")
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

best = 0
for i in range(N-1):
  a=0
  for j in range(i+1,N):
    if H[i] < H[j]: break
    else : 
      a += 1
  if a > best :
    best = a
print(best)

Fixed submission:
S = input()
T = input()

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

best = []
a = 0
for i in range(N):
  if H[i] >= H[i+1]:
    a += 1
  else : 
    best.append(a)
    a = 0
best.append(a)
print(max[best])

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

best = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
  else : 
    best.append(a)
    a = 0
best.append(a)
print(max(best))

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

best = []
a = 0
for i in range(N):
  if H[i] >= H[i+1]:
    a += 1
  else : 
    best.append(a)
    a = 0
best.append(a)
print(max(best))

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

best = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
  else : 
    best.append(a)
    a = 0
best.append(a)
print(max(best))

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

best = 0
for i, j in range(N-1):
  a=0
  if H[i] >= H[j]:
      a += 1
  else : break
  if a > best :
    best = a
print(best)

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

best = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
  else : 
    best.append(a)
    a = 0
best.append(a)
print(max(best))

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

best = 0
for i in range(N):
  for j in range(i+1,N):
    if H[i] < H[j]: break
  if j - i > best :
    best = j - i
print(best)

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

best = []
a = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    a += 1
  else : 
    best.append(a)
    a = 0
best.append(a)
print(max(best))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans =sum(range(1, n))
print(ans)

Fixed submission:
n = int(input())
ans = n*(n-1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys, collections
n = int(input())
uq = []
chk = {}
for x in sys.stdin.readlines():
    x = x.rstrip()
    tmp = collections.Counter(sorted(x))
    h = ''
    for i in tmp:
        h += i + str(tmp[i])
    if h not in uq:
        uq.append(h)
    else:
        if h not in chk:
            chk.setdefault(h, 1)
        chk[h] += 1
ans = 0
for x in chk:
    ans += chk[x]*(chk[x]-1)//2
print(ans)


Fixed submission:
import sys, collections
n = int(input())
uq = ["".join(sorted(x.rstrip())) for x in sys.stdin.readlines()]
chk = collections.Counter(uq)
ans = 0
for x in chk:
    if chk[x] != 1:
        ans += chk[x]*(chk[x]-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys, collections, math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(input())
uq = []
chk = {}
for x in sys.stdin.readlines():
    x = x.rstrip()
    tmp = collections.Counter(sorted(x))
    h = ''
    for i in tmp:
        h += i + str(tmp[i])
    if h not in uq:
        uq.append(h)
    else:
        if h not in chk:
            chk.setdefault(h, 1)
        chk[h] += 1
ans = 0
for x in chk:
    ans += combinations_count(chk[x], 2)
print(ans)


Fixed submission:
import sys, collections
n = int(input())
uq = ["".join(sorted(x.rstrip())) for x in sys.stdin.readlines()]
chk = collections.Counter(uq)
ans = 0
for x in chk:
    if chk[x] != 1:
        ans += chk[x]*(chk[x]-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
check = 0
tmp = 0
for i in range(n-1):
  if p[i+1] - p[i] == 1:
    cnt += 1
  else:
    if check == 0:
      tmp = i + 2
      check += 1
    else :
      if tmp == p[i+1]:
        check += 1
      else :
        cnt += 1

if cnt == n-1 or check == 2 :
  print("YES")
else:
  print("NO")  

Fixed submission:
a, b = map(int ,input().split())
if (a + b)%2 == 0:
  print(int((a + b)/2))
else :
  print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0]*n
for i in range(n):
  a[i] = int(input())
for i in range(n):
  b = a[:]
  b[i] = 0
  print(max(set(b)))

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = a[:]
b.sort(reverse=True)
for i in range(n):
  if a[i] == b[0]:
    print(b[1])
  else:
    print(b[0])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0]*n
for i in range(n):
  a[i] = int(input())
for i in range(n):
  b = a[:]
  b[i] = 0
  print(max(set(b)))

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = a[:]
b.sort(reverse=True)
for i in range(n):
  if a[i] == b[0]:
    print(b[1])
  else:
    print(b[0])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0]*n
for i in range(n):
  a[i] = int(input())
for i in range(n):
  b = a[:]
  b[i] = 0
  print(max(b))

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = a[:]
b.sort(reverse=True)
for i in range(n):
  if a[i] == b[0]:
    print(b[1])
  else:
    print(b[0])

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if a<=0 and 0<=b:
  print("Zero")  
elif a < 0 and min(b-a,-a)%2 == 0:
  print("Negative")
else:
  print("Positive")

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
b = a[:]
b.sort(reverse=True)
for i in range(n):
  if a[i] == b[0]:
    print(b[1])
  else:
    print(b[0])
Buggy python submission (verdict: Runtime Error):
n, d = map(int, input().split())
from sys import stdin

n, d = map(int, input().split())
x = []
for i in range(n):
        x.append(list(map(int,input().split())))

ans = 0
for i in range(n):
    tmp = 0
    for j in range(d):
        tmp += (x[i][j] - x[(i+1)%n][j])**2
    if tmp**(1/2)%1 == 0:
        ans += 1
print(ans)

Fixed submission:
from sys import stdin

n, d = map(int, input().split())
x = []
for i in range(n):
        x.append(list(map(int,input().split())))

ans = 0
for i in range(n):
  for k in range(i+1, n):
    tmp = 0
    for j in range(d):
        tmp += (x[i][j] - x[k][j])**2
    if tmp**(1/2)%1 == 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
s= input()
if s.count(s[0]) == 2 && s.count(s[1]) == 2:
  print("Yes")
else :
  print("No")  

Fixed submission:
s = input()
s = list(s)
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[1] != s[3]:
  print("Yes")
else :
  print("No")

Buggy python submission (verdict: Runtime Error):
s = input()
s = list(s)
s.sort()
if s[0] == s[1] && s[2] == s[3]:
  print("Yes")
else :
  print("No")  

Fixed submission:
s = input()
s = list(s)
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[1] != s[3]:
  print("Yes")
else :
  print("No")

Buggy python submission (verdict: Runtime Error):
s= input()
if s.count(s[0]) == 2 && s.count(s[1]) == 2:
  print("Yes")
else :
  print("No")  

Fixed submission:
s = input()
s = list(s)
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[1] != s[3]:
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int. input().split()))
ans = 0
for i in range(1, n-1):
    if p[i-1] < p[i] and p[i] < p[i+1]:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n-1):
    if (p[i-1] < p[i] and p[i+1] > p[i]) or (p[i-1] > p[i] and p[i+1] < p[i]):
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input)
p = list(map(int. input().split()))
ans = 0
for i in range(1, n-1):
    if p[i-1] < p[i] and p[i] < p[i+1]:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n-1):
    if (p[i-1] < p[i] and p[i+1] > p[i]) or (p[i-1] > p[i] and p[i+1] < p[i]):
        ans += 1
print(ans)