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

Fixed submission:
n,m = map(int, input().split())
div = 1000000007
ok = [True] * (n + 1)
for _ in range(m):
  a = int(input())
  ok[a] = False
dp = [0] * (n + 1)
dp[0] = 1
if ok[1]:
  dp[1] = 1
else:
  dp[1] = 0

for i in range(2, n+1):
  if ok[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= div

print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
div = 1000000007
ok [True] * (n + 1)
for _ in range(m):
  a = int(input())
  ok[a] = False
dp = [0] * (n + 1)
dp[0] = 1
if ok[1]:
  dp[1] = 1
else:
  dp[1] = 0

for i in range(2, n+1):
  if ok[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= div

print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
div = 1000000007
ok [True] * n + 1
for _ in range(m):
  a = int(input())
  ok[a] = False
dp = [0] * (n + 1)
dp[0] = 1
if ok[1]:
  dp[1] = 1
else:
  dp[1] = 0

for i in range(2, n+1):
  if ok[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= div

print(dp[n])

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
div = 1000000007
ok [True] * n
for _ in range(m):
  a = int(input())
  ok[a] = False
dp = [0] * (n + 1)
dp[0] = 1
if ok[1]:
  dp[1] = 1
else:
  dp[1] = 0

for i in range(2, n+1):
  if ok[i]:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= div

print(dp[n])
Problem p03072 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
count = 0
for i in range(n):
  if i == 0:
    count += 1
  else:
    if h[i] >= max(h[:i]):
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import math
n,d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]
ans = 0

for i in range(n):
  for j in range(i+1,n):
    temp = 0
    for k in range(d):
      temp += (x[i][k] - x[j][k]) ** 2
    l = math.sqrt(temp)
    if l.is_integer():
      ans += 1
print(ans)
Problem p03073 (python)

Fixed submission:
s = list(int(x) for x in input())
n = len(s)
ans = []
#s[0]固定
count = 0
if n >= 3:
  if s[0] == s[1]:
    count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] != s[0]:
    count += 1
  elif i%2 == 1 and s[i] == s[0]:
    count += 1
ans.append(count)
#s[0]変更
count = 1
if n >= 3:
  if s[0] != s[1]:
    count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] == s[0]:
    count += 1
  elif i%2 == 1 and s[i] != s[0]:
    count += 1
ans.append(count)

if n == 1:
  print(0)
elif n == 2:
  if s[0] == s[1]:
    print(1)
  else:
    print(0)
else:
  print(min(ans))

Buggy submission (verdict: Runtime Error):
s = list(int(x) for x in input())
n = len(s)
ans = []
#s[0]固定
count = 0
if s[0] == s[1]:
  count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] != s[0]:
    count += 1
  elif i%2 == 1 and s[i] == s[0]:
    count += 1
ans.append(count)
#s[0]変更
count = 1
if s[0] != s[1]:
  count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] == s[0]:
    count += 1
  elif i%2 == 1 and s[i] != s[0]:
    count += 1
ans.append(count)

if n == 1:
  print(0)
elif n == 2:
  if s[0] == s[1]:
    print(1)
  else:
    print(0)
else:
  print(min(ans))
Problem p03272 (python)

Fixed submission:
n,i = map(int, input().split())
print(n - i + 1)

Buggy submission (verdict: Runtime Error):
n,i = map(int, input())
print(n - i + 1)
Problem p03315 (python)

Fixed submission:
s = input()
ans = 0
for i in s:
  if i == "+":
    ans += 1
  else:
    ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
for i in s:
  if i = "+":
    ans += 1
  else:
    ans -= 1
print(ans)
Problem p03705 (python)

Fixed submission:
N,A,B=map(int,input().split())
 
if N==1:
  if A==B:
    print(1)
  else:
    print(0)
elif A==B:
  print(1)
elif A>B:
  print(0)
else:
  print(B*(N-2)-A*(N-2)+1)

Buggy submission (verdict: Runtime Error):
import itertools
import sys
 
N,A,B=map(int,input().split())
ans=set()
 
if A>B:
  print(0)
  sys.exit()
elif N==1:
  if A==B:
    print(1)
    sys.exit()
  else:
    print(0)
    sys.exit()
