Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
s1 = s
s2 = s

flag = True

if s[0] == '#':
    flag = False
else:
    for i in range(n-1):
        if s[i] == '.' and s[i+1] == '#':
            s = s[i+1:]
            flag = False
            break
if flag == False:
    a = s.count('.')
else:
    a = 0

flag = True

if s1[n-1] == '.':
    flag = False
else:
    for i in range(n-1):
        if s1[n-i-1] == '#' and s1[n-i-2] == '.':
            s1 = s1[:n-i-1]
            flag = False
            break

if flag == False:
    b = s1.count('#')
else:
    b = 0

c = min(a,b)

for i in range(n-1):
    if s2[i] == '.' and s2[i+1] == '#':
        s3 = s[:i+1]
        s4 = s[i+1:]
        d = s3.count('#') + s4.count('.')
        c = min(c,d)


print(c)


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

a = s.count('.')
b = 0

ans = a

for i in range(n):
    if s[i] == '#':
        b += 1
    else:
        a -= 1
    ans = min(ans,a+b)

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

for i in range(n+1):
    li[i] = s[0:i].count("AC")

for i in range(q):
    l,r = map(int,input().split())
    print(li[r]-li[l])


Fixed submission:
n,q = map(int,input().split())
s = input()
li = [0 for _ in range(n+1)]

for i in range(1,n):
    li[i+1] = li[i] + s[i-1:i+1].count("AC")

for i in range(q):
    l,r = map(int,input().split())
    print(li[r]-li[l])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
li = [list(map(int,input().split())) for _ in range(q)]

for i in range(q):
    a = s[li[i][0]-1:li[i][1]]
    print(a.count("AC"))


Fixed submission:
n,q = map(int,input().split())
s = input()
li = [0 for _ in range(n+1)]

for i in range(1,n):
    li[i+1] = li[i] + s[i-1:i+1].count("AC")

for i in range(q):
    l,r = map(int,input().split())
    print(li[r]-li[l])
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = []
for _ in range(n):
    c.append(int(input()))

dp = [0] * n
dp[0] = 1

pre = [-1] * n
tmp = [-1] * n

for i in range(n):
    pre[i] = tmp[c[i]-1]
    tmp[c[i]-1] = i

for i in range(1,n):
    dp[i] = dp[i-1]
    if pre[i] != -1 and c[i] != c[i-1]:
        dp[i] += dp[pre[i]]

print(dp[-1])


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

mod = 10**9+7
dp = [0] * n
dp[0] = 1

pre = [-1] * n
tmp = [-1] * (2*10**5+10)

for i in range(n):
    pre[i] = tmp[c[i]-1]
    tmp[c[i]-1] = i

for i in range(1,n):
    dp[i] = dp[i-1]
    if pre[i] != -1 and c[i] != c[i-1]:
        dp[i] += dp[pre[i]]
        dp[i] %= mod

print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
dict1 = {}
for i in range(n):
    a,b = map(int,input().split())
    dict1[a] = b

dict1_sorted = sorted(dict1.items(),key = lambda x:x[0],reverse = False)

money = 0
count = 0

while m > 0:
    if m > dict1_sorted[count][1]:
        money += dict1_sorted[count][0] * dict1_sorted[count][1]
        m -= dict1_sorted[count][1]
        count += 1
    else:
        money += dict1_sorted[count][0] * m
        m = 0
        count += 1

print(money)


Fixed submission:
n,m = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(n)]
li.sort(key = lambda x:x[0])

money = 0
count = 0

while m > 0:
    if m > li[count][1]:
        money += li[count][0] * li[count][1]
        m -= li[count][1]
        count += 1
    else:
        money += li[count][0] * m
        m = 0
        count += 1

print(money)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())

for i in range(a+1,b+1):
    a = a ^ i

print(a)


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

if a % 2 == 0:
    if (b-a+1)%2 == 0:
        if (b-a+1)%4 == 2:
            print(1)
        else:
            print(0)
    else:
        if (b-a+1)%4 == 1:
            print(0^b)
        else:
            print(1^b)
else:
    if (b-a)%2 == 0:
        if (b-a)%4 == 2:
            print(a^1)
        else:
            print(a^0)
    else:
        if (b-a)%4 == 1:
            print(a^0^b)
        else:
            print(a^1^b)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
count = 0

