Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if a > 0:
    print('Positive')
else if b >= 0:
    print('Zero')
else if (b-a) % 2 == 1:
    print('Positive')
else:
    print('Negative')

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

if a > 0:
    print('Positive')
elif b >= 0:
    print('Zero')
elif (b-a) % 2 == 1:
    print('Positive')
else:
    print('Negative')
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

import sys

sys.setrecursionlimit(20000)

l = [[] for i in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    l[a-1].append(b-1)
    l[b-1].append(a-1)

def first_search(first, depth):
    record = 0
    for i in l[first]:
        temp = search(first, i, depth-1)
        if record < temp:
            record = temp
    return record + 1

def search(before, now, depth):
    if depth <= 0:
        return 1
    else:
        ans = 1
        for i in l[now]:
            if before != i:
                ans += search(now, i, depth-1)
        return ans

ret = 0    
for i in range(n):
    temp = first_search(i, k)
    if temp > ret:
        ret = temp
        
if ret > n:
    print(0)
else:
    print(n-ret)

Fixed submission:
n = int(input())

l = list(map(int, input().split()))

ans = 0

l = sorted(l)

for i in range(n):
    ans += l[2*i]
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math

sets = dict()

def gcd2(a, b):
    if a > b:
        key = (b, a)
    else:
        key = (a, b)
    
    if key in sets.keys():
        # print("cached")
        return sets[key]
    else:
        # print("stored")
        ans = math.gcd(a, b)
        sets[key] = ans
        return ans

def gcd3(a, b, c):
    return gcd2(gcd2(a, b), c)

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            ans += gcd3(i, j, k)

print(ans)


Fixed submission:
import math

sets = dict()

def gcd2(a, b):
    if a > b:
        key = (b, a)
    else:
        key = (a, b)
    
    try:
        # print("cached")
        return sets[key]
    except:
        # print("stored")
        ans = math.gcd(a, b)
        sets[key] = ans
        return ans

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        pre = gcd2(i, j)

        for k in range(1, n+1):
            ans += gcd2(pre, k)

print(ans)

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

sets = dict()

def gcd3(a, b, c):
    key = tuple(set((a, b, c)))
    if key in sets.keys():
        # print("cached")
        return sets[key]
    else:
        # print("stored")
        ans = math.gcd(math.gcd(a, b), c)
        sets[key] = ans
        return ans

#     print(key)
    
# gcd3(1, 1, 2)
# gcd3(1, 1, 2)

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            ans += gcd3(i, j, k)

print(ans)


Fixed submission:
import math

sets = dict()

def gcd2(a, b):
    if a > b:
        key = (b, a)
    else:
        key = (a, b)
    
    try:
        # print("cached")
        return sets[key]
    except:
        # print("stored")
        ans = math.gcd(a, b)
        sets[key] = ans
        return ans

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        pre = gcd2(i, j)

        for k in range(1, n+1):
            ans += gcd2(pre, k)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
def gcd3(a, b, c):
    return math.gcd(math.gcd(a, b), c)

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            ans += gcd3(i, j, k)

print(ans)


Fixed submission:
import math

sets = dict()

def gcd2(a, b):
    if a > b:
        key = (b, a)
    else:
        key = (a, b)
    
    try:
        # print("cached")
        return sets[key]
    except:
        # print("stored")
        ans = math.gcd(a, b)
        sets[key] = ans
        return ans

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        pre = gcd2(i, j)

        for k in range(1, n+1):
            ans += gcd2(pre, k)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
quests = []
for _ in range(q):
    quests.append(tuple(map(int, input().split())))

check = []
for i in range(len(s)-1):
    temp = s[i:i+2]
    if temp == "AC":
        check.append(i)

for quest in quests:
    cnt = 0
    begin = quest[0]-1
    end = quest[1]-1
    for c in check:
        if begin <= c and (c+1) <= end:
            cnt += 1
    
    print(cnt)


Fixed submission:
n, q = map(int, input().split())
s = input()
quests = []
for _ in range(q):
    quests.append(tuple(map(int, input().split())))

check = []
for i in range(len(s)-1):
    temp = s[i:i+2]
    if temp == "AC":
        check.append(i)

check_begin = [0 for i in range(len(s))]
check_num = 0
for i in range(len(s)):
    if check_num != len(check) and (check[check_num]+1) == i :
        check_num += 1
    check_begin[i] = check_num

#print(check_begin)

check_end = [len(check)-i for i in check_begin]

for quest in quests:
    begin = quest[0]-1
    end = quest[1]-1
    cnt = len(check) - check_begin[begin] - check_end[end]
    print(cnt)
Buggy python submission (verdict: Runtime Error):
"""
C - Skip
Xを含めた与えられた数列をソートする
最小値を基準０にする
隣同士の差を取る
数列の最大公約数を求める
"""

import math
from functools import reduce

N, X = map(int, input().split())

numbers = [X]
for part in input().split():
    numbers.append(int(part))

numbers.sort()

# 最小値を基準0とする（ノーマライズ）
min_num = min(numbers)
normal_numbers = []
for num in numbers:
    normal_numbers.append(num - min_num)

# 隣との距離を出す
dist_numbers = []
for i in range(1, len(normal_numbers)):
    # 重複なしで隣との距離を数える
    dist_temp = normal_numbers[i] - normal_numbers[i-1]
    if dist_temp not in dist_numbers:
        dist_numbers.append(dist_temp)

# 最大公約数を求める
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(dist_numbers))

