Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input().strip())
is_irrversible = 0
answer = 0
while is_irrversible == 0:
    answer_when_start = answer
    for i in range(len(S)-1):
        if S[i] == 'B' and S[i+1] == 'W':
            S[i],S[i+1] = 'W','B'
            answer += 1
    if answer_when_start == answer:
        is_irrversible = 1
print(answer)

Fixed submission:
S = list(input().strip())
is_irrversible = 0
answer = 0
position_key_sum = 0
number_of_white = 0
sigma = 0
for i in range(len(S)):
    if S[i] == 'W':
        position_key_sum += (i+1)
        number_of_white += 1
        sigma += number_of_white
answer = position_key_sum - sigma
print(answer)

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

Fixed submission:
S = list(input().strip())
is_irrversible = 0
answer = 0
position_key_sum = 0
number_of_white = 0
sigma = 0
for i in range(len(S)):
    if S[i] == 'W':
        position_key_sum += (i+1)
        number_of_white += 1
        sigma += number_of_white
answer = position_key_sum - sigma
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ab_s = [list(map(int, input().split())) for _ in range(M)]
bridges = [0] * N
ab_s = sorted(ab_s, key=lambda x: x[1])
for ab in ab_s:
  if sum(bridges[ab[0]:ab[1]]) == 0:
    bridges[ab[1]-1] = 1
print(sum(bridges))


Fixed submission:
N, M = map(int, input().split())
ab_s = [list(map(int, input().split())) for _ in range(M)]
bridges = [0] * N
ab_s = sorted(ab_s, key=lambda x: x[1])
for ab in ab_s:
    if bridges[ab[1]-1] - bridges[ab[0]-1] == 0:
        for i in range(ab[1]-1, N):
            bridges[i] += 1
print(bridges[-1])
Buggy python submission (verdict: Runtime Error):
# ruiseki
from collections import Counter
F = open("/Users/yamataku/Downloads/subtask_1_09.txt")
# N = int(input())
# A_s = list(map(int,input().split()))
N = int(F.readline())
A_s = list(map(int,F.readline().split()))
ruiseki = [0]
for i,a in enumerate(A_s):
    ruiseki.append(ruiseki[i]+a)
counter = Counter(ruiseki)

answer = 0
for k,v in counter.items():
    if v > 1:
        answer += v * (v-1)//2
print(answer)

Fixed submission:
from collections import Counter
N = int(input())
A_s = list(map(int,input().split()))
ruiseki = [0]
for i,a in enumerate(A_s):
    ruiseki.append(ruiseki[i]+a)
counter = Counter(ruiseki)


answer = 0
for k,v in counter.items():
    if v > 1:
        answer += v * (v-1)//2
print(answer)

Buggy python submission (verdict: Runtime Error):
# ruiseki
from collections import Counter
N = int(input())
A_s = list(map(int,input().split()))
ruiseki = [0]
for i,a in enumerate(A_s):
    ruiseki.append(ruiseki[i]+a)
counter = Counter(ruiseki)
class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

comb = Combination((2*10**5))

answer = 0
for k,v in counter.items():
    if v > 1:
        answer += comb(v, 2)
print(answer)

Fixed submission:
from collections import Counter
N = int(input())
A_s = list(map(int,input().split()))
ruiseki = [0]
for i,a in enumerate(A_s):
    ruiseki.append(ruiseki[i]+a)
counter = Counter(ruiseki)


answer = 0
for k,v in counter.items():
    if v > 1:
        answer += v * (v-1)//2
print(answer)
Buggy python submission (verdict: Runtime Error):
S = list(input())
for i in range(S):
  if i % 2 == 0:
    print(S[i], end='')

Fixed submission:
S = list(input())
for i, s in enumerate(S):
  if i % 2 == 0:
    print(s, end='')
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input())
bucket = {}
for i in range(N):
  bucket[i] = 0
for m in range(m):
  tempa,tempb = map(int,input())
  bucket[tempa-1] += 1
  bucket[tempb-1] += 1
for i in range(N):
  print(bucket[i])

Fixed submission:
N,M = map(int,input().split())
bucket = {}
for i in range(N):
  bucket[i] = 0
