Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03294 (python)

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

def lcm(a, b):
    return a * b // gcd(a, b)

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

m = 1

for i in a:
    m = lcm(m, i)

m -= 1
ans = 0

for e in a:
    ans += m % e

print(ans)

Buggy submission (verdict: Runtime Error):
import math

def lcm(a, b):
    return a * b // math.gcd(a, b)

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

m = 1

for i in a:
    m = lcm(m, i)

m -= 1
ans = 0

for e in a:
    ans += m % e

print(ans)
Problem p02761 (python)

Fixed submission:
import sys
n, m = map(int, input().split())
num = [-1 for i in range(n)]
for i in range(m):
    s, c = map(int, input().split())
    s -= 1
    if num[s] != -1 and c != num[s]:
        print(-1)
        sys.exit()
    num[s] = c
if num[0] == 0 and n == 1:
    print(0)
elif num[0] == 0:
    print(-1)
elif n == 1 and num[0] == -1:
    print(0)
else:
    num[0] = max(num[0], 1)
    for i in range(1, n):
        num[i] = max(num[i], 0)
    print(''.join([str(i) for i in num]))

Buggy submission (verdict: Runtime Error):
import sys
n, m = map(int, input().split())
num = [-1 for i in range(n)]
for i in range(m):
    s, c = map(int, input().split())
    s -= 1
    if num[s] != -1 and c != num[s]:
        print(-1)
        sys.exit()
    num[s] = c
if num[0] == 0 and n == 1:
    print(0)
elif num[0] == 0:
    print(-1)
elif n == 1 and s[0] == -1:
    print(0)
else:
    num[0] = max(num[0], 1)
    for i in range(1, n):
        num[i] = max(num[i], 0)
    print(''.join([str(i) for i in num]))
Problem p02909 (python)

Fixed submission:
s = input()
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
elif s == 'Rainy':
    print('Sunny')

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split(" "))
liste = [k-q for i in range(n)]
for i in range(q):
    a = int(input())
    liste[a-1] += 1
for i in liste:
    if i > 0:
        print('Yes')
    else:
        print('No')
Problem p02981 (python)

Fixed submission:
n, a, b = map(int, input().split())
print(min(n*a, b))

Buggy submission (verdict: Runtime Error):
l, r = map(int, input().split())
mod = []
for i in range(l, min(r+1,l+2019)):
    mod.append(i % 2019)
mod = sorted(list(mod))
print(mod[0] * mod[1])
Problem p03125 (python)

Fixed submission:
a, b = map(int, input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)

Buggy submission (verdict: Runtime Error):
]
dp[0] = 0
for a in alist:
    match = matches[a]
    for i in range(n - match + 1):
        if dp[i] == -1: continue
        dp[i + match] = max(dp[i + match], dp[i] * 10 + a)
 
print(dp[-1])matches = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
 
n, m = map(int, input().split())
alist = list(map(int, input().split()))
alist.sort(reverse=True)
 
dp = [-1 for _ in range(n + 1)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(999999)
dicte = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
n, m = map(int, input().split())
arr = list(map(int, input().split()))
dp = [-1 for i in range(n+1)]
def cast(a, b):
    return int(str(a)+str(b))
def solve(curn):
    maxi = -1
    if dp[curn] != -1:
        return dp[curn]

    for j in arr:
        if curn - dicte[j] >= 0:
            dp[curn-dicte[j]] = solve(curn-dicte[j])
            if dp[curn-dicte[j]] == None:
                maxi = max(j, maxi)
            else:
                maxi = max(cast(j, dp[curn-dicte[j]]), maxi)
    if maxi == -1:
        return None
    return maxi
print(solve(n))

Buggy submission (verdict: Runtime Error):
import functools
dicte = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
n, m = map(int, input().split())
arr = list(map(int, input().split()))
dp = {}
def cast(a, b):
    return int(str(a)+str(b))
dp = {}
def solve(curn):
    maxi = -1
    if curn in dp:
        return dp[curn]
    if curn in dicte.values():
        for j in arr:
            if curn - dicte[j] == 0:
                maxi = max(j, maxi)
        if maxi == -1:
            return None
        dp[curn] = maxi
        return maxi
    for j in arr:
        if curn - dicte[j] >= 0:
            z = solve(curn-dicte[j])
            if z == None:
                maxi = max(j, maxi)
            else:
                maxi = max(cast(j, solve(curn - dicte[j])), maxi)
    if maxi == -1:
        return None
    dp[curn] = maxi
    return maxi
print(solve(n))
Problem p02732 (python)

Fixed submission:
from collections import Counter

def Comb(n,k):
    comb_ans=1
    for i in range(1,k+1):
        comb_ans*=(n-i+1)/i
    comb_ans=int(comb_ans)
    return comb_ans

N=int(input())
A=list(map(int,input().split()))
C=Counter()
C.update(A)
ans=0
L=[0]*N
for i in range(N):
    L[A[i]-1]+=1
Most=C.most_common()
#print(Most)
for i in range(len(C)):
    ans+=Comb(Most[i][1],2)
for i in range(N):
    pri=ans
    pri=ans-L[A[i]-1]+1
    print(pri)

Buggy submission (verdict: Runtime Error):
def Comb(n,k):
    comb_ans=1
    for i in range(1,k+1):
        comb_ans*=(n-i+1)/i
    comb_ans=int(comb_ans)
    return comb_ans

N=int(input())
A=list(map(int,input().split()))
ans=0
L=[0]*N
for i in range(N):
    L[A[i]-1]+=1
for i in range(len(C)):
    ans+=Comb(L[A[i]-1],2)
for i in range(N):
    pri=ans
    pri=ans-Comb(L[A[i]-1],2)+Comb(L[A[i]-1]-1,2)
    print(pri)
Problem p02741 (python)

Fixed submission:
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51,51]
k=int(input())
k-=1
print(l[k])