Fixed submission:
"""
C - Skip
Xを含めた与えられた数列をソートする
最小値を基準０にする
隣同士の差を取る
数列の最大公約数を求める
"""

N, X = map(int, input().split())

numbers = [X]
for part in input().split():
    numbers.append(int(part))

numbers.sort()

# 最小値を基準0とする（ノーマライズ）
min_num = min(numbers)
normal_numbers = []
for num in numbers:
    normal_numbers.append(num - min_num)

# 隣との距離を出す
dist_numbers = []
for i in range(1, len(normal_numbers)):
    # 重複なしで隣との距離を数える
    dist_temp = normal_numbers[i] - normal_numbers[i-1]
    if dist_temp not in dist_numbers:
        dist_numbers.append(dist_temp)

# 最大公約数を求める
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def gcd_list(numbers):
    if len(numbers) == 1:
        return numbers[0]
    elif len(numbers) == 2: 
        return gcd(numbers[0], numbers[1])
    else:
        return gcd(numbers[0], gcd_list(numbers[1:]))

print(gcd_list(dist_numbers))
Buggy python submission (verdict: Runtime Error):
"""
B - Grid Compression
ex in )
4 4
##.#
....
##.#
.#.#

ex out)
###
###
.##
"""

H, W = map(int, input().split())

matrix = []
for h in range(H):
    line = list(input())
    
    line_num = []
    for part in line:
        line_num.append(part)
    
    matrix.append(line_num)

#print(matrix)

cat = 0
for h in range(H):

    leave = False
    for w in range(W):
        
        # 黒ならのこす
        if matrix[h - cat][w] != ".":
            leave = True
            break
    
    if leave is False:
        matrix.pop(h - cat)
        cat += 1
    else:
        pass
        #print(h, "leave")

#print(matrix)

cat = 0
for w in range(W):

    leave = False
    for h in range(len(matrix)):
        
        # 黒ならのこす
        if matrix[h][w - cat] != ".":
            leave = True
            break
    
    if leave is False:
        cat += 1
        for h in range(len(matrix)):
            matrix[h].pop(w)
    else:
        pass
        #print(w, "leave")


for h in range(len(matrix)):
    line = ""
    for w in range(len(matrix[0])):
        line += matrix[h][w]
    print(line)


Fixed submission:
"""
B - Grid Compression
ex in )
4 4
##.#
....
##.#
.#.#

ex out)
###
###
.##
"""

H, W = map(int, input().split())

matrix = []
for h in range(H):
    line = list(input())
    
    line_num = []
    for part in line:
        line_num.append(part)
    
    matrix.append(line_num)

