Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())

# print(N)
# print(K)
# print(Q)

scores = []
for i in range(N):
    scores.append(K)

for i in range(Q):
    # print(i)
    A = int(input())
    # print(A)
    
    for j in range(N):
        if j + 1 != A:
            scores[j] -= 1
            
# print(scores)

for i in range(N):
    if scores[i] > 0:
        print('Yes')
    else:
        print('No')

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

# print(N)
# print(K)
# print(Q)

scores = []
for i in range(N):
    scores.append(K)

for i in range(Q):
    # print(i)
    A = int(input())
    # print(A)
    
    # for j in range(N):
    #     if j + 1 != A:
    #         scores[j] -= 1
    scores[A - 1] += 1
            
# print(scores)

for i in range(N):
    if scores[i] > K + Q - K:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

# print(N)
# print(M)

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

A = sorted(A, reverse=True)
# print(A)

for i in range(M):
    # print(i)
    A[0] = int(A[0] / 2)
    A = sorted(A, reverse=True)
    
print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
# print(N)
# print(M)

hq = []
A = list(map(int, input().split()))
for x in A:
    heapq.heappush(hq, -x)
    
# print(hq)

for i in range(M):
    x = heapq.heappop(hq)
    x = int(x / 2)
    # print(x)
    heapq.heappush(hq, x)

# print(hq)
ans = 0
for x in hq:
    ans += -x
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input()) 
v = list(map(int, input().split()))
c = list(map(int, input().split()))

l = [True, False]
max_diff_v_c = 0
for flags in itertools.product(l, repeat=n):
    # print(' '.join(map(str, flags)))
    
    sum_v = 0
    sum_c = 0
    for i in range(len(flags)):
        if flags[i]:
            sum_v += v[i]
            sum_c += c[i]

    diff_v_c = sum_v - sum_c

    if max_diff_v_c < diff_v_c:
        max_diff_v_c = diff_v_c
        
print(max_diff_v_c)

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

max_diff_v_c = 0
for i in range(n):
    diff_v_c = v[i] - c[i]
    if diff_v_c > 0:
        max_diff_v_c += diff_v_c

