Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = [input() for i in range(N)]

word_stock = []

for word in word_list:
    #同じワード確認
    if word in word_stock:
        print('No')
    #最後の文字確認
    try:
        if word_stock[-1][-1] != word[0]:
            print('No')
    except:
        pass
    word_stock.append(word)

print('Yes')

Fixed submission:
N = int(input())
W = [input() for i in range(N)]

stock = []
last = W[0][0]

for i in range(0,len(W)):
    #過去の発言に含まれない
    if W[i] in stock:
        print('No')
        break
    #前の単語の最後と次の単語の最初が一致する
    if W[i][0] != last:
        print('No')
        break
    stock.append(W[i])
    last = W[i][-1]
    #最後まで回り切ったらyesを表示
    if i+1 == len(W):
        print('Yes')

Buggy python submission (verdict: Runtime Error):
N = int(input())
W = [input() for i in range(N)]

for word in word_list:
    #同じワード確認
    if word in word_stock:
        print('No')
    #最後の文字確認
    try:
        if word_stock[-1][-1] != word[0]:
            print('No')
    except:
        pass
    word_stock.append(word)

print('Yes')

Fixed submission:
N = int(input())
W = [input() for i in range(N)]

stock = []
last = W[0][0]

for i in range(0,len(W)):
    #過去の発言に含まれない
    if W[i] in stock:
        print('No')
        break
    #前の単語の最後と次の単語の最初が一致する
    if W[i][0] != last:
        print('No')
        break
    stock.append(W[i])
    last = W[i][-1]
    #最後まで回り切ったらyesを表示
    if i+1 == len(W):
        print('Yes')

Buggy python submission (verdict: Runtime Error):
for word in word_list:
    #同じワード確認
    if word in word_stock:
        print('No')
    #最後の文字確認
    try:
        if word_stock[-1][-1] != word[0]:
            print('No')
    except:
        pass
    word_stock.append(word)

print('Yes')

Fixed submission:
N = int(input())
W = [input() for i in range(N)]

stock = []
last = W[0][0]

for i in range(0,len(W)):
    #過去の発言に含まれない
    if W[i] in stock:
        print('No')
        break
    #前の単語の最後と次の単語の最初が一致する
    if W[i][0] != last:
        print('No')
        break
    stock.append(W[i])
    last = W[i][-1]
    #最後まで回り切ったらyesを表示
    if i+1 == len(W):
        print('Yes')
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
list = [int(x) for x in input().split()]
list_dist = sorted([abs(x - X) for x in list])

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

ans = list_dist[0]

for x in list_dist[1:]:
    result = gcd(result,x)

print(result)

Fixed submission:
import functools as ft
 
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
 
def gcd_list(numbers):
    return ft.reduce(gcd,numbers)
 
N, X = map(int, input().split(" "))
Xi = [int(a) for a in input().split()]
 
def MinusX(Xi_):
    return abs(Xi_-X)
 
def main(Xi):
    Xi = map(MinusX,Xi)
    output = gcd_list(Xi)
    print(output)
 
if __name__ == "__main__":
    main(Xi)

Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
list = [int(x) for x in input().split()]
list_dist = sorted([abs(x - X) for x in list])

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

print(gcd(list_dist[0],list_dist[1]))

Fixed submission:
import functools as ft
 
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
 
def gcd_list(numbers):
    return ft.reduce(gcd,numbers)
 
N, X = map(int, input().split(" "))
Xi = [int(a) for a in input().split()]
 
def MinusX(Xi_):
    return abs(Xi_-X)
 
def main(Xi):
    Xi = map(MinusX,Xi)
    output = gcd_list(Xi)
    print(output)
 
if __name__ == "__main__":
    main(Xi)

Buggy python submission (verdict: Runtime Error):
N, X = list(map(int, input().split())) # 整数
list_temp = []
list_temp.append(list(map(int, input().split())))

list = list_temp[0]
list_dev = []

#公約数の関数作成
def devisor(x):
    list_div = []
    for i in range(1,x+1):
        if x % i == 0:
            list_div.append(i)
    return list_div

#xiとXの絶対値をとって、各絶対値の最大公約数を算出
for i in list:
    abs_temp = abs(i - X)
    list_dev += devisor(abs_temp)

l_dupli = [i for i in set(list_dev) if list_dev.count(i) > 2]
print(l_dupli[-1])

Fixed submission:
import functools as ft
 
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
 