leave_h = []
for h in range(H):
    for w in range(W):
        # 黒ならのこす
        if matrix[h][w] == "#":
            leave_h.append(h)
            break

leave_w = []
for w in range(W):
    for h in range(len(matrix)):
        
        # 黒ならのこす
        if matrix[h][w] == "#":
            leave_w.append(w)
            break


for h in range(H):
    if h not in leave_h:
        continue

    for w in range(W):
        if w not in leave_w:
            continue

        print(matrix[h][w], end="")
    
    print()
Buggy python submission (verdict: Runtime Error):
N = int(input())

value = []
for part in input().split():
  value.append(int(part))

print(max(value) - min(value))

Fixed submission:
n = int(input())

if (n % 2) == 0:
  print(n)
else:
  print(n * 2)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

diff = b - a

def func(x):
    if x == 0:
        return 0
    else:
        return x + func(x - 1)
    
print(func(diff) - b)

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

diff = b - a

def func(x):
    ret = 0
    while x != 0:
        ret += x
        x -= 1
    return ret

print(func(diff) - b)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import math
from functools import reduce

# 標準入力 <int>
N = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans = 0

for a in range(N):
  for b in range(N):
    for c in range(N):
      #print(gcd(a + 1, b + 1, c + 1))
      ans += gcd(a + 1, b + 1, c + 1)

print(ans)

Fixed submission:
# coding: utf-8

import math
from functools import reduce

# 標準入力 <int>
N = int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans = 0