print(max_diff_v_c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [*map(int, input().split())]

# print(n)
# print(l)

l_s = sorted(l, reverse=True)

# print(l_s)

longest = l_s.pop(0)

# print(longest)
# print(l_s)

if longest < sum(l_s):
    print('Yes')
else:
    print('No')

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

# print(n)
# print(l)

l_s = sorted(l, reverse=True)

# print(l_s)

longest = l_s.pop(0)

# print(longest)
# print(l_s)

if longest < sum(l_s):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [*map(int, input().split())]

# print(n)
# print(l)

l_s = sorted(l, reverse=True)

# print(l_s)

longest = l_s.pop(0)

# print(longest)
# print(l_s)

if longest < sum(l_s):
    print('Yes')
else:
    print('No')

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

# print(n)
# print(l)

l_s = sorted(l, reverse=True)

# print(l_s)

longest = l_s.pop(0)

# print(longest)
# print(l_s)

if longest < sum(l_s):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

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

# dp = [float('inf') for i in range(len(h))]
dp = [0] * n
dp[0] = 0
# dp[1] = abs(h[0] - h[1])
# print(dp)

for i in range(1, n):
    # for j in range(1, min(k + 1, n - i)):
    #     dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]))
    dp[i] = min([dp[j] + abs(h[j] - h[i]) for j in range(max(0, i - k), i)])
            
        # print(dp)
        
print(dp[-1])

Fixed submission:
# coding: utf-8
# Your code here!

n = int(input())
height = list(map(int, input().split()))
# print(height)
l = []

for i in range(n):
    if i == 0:
        l.append(0)
    elif i == 1:
        a = height[0]
        b = height[1]
        l.append(abs(a - b))
    else:
        c = height[i - 2]
        # print(c)
        d = height[i]
        # print(d)
        a = l[i - 2] + abs(c - d)
        # print(a)
        b = l[i -1 ] + abs(height[i - 1] - height[i])
        # print(b)
        l.append(min(a, b))
    
# print(len(l))
print(l[len(l) - 1])
Buggy python submission (verdict: Runtime Error):
import sympy

n = int(input())
# print(f"{n}")

ans = 0
for i in range(1, n + 1):
    if i % 2 == 0:
        continue
    
    d_count = sympy.divisor_count(i)
    # print(f"{i} {d_count}")
    if d_count == 8:
        ans += 1
print(ans)

Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
# print(f"{n}")

ans = 0
for i in range(1, n + 1):
    if i % 2 == 0:
        continue
    
    # d_count = sympy.divisor_count(i)
    a = make_divisors(i)
    # print(f"{i} {a}")
    d_count = len(a)
    # print(f"{i} {d_count}")
    if d_count == 8:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
# print(f"{a} {b} {k}")

# l = []
# for i in range(a, b + 1):
#     l.append(i)
# print(l)

# l_small = set()
# for i in range(a, a + k):
#     l_small.add(i)
# print(l_small)

# l_large = set()
# for i in range(b, b - k, -1):
#     l_large.add(i)
# print(l_large)

l = [i for i in range(a, b + 1)]
# print(l)

l_ans = set()
for i in range(len(l)):
    if i + 1 <= k:
        l_ans.add(l[i])
l = sorted(l, reverse=True)
for i in range(len(l)):
    if i + 1 <= k:
        l_ans.add(l[i])
# print(sorted(l_ans))
for num in sorted(l_ans):
    print(num)

Fixed submission:
a, b, k = map(int, input().split())
# print(f"{a} {b} {k}")

# l = []
# for i in range(a, b + 1):
#     l.append(i)
# print(l)

# l_small = set()
# for i in range(a, a + k):
#     l_small.add(i)
# print(l_small)

# l_large = set()
# for i in range(b, b - k, -1):
#     l_large.add(i)
# print(l_large)

# l = [i for i in range(a, b + 1)]
# print(l)

l_ans = set()

count = 1
for i in range(a, b + 1):
    if count <= k:
        l_ans.add(i)
    else:
        break
    count += 1

count = 1
for i in range(b, a - 1, -1):
    if count <= k:
        l_ans.add(i)
    else:
        break
    count += 1

for num in sorted(l_ans):
    print(num)
Buggy python submission (verdict: Runtime Error):
N = input().split()

if N[0] == N[2]:
  print('Yes')
else:
  print('No')

Fixed submission:
# coding: utf-8
# Your code here!

N = input()
 
if N[0] == N[2]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

# print(K)
# print(S)

count = 0
for i in range(K + 1):
	for j in range(K + 1):
		for k in range(K + 1):
			if i + j + k == S:
				count += 1

print(count)

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

# print(K)
# print(S)

count = 0
for i in range(K + 1):
	for j in range(K + 1):
		# for k in range(K + 1):
		# 	if i + j + k == S:
		# 		count += 1
		if i + j <= S and i + j + K >= S:
			count += 1

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

# print(a)
# print(b)
# print(x)

count = 0
for i in range(a, b + 1):
    # print(i)
    
    if i % x == 0:
        count += 1
        
print(count)

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

# print(a)
# print(b)
# print(x)

# count = 0
# for i in range(a, b + 1):
#     # print(i)
    
#     if i % x == 0:
#         count += 1
        
# print(count)

def f(n):
    if n == -1:
        return 0
    else:
        return (n // x) + 1

# print(int((a -1) / x) + 1)
# print(int(b / x))

# print(f(b))
# print(f(a - 1))
print(f(b) - f(a - 1))
Buggy python submission (verdict: Runtime Error):
S = {}

A = input()
B = input()
C = input()

S['a'] = A
S['b'] = B
S['c'] = C

player = 'a'
for i in range(len(A) + len(B) + len(C)):
    # pass
    # print(S[player][0])
    S[player] = S[player][1:]
    
    if len(S[player]) == 0:
        break
    
    player = S[player][0]
    

# print(A)
# print(B)
# print(C)

print(player.upper())

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

result = h * (a + b) / 2
result = int(result)

print(result)

Buggy python submission (verdict: Runtime Error):
S = {}

A = input()
B = input()
C = input()

S['a'] = A
S['b'] = B
S['c'] = C

player = 'a'
for i in range(len(A) + len(B) + len(C)):
    # pass
    # print(S[player][0])
    player = S[player][0]
    S[player] = S[player][1:]
    
    if len(S[player]) == 0:
        break
    

# print(A)
# print(B)
# print(C)

print(player.upper())

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

result = h * (a + b) / 2
result = int(result)

print(result)

Buggy python submission (verdict: Runtime Error):
S = {}

A = input()
B = input()
C = input()

S['a'] = A
S['b'] = B
S['c'] = C

player = 'a'
for i in range(len(A) + len(B) + len(C)):
    # pass
    # print(S[player][0])
    player = S[player][0]
    S[player] = S[player][1:]
    
    if len(S[player]) == 0:
        break
    

# print(A)
# print(B)
# print(C)

print(player.upper())

Fixed submission:
a = int(input())
b = int(input())
h = int(input())

result = h * (a + b) / 2
result = int(result)

print(result)
Buggy python submission (verdict: Runtime Error):
s = input()
count_arr = []
count = 0
for i in s:
    if i == "R": count += 1
    elif i == "S":
        count_arr.append(count)
        count = 0
print(max(count_arr))


Fixed submission:
s = input()
for i in range(3, -1, -1):
    if 'R' * i in s:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
s = input()
count_arr = []
count = 0
for i in s:
    if i == "R": count += 1
    else:
        count_arr.append(count)
        count = 0
print(max(count_arr))


Fixed submission:
s = input()
for i in range(3, -1, -1):
    if 'R' * i in s:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
s = input()
count_arr = []
count = 0
for i in s:
    if i == "R": count += 1
    else:
        count_arr.append(count)
        count = 0
print(max(count_arr))


Fixed submission:
s = input()
for i in range(3, -1, -1):
    if 'R' * i in s:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
s = input()
count_arr = []
count = 0
for i in s:
    if i == "R": count += 1
    else:
        count_arr.append(count)
        count = 0
print(max(count_arr))


Fixed submission:
s = input()
for i in range(3, -1, -1):
    if 'R' * i in s:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
s = input()
count_arr = []
count = 0
for i in s:
    if i == "R": count += 1
    else:
        count_arr.append(count)
        count = 0
print(max(count_arr))


Fixed submission:
s = input()
for i in range(3, -1, -1):
    if 'R' * i in s:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
k=int(())
print("ACL"*k)

Fixed submission:
k=int(input())
print("ACL"*k)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
data=list(range(n))
cnt=n-1
def find(x):
    if data[x]==x:
        return x
    else:
        return find(data[x])
for i in range(m):
    a,b=map(int,input().split())
    a=find(a-1)
    b=find(b-1)
    if a!=b:
        data[a]=b
        cnt-=1
print(cnt)

Fixed submission:
n,m=map(int,input().split())
data=list(range(n))
cnt=n-1
def find(x):
    if data[x]==x:
        return x
    else:
        data[x]=find(data[x])
        return data[x]
for i in range(m):
    a,b=map(int,input().split())
    a=find(a-1)
    b=find(b-1)
    if a!=b:
        data[a]=b
        cnt-=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
data=list(range(n))
cnt=n-1
def find(x):
    if data[x]==x:
        return x
    else:
        find(data[x])
for i in range(m):
    a,b=map(int,input().split())
    a=find(a-1)
    b=find(b-1)
    if a!=b:
        data[a]=b
        cnt-=1
print(cnt)

Fixed submission:
n,m=map(int,input().split())
data=list(range(n))
cnt=n-1
def find(x):
    if data[x]==x:
        return x
    else:
        data[x]=find(data[x])
        return data[x]
for i in range(m):
    a,b=map(int,input().split())
    a=find(a-1)
    b=find(b-1)
    if a!=b:
        data[a]=b
        cnt-=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
data=list(range(n))
cnt=n-1
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    while data[a]!=a:
        a=data[a]
    while data[b]!=b:
        b=data[b]
    if a!=b:
        data[a]=b
        cnt-=1
print(cnt)

Fixed submission:
n,m=map(int,input().split())
data=list(range(n))
cnt=n-1
def find(x):
    if data[x]==x:
        return x
    else:
        data[x]=find(data[x])
        return data[x]
for i in range(m):
    a,b=map(int,input().split())
    a=find(a-1)
    b=find(b-1)
    if a!=b:
        data[a]=b
        cnt-=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
data=list(map(int,input().split()))
ans=0
for i in range(len(data)):
    for j in range(i+1,len(data)):
        ans+=data[i]*data[j]
ans=ans%(10**9+7)
print(ans)

Fixed submission:
n=int(input())
data=list(map(int,input().split()))
num=0
ans=0
for i in range(len(data)):
    num+=data[i]
for i in range(len(data)):
    num-=data[i]
    temp=(num*data[i])
    ans+=temp
print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n=int(intput())
if 30<=n:
    print("Yes")
else:
    print("No")

Fixed submission:
n=int(input())
if 30<=n:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
data=list(map(int,input().split()))
num=1
for i in data:
    num*=i
if 10**18<num:
    print(-1)
else:
    print(num)

Fixed submission:
import sys
n=int(input())
data=list(map(int,input().split()))
num=1
if any(i==0 for i in data):
    print(0)
    sys.exit()
else:
    for i in data:
        num*=i
        if 10**18<num:
            print(-1)
            sys.exit()
print(num)
Buggy python submission (verdict: Runtime Error):
a,b=map(Decimal,input().split())
print(int(a*b))

Fixed submission:
from decimal import *
a,b=map(Decimal,input().split())
print(int(a*b))
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
twon=np.zeros(n)
twon=list(map(int,input().split()))
data=twon[0]
array=[-1]*n
array[0]=1
count=0
for i in range(1,k-1):
    if array[data-1]==-1:
        array[data-1]=i+1
    else:
        count=(k-i-1)%(i+1-array[data-1])
        array=[-1]*n
        count=k-count
    data=twon[data-1]
    if count!=0:
        break
    print(count,array)
    
for j in range(count,k):
    data=twon[data-1]
    #print(j)
print(data,count)

Fixed submission:
S=input("")
T=input("")
l=len(S)
if 1<=l and l<=10 and S.islower()==True and len(T)==l+1:
    if T.startswith(S)==True and T.islower()==True:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k=map(int,input().split())
twon=np.zeros(n)
twon=list(map(int,input().split()))
data=twon[0]
array=[-1]*n
array[0]=1
count=0
for i in range(1,k-1):
    if array[data-1]==-1:
        array[data-1]=i+1
    else:
        count=(k-i-1)%(i+1-array[data-1])
        array=[-1]*n
        count=k-count
    if count!=0:
        break
    data=twon[data-1]
for j in range(count,k):
    data=twon[data-1]
data=twon[data-1]
print(data)

Fixed submission:
S=input("")
T=input("")
l=len(S)
if 1<=l and l<=10 and S.islower()==True and len(T)==l+1:
    if T.startswith(S)==True and T.islower()==True:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
if S==t[:-1] and S.islower()==True:
  print("Yes")
else:
  print("NO")

Fixed submission:
S=input("")
T=input("")
l=len(S)
if 1<=l and l<=10 and S.islower()==True and len(T)==l+1:
    if T.startswith(S)==True and T.islower()==True:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math
k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans+=math.gcd(math.gcd(i,j),l)
print(ans)

Fixed submission:
import math
import collections
k=int(input())
ans=0
a=[]
for i in range(1,k+1):
    for j in range(1,k+1):
        a.append(math.gcd(i,j))
a=collections.Counter(a)
for key,value in a.items():
    for i in range(1,k+1):
        ans+=math.gcd(i,key)*value
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
ans=0
n=int(input())
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      num=gcd(i,j)
      ans+=gcd(num,k)
print(ans)
      

Fixed submission:
import math
import collections
k=int(input())
ans=0
a=[]
for i in range(1,k+1):
    for j in range(1,k+1):
        a.append(math.gcd(i,j))
a=collections.Counter(a)
for key,value in a.items():
    for i in range(1,k+1):
        ans+=math.gcd(i,key)*value
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
ans=[0]*n
for _ in range(m):
    s,c=map(int,input().split())
    if ans[s-1]!=0 and ans[s-1]!=c:
        print(-1)
        sys.exit()
    if s==1 and c==0 and n!=1:
        print(-1)
        sys.exit()
    ans[s-1]=c
if ans[0]==0 and n!=0:
num=0
for i in range(n):
    num+=ans[i]*(10**(n-i-1))
print(num)

Fixed submission:
import sys
n,m=map(int,input().split())
data=[0]*n
for i in range(m):
    s,c=map(int,input().split())
    if data[s-1]!=0 and data[s-1]!=c:
        print(-1)
        sys.exit()
    if s==1 and c==0 and n!=1:
        print(-1)
        sys.exit()
    data[s-1]=c
if data[0]==0 and n!=1:
    data[0]=1
ans=0
for i in range(n):
    ans+=data[i]*10**(n-i-1)
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
ans=[0]*n
for _ in range(m):
    s,c=map(int,input().split())
    if ans[s-1]!=0 and ans[s-1]!=c:
        print(-1)
        sys.exit()
    if s==1 and c==0 and n!=1:
        print(-1)
        sys.exit()
    ans[s-1]=c
if ans[0]==0:
    print(-1)
else:
    num=0
    for i in range(n):
        num+=ans[i]*(10**(n-i-1))
print(num)

Fixed submission:
import sys
n,m=map(int,input().split())
data=[0]*n
for i in range(m):
    s,c=map(int,input().split())
    if data[s-1]!=0 and data[s-1]!=c:
        print(-1)
        sys.exit()
    if s==1 and c==0 and n!=1:
        print(-1)
        sys.exit()
    data[s-1]=c
if data[0]==0 and n!=1:
    data[0]=1
ans=0
for i in range(n):
    ans+=data[i]*10**(n-i-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=[]
for i in range(n):
    num=ord(s[i])+2
    if num>90:
        num-=90
    ans.append(chr(num))
ans="".join(ans)
print(ans)

Fixed submission:
n=int(input())
s=input()
ans=[]
for i in range(len(s)):
    num=ord(s[i])+n
    if num>90:
        num-=26
    ans.append(chr(num))
ans="".join(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
N = A[0]
D = A[1:N*2+1]
D1 = []
D2 = []
for i in range(N):
    D1.append(D[2 * i])
    D2.append(D[2 * i + 1])
ans = "No"
for i in range(N - 2):
    if D1[i] == D[i]:
         if D[i + 1] == D[i + 1]:
            if D[i + 2] == D[i + 2]:
                ans = "Yes"
                break
print(ans)

Fixed submission:
N = int(input())
D = [input().split() for _ in range(N)]
ans = "No"
for i in range(N - 2):
    if D[i][0] == D[i][1]:
         if D[i + 1][0] == D[i + 1][1]:
            if D[i + 2][0] == D[i + 2][1]:
                ans = "Yes"
                break
print(ans)
Buggy python submission (verdict: Runtime Error):
a,p = input.split(" ")
print( (a*3+p)//2 )

Fixed submission:
a,p = map(int, input().split(" "))
print( (a*3+p)//2 )
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
  
n,x = map(int,input().split())
xlist = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = gcd(int(xlist[i]-x),ans)
print(ans)

Fixed submission:
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
  
n,x = map(int,input().split())
xlist = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = gcd(abs(xlist[i]-x),ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n,x = map(int,input().split())
xlist = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = math.gcd(xlist[i]-x,ans)
print(ans)

Fixed submission:
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
  
n,x = map(int,input().split())
xlist = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = gcd(abs(xlist[i]-x),ans)
print(ans)

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

n,x = map(int,input().split())
xlist = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = math.gcd(xlist[i]-x,ans)
print(ans)

Fixed submission:
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
  
n,x = map(int,input().split())
xlist = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = gcd(abs(xlist[i]-x),ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input())
if a+b >= c:
    print("Yes")
else:
    print("No")

Fixed submission:
a,b,c = map(int,input().split())
if a+b >= c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
nlist = [input() for i in range(n)]
m = int(input())
mlist = [input() for i in range(m)]

for i in range mlist:
    if i in nlist:
        nlist.remove(i)

def maxCOUNT( lis ):
  '''
  与えられたリストの中に、最も多く存在する要素を返す
  (最大の数の要素が複数ある場合、pythonのsetで先頭により近い要素を返す)
  '''
  L = lis[:]#copy
  S = set(lis)
  S = list(S)
  MaxCount=0

  for elem in S:
    c=0
    while elem in L:
      ind = L.index(elem)
      foo = L.pop(ind)
      c+=1
    if c>MaxCount:
      MaxCount=c
  return MaxCount

print(maxCOUNT(nlist))
    


Fixed submission:
n = int(input())
nlist = [input() for i in range(n)]
m = int(input())
mlist = [input() for i in range(m)]
 
for i in mlist:
    if i in nlist:
        nlist.remove(i)
 
def maxCOUNT( lis ):
  '''
  与えられたリストの中に、最も多く存在する要素を返す
  (最大の数の要素が複数ある場合、pythonのsetで先頭により近い要素を返す)
  '''
  L = lis[:]#copy
  S = set(lis)
  S = list(S)
  MaxCount=0
 
  for elem in S:
    c=0
    while elem in L:
      ind = L.index(elem)
      foo = L.pop(ind)
      c+=1
    if c>MaxCount:
      MaxCount=c
  return MaxCount
 
print(maxCOUNT(nlist))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
if k == 0:
    print(n**2)
else:
    r = n//k
    ans = 0
    for i in range(1,r+3): #a=(i-1)×b+あまり
        genkai = n - (i)*k
        for j in range(1,n-k+1): #b=k+j
            x = (i-1)*j
            ans += min(max(genkai-x+1,0),j)
    print(ans)


Fixed submission:
n,k = map(int,input().split())
if k == 0:
    print(n**2)
elif k <= 100:
    ans = 0
    for j in range(k):
        for i in range(k+1,n+1):
            ans += (n-j)//i
    print((n-k+1)*(n-k)-ans)
else:
    r = n//k
    ans = 0
    for i in range(1,r+3): #a=(i-1)×b+あまり
        genkai = n - (i)*k
        for j in range(1,n-k+1): #b=k+j
            x = (i-1)*j
            ans += min(max(genkai-x+1,0),j)
    print(ans)