elif N==2:
  print(1)
  sys.exit()
else:
  for x in itertools.combinations_with_replacement(range(A,B+1),N-2):
    if x in ans:
      continue
    ans.add(sum(x))
 
print(len(ans))

Buggy submission (verdict: Runtime Error):
import itertools

N,A,B=map(int,input().split())
ans=set()

if A>B:
  print(0)
elif N==1:
  if A==B:
    print(1)
  else:
    print(0)
elif N==2:
  print(1)
else:
  for x in itertools.combinations_with_replacement(range(A,B+1),N-2):
    if x in ans:
      continue
    ans.add(sum(x))

print(len(ans))
Problem p03745 (python)

Fixed submission:
import sys

N=int(input())
A=list(map(int,input().split()))
div_flg=False
inc_flg=False
dec_flg=False
ans=0

if N==1:
  print(1)
  sys.exit()
  
for i in range(N):
  if inc_flg:
    if i==N-1:
      break
    if A[i]<=A[i+1]:
      continue
    else:
      inc_flg=False
      div_flg=False
  elif dec_flg:
    if i==N-1:
      break
    if A[i]>=A[i+1]:
      continue
    else:
      dec_flg=False
      div_flg=False
  else:
    if i==0:
      ans+=1
      div_flg=True
    elif i==N-1:
      if not div_flg:
        ans+=1
      break
    if A[i]==A[i+1]:
      if not div_flg:
        ans+=1
      div_flg=True
      continue
    elif A[i]<A[i+1]:
      if not div_flg:
        ans+=1
      inc_flg=True
      continue
    elif A[i]>A[i+1]:
      if not div_flg:
        ans+=1
      dec_flg=True
      continue
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
div_flg=False
inc_flg=False
dec_flg=False
ans=0

for i in range(N):
  if inc_flg:
    if i==N-1:
      break
    if A[i]<=A[i+1]:
      continue
    else:
      inc_flg=False
      div_flg=False
  elif dec_flg:
    if i==N-1:
      break
    if A[i]>=A[i+1]:
      continue
    else:
      dec_flg=False
      div_flg=False
  else:
    if i==0:
      ans+=1
      div_flg=True
    elif i==N-1:
      if not div_flg:
        ans+=1
      break
    if A[i]==A[i+1]:
      if not div_flg:
        ans+=1
      div_flg=True
      continue
    elif A[i]<A[i+1]:
      if not div_flg:
        ans+=1
      inc_flg=True
      continue
    elif A[i]>A[i+1]:
      if not div_flg:
        ans+=1
      dec_flg=True
      continue
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
div_flg=False
inc_flg=False
dec_flg=False
ans=0

for i in range(N):
  if inc_flg:
    if i==N-1:
      break
    if A[i]<=A[i+1]:
      continue
    else:
      inc_flg=False
      div_flg=False
  elif dec_flg:
    if i==N-1:
      break
    if A[i]>=A[i+1]:
      continue
    else:
      dec_flg=False
      div_flg=False
  else:
    if i==0:
      ans+=1
      div_flg=True
    elif i==N-1:
      ans+=1
      break
    if A[i]==A[i+1]:
      ans+=1
      div_flg=True
      continue
    elif A[i]<A[i+1]:
      if not div_flg:
        ans+=1
      inc_flg=True
      continue
    elif A[i]>A[i+1]:
      if not div_flg:
        ans+=1
      dec_flg=True
      continue
print(ans)
Problem p03785 (python)

Fixed submission:
import bisect
import sys

N,C,K=map(int,input().split())
T=[int(input()) for _ in range(N)]
T.sort()
ans=0
i=0

