Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
for i in range(q):
    l, r = map(int, input().split())
    print(s[l - 1:r].count('AC'))


Fixed submission:
n, q = map(int, input().split())
s = input()
x = [0] * (n + 1)
for i in range(n):
    x[i + 1] = x[i] + 1 * (s[i:i + 2] == 'AC')
for i in range(q):
    l, r = map(int, input().split())
    print(x[r - 1] - x[l - 1])
Buggy python submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n):
    v = math.gcd(v, a[i])
print(v)


Fixed submission:
import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n):
    v = fractions.gcd(v, a[i])
print(v)

Buggy python submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n - 1):
    v = math.gcd(v, a[i])
print(v)


Fixed submission:
import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n):
    v = fractions.gcd(v, a[i])
print(v)
Buggy python submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
x=[]
for i in range(n):
    x.append(abs(a-(t-h[i]*0.006)))
print(x.index(min(x))+1)

Fixed submission:
x,y=map(int,input().split());print(x+y//2)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
i = 0
while s[i] == '1':
    i += 1
print([1, s[i]][i < k])


Fixed submission:
s = input()
k = int(input())
i = 0
if s.count('1') == len(s):
    print(1)
else:
    while s[i] == '1':
        i += 1
    print([1, s[i]][i < k])
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
l=[]
for i in range(a,b+1):
    l.append(i)
if 2*k>len(l):
    for i in range(len(l)):
        print(l[i])
else:
    for i in range(k):
        print(l[i])
    for i in range(k):
        print(l[-k+i])

Fixed submission:
a,b,k=map(int,input().split())
if 2*k>b-a+1:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(k):
        print(a+i)
    for i in range(k):
        print(b-k+1+i)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
l=[]
for i in range(a,b+1):
    l.append(i)
if 2*k>len(l):
    for i in range(len(l)):
        print(l[i])
else:
    for i in range(k):
        print(l[i])
    for i in range(k):
        print(l[-k+i])

Fixed submission:
a,b,k=map(int,input().split())
if 2*k>b-a+1:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(k):
        print(a+i)
    for i in range(k):
        print(b-k+1+i)
Buggy python submission (verdict: Runtime Error):
print('EOvdedn'[int(input())*int(input())%2::2])

Fixed submission:
print('EOvdedn'[eval(input().replace(' ','*'))%2::2])
Buggy python submission (verdict: Runtime Error):
print('YNeos'[input()!=input()[::-1]::2])

Fixed submission:
n=input();print('YNeos'[n!=n[::-1]::2])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n, m = map(int, input().split())
x = deque()
y = deque()
for _ in range(m):
    a, b = map(int, input().split())
    if a == 1:
        x.append(b)
    elif b == n:
        y.append(a)
for i in x:
    if i in y:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')


Fixed submission:
n, m = map(int, input().split())
x = [[0] * 2 for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    if a == 1:
        x[b - 1][0] = 1
    elif b == n:
        x[a - 1][1] = 1
if [1, 1] in x:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
print([2, 1][m > 1])


Fixed submission:
x = int(input())
ans = i = 0
while i < x:
    ans += 1
    i += ans
print(ans)
Buggy python submission (verdict: Runtime Error):
input_value = input()

return (input_value[2] == input_value[3]) and (input_value[4] == input_value[5])

Fixed submission:
input_value = input()

print(
  'Yes'
  if (input_value[2] == input_value[3]) and (input_value[4] == input_value[5])
  else
  'No')

Buggy python submission (verdict: Runtime Error):
s = input()
if (s[3] == s[4]) and (s[5] == s[6]):
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
if (s[2] == s[3]) and (s[4] == s[5]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())

from collections import defaultdict
d = defaultdict(int)

for i in range(1, n):
    for j in range(i+1, n+1):
        if i <= x and j >= y:
            dis = (x-i)+(j-y)+1
        elif j <= x or i >= y:
            dis = j - i
        elif i <= x and j >= x:
            dis = (x-i)+min(j-x, y-j+1)
        elif i <= y and j >= y:
            dis = min(y-i, i-x+1)+(j-y)
        elif i >= x and j <= y:
            dis = min(j-i, (i-x)+1+(y-j))
        d[dis] += 1
            

for i in range(1, n):
    print(d[i])

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

from collections import defaultdict
d = defaultdict(int)

for i in range(1, n):
    for j in range(i+1, n+1):
        if i <= x and j >= y:
            dis = (x-i)+(j-y)+1
        elif j <= x or i >= y:
            dis = j - i
        elif i <= x and j >= x:
            dis = (x-i)+min(j-x, y-j+1)
        elif i <= y and j >= y:
            dis = min(y-i, i-x+1)+(j-y)
        elif i >= x and j <= y:
            dis = min(j-i, (i-x)+1+(y-j))
        d[dis] += 1
            

for i in range(1, n):
    print(d[i])
Buggy python submission (verdict: Runtime Error):
h, a = map(int, input())

print(h//a + h%a)


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

if h%a != 0:
    print(h//a + 1)
else:
    print(h//a)
Buggy python submission (verdict: Time Limit Exceeded):
monster_num, special_num = map(int ,input().split())
monster_list = list(map(int, input().split()))

monster_list = sorted(monster_list)
 
for _ in range(special_num):
  monster_list = monster_list[:-1]
  
print(sum(monster_list))

Fixed submission:
monster_num, special_num = map(int ,input().split())
monster_list = list(map(int, input().split()))
 
monster_list = sorted(monster_list)[::-1]
 
monster_list = monster_list[special_num:]
  
print(sum(monster_list))

Buggy python submission (verdict: Runtime Error):
monster_num, special_num = input().split()
monster_list = [input() for _ in range(monster_num)]


monster_list = sorted(monster_list)

for _ in range(special_num):
  monster_list = monster_list[:-1]
  
print(sum(monster_list))
  

Fixed submission:
monster_num, special_num = map(int ,input().split())
monster_list = list(map(int, input().split()))
 
monster_list = sorted(monster_list)[::-1]
 
monster_list = monster_list[special_num:]
  
print(sum(monster_list))
Buggy python submission (verdict: Runtime Error):
h = int(input())

split_num = math.floor(math.log2(h)) + 1
attack_num = sum([2**s for s in range(1, split_num+1)])

print(attack_num)

Fixed submission:
H = int(input())

h = H
attack = []
division = 0
while h >= 1:
    h /= 2
    attack.append(2**division)
    division += 1
print(sum(attack))
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
import numpy as np

dp = np.zeros([N+1, H+1])
dp[0, 1:] = np.inf

for i in range(0, N):
    for j in range(1, H+1):        
        dp[i+1][j] = min(dp[i][j], dp[i+1][max(0, j-A[i])] + B[i])
        
print(int(dp[-1][-1]))

Fixed submission:
H, N = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
#import numpy as np
#dp = np.zeros([N+1, H+1])
#dp[0, 1:] = np.inf
dp = [[0]*(H+1) for _ in range(N+1)]
for j in range(1, H+1):
	dp[0][j] = float('inf')

for i in range(0, N):
    for j in range(1, H+1):        
        dp[i+1][j] = min(dp[i][j], dp[i+1][max(0, j-A[i])] + B[i])
        
print(int(dp[-1][-1]))

Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
import numpy as np

dp = np.zeros([N+1, H+1])
dp[0, 1:] = np.inf

for i in range(0, N):
    for j in range(1, H+1):        
        dp[i+1][j] = min(dp[i][j], dp[i+1][max(0, j-A[i])] + B[i])
        
print(int(dp[-1][-1]))

Fixed submission:
H, N = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
#import numpy as np
#dp = np.zeros([N+1, H+1])
#dp[0, 1:] = np.inf
dp = [[0]*(H+1) for _ in range(N+1)]
for j in range(1, H+1):
	dp[0][j] = float('inf')

for i in range(0, N):
    for j in range(1, H+1):        
        dp[i+1][j] = min(dp[i][j], dp[i+1][max(0, j-A[i])] + B[i])
        
print(int(dp[-1][-1]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p_list = list(map(int, input().split()))

ans = 0
for i, p in enumerate(p_list):
  if p == min(p_list[:i+1]):
    ans += 1

print(ans)


Fixed submission:
n = int(input())
p_list = list(map(int, input().split()))
 
mi = p_list[0]
ans = 1
for i in range(1, n):
  if mi >= p_list[i]:
    ans += 1
    mi = p_list[i]
print(ans)

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

print(len([i for i in range(n) if p[i] == min(p[:i+1])]))

Fixed submission:
n = int(input())
p_list = list(map(int, input().split()))
 
mi = p_list[0]
ans = 1
for i in range(1, n):
  if mi >= p_list[i]:
    ans += 1
    mi = p_list[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())

# エラトステネスの篩
def Eratosthenes(n):
    if n < 2:
        return None
    prime = [2]
    limit = math.ceil(n**0.5)
    data = list(range(3, n+1, 2))
    p = -1
    while p < limit:
        p = data[0]
        prime.append(p)
        data = [d for d in data if d%p != 0]
    return prime + data


prime = Eratosthenes(10**5+3)
if x in prime:
    print(x)
else:
    import bisect
    min_prime_index = bisect.bisect_right(prime, x)
    print(prime[min_prime_index])

Fixed submission:
import math

x = int(input())

# エラトステネスの篩
def Eratosthenes(n):
    if n < 2:
        return None
    prime = [2]
    limit = math.ceil(n**0.5)
    data = list(range(3, n+1, 2))
    p = -1
    while p < limit:
        p = data[0]
        prime.append(p)
        data = [d for d in data if d%p != 0]
    return prime + data


prime = Eratosthenes(10**5+3)
if x in prime:
    print(x)
else:
    import bisect
    min_prime_index = bisect.bisect_right(prime, x)
    print(prime[min_prime_index])
Buggy python submission (verdict: Runtime Error):
ans = 0
pre_s = ''
for s in S:
    if s == pre_s:
        continue
    else:
        pre_s = s
        ans += 1
print(ans)

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

ans = 0
pre_s = ''
for s in S:
    if s == pre_s:
        continue
    else:
        pre_s = s
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
 
ans = 0
for i in range(0, N-2):
    a = L[i]
    for j in range(i+1, N-1):
        b = L[j]
        if L[-1] > a - b:
            ans += len(L[j+1:])
        else:
            for k in range(j+1, N):
                c = L[k]
                if c > a - b:
                    ans += 1
                else:
                    break
print(ans)

Fixed submission:
import bisect

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

'''
リストをソートし、a, b <= cとなるようにa, bを取り出せば、
a < b + c, b < c + a という条件は満たすので、
a, bを取り出したとき、c < a + b を満たすcを二分探索で探す
'''

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l, l[i]+l[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)

ans = 0
for i in range(0, N-2):
    a = L[i]
    for j in range(i+1, N-1):
        b = L[j]
        for k in range(j+1, N):
            c = L[k]
            if c > a - b:
                ans += 1
            else:
                break
print(ans)

Fixed submission:
import bisect

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

'''
リストをソートし、a, b <= cとなるようにa, bを取り出せば、
a < b + c, b < c + a という条件は満たすので、
a, bを取り出したとき、c < a + b を満たすcを二分探索で探す
'''

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l, l[i]+l[j]) - j - 1
print(ans)

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

ans = 0
for i in range(0, N-2):
    a = L[i]
    for j in range(i+1, N-1):
        b = L[j]
        for k in range(j+1, N):
            c = L[k]
            if (a < b + c) and (b < c + a) and (c < a + b):
                ans += 1
print(ans)

Fixed submission:
import bisect

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

'''
リストをソートし、a, b <= cとなるようにa, bを取り出せば、
a < b + c, b < c + a という条件は満たすので、
a, bを取り出したとき、c < a + b を満たすcを二分探索で探す
'''

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        ans += bisect.bisect_left(l, l[i]+l[j]) - j - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

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

g = gcd(a, b)

common = []
for i in range(1, int(g**0.5)+1):
    if g%i == 0:
        common.append(i)
        common.append(g//i)
    
import math
def Eratosthenes(n):
    if n < 2:
        return [1]
    prime = [1, 2]
    limit = math.ceil(n**0.5)
    data = list(range(3, n+1, 2))
    p = -1
    while p < limit:
        p = data[0]
        prime.append(p)
        data = [d for d in data if d%p != 0]
    return prime + data

prime = Eratosthenes(max(common))

print(len(set(common) & set(prime)))

Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
 
a, b = map(int, input().split())
print(len(set(prime_factorize(a)) & set(prime_factorize(b))) + 1)

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

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

g = gcd(a, b)

common = []
for i in range(1, int(g**0.5)+1):
    if g%i == 0:
        common.append(i)
        common.append(g//i)
    
def Eratosthenes(n):
    if n < 2:
        return [1]
    prime = [1, 2]
    limit = math.ceil(n**0.5)
    data = list(range(3, n+1, 2))
    p = -1
    while p < limit:
        p = data[0]
        prime.append(p)
        data = [d for d in data if d%p != 0]
    return prime + data

prime = Eratosthenes(max(common))

print(len(set(common) & set(prime)))

Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
 
a, b = map(int, input().split())
print(len(set(prime_factorize(a)) & set(prime_factorize(b))) + 1)

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

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

g = gcd(a, b)

common = []
for i in range(1, int(g**0.5)+1):
    if g%i == 0:
        common.append(i)
        common.append(g//i)

import math
def Eratosthenes(n):
    if n < 2:
        return None
    prime = [2]
    limit = math.ceil(n**0.5)
    data = list(range(3, n+1, 2))
    p = -1
    while p < limit:
        p = data[0]
        prime.append(p)
        data = [d for d in data if d%p != 0]
    return prime + data

prime = Eratosthenes(max(common))

print(1 + len(set(common) & set(prime)))

Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
 
a, b = map(int, input().split())
print(len(set(prime_factorize(a)) & set(prime_factorize(b))) + 1)
Buggy python submission (verdict: Runtime Error):
k = int(input())
x = int(input())

print(*list(range(x-k+1, x)) + list(range(x, x+k)))

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

print(*list(range(x-k+1, x)) + list(range(x, x+k)))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
    
import numpy as np
dp = np.zeros([N+1, max(max(A), M)+1])
    
for i in range(1, N+1):
    for j in range(min(A[i-1], M+1), M+1):
        dp[i][j] = B[i-1]

ans = 0
for j in range(1, M+1):
    i = np.argmax(dp[:, j])
    ans += dp[i, j]
    dp[i, :] = 0
print(int(ans))

Fixed submission:
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])  # sort by days

import heapq
que = []
heapq.heapify(que)

ans = 0
i = 0
for day in range(1, M+1):
    while i < len(AB) and AB[i][0] <= day:
        heapq.heappush(que, (-1)*AB[i][1])
        i += 1
    if que:
        ans += (-1)*heapq.heappop(que)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
    
import numpy as np
dp = np.zeros([N+1, max(max(A), M)+1])
    
for i in range(1, N+1):
    for j in range(A[i-1], M+1):
        dp[i][j] = B[i-1]

ans = 0
for j in range(1, M+1):
    i = np.argmax(dp[:, j])
    ans += dp[i, j]
    dp[i, :] = 0
print(int(ans))

Fixed submission:
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])  # sort by days

import heapq
que = []
heapq.heapify(que)

ans = 0
i = 0
for day in range(1, M+1):
    while i < len(AB) and AB[i][0] <= day:
        heapq.heappush(que, (-1)*AB[i][1])
        i += 1
    if que:
        ans += (-1)*heapq.heappop(que)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

import numpy as np
dp = np.zeros([N+1, M+1])
    
for i in range(1, N+1):
    for j in range(A[i-1], M+1):
        dp[i][j] = B[i-1]

ans = 0
for j in range(1, M+1):
    i = np.argmax(dp[:, j])
    ans += dp[i, j]
    dp[i, :] = 0
print(int(ans))

Fixed submission:
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])  # sort by days

import heapq
que = []
heapq.heapify(que)

ans = 0
i = 0
for day in range(1, M+1):
    while i < len(AB) and AB[i][0] <= day:
        heapq.heappush(que, (-1)*AB[i][1])
        i += 1
    if que:
        ans += (-1)*heapq.heappop(que)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]

for i in range(n):
  print(max(a[:i]+a[i+1:]))

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

maximum = max(a)
ans = [maximum]*n
if a.count(maximum) ==1:
    maximum_index = a.index(maximum)
    ans[maximum_index] = max(
        a[:maximum_index]+a[maximum_index+1:]
    )
for i in range(n):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
print(
  len(set(list(range(A, B+1)))
      - set(list(range(C, B+1, C)))
      - set(list(range(D, B+1, D))))
)

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

a, b, c, d = map(int, input().split())
g = gcd(c, d)
l = int(c*d/g)

print((b - a + 1) - ((b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//l - (a-1)//l)))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 1000000007

# DPテーブル
dp = [0]*(N+1)
dp[0] = 1
if 1 not in A:  # 1段目が壊れている場合もあるので注意
    dp[1] = 1

for i in range(2, N+1):
    if i in A:  # 壊れている場合
        continue
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
        
print(dp[-1])

Fixed submission:
N, M = map(int, input().split())
BrokenSteps = [int(input()) for _ in range(M)]
 
MOD = 1000000007
 
# DPテーブル
dp = [0]*(N+1)
dp[0] = 1
if 1 not in BrokenSteps:  # 1段目が壊れている場合もあるので注意
    dp[1] = 1

steps = list(range(2, N+1))  # 0,1段目は計算済みなので2段目以降
NoBrokenSteps = list(set(steps) - set(BrokenSteps))
    
for i in NoBrokenSteps:
    dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
        
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

cards = range(1, N+1)
for _ in range(M):
    l, r = map(int, input().split())
    cards = set(cards) & set(range(l, r+1))
print(len(cards))

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

L, R = [], []
for _ in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
diff = min(R) - max(L) + 1
if diff > 0:
    print(diff)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
A = [int(input()) for _ in range(5)]
k = int(input())
cnt = 0
for i in range(n-1):
    if A[i+1] - A[i] > k:
        cnt += 1
if cnt:
    print(':(')
else:
    print('Yay!')

Fixed submission:
A = [int(input()) for _ in range(5)]
k = int(input())

if A[-1] - A[0] > k:
    print(':(')
else:
    print('Yay!')