def gcd_list(numbers):
    return ft.reduce(gcd,numbers)
 
N, X = map(int, input().split(" "))
Xi = [int(a) for a in input().split()]
 
def MinusX(Xi_):
    return abs(Xi_-X)
 
def main(Xi):
    Xi = map(MinusX,Xi)
    output = gcd_list(Xi)
    print(output)
 
if __name__ == "__main__":
    main(Xi)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())

if k%2==1:
    ans = (n//k)**3
else:
    even = n//k
    odd  = (2*n)//k - even
    ans = even**3 + odd**3
print(ans)

Fixed submission:
K = int(input())
list = [i for i in range(1, K + 1)]
odd = list[1::2]
even = list[0::2]

cnt = 0

for i in odd:
    for j in even:
        cnt += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
list = [i for i in range(1, K + 1)]
odd = list[1::2]
even = list[0::2]

cnt = 0

for i in odd:
    for j in even:
        cnt += 1

print(cnt)

Fixed submission:
K = int(input())
list = [i for i in range(1, K + 1)]
odd = list[1::2]
even = list[0::2]

cnt = 0

for i in odd:
    for j in even:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())

cnt = 0
ans = []

for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(1,N+1):
            if (i + j) % K == 0 and (j + k) % K == 0 and (k + i) % K == 0:
                cnt += 1
                ans.append([i,j,k])
print(cnt)


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