for m in range(M):
  tempa,tempb = map(int,input().split())
  bucket[tempa-1] += 1
  bucket[tempb-1] += 1
for i in range(N):
  print(bucket[i])
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
answer = 0 

for i in range(K+1):
    for j in range(K+1):
        for q in range(K+1):
            if i+j+q == S:
                answer+=1
print(answer)

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

for i in range(K+1):
    for j in range(K+1):
        if 0 <= S-i-j and S-i-j <= K:
            answer+=1
print(answer)
Buggy python submission (verdict: Runtime Error):
W,H,N = map(int,input().split())
limit = {'top': H, 'right': W, 'down': 0, 'left': 0}
for _ in range(N):
  x,y,a = map(int.input().split())
  if a == 1:
    if x > limit['left']:
      limit['left'] = x
  elif a == 2:
    if x < limit['right']:
      limit['right'] = x
  elif a == 3:
    if y > limit['down']:
      limit['down'] = y
  elif a == 4:
    if y < limit['top']:
      limit['top'] = y
height = limit['top'] - limit['down']
width = limit['right'] - limit['left']
if (height > 0) and (width > 0):
  print(height * width)
else:
  print(0)
  

Fixed submission:
W,H,N = map(int,input().split())
limit = {'top': H, 'right': W, 'down': 0, 'left': 0}
for _ in range(N):
  x,y,a = map(int,input().split())
  if a == 1:
    if x > limit['left']:
      limit['left'] = x
  elif a == 2:
    if x < limit['right']:
      limit['right'] = x
  elif a == 3:
    if y > limit['down']:
      limit['down'] = y
  elif a == 4:
    if y < limit['top']:
      limit['top'] = y
height = limit['top'] - limit['down']
width = limit['right'] - limit['left']
if (height > 0) and (width > 0):
  print(height * width)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
S = input()
power = 0
answer = 0
temps = int(S)
while True:
    temps = temps/10
    power += 1
    if temps < 10:
        break

SS = list(S)

for i in range(1 << power):
    output = []
    for j in range(power):
        if (i>>j)&1 == 1:
            output.append(SS[j])
            output.append('+')
        else:
            output.append(SS[j])
    output.append(SS[power])
    temp_string = ''.join(output)
    answer += eval(temp_string)
    output.clear()
    
print(answer)

Fixed submission:
S = input()
power = 0
answer = 0
temps = int(S)
while True:
    if temps < 10:
        break
    temps = temps/10
    power += 1

SS = list(S)

for i in range(1 << power):
    output = []
    for j in range(power):
        if (i>>j)&1 == 1:
            output.append(SS[j])
            output.append('+')
        else:
            output.append(SS[j])
    output.append(SS[power])
    temp_string = ''.join(output)
    answer += eval(temp_string)
    
print(answer)

Buggy python submission (verdict: Runtime Error):
S = input()
power = 0
answer = 0
temps = int(S)
while True:
    temps = temps/10
    power += 1
    if temps < 10:
        break

SS = list(S)

for i in range(1 << power):
    output = []
    for j in range(power):
        if (i>>j)&1 == 1:
            output.append(SS[j])
            output.append('+')
        else:
            output.append(SS[j])
    output.append(SS[power])
    temp_string = ''.join(output)
    answer += eval(temp_string)
    
print(answer)

Fixed submission:
S = input()
power = 0
answer = 0
temps = int(S)
while True:
    if temps < 10:
        break
    temps = temps/10
    power += 1

SS = list(S)

for i in range(1 << power):
    output = []
    for j in range(power):
        if (i>>j)&1 == 1:
            output.append(SS[j])
            output.append('+')
        else:
            output.append(SS[j])
    output.append(SS[power])
    temp_string = ''.join(output)
    answer += eval(temp_string)
    
print(answer)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*(n+2)
S=sum(a)
for i in range(k):
    s=S
    S=0
    for j in range(n):
        if j<a[j]:
            b[0]+=1
        else:
            b[j-a[j]+1]+=1
        if n-1-j<a[j]:
            b[n+1]-=1
        else:
            b[j+a[j]+2]-=1
    for j in range(n):
        if j==0:
            a[j] = b[j]+b[j+1]
        else:
            a[j] = a[j-1]+b[j+1]
        b[j]=0
        S+=a[j]
    b[-2]=0
    b[-1]=0
    if S==s:
        break
