Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# B - K-th Common Divisor
# https://atcoder.jp/contests/abc120/tasks/abc120_b
# 1WA
import math

MAX = 100

def gcd(m, n):
    return m if n == 0 else gcd(n, m % n)

prime_table = [True]*MAX
prime_table[0] = prime_table[1] = False
for i in range(2, int(math.sqrt(MAX)) + 1):
    for j in range(i*2, MAX, i):
        prime_table[j] = False
primes = [i_idx for i_idx in range(len(prime_table)) if prime_table[i_idx] == True]

A, B, K = map(int, raw_input().split())
gcdAB = gcd(A, B)

factors = set()
factors.add(gcdAB)
factors.add(1)

for prime in primes:
    if prime > gcdAB:
        break
    if gcdAB % prime == 0:
        factors.add(prime)
        factors.add(gcdAB/prime)

factors = list(factors)
factors.sort(reverse=True)

print '{}'.format(factors[K - 1])


Fixed submission:
# B - K-th Common Divisor
# https://atcoder.jp/contests/abc120/tasks/abc120_b
# 1WA
MAX = 100

def gcd(m, n):
    return m if n == 0 else gcd(n, m % n)

A, B, K = map(int, raw_input().split())
gcdAB = gcd(A, B)

cnt = 0
for n in range(gcdAB, 0, -1):
    if gcdAB % n == 0:
        cnt += 1
        if cnt == K:
            print '{}'.format(n)
            break

Buggy python submission (verdict: Runtime Error):
# B - K-th Common Divisor
# https://atcoder.jp/contests/abc120/tasks/abc120_b
import math

MAX = 100

def gcd(A, B):
    if B > A:
        A, B = A, B

    if B == 0:
        return A

    return gcd(B, A-(A/B)*B)

prime_table = [True]*MAX
prime_table[0] = prime_table[1] = False
for i in range(2, int(math.sqrt(MAX)) + 1):
    for j in range(i*2, MAX, i):
        prime_table[j] = False
primes = [i_idx for i_idx in range(len(prime_table)) if prime_table[i_idx] == True]

A, B, K = map(int, raw_input().split())
gcdAB = gcd(A, B)
factors = set()
factors.add(gcdAB)
factors.add(1)

for prime in primes:
    if prime > gcdAB:
        break
    if gcdAB % prime == 0:
        factors.add(prime)
        factors.add(gcdAB/prime)

factors = list(factors)
factors.sort(reverse=True)

print '{}'.format(factors[K - 1])


Fixed submission:
# B - K-th Common Divisor
# https://atcoder.jp/contests/abc120/tasks/abc120_b
# 1WA
MAX = 100

def gcd(m, n):
    return m if n == 0 else gcd(n, m % n)

A, B, K = map(int, raw_input().split())
gcdAB = gcd(A, B)

cnt = 0
for n in range(gcdAB, 0, -1):
    if gcdAB % n == 0:
        cnt += 1
        if cnt == K:
            print '{}'.format(n)
            break
Buggy python submission (verdict: Runtime Error):
# A - Still TBD
# https://atcoder.jp/contests/abc119/tasks/abc119_a

# threshold
TY, TM, TD = 2019, 4, 30

Y, M, D = map(int, raw_input().split('/'))

if M > 4:
    print '{}'.format('TBD')
else:
    print '{}'.foramt('Heisei')


Fixed submission:
# A - Still TBD
# https://atcoder.jp/contests/abc119/tasks/abc119_a

# threshold
TY, TM, TD = 2019, 4, 30

Y, M, D = map(int, raw_input().split('/'))

if M > 4:
    print '{}'.format('TBD')
else:
    print '{}'.format('Heisei')
Buggy python submission (verdict: Runtime Error):
A, B = map(int, raw_input().split())

if B%A == 0:
    print '{}'.format('A+B')
else: # B%A != 0
    print '{}'.format('B−A')


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

if B%A == 0:
    print '{}'.format(A+B)
else: # B%A != 0
    print '{}'.format(B-A)