if k%2==1:
    ans = (n//k)**3
else:
    even = n//k
    odd  = (2*n)//k - even
    ans = even**3 + odd**3
print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
list = []
for i in range(H):
    list.append(input())

new_list = []

H_del = []
W_del = []

#削除する行列の探索
for i in range(W):
    if list[i] == '.'*W:
        W_del.append(i)
    H_stock = ''
    for j in range(H):
        H_stock += list[j][i]
        if H_stock == '.'*H:
            H_del.append(i)

#削除する行列を除いた行列を再作成
for i in range(W):
    if i not in W_del:
        W_list = ''
        for j in range(H):
            if j not in H_del:
                W_list += list[i][j]
        new_list.append(W_list)

#答えを表示
for i in range(len(new_list)):
    print(new_list[i])

Fixed submission:
H, W = map(int, input().split())
list = []
for i in range(H):
    list.append(input())

new_list = []

H_del = []
W_del = []

#削除する行列の探索
for i in range(H):
    if list[i] == '.'*W:
        W_del.append(i)

for i in range(W):
    H_stock = ''
    for j in range(H):
        H_stock += list[j][i]
        if H_stock == '.'*H:
            H_del.append(i)

#削除する行列を除いた行列を再作成
for i in range(H):
    if i not in W_del:
        W_list = ''
        for j in range(W):
            if j not in H_del:
                W_list += list[i][j]
        new_list.append(W_list)

#答えを表示
for i in range(len(new_list)):
    print(new_list[i])
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
list = list(map(int,input().split()))

def dfs(N,ans):
    if N < 0:
        return ans
    return dfs(N-(K -1),ans+1)

print(dfs(N-K,1))

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

ans = 1
N = N - K

while N > 0:
    N -= K-1
    ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()
# print(A)
while len(A) > 1:
    a, b = A[0], A[1]
    c = b % a
    if c == 0:
        A = [a] + A[2:]
    else:
        A = [c,  a] + A[2:]
print(A[0])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
# print(A)
i = 0
while i < len(A) - 1:
    a, b = A[i], A[i + 1]
    A[i] = b % a
    A[i + 1] = a
    if A[i] == 0:
        i += 1
print(A[i])
Buggy python submission (verdict: Runtime Error):
import bisect

N = int(input())
A = list(set(map(int, input().split())))
B = list(set(map(int, input().split())))
C = list(set(map(int, input().split())))
ans = 0
A.sort()
B.sort()
C.sort()
# print(A, B, C)
for i in range(N):
    b = B[i]
    a_i = bisect.bisect_left(A, b)
    c_i = bisect.bisect_right(C, b)
    cnt = (a_i) * (N - c_i)
    # print(b, a_i, c_i, cnt)
    ans += cnt

print(ans)

Fixed submission:
import bisect

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
A.sort()
B.sort()
C.sort()
# print(A, B, C)
for b in B:
    a_i = bisect.bisect_left(A, b)
    c_i = bisect.bisect_right(C, b)
    cnt = (a_i) * (N - c_i)
    # print(b, a_i, c_i, cnt)
    ans += cnt

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A, B, a = [0] * N, [0] * N, [''] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
    a[i] = str(bin(A[i])[2:]).rjust(30, '0')
k = str(bin(K)[2:]).rjust(30, '0')

ans = 0

s = k.index('1')
for r in range(s, 30 + 1):
    tmp = 0
    for i in range(N):
        affordable = True
        for j in range(r):
            if k[j] == '0' and a[i][j] == '1':
                affordable = False
        if r < 30 and a[i][r] == '1':
            affordable = False
        if affordable:
            tmp += B[i]
    ans = max(ans, tmp)

print(ans)


Fixed submission:
N, K = map(int, input().split())
A, B, a = [0] * N, [0] * N, [''] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
    a[i] = str(bin(A[i])[2:]).rjust(30, '0')
k = str(bin(K)[2:]).rjust(30, '0')

ans = 0

s = k.index('1') if '1' in k else 30
for r in range(s, 30 + 1):
    tmp = 0
    for i in range(N):
        if r < 30 and k[r] == '0':
            continue
        affordable = True
        for j in range(r):
            if k[j] == '0' and a[i][j] == '1':
                affordable = False
        if r < 30 and a[i][r] == '1':
            affordable = False
        if affordable:
            tmp += B[i]
    ans = max(ans, tmp)

print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/local/bin/python3

import math

def solve(a,b,c,d):
	a = a - 1
	l = int(c * d / math.gcd(c, d))
	r1 = a - (a // c + a // d - a // l)
	r2 = b - (b // c + b // d - b // l)
	return (r2 - r1)


a,b,c,d = map(int, input().split())
ans = solve(a,b,c,d)
print(ans)


Fixed submission:
#!/usr/local/bin/python3

import fractions

def solve(a,b,c,d):
	a = a - 1
	l = c * d // fractions.gcd(c, d)
	r1 = a - (a // c + a // d - a // l)
	r2 = b - (b // c + b // d - b // l)
	return (r2 - r1)


a,b,c,d = map(int, input().split())
ans = solve(a,b,c,d)
print(ans)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if B % A == 0:
  print(A + B)
else:
  print(B - A)

Fixed submission:
A, B = map(int, input().split())
if B % A == 0:
  print(A + B)
else:
  print(B - A)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if B % A == 0:
  print(A + B)
else:
  print(A - B)

Fixed submission:
A, B = map(int, input().split())
if B % A == 0:
  print(A + B)
else:
  print(B - A)
Buggy python submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
sum = 0
ans = 0
for i in range(len(a) - 1):
    sum += a[i]
    if s > x:
        break
    else:
        ans += 1
sum += a[N-1]
if sum == x:
    ans += 1
print(ans)


Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
sum = 0
ans = 0
for i in range(len(a) - 1):
    sum += a[i]
    if sum > x:
        break
    else:
        ans += 1
sum += a[N-1]
if sum == x:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
a = sorted(a)
for i in range(len(a)):
	if x >= a[i]:
		x -= a[i]
		ans += 1
    else:
      break
print(ans)


Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
sum = 0
ans = 0
for i in range(len(a) - 1):
    sum += a[i]
    if sum > x:
        break
    else:
        ans += 1
sum += a[N-1]
if sum == x:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = [list(input()) for _ in range(N)]
ans = 'Yes'
W_set = set(W)
if len(W) == len(W_set):
  for i in range(1, N - 1):
    if W[i][0] != W[i-1][-1]:
      ans = 'No'
      break
else:
  ans = 'No'
print(ans)

Fixed submission:
N = int(input())
W = [input() for _ in range(N)]
ans = 'Yes'
W_set = set(W)
if len(W) == len(W_set):
  for i in range(1, N):
    if W[i][0] != W[i-1][-1]:
      ans = 'No'
      break
else:
  ans = 'No'
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
x = x1 - x2
y = y1 - y2
print(c - y, d + x, a - y, b + x)

Fixed submission:
a, b, c, d = map(int, input().split())
x = c - a
y = d - b
print(c - y, d + x, a - y, b + x)

Buggy python submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
x = x1 - x2
y = y1 - y2
print(c - y, d + x, a - y, b + x)

Fixed submission:
a, b, c, d = map(int, input().split())
x = c - a
y = d - b
print(c - y, d + x, a - y, b + x)
Buggy python submission (verdict: Runtime Error):
N, K=map(int, input().split())
x = list(map(int, input().split()))
ans = pow(10, 10)
for i in range(N-K+1):
    temp1 = abs(x[i]) + abs(x[i]-x[i+K-1])
    #temp2 = abs(x[i+K-1]) + abs(x[i]-x[i+K-1])
    ans = min(ans, temp1, temp2)
print(ans)


Fixed submission:
N, K = map(int, input().split())
x = list(map(int, input().split()))
ans = pow(10, 10)
for i in range(N-K+1):
    temp_l = abs(x[i]) + abs(x[i]-x[i+K-1])
    temp_r = abs(x[i+K-1]) + abs(x[i]-x[i+K-1])
    ans = min(ans, temp_l, temp_r)
print(ans)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print((A - 1) * (B - 1))

Fixed submission:
A, B = map(int, input().split())
print((A - 1) * (B - 1))
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(a):
    return reduce(lcm_base, a, 1)

N = int(input())
a = list(map(int, input().split()))
ans = 0
num = lcm_list(a) - 1
for i in range(len(a)):
	ans += num % a[i]
print(ans)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(a):
    return reduce(lcm_base, a, 1)

N = int(input())
a = list(map(int, input().split()))
ans = 0
num = lcm_list(a) - 1
print(num)
for i in range(len(a)):
	ans += num % a[i]
print(ans)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)

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

N = int(input())
a = list(map(int, input().split()))
ans = 0
num = 0
for i in range(1, len(a)):
	num *= int(a[i-1] * a[i] / math.gcd(a[i-1],a[i]))
num -= 1
for i in range(len(a)):
	ans += num % a[i]
print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)

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

N = int(input())
a = list(map(int, input().split()))
ans = 0
num = 0
for i in range(1, len(a)):
	num *= a[i-1] * a[i] // math.gcd(a[i-1],a[i])
num -= 1
for i in range(len(a)):
	ans += num % a[i]
print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(a):
    return reduce(lcm_base, a)
if __name__ == '__main__':
	N = int(input())
	a = list(map(int, input().split()))
	ans = 0
	num = lcm_list(a) - 1
	print(num)
	for i in range(len(a)):
		ans += num % a[i]
	print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(a):
    return reduce(lcm_base, a)

N = int(input())
a = list(map(int, input().split()))
ans = 0
num = lcm_list(a) - 1
print(num)
for i in range(len(a)):
	ans += num % a[i]
print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd_list(a):
	return reduce(math.gcd, a)

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(a):
    return reduce(lcm_base, a, 1)

N = int(input())
a = list(map(int, input().split()))
ans = 0
num = lcm_list(a)- 1
for i in range(len(a)):
	ans += num % a[i]
print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print(int(2 * N / (math.gcd(2, N)) ))

Fixed submission:
N = int(input())
if N % 2 == 0:
	print(N)
else:
	print(2 * N)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print(int(2 * N / math.gcd(2, N)))

Fixed submission:
N = int(input())
if N % 2 == 0:
	print(N)
else:
	print(2 * N)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print(int(2 * N / math.gcd(2, N)))

Fixed submission:
N = int(input())
if N % 2 == 0:
	print(N)
else:
	print(2 * N)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
for i in range(1, pow(10, 9)):
	if i % 2 == 0 and i % N == 0:
		print(i)
		break

Fixed submission:
N = int(input())
if N % 2 == 0:
	print(N)
else:
	print(2 * N)
Buggy python submission (verdict: Runtime Error):
D, N = map(int, input().split())
ans = 0
if N == 100 and D = 0:
	ans = pow(100, D + 1) + 1
elif N == 100 and D >= 1:
	ans = pow(100, D + 1) 
else:
	for i in range(1, N + 1):
			ans = pow(100, D) * i
print(ans)

Fixed submission:
D, N = map(int, input().split())
ans = 0
if N == 100:
	ans = pow(100, D + 1) +  pow(100, D)
else:
	for i in range(1, N + 1):
			ans = pow(100, D) * i
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(N):
	for n in a:
 		if n % 2 == 0:
    		count += 1
            n /= 2
print(count)

Fixed submission:
N = int(input())
a_list = list(map(int, input().split()))
count = 0
while True:
	odd = 0
	for i in range(N):
		if a_list[i] % 2 == 0:
			a_list[i] = int(a_list[i] / 2)
			count += 1
		else:
			odd += 1
	if odd == len(a_list):
		break
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N) ]
count = 0
for i in range(N):
	for j in range(len(a)):
 		if a[j] % 2 == 0:
    		count += 1
            a[j] /= 2
print(count)

Fixed submission:
N = int(input())
a_list = list(map(int, input().split()))
count = 0
while True:
	odd = 0
	for i in range(N):
		if a_list[i] % 2 == 0:
			a_list[i] = int(a_list[i] / 2)
			count += 1
		else:
			odd += 1
	if odd == len(a_list):
		break
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N) ]
count = 0
for i in range(N):
	for n in a:
 		if n % 2 == 0:
    		count += 1
            n /= 2