Buggy submission (verdict: Runtime Error):
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51,51]
k=int(input())
print(l[k+1])
Problem p02760 (python)

Fixed submission:
A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
B=[int(input()) for i in range(N)]
han=[]
for i in range(3):
    for j in range(3):
        for k in range(N):
            if A[i][j]==B[k]:
                A[i][j]=0
if A[0][0]==A[0][1]==A[0][2]==0 or A[1][0]==A[1][1]==A[1][2]==0 or A[2][0]==A[2][1]==A[2][2]==0:
    print("Yes")
    exit()
if A[0][0]==A[1][0]==A[2][0]==0 or A[0][1]==A[1][1]==A[2][1]==0 or A[0][2]==A[1][2]==A[2][2]==0:
    print("Yes")
    exit()
if A[0][0]==A[1][1]==A[2][2]==0 or A[0][2]==A[1][1]==A[2][0]:
    print("Yes") 
    exit()
print("No")

Buggy submission (verdict: Runtime Error):
A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
B=[int(input()) for i in range(N)]
han=[]
for i in range(3):
    for j in range(3):
        for k in range(N):
            if A[i][j]==B[k]:
                A[i][j]=0
if A[0][0]==A[0][1]==A[0][2]==0 or A[1][0]==A[1][1]==A[1][2]==0 or A[2][0]==A[2][1]==A[2][2]==0:
    print("Yes")
    exit()
if A[0][0]==A[1][0]==A[2][0]==0 or A[0][1]==A[1][1]==A[2][1]==0 or A[0][2]==A[1][2]==A[2][2]==0:
    print("Yes")
    exit()
if A[0][0]==A[1][1]==A[2][2]==0 or A[0][2]==A[1][1]==A[0][3]:
    print("Yes") 
    exit()
print("No")
Problem p02778 (python)

Fixed submission:
s=input()
t=""
for i in range(len(s)):
  t+="x"
print(t)

Buggy submission (verdict: Runtime Error):
s=input()
t=[]
for i in range(len(s)):
  t.sppend(x)
print(t)
Problem p02823 (python)

Fixed submission:
n,a,b=map(int,input().split())
cnt=0
c=100000000000000000
if (b-a)%2 == 0:
  cnt=b-(b+a)//2
  print(cnt)
  exit()
if (b-a)%2 == 1:
    cnt=min(a-1,n-b)+1+((b-a-1)//2)
    print(cnt)
    exit()

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
cnt=0
if (b-a)%2 == 0:
  cnt=round(b-(b+a)/2)
  print(cnt)
  exit()
if (b-a)%2 == 1:
  if a==1:
    if b==n:
        c=n-a
    d=round(1+((b-1)-(((b-1)+a)/2)))
    cnt=min(c,d)
    print(cnt)
    exit()
  if b==n:
    if a==1:
        c=b-1
    d=round(1+(b-(b+a+1)/2))
    cnt=min(c,d)
    print(cnt)
    exit()
  if a-1 >= n-b:
    cnt=round(n-a)
    print(cnt)
    exit()
  if a-1 <= n-b:
    cnt=round(b-1)
    print(cnt)
    exit()

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split()))
cnt=0
if (b-a) != 1:
    while a:
        a+=1
        b-=1
        cnt+=1
        if a == b:
            print(cnt)
            exit()