for i in a:
    print(i,end=" ")

Fixed submission:
s=input()
print(s[:3])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
b*=100
print(int(a*b/100))

Fixed submission:
a,b = map(float,input().split())
a=int(a)
b=int(100*(b+0.001))
print(a*b//100)
Buggy python submission (verdict: Time Limit Exceeded):
x=int(input())
s={0}
n=1
stop=0
while(1):
    N=n**5
    for i in s:
        if N-i==x:
            if i>0:
                sig=int(i//abs(i))
            else:
                sig=1
            print(n,sig*int(pow(abs(i),1/5)))
            stop=1
        elif N-i==-x:
            if i>0:
                sig=int(i//abs(i))
            else:
                sig=1
            print(n,sig*int(pow(abs(i),1/5)))
            stop=1
    if stop==1:
        break
    s|={N,-N}

Fixed submission:
x=int(input())
s={0}
n=1
stop=0
while(1):
    N=n**5
    for i in s:
        if N-i==x:
            if i>0:
                sig=1
            elif i<0:
                sig=-1
            else:
                sig=0
            print(n,int(sig*pow(abs(i),1/5)))
            stop=1
        elif i-N==x:
            if i>0:
                sig=1
            elif i<0:
                sig=-1
            else:
                sig=0
            print(int(sig*pow(abs(i),1/5)),n)
            stop=1
    if stop==1:
        break
    s|={N,-N}
    n+=1
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
alpha=[chr(i) for i in range(97, 97+26)]
d={i:[[],[],[],[],[],[],[],[],[],[]] for i in alpha}
ans=0
for _ in range(n):
    s=input()
    if s not in d[s[0]][len(s)-1]:
        d[s[0]][len(s)-1].append(s)
        ans+=1
print(ans)

Fixed submission:
n=int(input())
alpha=[chr(i) for i in range(97, 97+26)]
d={i:[{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}] for i in alpha}
ans=0
for _ in range(n):
    s=input()
    if s not in d[s[0]][len(s)-1]:
        d[s[0]][len(s)-1]|={s}
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
alpha=[chr(i) for i in range(97, 97+26)]
d={i:[] for i in alpha}
ans=0
for _ in range(n):
    s=input()
    if s not in d[s[0]]:
        d[s[0]].append(s)
        ans+=1
print(ans)

Fixed submission:
n=int(input())
alpha=[chr(i) for i in range(97, 97+26)]
d={i:[{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}] for i in alpha}
ans=0
for _ in range(n):
    s=input()
    if s not in d[s[0]][len(s)-1]:
        d[s[0]][len(s)-1]|={s}
        ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
l=len(s)
ans=0
p=0
a={}
b=-1
c=-1
d=-1
for j in range(l)[::-1]:
    p=(p+int(s[j])*10**(l-j-1))%2019
    if b>0:
        if a.get(b)!=None:
            a[b]+=1
        else:
            a[b]=1
    b=c
    c=d
    d=p
    if p==0:
        ans+=1
    if a.get(p)!=None:
        ans+=a[p]
print(ans)

Fixed submission:
s=input()
l=len(s)
ans=0
p=0
a={}
b=-1
c=-1
d=-1
e=-1
q=1
for j in range(l)[::-1]:
    p=(p+int(s[j])*q)%2019
    q*=10
    q%=2019
    if p==0:
        ans+=1
    if a.get(p)!=None:
        ans+=a[p]
    if a.get(p)!=None:
        a[p]+=1
    else:
        a[p]=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
l=len(s)
ans=0
for i in range(l-3):
    for j in range(3,l-i):
        if j==3:
            p=int(s[i:i+4])%2019
        else:
            p=(p*10+int(s[i+j]))%2019
        if p==0:
             ans+=1
print(ans)

Fixed submission:
s=input()
l=len(s)
ans=0
p=0
a={}
b=-1
c=-1
d=-1
e=-1
q=1
for j in range(l)[::-1]:
    p=(p+int(s[j])*q)%2019
    q*=10
    q%=2019
    if p==0:
        ans+=1
    if a.get(p)!=None:
        ans+=a[p]
    if a.get(p)!=None:
        a[p]+=1
    else:
        a[p]=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
li=list(map(int,input().split()))
g=n-sum(li)
if g>=0:
    print g
else:
    print -1

Fixed submission:
n,m = map(int,input().split())
li=list(map(int,input().split()))
g=n-sum(li)
if g>=0:
    print(g)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
li=list(map(int,input().split()))
g=n-sum(li)
if g>=0:
  return g
else:
  return -1

Fixed submission:
n,m = map(int,input().split())
li=list(map(int,input().split()))
g=n-sum(li)
if g>=0:
    print(g)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
d={}
if n==1:
    print(1)
for a in range(1,n+1):
    for b in range(1,n+1):
        p=math.gcd(a,b)
        if d.get(p)!=None:
            d[p]+=1
        else:
            d[p]=1
for c in range(1,n+1):
    for e in range(1,n+1):
        p=math.gcd(c,e)
        ans+=d[e]*p
print(ans)        

Fixed submission:
import math
n=int(input())
ans=0
d={}
for a in range(1,n+1):
    for b in range(1,n+1):
        p=math.gcd(a,b)
        if d.get(p)!=None:
            d[p]+=1
        else:
            d[p]=1
for c in range(1,n+1):
    for e in range(1,n+1):
        p=math.gcd(c,e)
        ans+=d[e]*p
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())
ans=[0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        ans[min(abs(i-j),min(abs(i-x)+1+abs(j-y),abs(i-y)+1+abs(j-x)))]+=1
for i in range(1,n):
    print(ans[i])

Fixed submission:
n,x,y = map(int,input().split())
ans=[0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        ans[min(j-i,abs(i-x)+1+abs(j-y))]+=1
for i in range(1,n):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
n,x,y = map(int,input().split())
ans={i:[] for i in range(1,n)}
for i in range(1,n):
    for j in range(i+1,n+1):
        ans[min(abs(i-j),min(abs(i-x)+1+abs(j-y),abs(i-y)+1+abs(j-x)))].append([i,j])
for i in range(1,n):
    print(len(ans[i]))

Fixed submission:
n,x,y = map(int,input().split())
ans=[0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        ans[min(j-i,abs(i-x)+1+abs(j-y))]+=1
for i in range(1,n):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
li=list(map(int,input().split()))
d={}
dif={-1}
ans={}
for i in range(n):
    if li[i] not in dif:
        dif|={li[i]}
    if d.get(li[i])!=None:
        d[li[i]]+=1
    else:
        d[li[i]]=1
dif.remove(-1)
for i in dif:
    g=0
    for j in dif:
        if i!=j:
            g+=d[j]*(d[j]-1)//2
        else:
            g+=(d[j]-2)*(d[j]-1)//2
    ans[i]=g
for i in li:
    print(ans[i])

Fixed submission:
n=int(input())
li=list(map(int,input().split()))
d={}
dif={-1}
ans={}
for i in range(n):
    if li[i] not in dif:
        dif|={li[i]}
    if d.get(li[i])!=None:
        d[li[i]]+=1
    else:
        d[li[i]]=1
dif.remove(-1)
g=0
for i in dif:
    g+=d[i]*(d[i]-1)//2
for i in dif:
    ans[i]=g-(d[i]-1)*d[i]//2+(d[i]-2)*(d[i]-1)//2
for i in li:
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
li=list(map(int,input().split()))
if m>=n:
    print(0)
else:
    sort(li)
    print(sum(li[n-m:]))

Fixed submission:
n,m = map(int,input().split())
li=list(map(int,input().split()))
if m>=n:
    print(0)
else:
    li.sort()
    print(sum(li[:n-m]))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
i=0
while(1):
    n//=2
    i+=1
    if n==1:
        break
i=bin(i+1)[2:]
ans=1
mkr=2
for j in i[::-1]:
    if j=="1":
        ans*=mkr
    mkr*=mkr
print(ans-1)

Fixed submission:
n=int(input())
i=0
while(1):
    if n==1:
        break
    n//=2
    i+=1
i=bin(i+1)[2:]
ans=1
mkr=2
for j in i[::-1]:
    if j=="1":
        ans*=mkr
    mkr*=mkr
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
i=0
while(1):
    n//=2
    i+=1
    if n==1:
        break
print(2**(i+1)-1)

Fixed submission:
n=int(input())
i=0
while(1):
    if n==1:
        break
    n//=2
    i+=1
i=bin(i+1)[2:]
ans=1
mkr=2
for j in i[::-1]:
    if j=="1":
        ans*=mkr
    mkr*=mkr
print(ans-1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
r,s,p = map(int,input().split())
d={"r":p,"s":r,"p":s}
li=[]
s=input()
ans=0
for i,j in enumerate(s):
    if i<k:
        ans+=d[j]
        li.append(j)
    else:
        if li[0]!=j:
            ans+=d[j]
            li=li[1:]+[j]
        else:
            li=li[1:]+["#"]
print(ans)

Fixed submission:
n,k = map(int,input().split())
r,s,p = map(int,input().split())
d={"r":p,"s":r,"p":s}
s=input()
memo=s[:k]
ans=0
for i,j in enumerate(s):
    if i<k:
        ans+=d[j]
    else:
        if memo[0]!=j:
            ans+=d[j]
            memo=memo[1:]+j
        else:
            memo=memo[1:]+"#"
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,d = map(int,input().split())
ans=0
g=[]
if d==1:
  ans=n*(n-1)//2
  print(ans)
else:
  for _ in range(n):
    for i in range(len(g)):
	    lis = np.array(list(map(int,input().split())))
    	u = g[i]-lis
        z=np.linalg.norm(u)
        if z-int(z)==0:
          ans+=1
    g.append(lis)
print(ans)
  

Fixed submission:
import numpy as np
n,d = map(int,input().split())
ans=0
g=[]
if d==1:
    for _ in range(n):
        lis = np.array(list(map(int,input().split())))
    ans=n*(n-1)//2
    print(ans)
else:
    for _ in range(n):
        lis = np.array(list(map(int,input().split())))
        for i in range(len(g)):
            u = g[i]-lis
            z=np.linalg.norm(u)
            if z==int(z):
                ans+=1
        g.append(lis)
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()

if a[0]>=0:
    g=sum(a[1:])-a[0]
    print(g)
    for i in range(n-1):
        if len(a)>2:
            print(str(a[0])+" "+str(a[-1]))
            a[0]-=a[-1]
            a.remove(a[-1])
        else:
            print(str(a[1])+" "+str(a[0]))
    
elif a[-1]<=0:
    g=a[-1]-sum(a[:-1])
    print(g)
    for i in range(n-1):
        print(str(a[-1])+" "+str(a[0]))
        a[-1]-=a[0]
        a.remove(a[0])
else:
    g=0 
    for i in range(n):
        g+=abs(a[i])
    print(g)
    for _ in range(n-1):
        if a[-2]>=0:
            print(str(a[0])+" "+str(a[-1]))
            a[0]-=a[-1]
            a.remove(a[-1])
        else:
            print(str(a[-1])+" "+str(a[0]))
            a[-1]-=a[0]
            a.remove(a[0])



Fixed submission:
a,b = map(int,input().split())
if b==1:
  print(0)
else:
  print(a-b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
li.sort()
s=0
for i in range(n-1):
  s+=li[i]
if s<=li[-1]:
  print(No)
else:
  print(Yes)

Fixed submission:
n = int(input())
li = map(int,input().split())
li = list(li)
li.sort()
s=0
for i in range(n-1):
  s+=li[i]
if s<=li[-1]:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = map(int,input().split())
li = list(li)
li.sort()
s=0
for i in range(n-1):
  s+=li[i]
if s<=li[-1]:
  print(No)
else:
  print(Yes)

Fixed submission:
n = int(input())
li = map(int,input().split())
li = list(li)
li.sort()
s=0
for i in range(n-1):
  s+=li[i]
if s<=li[-1]:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
lis = list(map(int,input().split()))
lis.sort()
ls=[]
for i in range(b-1):
  ls.append(lis[i+1]-lis[i])
ls.sort()
print(sum(ls[n-1:])
           

Fixed submission:
a,b = map(int,input().split())
lis = list(map(int,input().split()))
lis.sort()
ls=[]
for i in range(b-1):
    ls.append(lis[i+1]-lis[i])
ls.sort(reverse=True)
print(sum(ls[a-1:]))
Buggy python submission (verdict: Runtime Error):
s=input()
if "k" in s and "y" in s and "n" in s and "c" in s and k.count("e")>=3:
    print("YES")
else:
    print("NO")

Fixed submission:
s=input()
for i in range(8):
    ans=s[:i]+s[-7+i:]
    if ans=="keyence":
        ans=0
        print("YES")
        break
if ans!=0:
    print("NO")
Buggy python submission (verdict: Runtime Error):
import math
n,x = map(int,input().split())
xlist= list(map(int,input().split()))
ans=x-xlist[0]
for i in xlist:
    ans=math.gcd(ans,x-i)
print(ans)

Fixed submission:
def gcd(a,b):
    a=abs(a)
    b=abs(b)
    if a<b:
        c=a
        a=b
        b=c
    if a%b==0:
        return b
    else:
        return gcd(b,a%b)
n,x = map(int,input().split())
xlist= list(map(int,input().split()))
ans=x-xlist[0]
for i in xlist:
    ans=gcd(ans,x-i)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = int(input())
l = 10**9+7
list_1 = [0, 1, 1, 1]
list_2 = [0, 1, 2]
for i in range(3, s):
  list_2.append((list_2[i-1] + list_1[i])%l)
  list_1.append(list_2[i-2])
if s = 1 or s = 2:
  print(0)
else:
  print(list_1[s-1])

Fixed submission:
c = int(input())
if c == 0:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
s = int(input())
l = 10**9+7
list_1 = [0, 1, 1, 1]
list_2 = [0, 1, 2]
for i in range(3, s):
  list_2.append((list_2[i-1] + list_1[i])%l)
  list_1.append(list_2[i-2])
if s = 1 or s = 2:
  print(0)
else:
  print(list_1[s-1])


Fixed submission:
s = int(input())
l = 10**9+7
list_1 = [0, 1, 1, 1]
list_2 = [0, 1, 2]
for i in range(3, s):
  list_2.append((list_2[i-1] + list_1[i])%l)
  list_1.append(list_2[i-2])
if s == 1 or s == 2:
  print(0)
else:
  print(list_1[s-1])
Buggy python submission (verdict: Runtime Error):
a = input()
s = 0
if a == "RRR":
  s = 3
elif a == "RRS" or a == "SRR":
  s = 2
elif a = "SSS":
  s = 0
else:
  s = 1
print(s)

Fixed submission:
a = input()
s = 0
if a == "RRR":
  s = 3
elif a == "RRS" or a == "SRR":
  s = 2
elif a == "SSS":
  s = 0
else:
  s = 1
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
x, k, d = map(int, input().split())
for i in range(k):
  if x > 0:
    x -= d
  else:
    x += d
print(abs(x))

Fixed submission:
x, k, d = map(int, input().split())
r = x % d
q = (x - r) // d
if abs(x) >= k*d:
  if x>0:
    ans = x-k*d
  else:
    ans = abs(x+k*d)
elif k%2 == q%2:
  ans = r
else:
  ans = d - r
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
list = [0]*n
m = int((n-2)**0.5)
for i in range(1, m):
  for j in range(i, m):
    for k in range(j, m):
      if i*i + j*j + k*k + i*j + j*k + k*i <= n:
        if i==j and j == k:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 1
        elif i == j or j == k:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 3
        else:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 6
      else:
        break
for i in range(n):
  print(list[i])

Fixed submission:
n = int(input())
list = [0]*n
if n ==1:
  m = 1
else:
  m = int((n-2)**0.5)
for i in range(1, m):
  for j in range(i, m):
    for k in range(j, m):
      if i*i + j*j + k*k + i*j + j*k + k*i <= n:
        if i==j and j == k:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 1
        elif i == j or j == k:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 3
        else:
          list[i*i + j*j + k*k + i*j + j*k + k*i-1] += 6
      else:
        break
for i in range(n):
  print(list[i])