Buggy python submission (verdict: Runtime Error):
# C - Monsters Battle Royale
# https://atcoder.jp/contests/abc118/tasks/abc118_c

N = int(input())
A = set(map(int, raw_input().split()))

while len(A) != 1:

    # minimum number of A
    minA = min(A)

    # next round A
    nA = set(), nA.add(minA)

    for Ai in A:
        if Ai % minA != 0 and Ai != minA:
            nA.add(Ai%minA)

    # update for next round
    A = nextA

print '{}'.format( list(A)[-1])


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

while len(A) != 1:
    minA = min(A)

    nextA = set()
    for Ai in A:
        if Ai == minA:
            nextA.add(Ai)
            continue
        if Ai % minA != 0:
            nextA.add(Ai%minA)

    A = nextA

A = list(A)
print '{}'.format(A[0])
Buggy python submission (verdict: Runtime Error):
n = int(input())

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

for i in range(n):
    print(A.count(i+1))

Fixed submission:
import math

r = int(input())

print(2*math.pi*r)
Buggy python submission (verdict: Runtime Error):
N,K,M =  map(int,input().split())
A =  list(map(int,input().split()))

result = N*M - sum(A) 
if result > K:
    print("-1")
elif result <=0:
    print("0")
else:
    print(result)

Fixed submission:
C = input()
print(chr(ord(C) + 1))
Buggy python submission (verdict: Runtime Error):
K X = map(int,input().split())
if K*500 > X:
    print(Yes)
else:
    print(No)

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

N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

r = list(itertools.permutations(range(1,N+1)))

print(abs(r.index(P)-r.index(Q)))

Fixed submission:
import itertools

N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

r = list(itertools.permutations(range(1,N+1)))

print(abs(r.index(P)-r.index(Q)))
Buggy python submission (verdict: Runtime Error):
D, T, S = input().split()
sum = T * S
if D < sum
	return "Yes"
else
	return "No"


Fixed submission:
D, T, S = input().split()
sum_price = int(T) * int(S)
if int(D) <= sum_price:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
put D

Fixed submission:
D, T, S = input().split()
sum_price = int(T) * int(S)
if int(D) <= sum_price:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007

ans = 0

B = list(itertools.combinations(A,2))

for i in range(len(B)):
    ans += (B[i][0] * B[i][1]) % MOD

ans %= MOD

print(ans)

Fixed submission:
MOD = 1000000007
 
N = int(input())
A = list(map(int, input().split())) 
 
ans = 0
s = sum(A)
 
for a in A:
    s -= a
    ans += (a * s)

ans %= MOD

print(ans)

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

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

ans = 0

B = list(itertools.combinations(A,2))

for i in range(len(B)):
    ans += B[i][0] * B[i][1]

ans = ans % (10**9+7)

#print(B)
#print(len(B))
print(ans)

Fixed submission:
MOD = 1000000007
 
N = int(input())
A = list(map(int, input().split())) 
 
ans = 0
s = sum(A)
 
for a in A:
    s -= a
    ans += (a * s)

ans %= MOD

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

before_A = A/0.08
before_B = B/0.1

if A > B:
    print(-1)
    break
else:
    if before_A <= before_B:
        ans = before_B
        if int(before_B * 0.08) == A:
            print(int(ans))
        else:
            print(-1)
    else:
        ans = before_A
        if int(before_A * 0.1) == B:
            print(int(ans))
        else:
            print(-1)

Fixed submission:
a,b=map(int,input().split())
for i in  range(1,1300):
  if int(i*0.08)==a and int(i*0.1)==b:
    print(i)
    exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
S = input()