for a in range(N):
  for b in range(N):
    for c in range(N):
      #print(gcd(a + 1, b + 1, c + 1))
      ans += gcd(a + 1, b + 1, c + 1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import collections

# 標準入力 <int><int>
N, X, Y = map(int, input().split())

br = []

for i in range(N - 1):
  for j in range(i + 1, N):
    br.append(min(j - i, abs(X - (i + 1)) + 1 + abs(Y - (j + 1)), abs(Y - (i + 1)) + 1 + abs(X - (j + 1))))

c = collections.Counter(br)

for k, v in c.items():
  print(v)

for _ in range(N - 1 - len(c)):
  print(0)


Fixed submission:
# coding: utf-8

import collections

# 標準入力 <int><int>
N, X, Y = map(int, input().split())

br = []

for i in range(N - 1):
  for j in range(i + 1, N):
    """
    #print("(" , i+1, j+1, ")", j-i, abs(X - (i + 1)) + 1 + abs(Y - (j + 1)), abs(Y - (i + 1)) + 1 + abs(X - (j + 1)))
    """
    br.append(min(j - i, abs(X - (i + 1)) + 1 + abs(Y - (j + 1)), abs(Y - (i + 1)) + 1 + abs(X - (j + 1))))

c = collections.Counter(br)

for k, v in c.items():
  print(v)

for _ in range(N - 1 - len(c)):
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

import collections

# 標準入力 <int><int>
N, X, Y = map(int, input().split())

br = []

for i in range(N):
  for j in range(i + 1, N):
    l = []
    #print("(" , i+1, j+1, ")", j-i, abs(X - (i + 1)) + 1 + abs(Y - (j + 1)), abs(Y - (i + 1)) + 1 + abs(X - (j + 1)))
    l.append(j - i)
    l.append(abs(X - (i + 1)) + 1 + abs(Y - (j + 1)))
    l.append(abs(Y - (i + 1)) + 1 + abs(X - (j + 1)))
    br.append(min(l))

c = collections.Counter(br)

for k, v in c.items():
  print(v)

for _ in range(N - 1 - len(c)):
  print(0)


Fixed submission:
# coding: utf-8

import collections

# 標準入力 <int><int>
N, X, Y = map(int, input().split())

br = []

for i in range(N - 1):
  for j in range(i + 1, N):
    """
    #print("(" , i+1, j+1, ")", j-i, abs(X - (i + 1)) + 1 + abs(Y - (j + 1)), abs(Y - (i + 1)) + 1 + abs(X - (j + 1)))
    """
    br.append(min(j - i, abs(X - (i + 1)) + 1 + abs(Y - (j + 1)), abs(Y - (i + 1)) + 1 + abs(X - (j + 1))))

c = collections.Counter(br)

for k, v in c.items():
  print(v)

for _ in range(N - 1 - len(c)):
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0

for i in range(N):
    if min(P[:i + 1]) >= P[i]:
        count += 1

print(count)


Fixed submission:
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0
comp = 2 * (10**5)

for i in range(N):
    if comp >= P[i]:
        count += 1
        comp = P[i]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0

for i in range(N):
    if min(P[0:i + 1]) == P[i]:
        count += 1

print(count)


Fixed submission:
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0
comp = 2 * (10**5)

for i in range(N):
    if comp >= P[i]:
        count += 1
        comp = P[i]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0

for i in range(N):
    pi = P[0:i + 1]
    pi.sort()
    if pi[0] == P[i]:
        count += 1

print(count)


Fixed submission:
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0
comp = 2 * (10**5)

for i in range(N):
    if comp >= P[i]:
        count += 1
        comp = P[i]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0

for i in range(N):
    isOK = True
    for j in range(i + 1):
        if P[i] > P[j]:
            isOK = False
            break
    if isOK:
        count += 1

print(count)


Fixed submission:
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0
comp = 2 * (10**5)

for i in range(N):
    if comp >= P[i]:
        count += 1
        comp = P[i]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0

for i in range(N):
    isOK = True
    for j in range(i + 1):
        if P[i] > P[j]:
            isOK = False
    if isOK:
        count += 1

print(count)


Fixed submission:
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0
comp = 2 * (10**5)

for i in range(N):
    if comp >= P[i]:
        count += 1
        comp = P[i]

print(count)
Buggy python submission (verdict: Runtime Error):
s = str(input())
print('Yes' if s[0] ='7' or s[1] ='7' or s[2] ='7' else 'No') 

Fixed submission:
s = input()
print('Yes' if s[0] =='7' or s[1] =='7' or s[2] =='7' else 'No')

Buggy python submission (verdict: Runtime Error):
s = input()
print('Yes' if s[0] ='7' or s[1] ='7' or s[2] ='7' else 'No') 

Fixed submission:
s = input()
print('Yes' if s[0] =='7' or s[1] =='7' or s[2] =='7' else 'No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n < 11 or n == 12 or n == 14 or n == 15 or n == 16 or n == 18 or n == 20 or n == 24 or n == 25  or n == 27  or n == 28   or n == 30  or n == 32  or n == 35  or n == 36  or n == 40  or n == 42   or n == 45  or n == 48  or n == 49   or n == 54   or n == 56   or n == 64   or n == 72   or n == 81  :
  print('Yes')
  eixt()
print('No')

Fixed submission:
n = int(input())
if n < 11 or n == 12 or n == 14 or n == 15 or n == 16 or n == 18 or n == 20 or n == 21 or n == 24 or n == 25  or n == 27  or n == 28   or n == 30  or n == 32  or n == 35  or n == 36  or n == 40  or n == 42   or n == 45  or n == 48  or n == 49   or n == 54   or n == 56 or n == 63    or n == 64   or n == 72   or n == 81  :
  print('Yes')
  exit()
print('No')
Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
import math
if x  <= 0.5 * b * a **2:
  print(round(90 - math.degrees(math.atan(2*x / (a * b ** 2))),10))
else:
  print(round(90 - math.degrees(math.atan(a/  (2*(b-x/(a**2)))  )),10))

Fixed submission:
a, b, x = map(int, input().split())
import math
if x == b * a** 2:
  print(0)
elif x  <= 0.5 * b * a **2:
  print(round(90 - math.degrees(math.atan(2*x / (a * b ** 2))),10))
else:
  print(round(90 - math.degrees(math.atan(a/  (2*(b-x/(a**2)))  )),10))

Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
import math
if x  <= 0.5 * b * a **2:
  print(round(90 - math.degrees(math.atan(2*x / (a * b ** 2))),10))
else:
  print(round(90 - math.degrees(math.atan(a/  (2*(b-x/(a**2)))  )),10))

Fixed submission:
a, b, x = map(int, input().split())
import math
if x == b * a** 2:
  print(0)
elif x  <= 0.5 * b * a **2:
  print(round(90 - math.degrees(math.atan(2*x / (a * b ** 2))),10))
else:
  print(round(90 - math.degrees(math.atan(a/  (2*(b-x/(a**2)))  )),10))

Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
import math
if x  <= 0.5 * b * a **2:
  print(90 - math.degrees(math.atan(2*x / (a * b ** 2))))
else:
  print(90 - math.degrees(math.atan(a/  (2*(b-x/(a**2)))  )))

Fixed submission:
a, b, x = map(int, input().split())
import math
if x == b * a** 2:
  print(0)
elif x  <= 0.5 * b * a **2:
  print(round(90 - math.degrees(math.atan(2*x / (a * b ** 2))),10))
else:
  print(round(90 - math.degrees(math.atan(a/  (2*(b-x/(a**2)))  )),10))
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
  A[i] = int(input())
B = [K] * (N+1)
for i in range(1, N+1):
  B[i] +=  A.count(i) - Q 
  if B[i] <= 0:
    print('No')
  else:
    print('Yes')

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

Fixed submission:
A = list(map(int, input().split()))
for i in range(A[0] * 2 -2):
  print(A[1]-A[0] + i+1, end=' ')
print(A[1]+ A[0] -1 )
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [0] * N
for i in range(N):
  A_temp = input()
  A[i]= sorted([c for c in A_temp])
count = 0

B = sorted(A)
A_unique_count = 1
for i in range(N-1):
  if B[i] != B[i+1]:
    A_unique_count += 1
#print(A_unique_count)
C = 0    
num = 0

#print(B)

for i in range(A_unique_count):
#  print( 'i' + str(i))
  C = B.count(B[num])
  num += C
#  print(num)
#  print(C)
  count += C * (C -1 ) / 2

print(int(count))
  

Fixed submission:
N = int(input())
A = [0] * N
for i in range(N):
  A_temp = input()
  A[i]= sorted([c for c in A_temp])
count = 0

B = sorted(A)
A_unique_count = 1

for i in range(N-1):
  if B[i] == B[i+1]:
    A_unique_count += 1
  else:
    count += A_unique_count * (A_unique_count -1) /2
#    print('i' + str(i))
#    print(count)
    A_unique_count = 1

count += A_unique_count * (A_unique_count -1) /2
print(int(count))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [0] * N
for i in range(N):
  A_temp = input()
  A[i]= sorted([c for c in A_temp])
B = sorted(A)
count = 0

for i in range(N-1):
  for j in range(i+1, N):
    if B[i] != B[j]:
      continue
    else:
      count += 1

print(count)

Fixed submission:
N = int(input())
A = [0] * N
for i in range(N):
  A_temp = input()
  A[i]= sorted([c for c in A_temp])
count = 0

B = sorted(A)
A_unique_count = 1

for i in range(N-1):
  if B[i] == B[i+1]:
    A_unique_count += 1
  else:
    count += A_unique_count * (A_unique_count -1) /2
#    print('i' + str(i))
#    print(count)
    A_unique_count = 1

count += A_unique_count * (A_unique_count -1) /2
print(int(count))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [0] * N
for i in range(N):
  A_temp = input()
  A[i]= sorted([c for c in A_temp])
B = sorted(A)
#print(B)
count = 0

for i in range(N-1):
  for j in range(i+1, N):
#    print(str(i) + '&'+ str(j))
#    print(B[i])
#    print(B[j])
    if B[i] == B[j]:
      count += 1

print(count)
  

Fixed submission:
N = int(input())
A = [0] * N
for i in range(N):
  A_temp = input()
  A[i]= sorted([c for c in A_temp])
count = 0

B = sorted(A)
A_unique_count = 1

for i in range(N-1):
  if B[i] == B[i+1]:
    A_unique_count += 1
  else:
    count += A_unique_count * (A_unique_count -1) /2
#    print('i' + str(i))
#    print(count)
    A_unique_count = 1

count += A_unique_count * (A_unique_count -1) /2
print(int(count))
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):
  A_temp = A[i]
  A[i] = 0
  print(max(A))
  A[i] = A_temp

Fixed submission:
N = int(input())
A = [0] * N
for i in range(N):
  A[i] = int(input())
  
A_Max = sorted(A)[-1]
A_2nd = sorted(A)[-2]

for i in range(N):
  if A[i] == A_Max:
    print(A_2nd)
  else:
    print(A_Max)
Buggy python submission (verdict: Time Limit Exceeded):
W, H, x, y = map(int, input().split())
if x*y == 0 or (x-W)*(y-H) ==0 or (x == W/2 and y != H/2) or (x != W/2 and y == H/2) :
  print(str(W*H/2) + ' 0')
  exit()
else:
  for i in range(W+1):
    if x == i and y == H / W * x and x != W/2:
      print(str(W*H/2) + ' 0')
      exit()
    if x == i and y == W - H / W * x and x != W/2:
      print(str(W*H/2) + ' 0')
      exit()
print(str(W*H/2) + ' 1')


Fixed submission:
W, H, x, y = map(int, input().split())
#if x*y == 0 or (x-W)*(y-H) ==0 or (x == W/2 and y != H/2) or (x != W/2 and y == H/2) :
#  print(str(W*H/2) + ' 0')
#  exit()
#elif y == H / W * x and x != W/2:
#  print(str(W*H/2) + ' 0')
#  exit()
#elif y == H - H / W * x and x != W/2:
#  print(str(W*H/2) + ' 0')
#  exit()
#print(str(W*H/2) + ' 1')

if x == W/2 and y == H/2:
  print(str(W*H/2) + ' 1')
  exit()
print(str(W*H/2) + ' 0')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for i in range(M):
  L[i], R[i] = map(int, input().split())

ALL = [0] * N

for i in range(M):
  for j in range(L[i]-1, R[i]):
    ALL[j] += 1

print(ALL.count(M))  

Fixed submission:
N, M = map(int, input().split())
L = [0] * M
R = [0] * M
for i in range(M):
  L[i], R[i] = map(int, input().split())

print(max(0,min(R) - max(L)+1))
Buggy python submission (verdict: Runtime Error):
N = input()
S = [int(c) for c in N]

A = [0] * (len(S)+1)
B = [0] * (len(S)+1)

for i in range((len(S)//2)+1):
  A[i*2+1] = 1
  B[i*2] = 1
  
  
ca =0
cb =0
for i in range(len(S)):
  ca += abs(S[i]-A[i])
  cb += abs(S[i]-B[i])
print(min(ca, cb))
  
  

Fixed submission:
N = input()
S = [int(c) for c in N]

A = [0] * (len(S)+4)
B = [0] * (len(S)+4)

for i in range((len(S)//2)+1):
  A[i*2+1] = 1
  B[i*2] = 1
  
ca =0
cb =0
for i in range(len(S)):
  ca += abs(S[i]-A[i])
  cb += abs(S[i]-B[i])
print(min(ca, cb))
Buggy python submission (verdict: Runtime Error):
A[0]*5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
K = int(input())

for i in range(4):
  for j in range(i+1,5):
    if abs(A[i]-A[j]) > K:
      print(':(')
      exit()
print('Yay!')

Fixed submission:
A=[0]*5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
K = int(input())
 
for i in range(4):
  for j in range(i+1,5):
    if abs(A[i]-A[j]) > K:
      print(':(')
      exit()
print('Yay!')
Buggy python submission (verdict: Runtime Error):
b = input()
if b = 'A':
  print('T')
elif b = 'T':
  print('A')
elif b = 'C':
  print('G')
else:
  print('C')

Fixed submission:
b = input()
if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
else:
  print('C')