print(count)

Fixed submission:
N = int(input())
a_list = list(map(int, input().split()))
count = 0
while True:
	odd = 0
	for i in range(N):
		if a_list[i] % 2 == 0:
			a_list[i] = int(a_list[i] / 2)
			count += 1
		else:
			odd += 1
	if odd == len(a_list):
		break
print(count)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
dif = b - a
sum = int(dif / 2 * (1 + dif))
print(sum - b)

Fixed submission:
N = int(input())
if N <= 999:
	print("ABC")
if N > 999:
	print("ABD")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
dir_change = [0] * N
for i in range(N):
	for j in range(N):
		if i < j and S[j] == "E":
			dir_change[i] += 1
		if i > j and S[j] == "W":
			dir_change[i] += 1
print(min(dir_change))

Fixed submission:
N = int(input())
S = input()

left = 0
right = S[1:].count('E')
result = left + right

for i in range(1, N):
	if S[i - 1] == "W":
		left += 1
	if S[i] == "E":
		right -= 1
	result = min(result, left + right)
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())
for i in range(K):
	temp_a = A
	temp_b = B
	A = B + C
	B = temp_a + C
	C = temp_a + temp_b
if abs(A - B) <= 10 ** 18:
	print(A - B)
else:
	print("Unfair")

Fixed submission:
A, B, C, K = map(int, input().split())
if K % 2 != 0:
	res = B - A