week = {"SUT":1, "SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3,"FRI":2}

ans = week[S]

print(ans)

Fixed submission:
S = input()

week = {"SAT":1, "SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3,"FRI":2}

ans = week[S]

print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()

week = {"SUT":1, "SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3,"FRI":2}

ans = week[S]

print(ans)

Fixed submission:
S = input()

week = {"SAT":1, "SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3,"FRI":2}

ans = week[S]

print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()

week = {"SUT":1, "SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3,"FRI":2}

print(week[S])

Fixed submission:
S = input()

week = {"SAT":1, "SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3,"FRI":2}

ans = week[S]

print(ans)
Buggy python submission (verdict: Runtime Error):
D,T,S=[int(input()) for i in range(3)]
if D/S<=T:
    print('Yes')
else:
    print('No')


Fixed submission:
D,T,S= map(int, input().split())
if D/S<=T:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
result=1
a = list(map(int,input().split()))
for i in a:
    result*=i
    
if 0 in a:
    print(0) 
    
elif result > 1000000000000000000:
    print(-1)

else:
    print(result)

Fixed submission:
n = int(input())
result=1
a = list(map(int,input().split()))
    
if 0 in a:
    print(0) 
else:
    for i in a:
        result*=i
        if result > 10**18:
            print(-1)
            break
    if result <= 10**18:
        print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
result=1
a = list(map(int,input().split()))
for i in a:
    result*=i
 
if result > 1000000000000000000:
    print(-1)
else:
    print(result)

Fixed submission:
n = int(input())
result=1
a = list(map(int,input().split()))
    
if 0 in a:
    print(0) 
else:
    for i in a:
        result*=i
        if result > 10**18:
            print(-1)
            break
    if result <= 10**18:
        print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
result=1
a = list(map(int,input().split()))
for i in a:
    result*=i

if result > 1000000000000000000:
    print("-1")
else:
    print(result)

Fixed submission:
n = int(input())
result=1
a = list(map(int,input().split()))
    
if 0 in a:
    print(0) 
else:
    for i in a:
        result*=i
        if result > 10**18:
            print(-1)
            break
    if result <= 10**18:
        print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

H, W = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())

ch -= 1; cw -= 1; dh -= 1; dw -= 1; 

s = []
for _ in range(H):
    s.append(list(input()))
cs = [[1000000 for _ in range(W)] for _ in range(H)]

q = []
heapq.heappush(q, (0, (ch, cw)))

while q:
    c, (h, w) = heapq.heappop(q)
    if cs[h][w] <= c:
        continue
    cs[h][w] = c
    for nh, nw in [(h - 1, w), (h + 1, w), (h, w - 1), (h, w + 1)]:
        if 0 <= nh < H and 0 <= nw < W and s[nh][nw] == '.' and c < cs[nh][nw]:
            heapq.heappush(q, (c, (nh, nw)))
    for nh in range(h - 2, h + 3):
        for nw in range(w - 2, w + 3):
            if 0 <= nh < H and 0 <= nw < W and s[nh][nw] == '.' and c + 1 < cs[nh][nw]:
                heapq.heappush(q, (c + 1, (nh, nw)))

print(-1 if cs[dh][dw] == 1000000 else cs[dh][dw])


Fixed submission:
import heapq

H, W = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())

ch -= 1; cw -= 1; dh -= 1; dw -= 1; 

s = []
for _ in range(H):
    s.append(list(input()))
cs = [[1000000 for _ in range(W)] for _ in range(H)]

q = []
heapq.heappush(q, (0, (ch, cw)))

while q:
    c, (h, w) = heapq.heappop(q)
    if cs[h][w] < c:
        continue
    cs[h][w] = c
    for nh, nw in [(h - 1, w), (h + 1, w), (h, w - 1), (h, w + 1)]:
        if 0 <= nh < H and 0 <= nw < W and s[nh][nw] == '.' and c < cs[nh][nw]:
            cs[nh][nw] = c
            heapq.heappush(q, (c, (nh, nw)))
    for nh in range(h - 2, h + 3):
        for nw in range(w - 2, w + 3):
            if 0 <= nh < H and 0 <= nw < W and s[nh][nw] == '.' and c + 1 < cs[nh][nw]:
                cs[nh][nw] = c + 1
                heapq.heappush(q, (c + 1, (nh, nw)))

print(-1 if cs[dh][dw] == 1000000 else cs[dh][dw])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
input = sys.stdin.readline

n, k = map(int, input().split())
a = list(map(int, input().split()))

if k == 0:
    print(max(a))
    exit()

def check(x):
    res = 0
    for i in a:
        res += i // x
    return res

l = 0
r = 10 ** 9 + 1
while not math.ceil(l) == math.ceil(r):
    x = (l + r) / 2
    if check(x) > k:
        l = x
    else:
        r = x
print(math.ceil(l))


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

n, k = map(int, input().split())
a = list(map(int, input().split()))

def check(x):
    res = 0
    for i in a:
        res += math.floor(i / x)
    return res

l = 0
r = 10 ** 9 + 1
for _ in range(100):
    x = (l + r) / 2
    if check(x) > k:
        l = x
    else:
        r = x
print(math.ceil(l))
Buggy python submission (verdict: Runtime Error):
import heapq

n, q = map(int, input().split())
children = []  # (-レート, 幼稚園番号)
schools = [[] for _ in range(200000)]  # [(-レート, 子供番号)]
strongests = []  # (+レート, 幼稚園番号)

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

for i, school in enumerate(schools):
    if len(school) > 0:
        heapq.heapify(school)
        strongests.append((-school[0][0], i))
heapq.heapify(strongests)

for _ in range(q):
    c, d = map(int, input().split())
    c -= 1
    d -= 1
    org_school = children[c][1]
    children[c] = (children[c][0], d)

    while True:
        if len(schools[org_school]) == 0:
            break
        if children[schools[org_school][0][1]][1] == org_school:
            break
        else:
            heapq.heappop(schools[org_school])
    if len(schools[org_school]) > 0:
        heapq.heappush(strongests, (-schools[org_school][0][0], org_school))

    heapq.heappush(schools[d], (children[c][0], c))
    heapq.heappush(strongests, (-schools[d][0][0], d))

    while True:
        if len(schools[strongests[0][1]]) == 0 or strongests[0][0] != -schools[strongests[0][1]][0][0]:
            heapq.heappop(strongests)
        else:
            print(strongests[0][0])
            break


Fixed submission:
x = list(map(int, input().split()))
print(x.index(0) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n, m = map(int, input().split())
roots = [[] for _ in range(n)]
signs = [-1 for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    roots[a].append(b)
    roots[b].append(a)

queue = deque([(0, 0)])

while queue:
    room, org = queue.popleft()
    if signs[room] == -1:
        signs[room] = org
    for root in roots[room]:
        if signs[root] == -1:
            queue.append((root, room))

print('Yes')
for i in signs[1:]:
    print(i + 1)


Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
roots = [[] for _ in range(n)]
signs = [-1 for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    roots[a].append(b)
    roots[b].append(a)

queue = deque([0])
signs[0] = 0

while queue:
    room = queue.popleft()
    for root in roots[room]:
        if signs[root] == -1:
            signs[root] = room
            queue.append(root)

print('Yes')
for i in signs[1:]:
    print(i + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import sys
sys.setrecursionlimit(1000000)

input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

tree = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    tree[u - 1].append(v - 1)
    tree[v - 1].append(u - 1)

ans = [0] * n
visited = [0] * n
visited[0] = 1


def dfs(i, l):
    s = a[i]
    if len(l) == 0 or s > l[-1]:
        l.append(s)
    else:
        l[bisect.bisect_left(l, s)] = s
    ans[i] = len(l)

    for ni in tree[i]:
        if not visited[ni]:
            visited[ni] = 1
            dfs(ni, l[:])


dfs(0, [])

for i in ans:
    print(i)


Fixed submission:
import bisect
import sys
sys.setrecursionlimit(1000000)

input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

tree = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    tree[u - 1].append(v - 1)
    tree[v - 1].append(u - 1)

ans = [0] * n
visited = [0] * n
visited[0] = 1
l = []

def dfs(i):
    s = a[i]
    pi = -1
    pv = -1
    if len(l) == 0 or s > l[-1]:
        l.append(s)
    else:
        pi = bisect.bisect_left(l, s)
        pv = l[pi]
        l[pi] = s
    ans[i] = len(l)

    for ni in tree[i]:
        if not visited[ni]:
            visited[ni] = 1
            dfs(ni)
            
    if pi == -1:
        l.pop()
    else:
        l[pi] = pv


dfs(0)

for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
import bisect
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

tree = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    tree[u - 1].append(v - 1)
    tree[v - 1].append(u - 1)

ans = [0] * n
visited = [0] * n
visited[0] = 1


def dfs(i, l):
    s = a[i]
    if len(l) == 0 or s > l[-1]:
        l.append(s)
    else:
        l[bisect.bisect_left(l, s)] = s
    ans[i] = len(l)

    for ni in tree[i]:
        if not visited[ni]:
            visited[ni] = 1
            dfs(ni, l[:])


dfs(0, [])

for i in ans:
    print(i)


Fixed submission:
import bisect
import sys
sys.setrecursionlimit(1000000)

input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

tree = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    tree[u - 1].append(v - 1)
    tree[v - 1].append(u - 1)

ans = [0] * n
visited = [0] * n
visited[0] = 1
l = []

def dfs(i):
    s = a[i]
    pi = -1
    pv = -1
    if len(l) == 0 or s > l[-1]:
        l.append(s)
    else:
        pi = bisect.bisect_left(l, s)
        pv = l[pi]
        l[pi] = s
    ans[i] = len(l)

    for ni in tree[i]:
        if not visited[ni]:
            visited[ni] = 1
            dfs(ni)
            
    if pi == -1:
        l.pop()
    else:
        l[pi] = pv


dfs(0)

for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = sorted(list(map(int, input().split())))

n = 0
np = 0
nq = 0
ans = 0
while n < x + y:
    cs = []
    if p and np < x:
        cs.append(p[-1])
    if q and nq < y:
        cs.append(q[-1])
    if r:
        cs.append(r[-1])
    m = max(cs)
    if m == r[-1]:
        ans += r.pop()
    elif m == p[-1]:
        ans += p.pop()
        np += 1
    else:
        ans += q.pop()
        nq += 1
    n += 1

print(ans)


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

x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = sorted(list(map(int, input().split())))

n = 0
np = 0
nq = 0
ans = 0
while n < x + y:
    cs = []
    if p and np < x:
        cs.append(p[-1])
    if q and nq < y:
        cs.append(q[-1])
    if r:
        cs.append(r[-1])
    m = max(cs)
    if r and m == r[-1]:
        ans += r.pop()
    elif p and m == p[-1]:
        ans += p.pop()
        np += 1
    else:
        ans += q.pop()
        nq += 1
    n += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n, s = map(int, input().split())
a = list(map(int, input().split()))

dp = [[0 for _ in range(s + 1)] for j in range(n + 1)]
dp[0][0] = 1

ans = 0
for i in range(n):
    for j in range(s + 1):
        dp[i + 1][j] += dp[i][j]
        if j >= a[i]:
            if j == a[i]:
                dp[i + 1][j] += i + 1
            else:
                dp[i + 1][j] += dp[i][j - a[i]]
    ans += dp[i + 1][s]
    ans %= mod
print(ans)


Fixed submission:
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

dp = [[0 for _ in range(s + 1)] for j in range(n + 1)]
dp[0][0] = 1

ans = 0
for i in range(n):
    for j in range(s + 1):
        dp[i + 1][j] += dp[i][j]
        if j >= a[i]:
            if j == a[i]:
                dp[i + 1][j] += i + 1
            else:
                dp[i + 1][j] += dp[i][j - a[i]]
    ans += dp[i + 1][s]
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
H, W, D = map(int, input().split())
A = []
C = [0 for _ in range(H * W + 1)]
for h in range(H):
    A.append(list(map(int, input().split())))
for i in range(H):
    for j in range(W):
        C[A[i][j]] = (i, j)
Q = int(input())
for _ in range(Q):
    ans = 0
    l, r = map(int, input().split())
    p = (C[l][0], C[l][1])
    l += D
    while l <= r:
        n = (C[l][0], C[l][1])
        ans += abs(n[0] - p[0]) + abs(n[1] - p[1])
        p = n
        l += D
    print(ans)


Fixed submission:
H, W, D = map(int, input().split())
A = []
C = [0 for _ in range(H * W + 1)]
for h in range(H):
    A.append(list(map(lambda x: int(x) - 1, input().split())))
for i in range(H):
    for j in range(W):
        C[A[i][j]] = (i, j)
h = [0 for _ in range(H * W)]
for i in range(D):
    s = 0
    for j in range(i, H * W, D):
        if j != i:
            n = (C[j][0], C[j][1])
            p = (C[j - D][0], C[j - D][1])
            s += abs(n[0] - p[0]) + abs(n[1] - p[1])
        h[j] = s
Q = int(input())
for _ in range(Q):
    l, r = map(lambda x: int(x) - 1, input().split())
    print(h[r] - h[l])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = 0
b = 0
for i in range(N):
    if B[i] >= A[i]:
        a += (B[i] - A[i] + 1) // 2
        b += (B[i] - A[i]) % 2
    else:
        b += A[i] - bytes[i]
print('Yes' if a >= b else 'No')


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = 0
b = 0
for i in range(N):
    if B[i] >= A[i]:
        a += (B[i] - A[i] + 1) // 2
        b += (B[i] - A[i]) % 2
    else:
        b += A[i] - B[i]
print('Yes' if a >= b else 'No')
Buggy python submission (verdict: Runtime Error):
import sys

S = input()
center = len(S) // 2
b = S[center]

if len(S) % 2 == 1:
    for i in range(1, center + 1):
        if S[center + i] != b or S[center - i] != b:
            print(center + i)
            sys.exit()
else:
    for i in range(center + 1):
        if S[center - i] != b or S[center + 1 + i] != b:
            print(center)
            sys.exit()


Fixed submission:
import sys

S = input()
center = len(S) // 2

if len(S) % 2 == 1:
    b = S[center]
    for i in range(1, center + 1):
        if S[center + i] != b or S[center - i] != b:
            print(center + i)
            sys.exit()
else:
    b = S[center - 1]
    for i in range(center):
        if S[center - 1 - i] != b or S[center + i] != b:
            print(center + i)
            sys.exit()
print(len(S))
Buggy python submission (verdict: Runtime Error):
N, Z, W = map(int, input().split())
a = [int(n) for n in input().split()]
b = a.pop()
max = 0
if nota == []:
    for n in a:
        if abs(n - b) > max:
            max = abs(n - b)
if abs(n - Z) > max:
    max = abs(n - Z)
if abs(n - W) > max:
    max = abs(n - W)

print(max)

Fixed submission:
N, Z, W = map(int, input().split())
a = [int(n) for n in input().split()]

if N == 1:
    ans = abs(a[-1] - W)
else:
    ans = max(abs(a[-1] - W), abs(a[-1] - a[-2]))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
A = input()
B = input()
C = input()
a = sorted([int(i) for i in A.split()])
b = sorted([int(i) for i in B.split()])
c = sorted([int(i) for i in C.split()])

ans = 0
for i in b:
    a_small = len([x for x in a if x < i])
    c_large = len([x for x in c if x > i])
    ans += a_small * c_large
print(ans)


Fixed submission:
import math
from math import modf

n = int(input())
A = input()
B = input()
C = input()
a = [(int(i) + 0.1) for i in A.split()]
b = [int(i) for i in B.split()]
c = [(int(i) - 0.1) for i in C.split()]
al = sorted(a + b + c)
ans = 0
a_count = 0
c_count = n
for i in al:
    decimal, integer = modf(i)
    if decimal > 0.8:
        c_count -= 1
    elif decimal > 0.05:
        a_count += 1
    else:
        ans += a_count * c_count
print(ans)