while True:
    if '111000' in s:
        count += s.count('111000') * 6
        s = s.replace('111000','')
    if '000111' in s:
        count += s.count('000111') * 6
        s = s.replace('000111','')
    if '1100' in s:
        count += s.count('1100') * 4
        s = s.replace('1100','')
    if '0011' in s:
        count += s.count('0011') * 4
        s = s.replace('0011','')
    if '10' in s:
        count += s.count('10') * 2
        s = s.replace('10','')
    elif '01' in s:
        count += s.count('01') * 2
        s = s.replace('01','')
    else:
        break

print(count)


Fixed submission:
s = input()
print(min(s.count('0'),s.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
count = 0

while True:
    if '10' in s:
        count += s.count('10') * 2
        s = s.replace('10','')
    elif '01' in s:
        count += s.count('01') * 2
        s = s.replace('01','')
    else:
        break

print(count)


Fixed submission:
s = input()
print(min(s.count('0'),s.count('1'))*2)

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
count = 0

while True:
    if '10' in s:
        count += s.count('10') * 2
        s = s.replace('10','')
    elif '01' in s:
        count += s.count('01','') * 2
        s = s.replace('01','')
    else:
        break

print(count)


Fixed submission:
s = input()
print(min(s.count('0'),s.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
count = 0

while True:
    if '10' in s:
        s = s.replace('10','',1)
        count += 2
    elif '01' in s:
        s = s.replace('01','',1)
        count += 2
    else:
        break

print(count)


Fixed submission:
s = input()
print(min(s.count('0'),s.count('1'))*2)

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
count = 0

while True:
    if '10' in s:
        s = s.replace('10','',1)
        count += 2
        print(s)
    elif '01' in s:
        s = s.replace('01','',1)
        count += 2
        print(s)
    else:
        break

print(count)


Fixed submission:
s = input()
print(min(s.count('0'),s.count('1'))*2)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
l = [int(x) for x in list(s)]

count = 0
flag = True

while flag == True:
    flag = False
    for i in range(n-1):
        if l[i] != l[i+1]:
            l = l[:i] + l[i+2:]
            count += 2
            n -= 2
            flag = True
            break

print(count)



Fixed submission:
s = input()
print(min(s.count('0'),s.count('1'))*2)
Buggy python submission (verdict: Runtime Error):
import bisect
import sys
input = sys.stdin.readline

a,b,q = map(int,input().split())
s = []
t = []
s1 = []
t1 = []

for _ in range(a):
    s.append(int(input()))
for _ in range(b):
    t.append(int(input()))

for i in range(a-1):
    s1.append((s[i]+s[i+1])/2)
for i in range(b-1):
    t1.append((t[i]+t[i+1])/2)

for _ in range(q):
    x = int(input())
    s_index = bisect.bisect_left(s1, x)
    t_index = bisect.bisect_left(t1, x)
    xs = []
    xt = []
    for i in range(-2, 3):
        if 0 <= s_index + i < a:
            xs.append(s[s_index+i])
        if 0 <= t_index + i < a:
            xt.append(t[t_index+i])
    ans = 10**20
    for i in xs:
        for j in xt:
            ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

    print(ans)


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

a,b,q = map(int,input().split())
s = []
t = []
s1 = []
t1 = []

for _ in range(a):
    s.append(int(input()))
for _ in range(b):
    t.append(int(input()))

for i in range(a-1):
    s1.append((s[i]+s[i+1])/2)
for i in range(b-1):
    t1.append((t[i]+t[i+1])/2)

for _ in range(q):
    x = int(input())
    s_index = bisect.bisect_left(s1, x)
    t_index = bisect.bisect_left(t1, x)
    xs = []
    xt = []
    for i in range(-2, 3):
        if 0 <= s_index + i < a:
            xs.append(s[s_index+i])
        if 0 <= t_index + i < b:
            xt.append(t[t_index+i])
    ans = 10**20
    for i in xs:
        for j in xt:
            ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

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

while len(li) > 1:
  a = min(li)
  for i in range(len(li)):
    li[i] %= a
    if li[i] == 0:
      li.pop(i)
      
print(li[0])
    

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

while len(li) > 1:
  a = min(li)
  for i in range(len(li)):
    if li[i] != a:
      li[i] %= a
  li = list(set(li))
  if 0 in li:
    li.remove(0)
      
print(li[0])

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

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

n = int(input())
li = list(map(int,input().split()))
li2 = list(set(li))
li2.sort()
li3 = [li2[0]]

for i in range(n-1):
    li3.append(abs(li[i+1]-li[i]))

a = math.gcd(li3[i],li3[i+1])
li4 = [a]

for i in li3:
    a = math.gcd(li4[-1],i)
    li4.append(a)

print(li4[-1])


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

while len(li) > 1:
  a = min(li)
  for i in range(len(li)):
    if li[i] != a:
      li[i] %= a
  li = list(set(li))
  if 0 in li:
    li.remove(0)
      
print(li[0])

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

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

n = int(input())
li = list(map(int,input().split()))
li2 = list(set(li))
li2.sort()
li3 = [li2[0]]

for i in range(n-1):
    li3.append(abs(li[i+1]-li[i]))

print(gcd_list(li2))


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

while len(li) > 1:
  a = min(li)
  for i in range(len(li)):
    if li[i] != a:
      li[i] %= a
  li = list(set(li))
  if 0 in li:
    li.remove(0)
      
print(li[0])
Buggy python submission (verdict: Runtime Error):
s = input()
t = 'keyence'

count = 0
count2 = 0
flag = True

for i in s:
    if i == t[count]:
        count += 1
        flag = True
    else:
        if flag:
            count2 += 1
            flag = False
        else:
            pass

if count2 <= 1 and count == len(t):
    print('YES')
else:
    print('NO')


Fixed submission:
s = input()
t = 'keyence'

idx = 0
for i in range(len(s)):
    if i < len(t):
        if s[i] != t[i]:
            idx = i
            break
    elif i == len(t):
        print('YES')
        exit()

for i in range(idx,len(s)):
    if s[:idx] + s[i:] == t:
        print('YES')
        exit()

print('NO')
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
py = []
li = [1] * 10**5

for i in range(m):
    p,y = map(int,input().split())
    py.append((p,y,i))

py.sort(key = lambda x: x[1])

ans = []

for p,y,i in py:
    ans_tmp = '0' * (6 - len(str(p))) + str(p) + '0' * (6 - len(str(li[p]))) + str(li[p])
    li[p] += 1
    ans.append([ans_tmp, i])

ans.sort(key = lambda x: x[1])
for i in range(m):
    print(ans[i][0])


Fixed submission:
n,m = map(int,input().split())
py = []
li = [1] * (10**5 + 10)

for i in range(m):
    p,y = map(int,input().split())
    py.append((p,y,i))

py.sort(key = lambda x: x[1])

ans = []

for p,y,i in py:
    ans_tmp = '0' * (6 - len(str(p))) + str(p) + '0' * (6 - len(str(li[p]))) + str(li[p])
    li[p] += 1
    ans.append([ans_tmp, i])

ans.sort(key = lambda x: x[1])
for i in range(m):
    print(ans[i][0])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(m)]

li2 = []
li3 = []

for i in range(m):
    li2.append(li[i][0]*10**6)

for i in range(1,n+1):
    for j in range(m):
        if li[j][0] == i:
            li3.append(li[j][1])
    li3.sort()
    for j in range(m):
        for k in range(len(li3)):
            if li[j][1] == li3[k]:
                li2[j] += k+1
    li3.clear()

for i in li2:
    if i % 10**10 != i:
        i = "0" + str(i)
        print(i)
    elif i % 10**9 != i:
            i = "00" + str(i)
            print(i)
    elif i % 10**8 != i:
        i = "000" + str(i)
        print(i)
    elif i % 10**7 != i:
        i = "0000" + str(i)
        print(i)
    elif i % 10**6 != i:
        i = "00000" + str(i)
        print(i)
    else:
        print(i)


Fixed submission:
n,m = map(int,input().split())
py = []
li = [1] * (10**5 + 10)

for i in range(m):
    p,y = map(int,input().split())
    py.append((p,y,i))

py.sort(key = lambda x: x[1])

ans = []

for p,y,i in py:
    ans_tmp = '0' * (6 - len(str(p))) + str(p) + '0' * (6 - len(str(li[p]))) + str(li[p])
    li[p] += 1
    ans.append([ans_tmp, i])

ans.sort(key = lambda x: x[1])
for i in range(m):
    print(ans[i][0])
Buggy python submission (verdict: Time Limit Exceeded):
import math

n,m = map(int,input().split())
flag = False

for i in range(2,int(math.sqrt(m)+1)):
    if m % i == 0:
        flag = True
        break

if flag == True:
    for i in range(int(m/n),0,-1):
        if m % i == 0:
            print(i)
            break
else:
    print(1)

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

def yakusuu(n,m):
    for i in range(int(m/n),0,-1):
        if m % i == 0:
            print(i)
            break

yakusuu(n,m)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

for i in range(int(m/n),0,-1):
    if m % i == 0:
        print(i)
        break


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

def yakusuu(n,m):
    for i in range(int(m/n),0,-1):
        if m % i == 0:
            print(i)
            break

yakusuu(n,m)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

a = int(m/n)

li = []
for i in range(1,a+1):
    if m % i == 0:
        li.append(i)
print(li[len(li)-1])

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

def yakusuu(n,m):
    for i in range(int(m/n),0,-1):
        if m % i == 0:
            print(i)
            break

yakusuu(n,m)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))

li2 = li[::2]
li3 = li[1::2]
max2,max22,max3,max33 = [0,0,0,0]

for i in li2:
    a = li2.count(i)
    if a > max2:
        max22 = max2
        max2 = a
        b = i
    elif a > max22 and i != b:
        max22 = a

for i in li3:
    a = li3.count(i)
    if a > max3:
        max33 = max3
        max3 = a
        c = i
    elif a > max33 and i != c:
        max33 = a

if b == c:
    print(max(n-max22-max3,n-max2-max33))
else:
    print(n-max2-max3)


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

cnt1 = {}
cnt2 = {}

for i in range(n):
    if i % 2 == 0:
        if v[i] in cnt1:
            cnt1[v[i]] += 1
        else:
            cnt1[v[i]] = 1
    else:
        if v[i] in cnt2:
            cnt2[v[i]] += 1
        else:
            cnt2[v[i]] = 1

sorted_cnt1 = sorted(cnt1.items(), key = lambda x: x[1], reverse = True)
sorted_cnt2 = sorted(cnt2.items(), key = lambda x: x[1], reverse = True)

sorted_cnt1.append((-1,0))
sorted_cnt2.append((-1,0))

if sorted_cnt1[0][0] != sorted_cnt2[0][0]:
    print(n - sorted_cnt1[0][1] - sorted_cnt2[0][1])
else:
    print(n - max(sorted_cnt1[0][1] + sorted_cnt2[1][1], sorted_cnt1[1][1]+sorted_cnt2[0][1]))

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

li2 = li[::2]
li3 = li[1::2]
max2 = 0
max22 = 0
max3 = 0
max33 = 0

for i in range(int(n/2)):
    a = li2[i]
    count = 0
    for j in range(int(n/2)):
        if li2[j] == a:
            count += 1
    if count > max2:
        max22 = max2
        max2 = count
        b = a
    elif count > max22 and a != b:
        max22 = count


for i in range(int(n/2)):
    a = li3[i]
    count = 0
    for j in range(int(n/2)):
        if li3[j] == a:
            count += 1
    if count > max3:
        max33 = max3
        max3 = count
        c = a
    elif count > max33 and a != c:
        max33 = count

if b == c:
    print(max(n-max22-max3,n-max2-max33))
else:
    print(n-max2-max3)


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

cnt1 = {}
cnt2 = {}

for i in range(n):
    if i % 2 == 0:
        if v[i] in cnt1:
            cnt1[v[i]] += 1
        else:
            cnt1[v[i]] = 1
    else:
        if v[i] in cnt2:
            cnt2[v[i]] += 1
        else:
            cnt2[v[i]] = 1

sorted_cnt1 = sorted(cnt1.items(), key = lambda x: x[1], reverse = True)
sorted_cnt2 = sorted(cnt2.items(), key = lambda x: x[1], reverse = True)

sorted_cnt1.append((-1,0))
sorted_cnt2.append((-1,0))

if sorted_cnt1[0][0] != sorted_cnt2[0][0]:
    print(n - sorted_cnt1[0][1] - sorted_cnt2[0][1])
else:
    print(n - max(sorted_cnt1[0][1] + sorted_cnt2[1][1], sorted_cnt1[1][1]+sorted_cnt2[0][1]))
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
li = list(map(int,input().split()))

li2 = [i-x for i in li]
li3 = [abs(i) for i in li2]
a = min(li3)
flag = 1
b = li3[0]

import math

for i in li3:
    b = math.gcd(b,i)

print(b)


Fixed submission:
n,x = map(int,input().split())
li = list(map(int,input().split()))

li2 = [i-x for i in li]
li3 = [abs(i) for i in li2]
b = li3[0]

def gcd(x,y):
    if x < y:
        x,y = y,x
    if y == 0:
        return x
    z = x % y
    return gcd(y,z)

for i in li3:
    b = gcd(b,i)

print(b)

Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
li = list(map(int,input().split()))

li2 = [i-x for i in li]
li3 = [abs(i) for i in li2]
a = min(li3)
flag = 1

import math
from functools import reduce

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

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

print(gcd_list(li3))


Fixed submission:
n,x = map(int,input().split())
li = list(map(int,input().split()))

li2 = [i-x for i in li]
li3 = [abs(i) for i in li2]
b = li3[0]

def gcd(x,y):
    if x < y:
        x,y = y,x
    if y == 0:
        return x
    z = x % y
    return gcd(y,z)

for i in li3:
    b = gcd(b,i)

print(b)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

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

for i in a:
    li = factorization(i)
    for j in li:
        if j[0] == 2:
            ans += j[1]

print(ans)


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

def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans = 0

    for i in a:
        count = 0
        while i // 2 * 2 == i:
            i = i // 2
            count += 1
        ans += count

    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

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

b = []
li = [0] * 21
r = 0
ans = 0

for i in a:
    ai = bin(i)
    b.append(ai[2:])

for l in range(n):
    while True:
        if r >= n:
            ans += r - l
            break
        tmp = b[r]
        flag = True
        for i in range(len(tmp)):
            if li[i] == 1 and tmp[-i-1] == '1':
                flag = False
            if not flag:
                break
        if flag:
            for i in range(len(tmp)):
                li[i] += int(tmp[-i-1])
            r += 1
        else:
            for i in range(len(b[l])):
                li[i] -= int(b[l][-i-1])
            ans += r - l
            break

print(ans)


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

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

b = []
li = [0] * 21
r = 0
ans = 0

for i in a:
    ai = bin(i)
    b.append(ai[2:])

for l in range(n):
    while True:
        if r >= n:
            ans += r - l
            break
        tmp = b[r]
        flag = True
        for i in range(len(tmp)):
            if li[i] == 1 and tmp[-i-1] == '1':
                flag = False
            if not flag:
                break
        if flag:
            for i in range(len(tmp)):
                li[i] += int(tmp[-i-1])
            r += 1
        else:
            for i in range(len(b[l])):
                li[i] -= int(b[l][-i-1])
            ans += r - l
            break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
import bisect

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

a.sort()

def comb(x,y):
    return factorial(x) // factorial(y) // factorial(x-y)

count = 0
max1 = 0
ans = [0,0]

for i in a:
    j = bisect.bisect_left(a,i/2)
    if j-1 >= 0:
        if max1 < comb(i,a[j-1]) and i != a[j-1]:
            max1 = comb(i,a[j-1])
            ans = [i,a[j-1]]

    if j >= 0:
        if max1 < comb(i,a[j]) and i != a[j]:
            max1 = comb(i,a[j])
            ans = [i,a[j]]
    if j+1 < n:
        if i >= a[j+1]:
            if max1 < comb(i,a[j+1]) and i != a[j+1]:
                max1 = comb(i,a[j+1])
                ans = [i,a[j+1]]

print(ans[0], ans[1])


Fixed submission:
import bisect

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

a.sort()

idx = bisect.bisect_left(a,a[-1]/2)

if idx == 0:
    print(a[-1],a[idx])
else:
    x,y = a[idx-1],a[idx]
    if y - a[-1]/2 < a[-1]/2 - x:
        print(a[-1],y)
    else:
        print(a[-1],x)
Buggy python submission (verdict: Runtime Error):
import heapq

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

sub1 = 0
li = []

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        heapq.heappush(li, a[i] - b[i])

for i in range(sub1):
    x = -heapq.heappop(li)
    if x >= 2:
        heapq.heappush(li, 2-x)
    else:
        print('No')
        exit()

print('Yes')


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

sub1 = 0
sub2 = 0

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        sub2 += (b[i] - a[i]) // 2

if sub1 <= sub2:
    print('Yes')
else:
    print('No')

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

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

sub1 = 0
li = []

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        heapq.heappush(li, a[i] - b[i])

for i in range(sub1):
    x = -heapq.heappop(li)
    if x >= 2:
        heapq.heappush(li, x-2)
    else:
        print('No')
        exit()

print('Yes')


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

sub1 = 0
sub2 = 0

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        sub2 += (b[i] - a[i]) // 2

if sub1 <= sub2:
    print('Yes')
else:
    print('No')