if (b-a) == 1:
    if a-1 > n-b:
        while a:
            if b != n:
                b+=1
                a+=1
                cnt+=1
            if b == n:
                a+=1
                cnt+=1
            if a == n and b == n:
                print(cnt)
                exit()
    if a-1 < n-b:
        while a:
            if a != 1:
                a-=1
                b-=1
                cnt+=1
            if a == 1:
                b-=1
                cnt+=1
            if a == 1 and b == 1:
                print(cnt)
                exit()
Problem p02841 (python)

Fixed submission:
m,d=map(int,input().split())
s,t=map(int,input().split())
if t==1:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
m,d=map(int,input()split())
s,t=map(int,input()split())
if t==1:
    print(1)
else:
    print(0)
Problem p02886 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(N-1):
    for j in range(i+1,N):
        ans+=A[i]*A[j]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
tako=list(map(int,input().split()))
umami=0
for i in range(n):
  for j in range(i+1,n):
    umami+==tako[i]*tako[j]
print(umami)

Buggy submission (verdict: Runtime Error):
n=int(input())
tako=list(map(int,input().split()))
umami=0
for i in range(n):
  for j in range(i+1,n):
    umami+==tako[i]*tako[j]
print(umami)
Problem p02898 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
K=int(input())
h=list(map(int,input().split()))
for i in range(N):
    if h[i]>=K:
        ans+=1
print(ans)
Problem p02934 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
x=0
for i in range(N):
    x+=1/A[i]
x=1/x
print(x)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=map(int,input().split())
x=0
for i in range(N):
    x+=1/A[i]
x=1/x
print(x)
Problem p03086 (python)

Fixed submission:
s=input()
s+="Z"
ans=0
cnt=0
for i in s:
    if i in ["A","T","C","G"]:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
for i in s:
    if i in ["A","T","C","G"]:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
print(ans)
Problem p03568 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
  if a[i]%2==0:
    cnt+=1
ans=(3**n)-2**cnt
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i range(n):
  if a[i]%2==0:
    cnt+=1
ans=(3*n)-2*cnt
print(ans)
Problem p03574 (python)

Fixed submission:
H,W=map(int,input().split())
field=[["."]*(W+2)]
for i in range(H):
    field.append(["."])
    field[-1].extend(list(input()))
    field[-1].append(".")
field.append(["."]*(W+2))
for i in range(1,H+1):
    for j in range(1,W+1):
        if field[i][j]=="#":
            print("#",end="")
        else:
            cnt=0
            for dy in range(-1,2):
                for dx in range(-1,2):
                    if field[i+dy][j+dx]=="#":
                        cnt+=1
            print(cnt,end="")
    print("")

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
field=[["."]*(W+2)]
for i in range(H):
    field.append(["."])
    field[-1].extend(list(input()))　#ここらへんミスりそうでこわひ
    field[-1].append(".")
field.append(["."]*(W+2))
print(field)
for i in range(1,H+1):
    for j in range(1,W+1):
        if field[i][j]=="#":
            print("#",end="")
        else:
            cnt=0
            for dy in range(-1,2):
                for dx in range(-1,2):
                    if field[i+dy][j+dx]=="#":
                        cnt+=1
            print(cnt,end="")
    print("")
Problem p03854 (python)

Fixed submission:
S=input()
div=["maerd","remaerd","esare","resare"]
S=S[::-1]
judge=True
cnt=0
while cnt<len(S):
    can=False
    for j in range(4):
        d=div[j]
        if S[cnt:len(d)+cnt]==d:
            can=True
            cnt+=len(d)
    if not can:
        judge=False
        break
if judge:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s=input()
di={maerd,remaerd,esare,resare}
s.reverse()
for i in range(len(s)):
  for j in range(4):
    f=False
    t=di[j]
    if s[i:len(t)]==t:
      f=True
      i+=len(t)
  if (not f):
    print("NO")
    exit()
print("YES")
Problem p03860 (python)