else:
	res = A - B
if res >= 10 ** 18:
	print("Unfair")
else:
	print(res)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())
for i in range(K):
	temp_a = A
	temp_b = B
	A = B + C
	B = temp_a + C
	C = temp_a + temp_b
if abs(A - B) <= 10 ** 18:
	print(A - B)
else:
	print("unfair")

Fixed submission:
A, B, C, K = map(int, input().split())
if K % 2 != 0:
	res = B - A
else:
	res = A - B
if res >= 10 ** 18:
	print("Unfair")
else:
	print(res)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())
for i in range(K):
	temp_a = A
	temp_b = B
	temp_c = C
	A = temp_b + temp_c
	B = temp_a + temp_c
	C = temp_a + temp_b
if abs(A - B) <= 10 ** 18:
	print(A - B)
else:
	print("unfair")

Fixed submission:
A, B, C, K = map(int, input().split())
if K % 2 != 0:
	res = B - A
else:
	res = A - B
if res >= 10 ** 18:
	print("Unfair")
else:
	print(res)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a > b:
  print(a - 1)
else:
print(a)

Fixed submission:
a, b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a > b:
  print(a - 1)
else;
print(a)

Fixed submission:
a, b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input()))
S = [0]
ans = 0
for i in range(len(A)):
  S.append(S[i] + A[i])
S.sort()
count = 1
for i in range(1, len(S)):
  if S[i-1] == S[i]:
    count += 1
  else:
    ans += count * (count-1) / 2
    count = 1
ans += count * (count-1) / 2
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
S = [0]
ans = 0
for i in range(len(A)):
	S.append(S[i] + A[i])
S.sort()
count = 1
for i in range(1, len(S)):
	if S[i-1] == S[i]:
		count += 1
	else:
		ans += (count * (count - 1)) / 2
		count = 1
ans += (count * (count - 1)) / 2
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
def find_medians(x, num):
	temp_X = list(x)
	del temp_X[num]
	temp_X.sort()
	return temp_X[int( (len(temp_X)  + 1 ) / 2 - 1)]

N = int(input())
X = list(map(int, input().split()))
for i in range(N):
	print(find_medians(X, i))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = X.copy()
Y.sort()
for i in range(N):
	if X[i] < Y[int(N / 2)]:
		print(Y[int(N / 2)] )
	else:
		print(Y[int(N / 2 - 1)])