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

Fixed submission:
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def cmb(n,r):
    return factorial(n) // (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    if n-k+1 < i or k-1 < i-1:
        print(0)
    else:
        x = cmb(k-1,i-1) % mod
        y = cmb(n-k+1,i) % mod
        ans = (x*y) % mod
        print(int(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def cmb(n,r):
    return factorial(n) / (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    if i > n-k+1:
        print(0)
    else:
        x = cmb(k-1,i-1) % mod
        y = cmb(n-k+1,i) % mod
        ans = (x*y) % mod
        print(int(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def comb(n,r):
    return factorial(n) / (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    if i > n-k+1:
        print(0)
    else:
        x = comb(k-1,i-1) % mod
        y = comb(n-k+1,i) % mod
        print(x*y % mod)

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def comb(n,r):
    return factorial(n) / (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    if i > n-k+1:
        print(0)
    else:
        x = comb(k-1,i-1) % mod
        y = comb(n-k+1,i)
        print(int(x*y) % mod)

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def comb(n,r):
    return factorial(n) / (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    if i > n-k+1:
        print(0)
    else:
        x = comb(k-1,i-1) % mod
        y = comb(n-k+1,n-k-i+1)
        print(int(x*y) % mod)

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def cmb(n,r):
    return factorial(n) / (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    if i > n-k+1:
        print(0)
    else:
        x = cmb(k-1,k-i) % mod
        y = cmb(n-k+1,n-k-i+1)
        print(int(x*y) % mod)

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def comb(n,r):
    return factorial(n) / (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    x = comb(k-1,k-i) % mod
    if n-k+1 >= i:
        y = comb(n-k+1,i) % mod
    elif i > n-k+1:
        y = 0
    print(int(x*y)%mod)

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def comb(n,r):
    return factorial(n) / (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    x = comb(k-1,k-i) % mod
    if n-k+1 >= i:
        y = comb(n-k+1,i) % mod
    elif: i > n-k+1
        y = 0
    print(int(x*y)%mod)

Buggy submission (verdict: Runtime Error):
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def comb(n,r):
    return factorial(n) / (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    x = comb(k-1,k-i)
    if n-k+1 >= i:
        y = comb(n-k+1,i)
    else:
        y = 0
    print(int(x*y)%mod)
Problem p03012 (python)

Fixed submission:
n = int(input())
lst = [int(i) for i in input().split()]
for i in range(n):
    s1=0
    for j in range(i):
        s1+=lst[j]
    s2=sum(lst)-s1
    if i==0:
        ans=abs(s1-s2)
    elif abs(s1-s2)<ans:
        ans=abs(s1-s2)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = [int(i) for i in input().split()]
for i in range(n):
    s1=0
    for j in range(i):
        s1+=lst[j]
    s2=sum(lst)-s1
    if i==1:
        ans=abs(s1-s2)
    elif abs(s1-s2)<ans:
        ans=abs(s1-s2)
print(ans)
Problem p03018 (python)

Fixed submission:
"""Binary Indexed Tree (Fenwick Tree)"""
class BIT:
    def __init__(self, n):
        self.n = n
        
        #BIT木データ
        self.data = [0]*(n+1)
        
        #元配列
        self.el = [0]*(n+1)
    
    """A1~Aiまでの累積和"""
    def Sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            
            #LSB(Least Significant Bit)の獲得:i&(-i)
            i -= i & (-i) 
        return s
    
    """Ai += x"""
    def Add(self, i, x):
        self.el[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i
    
    """Ai ~ Ajまでの累積和"""
    def Get(self, i, j=None):
        if j is None:
            return self.el[i]
        return self.Sum(j) - self.Sum(i)
    
s = input()
s = s.replace('BC', 'D')
mode = 0
res = 0
for i in range(len(s)):
    if s[i] == 'B' or s[i]=='C':
        mode = 0
    elif s[i] == 'A':
        mode += 1
    else:
        res += mode
print(res)

Buggy submission (verdict: Runtime Error):

import numpy as np

def f(lst):
    return np.cumsum(lst)

s = input()
cnt = 0
s = s.replace('BC', 'D')

x = [0]*len(s)
for i in range(len(s)):
    if s[i]=='A':
        x[i] += 1
x = f(x)

res = 0
for i in range(len(s)):
    if s[i]=='D':
        res += x[i]
print(res)
Problem p03036 (python)

Fixed submission:
r,d,x = map(int,input().split())
for i in range(1,11):
    w = r*x - d
    x=w
    print(w)

Buggy submission (verdict: Runtime Error):
r,d,x = map(int,input().split())
for i in range(1,11):
  w = r*x - d
  x = w
  print(W)
Problem p03053 (python)

Fixed submission:
from scipy.ndimage import distance_transform_cdt
H,W = map(int,input().split())
S = list(list(input()) for h in range(H))
for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            S[h][w] = 0
        else:
            S[h][w] = 1
print(distance_transform_cdt(S, metric='taxicab').max())

Buggy submission (verdict: Runtime Error):
from collections import deque
import numpy as np
H,W = map(int,input().split())
A = [list(input()) for _ in range(H)]
table = [[float('inf')]*(W) for _ in range(H)]
visited = [[False]*(W) for _ in range(H)]
start = []
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            table[i][j] = 0
            start.append((i,j))
for (sy, sx) in start:
    visited[sy][sx] = True
    que = deque([(sx,sy)])
    while que:
        y,x = que.popleft()
        for dy, dx in ((1,0),(-1,0),(0,1),(0,-1)):
            ny,nx = y+dy, x+dx
            if 0<=ny<H and 0<=nx<W:
                if table[ny][nx] == float('inf'):
                    table[ny][nx] = table[y][x]+1
                    que.append((ny, nx))
print(np.array(table).max())

Buggy submission (verdict: Runtime Error):

from collections import deque
import numpy as np
H,W = map(int,input().split())
A = [list(input()) for _ in range(H)]
table = [[float('inf')]*(W) for _ in range(H)]
visited = [[False]*(W) for _ in range(H)]
start = []
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            table[i][j] = 0
            start.append((i,j))
for (sy, sx) in start:
    visited[sy][sx] = True
    que = deque([(sx,sy)])
    while que:
        y,x = que.popleft()
        for dy, dx in ((1,0),(-1,0),(0,1),(0,-1)):
            ny,nx = y+dy, x+dx
            if 0<=ny<H and 0<=nx<W:
                if table[ny][nx] == float('inf'):
                    table[ny][nx] = table[y][x]+1
                    que.append((ny, nx))
print(np.array(table).max())

Buggy submission (verdict: Runtime Error):
from collections import deque
import numpy as np

H,W = map(int,input().split())
A = [list(input()) for _ in range(H)]
table = [[float('inf')]*(W) for _ in range(H)]
visited = [[False]*(W) for _ in range(H)]
start = []
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            table[i][j] = 0
            start.append((i,j))
for (sy, sx) in start:
    visited[sy][sx] = True
    que = deque([(sx,sy)])
    while que:
        y,x = que.popleft()
        for dy, dx in ((1,0),(-1,0),(0,1),(0,-1)):
            ny,nx = y+dy, x+dx
            if 0<=ny<H and 0<=nx<W:
                if table[ny][nx] == float('inf'):
                    table[ny][nx] = table[y][x]+1
                    que.append((ny, nx))
print(np.array(table).max())
Problem p03221 (python)

Fixed submission:
n,m = map(int,input().split())
city_inf = []
for i in range(m):
    array = [i]
    array.extend(list(map(int,input().split())))
    city_inf.append(array)

city_inf.sort(key=lambda x:x[2])
order_counter = {}

for list in city_inf:
    if list[1] in order_counter.keys():
        order_counter[list[1]] += 1
        list.append(order_counter[list[1]])
    else:
        order_counter[list[1]] = 1
        list.append(1)

city_inf.sort(key=lambda x:x[0])
zero_p = ''
zero_y = ''
for list in city_inf:
    zero_p = '0'*(6-len(str(list[1])))
    zero_y = '0'*(6-len(str(list[3])))
    list.append(zero_p + str(list[1]) + zero_y + str(list[3]))
    print(list[4])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
lst = [list(map(int,input().split())) for i in range(m)]
order = sorted(lst , key=lambda x:(x[0],x[1]))
mydict = {}

c = 1
for i in range(len(order)-1):
    mydict[str(order[i])] = c
    if order[i][0] == order[i+1][0]:
        c += 1
    else:
        c = 1
if order[m-1][0] == order[m-2][0]:
    mydict[str(order[m-1])] = order[m-2][2]+1
else:
    mydict[str(order[m-1])] = 1

for i in range(m):
    val = mydict[str(lst[i])]
    p = lst[i][0]
    s='0'*(6-len(str(p)))+str(p)+'0'*(6-len(str(val)))+str(val)
    print(s)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
lst = [list(map(int,input().split())) for i in range(m)]
order = sorted(lst , key=lambda x:(x[0],x[1]))

c = 1
for i in range(len(order)-1):
    order[i].append(c)
    if order[i][0] == order[i+1][0]:
        c += 1
    else:
        c = 1
if order[m-1][0] == order[m-2][0]:
    order[m-1].append(order[m-2][2]+1)
else:
    order[m-1].append(1)


for i in range(m):
    p,y = lst[i][0],lst[i][1]
    for odr in order:
        if odr[0]==p and odr[1]==y:
            x = odr[2]
    s='0'*(6-len(str(p)))+str(p)+'0'*(6-len(str(x)))+str(x)
    print(s)
Problem p03329 (python)

Fixed submission:
n = int(input())
dp = [10**9]*30000000
dp[0] = 0
pow6 = [6**i for i in range(10) if 6**i <= n]
pow9 = [9**i for i in range(10) if 9**i <= n]

for i in range(n):
    for p6 in pow6:
        dp[i+p6] = min(dp[i+p6], dp[i]+1)
    for p9 in pow9:
        dp[i+p9] = min(dp[i+p9], dp[i]+1)
print(dp[n])

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
dp = [np.inf for _ in range(100000)]
dp[0] = 0
num = [1,6,9]
pow6 = [6**i for i in range(10) if 6**i <= n]
pow9 = [9**i for i in range(10) if 9**i <= n]

for i in range(n):
    for p6 in pow6:
        dp[i+p6] = min(dp[i+p6], dp[i]+1)
    for p9 in pow9:
        dp[i+p9] = min(dp[i+p9], dp[i]+1)
print(dp[n])

Buggy submission (verdict: Runtime Error):
n = int(input())
dp = [100000] * 100010
dp[0] = 0
pow6 = [6**i for i in range(10) if 6**i <= n]
pow9 = [9**i for i in range(10) if 9**i <= n]

for i in range(n):
    for p6 in pow6:
        dp[i+p6] = min(dp[i+p6],dp[i]+1)
    for p9 in pow9:
        dp[i+p9] = min(dp[i+p9],dp[i]+1)
print(dp[n])
Problem p03705 (python)

Fixed submission:
n,a,b = map(int,input().split())
if n==1:
  if a==b:
    print(1)
  else:
    print(0)
else:
  k = b-a
  if k < 0:
    print(0)
  elif k==0:
    print(1)
  else:
    print((b-a)*(n-2)+1)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
if n==1:
  if a==b:
    print(1)
  else:
    print(0)
else:
  if b-a < 0:
    print(0)
  elif k==1:
    print(1)
  else:
    print(b*k - a*k+1)
Problem p03723 (python)

Fixed submission:
a,b,c = map(int,input().split())
res = 0
while True:
    if a%2!=0 or b%2!=0 or c%2!=0:
        break
    elif a==b==c:
        res = -1
        break
    else:
        res += 1
        a,b,c = (b+c)//2, (c+a)//2, (a+b)//2
print(res)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
lst = [a,b,c]
lst.sort()
res = True
if a==b-=c:
    print(-1)
else:
    while True:
        if a%2!=0 or b%2!=0 or c%2!=0:
            break
        else:
            res += 1
            nx_a = b//2 + c//2
            nx_b = a//2 + c//2
            nx_c = a//2 + b//2
            tmp = [nx_a, nx_b, nx_c]
            tmp.sort()
            if lst==tmp:
                print(-1)
                exit()
            a,b,c = nx_a, nx_b, nx_c
    print(res)
Problem p03745 (python)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
if n==1 or n==2:
    print(1)
else:
    cnt = 0
    num = lst[0]
    mode = 0
    for i in range(1,n):
        if mode==0:
            if lst[i]==num:
                continue            
            elif lst[i] > num:
                mode = 1
            elif lst[i] < num:
                mode = 2
        elif mode == 1:
            if lst[i] < num:
                cnt += 1
                mode = 0
        elif mode == 2:
            if lst[i] > num:
                cnt += 1
                mode = 0
        num = lst[i]
    print(cnt + 1)

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

m = -1 #m=1:増加、m=2:減少
if n==1 or n==2:
    print(1)
else:
    cnt = 0
    num = lst[0]
    mode = 0
    for i in range(1,n):
        if mode==0:　# 待機
            if lst[i]==num:
                continue            
            elif lst[i] > num:
                mode = 1 # 増加
            elif lst[i] < num:
                mode = 2 # 減少
        elif mode == 1:
            if lst[i] < num:
                cnt += 1
                mode = 0
        elif mode == 2:
            if lst[i] > num:
                cnt += 1
                mode = 0
        num = lst[i]
    print(cnt + 1)
Problem p02623 (python)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=[0]
B=[0]
for i in range(n):
    A.append(a[i]+A[i])
for j in range(m):
    B.append(b[j]+B[j])

i=0
j=m
ans=0
tmp=0
while(i<n+1 and j>=0):
    if(k>=A[i]):
        tmp=k-A[i]
        if(tmp-B[j]>=0):
            ans=max(ans,i+j)
            i+=1
        else:
            j-=1
    else:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
  N, M, K = map(int, input().split())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  a, b = [0], [0]
  for i in range(N):
  a.append(a[i] + A[i])
  for i in range(M):
  b.append(b[i] + B[i])

 ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
   break
   while b[j] > K - a[i]:
	j -= 1
ans = max(ans, i + j)
print(ans)
Problem p02659 (python)

Fixed submission:
s = list(input().split())
a = int(s[0]);
b = int(s[1][:1]+s[1][2:])
print(a*b//100)

Buggy submission (verdict: Runtime Error):
s = input().split()
a = int(s[0]);
b = int(s[1][0:1]+s[2:len(s[1])])
b *= 100
print(a*b//100)
Problem p03073 (python)

Fixed submission:
s = input() 
answer1 = '10'*50000
answer2 = '01'*50000 

count1 = 0
for i in range(len(s)):
    if s[i] != answer1[i]:
        count1 += 1

count2 = 0
for i in range(len(s)):
    if s[i] != answer2[i]:
        count2 += 1

print(count1) if count1 < count2 else print(count2)

Buggy submission (verdict: Runtime Error):
s = input() 
answer1 = '10'*5000 
answer2 = '01'*5000 

count1 = 0
for i in range(len(s)):
    if s[i] != answer1[i]:
        count1 += 1

count2 = 0
for i in range(len(s)):
    if s[i] != answer2[i]:
        count2 += 1

print(count1) if count1 < count2 else print(count2)
Problem p02859 (python)

Fixed submission:
n=int(input())
print(n**2)

Buggy submission (verdict: Runtime Error):
n=int(input)
print(n**2)
Problem p02779 (python)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
ans='YES'
for i in range(n-1):
  if a[i]==a[i+1]:
    ans='NO'
  if ans=='NO':
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))
ans='YES'
for i in range(n):
  if a[i]==a[i+1]:
    ans='NO'
  if ans=='NO':
    break
print(ans)
Problem p02862 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
#(a*x)をmで割った余りが1になるようなxを求める
#aで割ったときの余りはa^(-1)をかけた余りと同じ
#逆元a^(-1)を求める
#aとmが互いに素であることが条件

def gyakugen( a, m ):
  b = m
  x, y = 1, 0
  while b>0:
    q = a // b
    a, b = b, a-q*b
    x, y = y, x-q*y
  return x if x>0 else x+m


#(a/b)をmで割った余りを求める
#b^(-1)にaを掛けたものをmで割ればよい

def div_remainder(a,b,m):
    b_inv=gyakugen(b,m)
    a%=m
    return (a*b_inv)%m


#(a*b)をmで割った余りを求める

def multi_remainder(a,b,m):
    a%=m
    b%=m
    return (a*b)%m



#nPrをmで割った余りを求める(ただしn<m、mは素数)

def perm_remainder(n,r,m):
    if r>1:
      return (perm_remainder(n-1,r-1,m)*n)%m
    elif r==1:
      return n
    else:
      return 1

#nCrをmで割った余りを求める(ただしn<m,mは素数)

def comb_remainder(n,r,m):
    r=min(r,n-r)
    return (perm_remainder(n,r,m)*gyakugen(perm_remainder(r,r,m),m))%m


x,y=map(int,input().split())
m=10**9+7
if (2*x-y)%3!=0 or (-x+2*y)%3!=0 or 2*x-y<0 or -x+2*y<0:
  ans=0
else:
  nx=(2*x-y)//3
  n=(x+y)//3
  ans=comb_remainder(n,nx,m)
print(ans)

Buggy submission (verdict: Runtime Error):
#(a*x)をmで割った余りが1になるようなxを求める
#aで割ったときの余りはa^(-1)をかけた余りと同じ
#逆元a^(-1)を求める
#aとmが互いに素であることが条件

def gyakugen( a, m ):
  b = m
  x, y = 1, 0
  while b>0:
    q = a // b
    a, b = b, a-q*b
    x, y = y, x-q*y
  return x if x>0 else x+m


#(a/b)をmで割った余りを求める
#b^(-1)にaを掛けたものをmで割ればよい

def div_remainder(a,b,m):
    b_inv=gyakugen(b,m)
    a%=m
    return (a*b_inv)%m


#(a*b)をmで割った余りを求める

def multi_remainder(a,b,m):
    a%=m
    b%=m
    return (a*b)%m



#nPrをmで割った余りを求める(ただしn<m、mは素数)

def perm_remainder(n,r,m):
    if r>=1:
        return (perm_remainder(n-1,r-1,m)*n)%m
    else:
        return 1

#nCrをmで割った余りを求める(ただしn<m,mは素数)

def comb_remainder(n,r,m):
    r=min(r,n-r)
    return (perm_remainder(n,r,m)*gyakugen(perm_remainder(r,r,m),m))%m


x,y=map(int,input().split())
m=10**9+7
if (2*x-y)%3!=0 or (-x+2*y)%3!=0 or 2*x-y<0 or -x+2*y<0:
  ans=0
else:
  nx=(2*x-y)//3
  n=(x+y)//3
  ans=comb_remainder(n,nx,m)
print(ans)
Problem p02880 (python)

Fixed submission:
n=int(input())
ans='No'
for i in range(1,10):
  if n//i<10 and n%i==0:
    ans='Yes'

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans='No'
for i in range(10):
  if n//i<10 and n%i==0:
    ans='Yes'

print(ans)
Problem p02916 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
c.append(0)
for i in range(n-1):
  if a[i]!=a[i+1]-1:
    c[a[i]-1]=0
c[a[n-1]-1]=0
print(sum(b)+sum(c))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
c.append(0)
for i in range(n-1):
  if a[i]!=a[i+1]-1:
    c[a[i]]=0
print(sum(b)+sum(c))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n-1):
  if a[i]!=a[i+1]-1:
    c[a[i]]=0
print(sum(b)+sum(c))
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
p=10**9+7
a=[int(input()) for i in range(m)]
a.append(n+1)
b=[a[0]-1]
for i in range(m):
  b.append(a[i+1]-a[i]-2)
x=[1]*(max(b)+1)
for i in range(2,max(b)+1):
  x[i]=(x[i-1]+x[i-2])%p

ans=1
if min(b)==-1:
  ans=0
else:
  for i in range(m+1):
    ans=(ans*x[b[i]])%p
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=10**9+7
a=[int(input()) for i in range(m)]
b=[a[0]-1]
for i in range(m):
  b.append(a[i+1]-a[i]-2)
x=[1]*(max(b)+1)
for i in range(2,max(b)+1):
  x[i]=(x[i-1]+x[i-2])%p

ans=1
if min(b)==-1:
  ans=0
else:
  for i in range(m):
    ans=(ans*x[b[i]])%p
print(ans)
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c'
for i in range(n):
  print(s[i],end='')

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(input())
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c'
print(s,end='' for i in range(n))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c'
print(s)
Problem p03723 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a%2==1 or b%2==1 or c%2==1:
  print(0)
elif a==b==c:
  print(-1)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
  print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c=map(input().split())
if a==b==c:
  print(-1)
elif a%2==1 or b%2==1 or c%2==1:
  print(0)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
  print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c=map(input().split())
if a==b==c:
  print(-1)
elif a%2==1 or b%2==1 or c%2==1:
  print(0)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    ans+=1
    a1=(b+c)//2
    b1=(c+a)//2
    c1=(a+b)//2
    a=a1
    b=b1
    c=c1
print(ans)
Problem p02623 (python)

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

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

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

A,B=[0],[0]

for i in range(n):
    A.append(A[i] + a[i])

for i in range(m):
    B.append(B[i] + b[i])


ans,j =0,m

for i in range(n+1):
    if A[i] > k:
        break
    while B[j] > k-A[i]:
        j -=1

    ans =max(ans,i+j)

print(ans)

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

a,b=[0],[0]
for i in range(n):
  a.apppend(a[i]+A[i])
 
for i in range(m):
  b.append(b[i] + B[i])
 
ans,j=0,m

for i in range(n+1):
  if a[i] >k:
    break
   while b[j] > k-a[i]:
    j -=1
   
   ans=max(ans,i+j)
    
print(ans)
Problem p02623 (python)

Fixed submission:
from itertools import accumulate
from bisect import bisect_left

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
acc_A = [0] + list(accumulate(A))
acc_B = [0] + list(accumulate(B))
res = 0
for i, a in enumerate(acc_A):
    if a > K:
        break
    idx = bisect_left(acc_B, K - a)
    idx = min(idx, M)
    if acc_B[idx] > K - a:
        idx -= 1
    res = max(res, i + idx)
print(res)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
k = 0
idx1 = 0
idx2 = 0
while True:
    if idx1 >= N and idx2 >= M:
        break
    if idx1 >= N:
        if B[idx2] <= K:
            K -= B[idx2]
            idx2 += 1
            continue
        else:
            break
    elif idx2 >= N:
        if A[idx1] <= K:
            K -= A[idx1]
            idx1 += 1
        else:
            break
    if A[idx1] <= B[idx2]:
        if A[idx1] <= K:
            K -= A[idx1]
            idx1 += 1
            continue
        else:
            break
    else:
        if B[idx2] <= K:
            K -= B[idx2]
            idx2 += 1
            continue
        else:
            break
print(idx1 + idx2)