Fixed submission:
s=input()
print("A"+s[8]+"C")

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
ans=(b//x)-((a-1)//x)
print(ans)
Problem p02903 (python)

Fixed submission:
h,w,a,b,=map(int,input().split())
ans='No'
if h==1 and b==0:
        ans=['1']*a+['0']*(w-a)
        print(''.join(ans))
elif w==1 and a==0:
        ans=['1']*b+['0']*(h-b)
        for i in ans:
                print(i)
else:
    ans1='0'*a+'1'*(w-a)
    ans2='1'*a+'0'*(w-a)
    for i in range(h):
        if i<=b-1:
            print(ans1)
        else:
            print(ans2)

Buggy submission (verdict: Runtime Error):
h,w,a,b,=map(int,input().split())
ans='No'
if h==1 and b==0:
        ans=['1']*a+['0']*(w-a)
        print(''.join(ans))
elif w==1 and a==0:
        ans=['1']*b+['0']*(h-b)
        for i in ans:
                print(i)
else:
    ans1='0'*a+'1'*(w-a)
    ans2='1'*a_+'0'*(w-a)
    for i in range(h):
        if i<=b-1:
            print(ans1)
        else:
            print(ans2)
Problem p02923 (python)

Fixed submission:
n=int(input())
inf=10*100
h=list(map(int,input().split()))+[inf]
n=len(h)
length=[0]*(n-1)+[1]
cnt=[]
move=0
for i in range(n-1):
    if h[i]<h[i+1]:
        length[i+1]=1
        if i==0:
            length[i]=1
for i in range(1,n):
    if length[i]==0:
        move+=1
    else:
        cnt.append(move)
        move=0
if len(cnt)==0:
    print(n-2)
else:
    print(max(cnt))

Buggy submission (verdict: Runtime Error):
n=int(input())
inf=10*9+7
h=list(map(int,input().split()))+[inf]
n=len(h)
length=[0]*n
cnt=[]
move=0
for i in range(n-1):
    if h[i]<h[i+1]:
        length[i+1]=1
        if i==0:
            length[i]=1
for i in range(1,n):
    if length[i]==0:
        move+=1
    else:
        cnt.append(move)
        move=0
print(max(cnt))

Buggy submission (verdict: Runtime Error):
n=int(input())
inf=10*9+7
h=list(map(int,input().split()))+[inf]
n=len(h)
length=[0]*n
cnt=[]
move=0
for i in range(n-1):
    if h[i]<h[i+1]:
        if i==0:
            length[0]=1
        length[i+1]=1
for i in range(n):
    if length[i]==0:
        move+=1
    else:
        cnt.append(move)
        move=0
print(max(cnt))
Problem p02983 (python)

Fixed submission:
l,r=map(int,input().split())
ans=l*r%2019
for i in range(l,r):
    for j in range(i+1,r+1):
        ans=min(ans,i*j%2019)
        if ans==0:
            break
    if ans==0:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
ans=0
if l%2019>r%2019 or r-l>=2018:
    ans=0
else:
    if l%673>r%673 or r-l>=672:
        ans=0
    else:
        ll=l%2019
        rr=r%2019
        ans=min((rr*((r-1)%2019))%2019,(ll*((l+1)%2019)%2019)
print(ans)
Problem p03007 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
minus=[i for i in a if i<0]
plus=[i for i in a if i>=0]
if len(minus)==0:
    print(a[-1]-a[0]+sum(a[1:n-1]))
    for i in range(n-1):
        if i==n-2:
            print(a[-1],a[n-2])
        else:
            print(a[i],a[i+1])
            a[i+1]=a[i]-a[i+1]
elif len(plus)==0:
    print(a[-1]-a[0]-sum(a[1:n-1]))
    print(a[-1],a[0])
    a[-1]=a[-1]-a[0]
    for i in range(1,n-1):
        print(a[-1],a[i])
        a[-1]-=a[i]
else:
    print(a[-1]-a[0]-sum(minus[1:])+sum(plus[0:-1]))
    for i in range(len(plus)-1):
        print(minus[0],plus[i])
        minus[0]-=plus[i]
    for i in range(len(minus)):
        print(a[-1],minus[i])
        a[-1]-=minus[i]

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
minus=[i for i in a if i<0]
plus=[i for i in a if i>=0]
if len(minus)==0:
    print(a[-1]-a[0]+sum(a[1:n-1]))
    for i in range(n):
        if i==n-2:
            print(a[-1],a[n-2])
        else:
            print(a[i],a[i+1])
            a[i+1]=a[i]-a[i+1]
elif len(plus)==0:
    print(a[-1]-a[0]-sum(a[1:n-1]))
    print(a[-1],a[0])
    a[-1]=a[-1]-a[0]
    for i in range(1,n-1):
        print(a[-1],a[i])
        a[-1]-=a[i]
else:
    print(a[-1]-a[0]-sum(minus[1:-1])+sum(plus[0:-1]))
    for i in range(len(plus)-1):
        print(a[0],plus[i])
        a[0]-=plus[i]
    for i in range(0,len(minus)):
        print(a[-1],minus[i])
        a[-1]-=minus[i]

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
minus=[i for i in a if i<0]
plus=[i for i in a if i>=0]
if len(minus)==0:
    print(a[-1]-a[0]+sum(a[1:n-1]))
    for i in range(n):
        if i==n-2:
            print(a[-1],a[n-2])
        else:
            print(a[i],a[i+1])
            a[i+1]=a[i]-a[i+1]
elif len(plus)==0:
    print(a[-1]-a[0]-sum(a[1:n-1]))
    print(a[-1],a[0])
    a[-1]=a[-1]-a[0]
    for i in range(1,n-1):
        print(a[-1],a[i])
        a[-1]-=a[i]
else:
    print(a[-1]-a[0]-sum(minus[1:-1])+sum(plus[0:-2]))
    for i in range(len(plus)-1):
        print(a[0],plus[i])
        a[0]-=plus[i]
    for j in range(1,len(minus)):
        print(a[-1],minus[i])
        a[-1]-=minus[i]

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
minus=[i for i in a if i<0]
plus=[i for i in a if i>=0]
if len(plus)==0:
    print(a[-1]-a[0]+sum(a[1:n-1]))
    for i in range(n-1):
        if i==n-2:
            print(a[-1],a[n-2])
        else:
            print(a[i],a[i+1])
            a[i+1]=a[i]-a[i+1]
elif len(minus)==0:
    print(a[-1]-a[0]-sum(a[1:-2]))
    print(a[-1],a[0])
    a[-1]=a[-1]-a[0]
    for i in range(1,n-1):
        print(a[-1],a[i])
        a[-1]-=a[i]
else:
    print(a[-1]-a[0]-sum(minus[1:-1])+sum(plus[0:-2]))
    for i in range(len(plus)-1):
        print(a[0],plus[i])
        a[0]-=plus[i]
    for j in range(1,len(minus)):
        print(a[-1],minus[i])
        a[-1]-=minus[i]
Problem p03086 (python)

Fixed submission:
s=list(input())+['Z']
ACGT=['A','C','G','T']
t=[]
count=0
for i in s:
    if i in ACGT:
        count+=1
    else:
        t.append(count)
        count=0

if len(t)==0:
    print(len(s))
else:
    print(max(t))

Buggy submission (verdict: Runtime Error):
s=list(input())
n=len(s)
ACGT=['A','C','G','T']
t=[]
count=0
for i in s:
    if i in ACGT:
        count+=1
    else:
        t.append(count)
print(max(t))
Problem p03103 (python)

Fixed submission:
n,m=list(map(int,input().split(" ")))
l=[]
l=[list(map(int,input().split(" "))) for i in range(n)]
drink=0
price=0
i=0
l.sort(key=lambda x: x[0])
while drink<m:
    pri=l[i][0]
    num=l[i][1]
    i+=1
    drink+=num
    price+=pri*num
if drink>m:
    price-=(drink-m)*pri
print(price)

Buggy submission (verdict: Runtime Error):
N,M=list(map(int,input().split(" ")))
l=[]
l=[list(map(int,input().split(" "))) for i in range(n)]
drink=0
price=0
i=0
l.sort(key=lambda x: x[0])
while drink<M:
    pri=l[i][0]
    num=l[i][1]
    i+=1
    drink+=num
    price+=pri*num
if drink>M:
    price-=(drink-m)*pri
print(price)
Problem p03129 (python)

Fixed submission:
n,k=map(int,input().split())
ans='NO'
if k<=(n+1)//2:
  ans='YES'
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input())
ans='NO'
if k<=(n+1)//2:
  ans='YES'
print(ans)
Problem p03150 (python)

Fixed submission:
s=input()
n=len(s)
k='keyence'
ans='NO'
for i in range(n):
    if s[:i]+s[i+n-7:]==k:
        ans='YES'
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
k=list('keyence')
ans='NO'
cnt=[0]*n
final=0
j=0
for i in range(n):
    if j==n-1:
        break
    if s[i]==k[j]:
        cnt[i]=1
        j+=1
for i in range(n-1):
    if cnt[i]!=cnt[i+1]:
        final+=1
if cnt[0]==0 and final==1:
    ans='YES'
elif cnt[0]==1 and final==2:
    ans='YES'
if n==7 and final==0:
    ans='YES'
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
k=list('keyence')
ans='NO'
cnt=[0]*n
final=0
j=0
for i in range(n):
    if s[i]==k[j]:
        cnt[i]=1
        j+=1
for i in range(n-1):
    if cnt[i]!=cnt[i+1]:
        final+=1
if cnt[0]==0 and final==1:
    ans='YES'
elif cnt[0]==1 and final==2:
    ans='YES'
if n==7 and final==0:
    ans='YES'
print(ans)
Problem p03241 (python)

Fixed submission:
n,m=map(int,input().split())
ans=1
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        if m/i>=n:
            ans=max(ans,i)
        if i>=n:
            ans=max(ans,m//i)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=1
for i in range(1,m**0.5+1):
    if m%i==0:
        if m/i>=n:
            ans=max(ans,i)
        elif i>=n:
            ans=max(ans,m//i)
print(ans)
Problem p03243 (python)

Fixed submission:
N=int(input())
x=list(int(100*i+10*i+i) for i in range(1,10))
y=list(t for t in x if t>=N)
print(min(y))

Buggy submission (verdict: Runtime Error):
N=int(input())
x=list(int(100*i+10*i+i) for i in range(1,9))
y=list(t for t in x if t>=N)
print(min(y))
Problem p03244 (python)

Fixed submission:
import collections
n=int(input())
v=list(map(int,input().split()))
vo=v[0::2]
ve=v[1::2]
co=collections.Counter(vo)
ce=collections.Counter(ve)
cmo=co.most_common()
cme=ce.most_common()
ans=n-cmo[0][1]-cme[0][1]
if cmo[0][0]==cme[0][0]:
    if cmo[0][1]>cme[0][1]:
       if cmo[0][1]!=n//2:
           ans=n-cmo[0][1]-cme[1][1]
    elif cmo[0][1]<cme[0][1]:
        if cme[0][1]!=n//2:
            ans=n-cmo[1][1]-cme[0][1]
    else:
        if cmo[0][1]==n//2:
            ans=n//2
        else:
            ans=n-cmo[0][1]-max(cmo[1][1],cme[1][1])
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
v=list(map(int,input().split()))
vo=v[0::2]
ve=v[1::2]
co=collections.Counter(vo)
ce=collections.Counter(ve)
cmo=co.most_common()
cme=ce.most_common()
ans=n-cmo[0][1]-cme[0][1]
if cmo[0][0]==cme[0][0]:
    if cmo[0][1]>cme[0][1]:
       if cmo[0][1]!=n//2:
           ans=n-cmo[0][1]-cme[1][1]
    elif cmo[0][1]<cme[0][1]:
        if cme[0][1]!=n//2:
            ans=n-cmo[1][1]-cme[0][1]
    else:
        ans=n-cmo[0][1]-max(cmo[1][1],cme[1][1])
print(ans)
Problem p03261 (python)

Fixed submission:
N=int(input())
W=[input() for i in range(N)]
if len(W)!=len(set(W)):
    print('No')
    exit()
for i in range(len(W)-1):
       if W[i][-1]!=W[i+1][0]:
          print('No')
          exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
N=int(input())
W=[input() for i in range(N)]
if len(W)!=len(set(W)):
    print('No')
    exit()
for i in range(len(W)-1):
       if W[i][-1]==W[i+1][0]:
          ans='Yes'
print(ans)
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce
n,x=map(int,input().split())
y=list(map(int,input().split()))
def gcd(num):
    return reduce(fractions.gcd, num)
ya=[abs(y[i]-x) for i in range(n)]
print(gcd(ya))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from functools import reduce
n,x=map(int,input().split())
y=list(map(int,input().split()))
def gcd(num):
    return reduce(fractions.gcd, num)
ya=[abs(y[i]-x) for i in range(n)]
print(gcd(ya))
Problem p03323 (python)

Fixed submission:
A,B=map(int,input().split())
if A>8 or B>8:
    print(':(')
else:
    print('Yay!')

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
count=0
for i in a:
    while i%2==0:
        i/=2
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
count=0
for i in a:
    while b%2==0:
        b/=2
        count+=1
print(count)