if T[0]+K>=T[-1]:
  if N%C==0:
    print(N//C)
  else:
    print(N//C+1)
  sys.exit()
else:
  while True:
    t=bisect.bisect_right(T,T[i]+K)
    if t-i>C:
      i+=C
    else:
      i=t
    ans+=1
    if i==N-1:
      ans+=1
      break
    if i>N-1:
      i=N-1
      break
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

N,C,K=map(int,input().split())
T=[int(input()) for _ in range(N)]
T.sort()
ans=0
i=0

if T[0]+K>=T[-1]:
  print(1)
else:
  while True:
    if i==N-1:
      ans+=1
      break
    i=bisect.bisect_right(T,T[i]+K)
    print(T,i)
    ans+=1
  print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

N,C,K=map(int,input().split())
T=[int(input()) for _ in range(N)]
T.sort()
ans=0
i=0

if T[0]+K>=T[-1]:
  print(1)
else:
  while True:
    if i==N-1:
      ans+=1
      break
    i=bisect.bisect_left(T,T[i]+K)
    ans+=1
  print(ans)
Problem p02897 (python)

Fixed submission:
n = int(input())

count = 0
for i in range(n):
    if i % 2 == 0:
        count = count + 1
print(count/n)

Buggy submission (verdict: Runtime Error):
n = int(input())

count = 0
for i in range(n):
    if i4 % 2 == 0:
        count = count + 1
print(count/n)
Problem p03041 (python)

Fixed submission:
n, k = map(int,input().split())
S = input()
S = S[:k-1] + S[k-1].lower() + S[k:]
print(S)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
S = input()
S[k-1] = S[k-1].lower()
print(S)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
S = input()
S[k-1] = S[k-1].lower
print(S)
Problem p03107 (python)

Fixed submission:
S = input()
N = len(S)
A = 0

for i in range(N):
    if S[i] == '1':
        A = A + 1

print(min(N - A, A)*2)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
 
for i in range(N/2):
    S = S.replace('01', '').replace('10', '')
 
print(N - len(S))
Problem p02688 (python)

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

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
AA=set([])
for i in range(n):
  d=int(input())
  A=list(map(int,input().split()))
  AA=AA|set(A)#|は「パイプ」和集合
print(n-len(AA))
Problem p02990 (python)

Fixed submission:
N, K = map(int, input().split())
def nCr(n, r):
    if n<r :
      return 0
    else:
      """
      Calculate the number of combination (nCr = nPr/r!).
      The parameters need to meet the condition of n >= r >= 0.
      It returns 1 if r == 0, which means there is one pattern
      to choice 0 items out of the number of n.
      """
  
      # 10C7 = 10C3
      r = min(r, n-r)
  
      # Calculate the numerator.
      numerator = 1
      for i in range(n, n-r, -1):
          numerator *= i
  
      # Calculate the denominator. Should use math.factorial?
      denominator = 1
      for i in range(r, 1, -1):
          denominator *= i
  
      return numerator // denominator
for i in range(K):
  a=nCr(N-K+1,i+1)*nCr(K-1,i)
  print(a%1000000007)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
def nCr(n, r):
    """
    Calculate the number of combination (nCr = nPr/r!).
    The parameters need to meet the condition of n >= r >= 0.
    It returns 1 if r == 0, which means there is one pattern
    to choice 0 items out of the number of n.
    """

    # 10C7 = 10C3
    r = min(r, n-r)

    # Calculate the numerator.
    numerator = 1
    for i in range(n, n-r, -1):
        numerator *= i

    # Calculate the denominator. Should use math.factorial?
    denominator = 1
    for i in range(r, 1, -1):
        denominator *= i

    return numerator // denominator
for i in range(K-1):
  print(nCr(N-K+1,i+1):nCr(K-1,i+1))
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
S = []
for _ in range(M):
    S.append(int(input()))
def fib(n):
  if n==-1:
    return 0
  elif n==0:
    return 1
  else:
    a, b = 0, 1
    for i in range(n):
        a, b = b, a + b
    return b
if len(S)==0:
  c=fib(N)
  print(c%1000000007)
else:
  if S[0]==1:
    c=1
  else:
    c=fib(S[0]-1)
  for i in range(M-1):
    c=c*fib(S[i+1]-S[i]-2)
  c=c*fib(N-S[M-1]-1)
  c=c%1000000007
  print(c)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
L=[0]*M
R=[0]*M
for i in range(M):
    L[i],R[i]=map(int,input().split())
def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right
L=quick_sort(L)
R=quick_sort(R)
a=L[M-1]
b=R[0]
if a>b:
  print("0")
else:
  print(b-a+1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = []
for _ in range(M):
    S.append(int(input()))
def fib(n):
  if n==-1:
    return 0
  elif n==0:
    return 1
  else:
    a, b = 0, 1
    for i in range(n):
        a, b = b, a + b
    return b
if S[0]==1:
  c=1
else:
  c=fib(S[0]-1)
for i in range(M-1):
  c=c*fib(S[i+1]-S[i]-2)
c=c*fib(N-S[M-1]-1)
c=c%1000000007
print(c)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = []
for _ in range(M):
    S.append(int(input()))
def fib(n):
  if n==0:
    return 0
  else:
    a, b = 0, 1
    for i in range(n):
        a, b = b, a + b
    return b
if S[0]==1:
  c=1
else:
  c=fib(S[0]-1)
for i in range(M-1):
  c=c*fib(S[i+1]-S[i]-2)
c=c*fib(N-S[M-1]-1)
c=c%1000000007
print(c)
Problem p03222 (python)

Fixed submission:
h,w,k=map(int,input().split())
mod=10**9+7
fib=[1,1]
for i in range(6):
  fib.append(fib[-2]+fib[-1])
dp=[[0]*w for i in range(h+1)]
dp[0][0]=1
for i in range(h):
  for j in range(w):
    if w==1:
      dp[i+1][j]=dp[i][j]
    elif j==0:
      dp[i+1][j]=(dp[i][j]*fib[j]*fib[w-j-1]+dp[i][j+1]*fib[j]*fib[w-j-2])%(mod)
    elif j==w-1:
      dp[i+1][j]=(dp[i][j-1]*fib[j-1]*fib[w-j-1]+dp[i][j]*fib[j]*fib[w-j-1])%(mod)
    else:
      dp[i+1][j]=(dp[i][j-1]*fib[j-1]*fib[w-j-1]+dp[i][j]*fib[j]*fib[w-j-1]+dp[i][j+1]*fib[j]*fib[w-j-2])%(mod)
print(dp[h][k-1])

Buggy submission (verdict: Runtime Error):
h,w,k=map(int,input().split())
mod=10**9+7
fib=[1,1]
for i in range(6):
  fib.append(fib[-2]+fib[-1])
print(fib)
dp=[[0]*w for i in range(h+1)]
dp[0][0]=1
for i in range(h):
  for j in range(w):
    if j==0:
      dp[i+1][j]=(dp[i][j]*fib[j]*fib[w-j-1]+dp[i][j+1]*fib[j]*fib[w-j-2])%(mod)
    elif j==w-1:
      dp[i+1][j]=(dp[i][j-1]*fib[j-1]*fib[w-j-1]+dp[i][j]*fib[j]*fib[w-j-1])%(mod)
    else:
      dp[i+1][j]=(dp[i][j-1]*fib[j-1]*fib[w-j-1]+dp[i][j]*fib[j]*fib[w-j-1]+dp[i][j+1]*fib[j]*fib[w-j-2])%(mod)
print(dp[h][k-1])
Problem p03253 (python)

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**5+5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


n,m=map(int,input().split())
A=factorization(m)
ans=1
if m==1:
  print(ans)
else:
  for i in range(len(A)):
    ans=ans*cmb(n+A[i][1]-1,A[i][1],mod)
  print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**5+5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


n,m=map(int,input().split())
A=factorization(m)
if m==1:
  print(1)
else:
  ans=1
  for i in range(len(A)):
    ans=ans*cmb(n+A[i][1]-1,A[i][1],mod)
print(ans%(10**9+7))
Problem p03307 (python)

Fixed submission:
n=int(input())
if n%2==0:
  print(n)
else:
  print(2*n)

Buggy submission (verdict: Runtime Error):
import bisect
n=int(input())
A=list(map(int,input().split()))
S=[A[0]]
for i in range(n-1):
  S.append(S[-1]+A[i+1])
ans=10**15
for i in range(2,n-1):
  A1=A[0:i]
  A2=A[i:n]
  if len(A1)==2:
    M1=max(A1)
    m1=min(A1)
  else:
    x=bisect.bisect_left(S,S[i-1]//2,lo=0,hi=i+1)
    M11=max(S[x-1],S[i-1]-S[x-1])
    m11=min(S[x-1],S[i-1]-S[x-1])
    M12=max(S[x],S[i-1]-S[x])
    m12=min(S[x],S[i-1]-S[x])
    M1=min(M11,M12)
    m1=max(m11,m12)
  S2=[A[i]]
  for i in range(i+1,n):
    S2.append(S2[-1]+A[i])
  if len(A2)==2:
    M2=max(A2)
    m2=min(A2)
  else:
    x=bisect.bisect_left(S2,S2[-1]//2,lo=0,hi=len(S2))
    M21=max(S2[x-1],S2[-1]-S2[x-1])
    m21=min(S2[x-1],S2[-1]-S2[x-1])
    M22=max(S2[x],S2[-1]-S2[x])
    m22=min(S2[x],S2[-1]-S2[x])
    M2=min(M21,M22)
    m2=max(m21,m22)
  a=max(M1,M2)-min(m1,m2)
  if a<ans:
    ans=a
print(ans)
Problem p03805 (python)

Fixed submission:
import itertools
n,m=map(int,input().split())
G=[[0]*n for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  G[a-1][b-1]=1
  G[b-1][a-1]=1
S=""
for i in range(1,n):
  S=S+str(i)
ans=0
for x in itertools.permutations(S):
  a=0
  if G[0][int(x[0])]==0:
    a=1
  for i in range(n-2):
    if G[int(x[i])][int(x[i+1])]==0:
      a=1
  if a==0:
    ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
A=[["."]*n for i in range(n)]
B=[["."]*m for i in range(m)]
for i in range(n):
  A[i]=list(input())
for i in range(m):
  B[i]=list(input())
for i in range(n-m+1):
  for j in range(n-m+1):
    a=0
    for x in range(m):
      for y in range(m):
        if A[i+x][j+y]!=B[x][y]:
          a=1
          break
    if a==0:
      print("Yes")
      exit()
print("No")
Problem p02571 (python)

Fixed submission:
S=list(input())
T=list(input())
ans_li=[]
for i in range(len(S)-len(T)+1):
    ans=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            ans+=1
    ans_li.append(ans)
print(min(ans_li))

Buggy submission (verdict: Runtime Error):
S=list(input())
T=list(input())
ans_li=[]
for i in range(len(S)-len(T)):
    ans=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            ans+=1
    ans_li.append(ans)
print(min(ans_li))
Problem p02682 (python)

Fixed submission:
r=input().split()
A=int(r[0])
B=int(r[1])
C=int(r[2])
K=int(r[3])
if K<=A:
    print(K)
elif K<=A+B:
    print(A)
else:
    print(2*A-K+B)

Buggy submission (verdict: Runtime Error):
r=input().split()
A=int(r[0])
B=int(r[1])
C=int(r[2])
K=int(r[3])
d_a=[1]*A
d_b=[0]*B
d_c=[-1]*C
d=d_a+d_b+d_c
if K>A+B+C:
    print(A-B)
else:
    ans=0
    for i in range(K):
        ans+=d[i]
    print(ans)

Buggy submission (verdict: Runtime Error):
r=input().split()
A=int(r[0])
B=int(r[1])
C=int(r[2])
K=int(r[3])
d_a=[1]*A
d_b=[0]*B
d_c=[-1]*C
d=d_a+d_b+d_c
ans=0
for i in range(K):
    ans+=d[i]
print(ans)
Problem p03041 (python)

Fixed submission:
data=input().split()
N=int(data[0])
K=int(data[1])
S=input()
s=list(S)
s[K-1]=S[K-1].lower()
print("".join(s))

Buggy submission (verdict: Runtime Error):
data=input().split()
N=int(data[0])
K=int(data[1])
S=input()
s=list(S)
s[K]=S[K].lower()
print("".join(s))
Problem p02831 (python)

Fixed submission:
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


A, B = map(int, input().split())

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


A, B = map(int, input().split())

print(lcm(A, B))
Problem p02915 (python)

Fixed submission:
N = int(input())

print(N * N * N)

Buggy submission (verdict: Runtime Error):
N = int(input().split())

print(N * N * N)
Problem p02578 (python)

Fixed submission:
n = int(input())

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

ans = 0
for i in range(n-1):
    x = max(0, a[i] - a[i+1])
    ans += x
    a[i+1] += x

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

a = []

for i in range(n):
    a.append(list(map(int,input().split())))

ans = 0
for i in range(n-1):
    x = max(0,a[i+1]-a[i])
    ans+=x
    a[i+1]+=x

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input().rstrip())

a = []

for i in range(n):
    a.append(list(map(int,input().split())))

ans = 0
for i in range(n-1):
    x = max(0,a[i+1]-a[i])
    ans+=x
    a[i+1]+=x

print(ans)
Problem p02833 (python)

Fixed submission:
import math
N=int(input())
a=0
b=10
if N%2!=0:
	print(0)
else:
	while N>=b:
		a+=(N//b)
		b=b*5
	print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
b=0

def f(N):
	if N<2:
		return 1
	if N>=2:
		return N*f(N-2)
X=f(N)
print(X)
if X%2==0:
	while X%5==0:
		X=X/5
		b=b+1
      
print(b)
Problem p02659 (python)

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

a = int(a)

b = 100*int(b[0])+10*int(b[2])+1*int(b[3])

print((a*b)//100)

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

a = int(a)

b = 100*int(b[0])+10*int(b[2])+1*int(v[3])

print((a*b)//100)

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

print(int(a)*(int(b)*100)/100)
Problem p02725 (python)

Fixed submission:
k, n = map(int, input().split())
a = list(map(int, input().split()))
a2 = []
for i in range(n-1):
    d = int(a[i+1]-a[i])
    a2.append(d)
a2.append(k-a[n-1]+a[0])
ans = k - max(a2)
print(ans)

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=list(map(int,input().split())
lists=[]
for i in range(N):
       d=int(a[i+1]-a[i])
       lists.append(d)
lists.append(K-a[N-1]+a[0])
ans=K-max(b)
print(ans)

Buggy submission (verdict: Runtime Error):
k, n = map(int, input().split())
a = list(map(int, input().split())
b = []
for i in range(N):
    d = int(a[i+1]-a[i])
    b.append(int(d))

b.append(K - a[N-1] + a[0])

ans = K - max(b)

print(ans)
Problem p02753 (python)

Fixed submission:
S = input()

if S.count("A") >= 1 and S.count("B") >= 1 :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()

if S.count(A) >= 1 and S.count(B) >= 1 :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()

if S.count(A) >= 1 and S.count(B) >= 0 :
    print("Yes")
else :
    print("No")
Problem p02771 (python)

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

if a == b != c or b == c != a or a == c != b :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
list = [map(int, input().split())]

if a = b or b = c or a = c :
    print("Yes")
else :
    print("No")
Problem p02773 (python)

Fixed submission:
N = int(input())
d = {}
for _ in range(N):
    S = input()
    if S in d :
        d[S] += 1
    else :
        d[S] = 1

m = max(d.values())

for s in sorted(k for k in d if d[k]==m) :
    print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = {}
for _ in range(N):
    S = input()
    if S in l :
        d[S] += 1
    else :
        d[S] = 1

m = max(d.values())

for s in sorted(k for k in d if d[k]==m) :
    print(s)
Problem p02785 (python)

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

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

h.sort(reverse=True)

if k == 0 :
    print(sum(h))
elif k <= n :
    for i in range(k):
        h[i] = 0
    print(sum(h))
else :
    print(0)

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

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

h.sort(reverse=True)
ans = 0
if k == 0 :
    ans = sum(h)
else :
    for i in range(k):
        h[i] = 0
    print(sum(h))

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

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

h.sort()
sumh = 0
if k == 0 :
    print(sum(h))
else :
    for i in range(1,k+1):
        sumh += h[i*-1]
    print(sum(h)-sumh)

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

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

h.sort()
sumh = 0
for i in range(1,k+1):
    sumh += h[i*-1]
print(sum(h)-sumh)
Problem p02915 (python)

Fixed submission:
print(int(input())**3)

Buggy submission (verdict: Runtime Error):
print(int(input(n**3)))

Buggy submission (verdict: Runtime Error):
print(int(input(n**3)))

Buggy submission (verdict: Runtime Error):
print(n**3)