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

Fixed submission:
from operator import itemgetter as ite

n,m=map(int,input().split())
A=list(map(int,input().split()))
BC=[]
for i in range(m):
    BC.append(list(map(int,input().split())))
A.sort()
BC.sort(key=ite(1),reverse=True)

k=0
cnt=0

for i in range(n):
    if A[i]<BC[k][1]:
        A[i]=BC[k][1]
        cnt+=1
        if cnt==BC[k][0]:
            k+=1
            cnt=0
            if k==len(BC):
                break
    else:
        break

ans=sum(A)
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
n,m=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

def bin_ser(x):
    l=-1
    r=n+1
    while r-l>1:
        i=(l+r)//2
        
        if A[i]==x:
            return i
        
        if A[i]<x:
            l=i
        else:
            r=i
            
    return i

for i in range(m):
    B,C=map(int,input().split())
    k=bin_ser(C)
    for j in range(min(B,k)):
        A.insert(k,C)
        A.pop(0)

print(sum(A))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
n,m=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

def bin_ser(x):
    l=-1
    r=n+1
    while r-l>1:
        i=(l+r)//2
        
        if A[i]==x:
            return i
        
        if A[i]<x:
            l=i
        else:
            r=i
            
    return i

for i in range(m):
    B,C=map(int,input().split())
    k=bin_ser(C)
    for j in range(min(B,k)):
        A.insert(k,C)
        A.pop(0)

print(sum(A))
Problem p03053 (python)

Fixed submission:
h,w=map(int,input().split())
INF=10**10
a=[[INF for i in range(w)] for j in range(h)]
ans=0
for i in range(h):
    s=input()
    for j in range(w):
        if s[j]=="#":
            a[i][j]=0
            
for i in range(h):
    for j in range(w):
        k=a[i][j]+1

        if i!=h-1:
            if k<a[i+1][j]:
                a[i+1][j]=k
        if j!=w-1:
            if k<a[i][j+1]:
                a[i][j+1]=k

for i in range(h):
    for j in range(w):
        k=a[-1-i][-1-j]+1
        if i!=h-1:
            if k<a[-i-2][-j-1]:
                a[-i-2][-j-1]=k

        if j!=w-1:        
            if k<a[-i-1][-j-2]:
                a[-i-1][-j-2]=k

for i in range(h):
    ans=max(ans,max(a[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
h,w=map(int,input().split())
INF=10**10
a=[[INF for i in range(w)] for j in range(h)]
for i in range(h):
    s=input()
    for j in range(w):
        if s[j]=="#":
            a[i][j]=0
for i in range(h):
    for j in range(w):
        k=a[i][j]+1

        if i!=h-1:
            if k<a[i+1][j]:
                a[i+1][j]=k

        if j!=w-1:
            if k<a[i][j+1]:
                a[i][j+1]=k

for i_ in range(h):
    for j_ in range(w):
        i=h-1-i_
        j=w-1-j_
        k=a[i][j]+1
        if i!=0:
            if k<a[i-1][j]:
                a[i-1][j]=k

        if j!=0:        
            if k<a[i][j-1]:
                a[i][j-1]=k


arr=np.array(a)
ans=arr.max()
print(ans)
Problem p03054 (python)

Fixed submission:
H,W,n=map(int,input().split())
h,w=map(int,input().split())
s=list(input())
t=list(input())
sr=0
sl=0
su=0
sd=0
tr=0
tl=0
tu=0
td=0

rl=W-w
ll=w-1
ul=h-1
dl=H-h
nr=w
nl=w
nu=h
nd=h
ans="YES"

for i in range(n):
    if s[i]=="R":
        nr+=1
        sr+=1
    if s[i]=="L":
        nl-=1
        sl+=1
    if s[i]=="U":
        nu+=1
        su+=1
    if s[i]=="D":
        nd-=1
        sd+=1
    if i!=0:
        if t[i-1]=="R":
            nl+=1
            if -lp<rl:
                tr+=1
        if t[i-1]=="L":
            nr-=1
            if -rp<ll:
                tl+=1
        if t[i-1]=="U":
            nd+=1
            if -dp<ul:
                tu+=1
        if t[i-1]=="D":
            nu-=1
            if -up<dl:
                td+=1
    rp=sr-tl
    lp=sl-tr
    up=su-td
    dp=sd-tu
    
    if rl<rp or ll<lp or ul<up or dl<dp:
        ans="NO"
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
h,w=map(int,input().split())
INF=10**10
a=[[INF for i in range(w)] for j in range(h)]
for i in range(h):
    s=input()
    for j in range(w):
        if s[j]=="#":
            a[i][j]=0
for i in range(h):
    for j in range(w):
        k=a[i][j]+1

        if i!=h-1:
            if k<a[i+1][j]:
                a[i+1][j]=k

        if j!=w-1:
            if k<a[i][j+1]:
                a[i][j+1]=k

for i_ in range(h):
    for j_ in range(w):
        i=h-1-i_
        j=w-1-j_
        k=a[i][j]+1
        if i!=0:
            if k<a[i-1][j]:
                a[i-1][j]=k

        if j!=0:        
            if k<a[i][j-1]:
                a[i][j-1]=k


arr=np.array(a)
ans=arr.max()
print(ans)
Problem p03107 (python)

Fixed submission:
nums=str(input())
arr=list(map(int,nums))
l=len(arr)
a=0
i=0
while i<len(arr)-1:
    if i<0:
        i=0
    if arr[i]!=arr[i+1]:
        del arr[i:i+2]
        #print(arr)
        a+=2
        i-=2
    i+=1
print(a)

Buggy submission (verdict: Runtime Error):
nums=str(input())
arr=list(map(int,nums))
l=len(arr)
a=0
i=0
while i<len(arr)-1:
    if arr[i]!=arr[i+1]:
        del arr[i:i+2]
        #print(arr)
        a+=2
        i-=2
    i+=1
print(a)
Problem p03137 (python)

Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
w=[[] for i in range(m-1)]
for i in range(m-1):
    w[i]=[x[i],x[i+1]-x[i]]
w=sorted(w,key=lambda y:y[1])
w.reverse()
skip=[]
if m!=1:
    for i in range(n-1):
        skip.append(w[i])
        if i==m-2:
            break
            
    skip=sorted(skip,key=lambda y:y[0])
ans=[]
k=x[0]
for i in skip:
    ans.append(i[0]-k)
    k=i[0]+i[1]
ans.append(x[m-1]-k)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
w=[[] for i in range(m-1)]
for i in range(m-1):
    w[i]=[x[i],x[i+1]-x[i]]
w=sorted(w,key=lambda y:y[1])
w.reverse()
skip=[]
if m!=1:
    for i in range(n-1):
        skip.append(w[i])
    skip=sorted(skip,key=lambda y:y[0])
ans=[]
k=x[0]
for i in skip:
    ans.append(i[0]-k)
    k=i[0]+i[1]
ans.append(x[m-1]-k)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
w=[[] for i in range(m-1)]
for i in range(m-1):
    w[i]=[x[i],x[i+1]-x[i]]
w=sorted(w,key=lambda y:y[1])
w.reverse()
skip=[]
for i in range(n-1):
    skip.append(w[i])
skip=sorted(skip,key=lambda y:y[0])
ans=[]
k=x[0]
for i in skip:
    ans.append(i[0]-k)
    k=i[0]+i[1]
ans.append(x[m-1]-k)
print(sum(ans))
Problem p03242 (python)

Fixed submission:
num=input()
num_str=list(num)
lengh=len(num_str)
tmp=num_str
for i in range(lengh):
    if num_str[i]=="1":
        tmp[i]="9"
    elif num_str[i]=="9":
        tmp[i]="1"
ans="".join(tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
arr=input().split(" ")
arr_s=set(arr)
a=0
arr_e=[0 for i in range(int(n/2))]
arr_o=[0 for i in range(int(n/2))]
for i in range(int(n/2)):
    arr_e[i]=arr[a]
    arr_o[i]=arr[a+1]
    a+=2
ce=collections.Counter(arr_e).most_common()
co=collections.Counter(arr_o).most_common()
if len(arr_s)==1:
    print(int(n/2))
else:
    if ce[0][0]!=co[0][0]:
        print(n-ce[0][1]-co[0][1])
    else:
        print(n-max(ce[0][1]+co[1][1],ce[1][1]+co[0][1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=input().split(" ")
arr_s=set(arr)
#print(arr)
a=0
most_e=0
most_o=0
arr_e=[0 for i in range(int(n/2))]
arr_o=[0 for i in range(int(n/2))]
for i in range(int(n/2)):
    arr_e[i]=arr[a]
    arr_o[i]=arr[a+1]
    a+=2
#print(arr_e,arr_o)
arr_es=set(arr_e)
arr_os=set(arr_o)
#print(arr_es,arr_os)

for i in arr_es:
    cnt_e=arr_e.count(i)
    if cnt_e>most_e:
        most_e=cnt_e
        if cnt_e>=n/4:
            break
        
for i in arr_os:
    cnt_o=arr_o.count(i)
    if cnt_o>most_o:
        most_o=cnt_o
        if cnt_o>=n/4:
            break

#print(most_e,most_o)
if len(arr_s)==1:
    print(int(n/2))
else:
    print(n-most_e-most_o)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
arr=input().split(" ")
arr_s=set(arr)
if len(arr_s)==1:
    print(int(n/2))
    sys.exit()
#print(arr)
a=0
most_e=0
most_o=0
arr_e=[0 for i in range(int(n/2))]
arr_o=[0 for i in range(int(n/2))]
for i in range(int(n/2)):
    arr_e[i]=arr[a]
    arr_o[i]=arr[a+1]
    a+=2
#print(arr_e,arr_o)
arr_es=set(arr_e)
arr_os=set(arr_o)
#print(arr_es,arr_os)

for i in arr_es:
    cnt_e=arr_e.count(i)
    if cnt_e>most_e:
        most_e=cnt_e
        
for i in arr_os:
    cnt_o=arr_o.count(i)
    if cnt_o>most_o:
        most_o=cnt_o

#print(most_e,most_o)
else:
    print(n-most_e-most_o)
Problem p03804 (python)

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

A=[]
B=[]

for i in range(N):
    A.append(list(input()))
    
for i in range(M):
    B.append(list(input()))

k=N-M+1
ans=False

for i in range(k):
    for j in range(k):
        flg=True
        
        for p in range(M):
            for q in range(M):
                if A[i+p][j+q] != B[p][q]:
                    flg=False
                    
        ans=flg
        if ans:
            break
    if ans:
        break

if ans:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N,M=map(int,input().split())
picN=[]
picM=[]

for i in range(N):
    L=list(input())
    picN.append(L)

for i in range(M):
    L=list(input())
    picM.append(L)

K=N-M

for i in range(K):
    for j in range(K):
        flg=True
        for a in range(M):
            for b in range(M):
                if picN[a+i][b+j]!=picM[a][b]:
                    flg=False
        if flg:
            break
if flg:
    print("YES")
else:
    print("NO")
Problem p02753 (python)

Fixed submission:
s=input()
if s=="AAA" or s=="BBB":
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s=input()
if s=="AAA" or s="BBB":
  print('No')
else:
  print('Yes')
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())
if (a!=b and b!=c and c!=a) or (a==b and b==c):
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input())
if (a!=b and b!=c and c!=a) or (a==b and b==c):
  print('No')
else:
  print('Yes')
Problem p02550 (python)

Fixed submission:
N,X,M=map(int,input().split())
A = [X,]
setA = {X,}
alast=X
flag=False
for i in range(min(N-1,M)):
    P=alast**2%M
    if P in setA:
        flag=True
        d = A.index(P)
        C=A[d:]
        alast=P
        break
    else:
        A.append(P)
        setA.add(P)
        alast=P
if flag:
    if alast==0:
        ans = sum(A)
    else:
        res = (N-d)%len(C)
        ans = sum(A[:d])+((N-d)//len(C))*sum(C) + sum(C[:res])
else:
    ans = sum(A) 
print(ans)

Buggy submission (verdict: Runtime Error):
N,X,M=map(int,input().split())
A = [X,]
setA = {A,}
alast=X
flag=False
for i in range(min(N-1,M)):
    P=alast**2%M
    if P in setA:
        flag=True
        d = A.index(P)
        C=A[d:]
        alast=P
        break
    else:
        A.append(P)
        setA.add(P)
        alast=P
if alast==0:
    print(sum(C))
elif (flag==False) and (alast!=0):
    print(sum(A))
else:
    suma=sum(C)
    res = (N-d)%len(C)
    print(sum(A[:d])+((N-d)//len(C))*suma + sum(C[:res]))
Problem p02571 (python)

Fixed submission:
S,T=open(0).read().split()
score = 0
for i in range(len(S)-len(T)+1):
    score=max(score,sum([T[k]==S[i+k] for k in range(len(T))]))
print(len(T)-score)

Buggy submission (verdict: Runtime Error):
S,T=open(0).read().split()
def main():
    for i in range(1,len(T)+1):
        for j in range(i+1):
            print(T[j:(len(T)-i+j)], S[j:(len(S)-i+j)])
            if T[j:(len(T)-i+j)] in S[j:(len(S)-i+j)]:
                return i
                break
if T in S:
    print(0)
else:
    print(main())
Problem p02577 (python)

Fixed submission:
S=input()
n=0
for s in S:
  n+=int(s)
print("Yes" if n%9==0 else "No")

Buggy submission (verdict: Runtime Error):
print("Yes" if int(input())%9==o else "No")
Problem p02595 (python)

Fixed submission:
import math
N,D=map(int,input().split())
ans=0
for _ in range(N):
  p,q=map(int,input().split())
  if math.sqrt(p**2+q**2)<=D:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import sqrt
N,D=map(int,input())
ans=0
for _ in range(N):
  p,q=map(int,input().split())
  if math.sqrt(p**2+q**2)<=D:
    ans+=1
print(ans)
Problem p02629 (python)

Fixed submission:
N=int(input())
keta=1
a=26
ans=""
while N>0:
  N-=1
  ans+=chr(ord('a')+N%26)
  N=N//26
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
keta=1
a=26
while N>a:
  a*=26
  keta+=1
ans=""
for i in range(keta-1,0,-1):
  a=N//(26**i)-1
  N=N%(26**i)
  ans+=chr(ord('a')+a)
ans+=chr(ord('a')+N//(26**i))
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
keta=1
a=26
while N>a:
  a*=26
  keta+=1
ans=""
for i in range(keta-1,0,-1):
  a=N//(26**i)-1
  N=N%(26**i)
  ans+=chr(ord('a')+a)
ans+=chr(ord('a')+N//(26**i))
print(ans)
Problem p02633 (python)

Fixed submission:
import math
n=int(input())
a=360/n
b=a-360//n
print(int(n*360/math.gcd(n,360)/n))

Buggy submission (verdict: Runtime Error):
a=360/n
b=a-360//n
print(int(n*360/math.gcd(n,360)/n))
Problem p02688 (python)

Fixed submission:
N,K=map(int,input().split())
s={i+1 for i in range(N)}
t=set()
for i in range(K):
  input()
  t|=set(map(int,input().split()))
print(len(s-t))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
s={i+1 for i in range(N)}
t={}
for i in range(K):
  input()
  t|=set(map(int,input().split()))
print(len(s-t))
Problem p02693 (python)

Fixed submission:
K=int(input())
A,B=map(int,input().split())
n=A//K
print("OK" if A<=K*n<=B or K*(n+1)<=B else "NG")

Buggy submission (verdict: Runtime Error):
K=int(input().split())
A,B=map(int,input().split())
n=A//K
print("OK" if A<=K*n<=B or K*(n+1)<=B else "NG")
Problem p02725 (python)

Fixed submission:
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
p = A[-1]-K
for a in A:
  l.append(a-p)
  p=a
print(sum(l)-max(l))

Buggy submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
p = A[-1]-K
for a in A:
  l.append(a-l)
  p=a
print(sum(l)-max(l))
Problem p02762 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1]*n
        self.rank = [0]*n

    def find(self, x):
        if self.par[x-1] < 0:
            return x
        else:
            self.par[x-1] = self.find(self.par[x-1])
            return self.par[x-1]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        elif self.rank[x-1] > self.rank[y-1]:
            self.par[x-1] += self.par[y-1]
            self.par[y-1] = x
        else:
            self.par[y-1] += self.par[x-1]
            self.par[x-1] = y
            if self.rank[x-1] == self.rank[y-1]:
                self.rank[y-1] += 1

    def same(self, x, y):
        return self.find(x)==self.find(y)

    def count(self, x):
        return -self.par[self.find(x)-1]

from collections import deque

N,M,K=map(int,input().split())
U=UnionFind(N)
q=deque([])
for _ in range(M):
  a,b=map(int,input().split())
  U.union(a,b)
  deque.append(q,(a,b))
G=[set([]) for _ in range(N)]
for _ in range(M):
  a,b=deque.pop(q)
  if U.same(a,b):
    G[a-1].add(b)
    G[b-1].add(a)
for _ in range(K):
  a,b=map(int,input().split())
  if U.same(a,b):
    G[a-1].add(b)
    G[b-1].add(a)
ans=[0]*N
for i in range(1,N+1):
  ans[i-1]=U.count(i)-len(G[i-1])-1
print(*ans)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n=n
        self.par = [i for i in range(1,n+1)]

    def find(self, x):
        if self.par[x-1] == x:
            return x
        else:
            self.par[x-1] = self.find(self.par[x-1])
            return self.par[x-1]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        else:
            self.par[y-1]=x

    def same(self, x, y):
        return self.find(x)==self.find(y)

N,M,K=map(int,input().split())
U=UnionFind(N)
F=[set() for _ in range(N)]
B=[set() for _ in range(N)]
for _ in range(M):
  a,b=map(int,input().split())
  U.union(a,b)
  F[a-1].add(b)
  F[b-1].add(a)
for _ in range(K):
  a,b=map(int,input().split())
  B[a-1].add(b)
  B[b-1].add(a)
G={}
for i in range(1,N+1):
  x = U.find(i)
  if x in G:
    G[x].add(i)
  else:
    G[x]={i}
ans=[0]*N
for g in G.values():
  for i in g:
    ans[i-1]=len(g-F[i-1]-B[i-1])-1
print(*ans)

Buggy submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
G=[]
F=[set([]) for _ in range(N)]
B=[set([]) for _ in range(N)]
for _ in range(M):
  a,b=map(int,input().split())
  F[a-1].add(b)
  F[b-1].add(a)
  p,i=True,0
  for g in G:
    if a in g and b in g:
      i+=1
    elif (a in g or b in g) and p:
      g|={a,b}
      p=False
    elif a in g or b in g:
      G[j]|=g|{a,b}
      G.remove(g)
  if p:
    G.append({a,b})
for _ in range(K):
  a,b=map(int,input().split())
  B[a-1].add(b)
  B[b-1].add(a)
ans=[0]*N
for g in G:
  for i in g:
    ans[i-1]=len(g-F[i-1]-B[i-1]-{i})
print(*ans)
Problem p02779 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
S=set(A)
print("YES" if len(A)==len(S) else "NO")

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input()))
S=set(A)
print("YES" if len(A)==len(S) else "NO")

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input()))
B=[]
p=True
for a in A:
  if a in B:
    p = False
    break
  else:
    B.append(a)
print("Yes" if p else "No")
Problem p02819 (python)

Fixed submission:
def is_prime(x):
  if x <= 1: return false
  i=2
  while i*i <= x:
    if not x%i: return False
    i+=1
  return True
 
X=int(input())
while not is_prime(X):
  X+=1
print(X)

Buggy submission (verdict: Runtime Error):
def is_prime(int x):
  if x <= 1: return false
  int i=2
  while i*i <= x:
    if x%i: return False
    i+=1
  return True

X=int(input())
while is_prime(X):
  X+=1
print(X)
Problem p02829 (python)

Fixed submission:
L=[int(input()),int(input())]
if not 1 in L:
  print(1)
elif not 2 in L:
  print(2)
else:
  print(3)

Buggy submission (verdict: Runtime Error):
A=[int(input()),int(input())]
if not 1 in A:
  print(1)
elif not 2 in A:
  print(2)
else not 3 in A:
  print(3)
Problem p02836 (python)

Fixed submission:
S=input()
s=0
for i in range(len(S)//2):
	if S[i] != S[-i-1]: s+=1
print(s)

Buggy submission (verdict: Runtime Error):
S=input()
s=0
for i in range(len(S)//2)
	if S[i] != S[-i-1]: s+=1
print(s)
Problem p02948 (python)

Fixed submission:
import heapq

N,M = map(int, input().split())
jobs = [[] for _ in range(M)]
for _ in range(N):
    a,b = map(int, input().split())
    if a <= M: jobs[a-1].append(b)
h=[]
rsl=0
for i in range(M):
    for j in jobs[i]:
        heapq.heappush(h, -j)
    if len(h) > 0:
        rsl += -heapq.heappop(h)
print(rsl)

Buggy submission (verdict: Runtime Error):
n = int(input())
sl = []
for _ in range(n):
    sl.append(input())
rl=[[0 for _ in range(26)] for _ in range(n)]
for i in range(n):
    for c in sl[i]:
        a=ord(c)-ord('a')
        rl[i][a]+=1
rslt=0
for i in range(n-1):
    for j in range(i+1,n):
        if rl[i] == rl[j]: rslt+=1
print(rslt)
Problem p02989 (python)

Fixed submission:
n=int(input())
d=list(map(int,input().split()))
d.sort()
print(d[n//2]-d[n//2-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
d.sorted()
print(d[n/2]-d[n/2-1])
Problem p02990 (python)

Fixed submission:
def make_comb_dp(n):
    dp = [[0] * (n + 1) for i in range(n + 1)]
    for i in range(n + 1):
        dp[i][0] = 1
        dp[i][i] = 1
    for i in range(2, n + 1):
        for j in range(1, i):
            dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]
    return dp

mod=10**9+7
N,K=map(int,input().split())
C=make_comb_dp(N)
for i in range(1,K+1):
    print(int(C[N+1-K][i]*C[K-1][i-1])%mod)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

mod=10**9+7
N,K=map(int,input().split())
for i in range(1,K+1):
    print(int(cmb(N+1-K,i)*cmb(K-1,i-1))%mod)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
mod=10**9+7
N,K=map(int,input().split())
for i in range(1,K+1):
    print(int(comb(N+1-K,i)*comb(K-1,i-1))%mod)
Problem p03012 (python)

Fixed submission:
N=int(input())
S=list(map(int, input().split()))
A=[]
for i in range(1,N):
  A.append(abs(sum(S[:i])-sum(S[i:])))
print(min(A) if not A==[] else abs(S[0]-S[1]))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(map(int, input().split()))
A=[]
for i in range(1,N-1):
  A.append(abs(S[:i]-S[i:]))
print(min(A))
Problem p03013 (python)

Fixed submission:
MOD=10**9+7
N,M=map(int,input().split())
A=[int(input()) for _ in range(M)]
L=[-1 for _ in range(N)]
p=0
if A == []:
  A=[0]
if 1 == A[p]:
  L[0] = 0
  if p < M-1:
    p +=1
else:
  L[0] = 1
if N>1:
  if 2 == A[p]:
    L[1] = 0
    if p < M-1:
      p+=1
  else:
    L[1]=L[0]+1
for i in range(2,N):
  if i+1 == A[p]:
    L[i] = 0
    if p < M-1:
      p+=1
  else:
    L[i]=L[i-1]+L[i-2]
print(L[-1]%MOD)

Buggy submission (verdict: Runtime Error):
MOD=10**9+7
N,M=map(int,input().split())
A=[int(input()) for _ in range(M)]
L=[-1 for _ in range(N)]
p=0
if 1 == A[p]:
  L[0] = 0
  if p < M-1:
    p +=1
else:
  L[0] = 1
if N>1:
  if 2 == A[p]:
    L[1] = 0
    if p < M-1:
      p+=1
  else:
    L[1]=L[0]+1
for i in range(2,N):
  if i+1 == A[p]:
    L[i] = 0
    if p < M-1:
      p+=1
  else:
    L[i]=L[i-1]+L[i-2]
print(L[-1]%MOD)
Problem p03036 (python)

Fixed submission:
x,D,xx=map(int,input().split())
for i in range(10):
  xx = x*xx-D
  print(xx)

Buggy submission (verdict: Runtime Error):
x,D,xx=map(int,input().split())
for i for range(10):
  xx = x*xx-D
  print(xx)
Problem p03209 (python)

Fixed submission:
N,X=map(int,input().split())
a=[1]
p=[1]
for i in range(N):
    a.append(a[i]*2+3)
    p.append(p[i]*2+1)

def f(n,x):
    if n==0:
        return 0 if x<=0 else 1
    if x<=a[n-1]+1:
        return f(n-1,x-1)
    return p[n-1]+f(n-1,x-a[n-1]-2)+1
print(f(N,X))

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
a=[1]
p=[1]
for i in range(N):
    a.append(a[i]*2+3)
    p.append(p[i]*2+1)

def f(n,x):
    if x==1:
        return 0
    if x<=a[n-1]+1:
        return f(n-1,x-1)
    return p[n-1]+f(n-1,x-a[n-1]-2)+1
print(f(N,X))
Problem p02552 (python)

Fixed submission:
x = int(input())

if x == 1:
    print(0)
elif x == 0:
    print(1)

Buggy submission (verdict: Runtime Error):
1x = int(input())

if x == 1:
    print(0)
else:
    print(1)
Problem p02571 (python)

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

ans = 0
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cnt += 1
    ans = max(ans,cnt)

print(len(t)-ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

ans = 0
for i in range(s-t+1):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cnt += 1
    ans = max(ans,cnt)

print(len(t)-ans)
Problem p02629 (python)

Fixed submission:

n = int(input())

alphabet = [chr(i) for i in range(ord('a'), ord('z')+1)]

ans = ''
while n > 0:
    n -= 1
    ans += alphabet[n%26]
    n = n//26

print(ans[::-1])

Buggy submission (verdict: Runtime Error):

n = int(input())

alphabet = [chr(i) for i in range(ord('a'), ord('z')+1)]

alphabet.insert(0,0)

ans = ''
while n > 0:
    ans += alphabet[n%26]
    n = n//26

print(ans[::-1])
Problem p02595 (python)

Fixed submission:
n, d=map(int, input().split())
cnt=0

for i in range(n):
    x, y=map(int, input().split())
    tmp=(x**2 +y**2)**0.5
    if tmp<=d:
        cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
n, d=map(int, input().split())
cnt=0

for i in range(n):
    x, y=map(int, input().split())
    tmp=x**2 + y**2
    if tmp<=d**2z:
        cnt+=1

print(cnt)