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

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

ans = {}
for i in range(n-1):
  ans[i+1] = 0
  
for i in range(n):
  for j in range(i+1,n):
    if i <= x-1:
      if j <= x-1:
      	t=j-i
      	ans[t] += 1
      elif j <= y-1:
      	t = min(j-i, (x-1)-i + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j > y-1
      	t = (x-1)-i + 1 + j -(y-1)
      	ans[t] += 1
    elif i < y-1:
      if j < y-1:
      	t = min(j-i, i-(x-1) + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j >= y-1:
      	t = min(j-i, i-(x-1) + 1 + j - (y-1))
      	ans[t] += 1
    elif i >= y-1:
      t=j-i
      ans[t] += 1
    else:
      print("error")

for i in range(1,n):
  print(ans[i])

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

ans = {}
for i in range(n-1):
  ans[i+1] = 0
  
for i in range(n):
  for j in range(i+1,n):
    if i <= x-i:
      if j <= x-1:
      	t=j-i
      	ans[t] += 1
      elif j <= y-1:
      	t = min(j-i, (x-1)-i + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j > y-1
      	t = (x-1)-i + 1 + j -(y-1)
      	ans[t] += 1
    elif i < y-1:
      if j < y-1:
      	t = min(j-i, i-(x-1) + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j >= y-1:
      	t = min(j-i, i-(x-1) + 1 + j - (y-1))
      	ans[t] += 1
    elif i >= y-1:
      t=j-i
      ans[t] += 1
    else:
      print("error")

for i in range(1,n):
  print(ans[i])

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

ans = {}
for i in range(n-1):
  ans[i+1] = 0
  
for i in range(n):
  for j in range(i+1,n):
    if i <= x-i:
      if j <= x-1:
      	t=j-i
      	ans[t] += 1
      elif j <= y-1:
      	t = min(j-i, (x-1)-i + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j > y-1
      	t = (x-1)-i + 1 + j -(y-1)
      	ans[t] += 1
    elif i < y-1:
      if j < y-1:
      	t = min(j-i, i-(x-1) + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j >= y-1:
      	t = min(j-i, i-(x-1) + 1 + j - (y-1))
      	ans[t] += 1
    elif i >= y-1:
      t=j-i
      ans[t] += 1
    else:
      print("error")

for i in range(1,n):
  print(ans[i])

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

ans = {}
for i in range(n-1):
  ans[i+1] = 0
  
for i in range(n):
  for j in range(i+1,n):
    if i <= x-i:
      if j <= x-1:
      	t=j-i
      	ans[t] += 1
      elif j <= y-1:
      	t = min(j-i, (x-1)-i + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j > y-1
      	t = (x-1)-i + 1 + j -(y-1)
      	ans[t] += 1
    elif i < y-1:
      if j < y-1:
      	t = min(j-i, i-(x-1) + 1 + (y-1) -j)
      	ans[t] += 1
      elif j >= y-1:
      	t = min(j-i, i-(x-1) + 1 + j - (y-1))
      	ans[t] += 1
    elif i >= y-1:
      t=j-i
      ans[t] += 1
    else:
      print("error")

for i in range(1,n):
  print(ans[i])
Problem p02834 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
N,T,A = map(int,input().split()); INF = float("inf")
T-=1;A-=1 #0index
G = [[] for _ in range(N)]
for i in range(N-1):
  a,b = map(int,input().split())
  a-=1;b-=1 #0index
  G[a].append(b);G[b].append(a)

disT = [INF for _ in range(N)]; disT[T] = 0
disA = [INF for _ in range(N)]; disA[A] = 0

def dfs(v, L):
  for u in G[v]:
    if L[u] != INF:
      continue
    L[u] = L[v]+1
    dfs(u,L)
dfs(T,disT)
dfs(A,disA)
#print(disT)
#print(disA)
ans = 0
for i in range(N):
  if disT[i] < disA[i]:
    ans = max(ans,disA[i]-1)
print(ans)

Buggy submission (verdict: Runtime Error):
N,T,A = map(int,input().split()); INF = float("inf")
T-=1;A-=1 #0index
G = [[] for _ in range(N)]
for i in range(N-1):
  a,b = map(int,input().split())
  a-=1;b-=1 #0index
  G[a].append(b);G[b].append(a)

disT = [INF for _ in range(N)]; disT[T] = 0
disA = [INF for _ in range(N)]; disA[A] = 0

def dfs(v, L):
  for u in G[v]:
    if L[u] != INF:
      continue
    L[u] = L[v]+1
    dfs(u,L)
dfs(T,disT)
dfs(A,disA)
#print(disT)
#print(disA)
ans = 0
for i in range(N):
  if disT[i] < disA[i]:
    ans = max(ans,disA[i]-1)
print(ans)
Problem p03013 (python)

Fixed submission:
N,M = map(int,input().split())
A = set([]); MOD = pow(10,9)+7
for i in range(M):
  a = int(input())
  A.add(a-1)
dp = [[0]*2 for _ in range(N)] #dp[i][j] i段目(0index)にj=0最後1段でj=1最後2段できた。
if 0 not in A:
  dp[0][0] = 1
if N == 1:
  print(sum(dp[0]))
  exit()
if 1 not in A:
  dp[1][0] = dp[0][0]+dp[0][1]
  dp[1][1] = 1
for i in range(2,N):
  if i in A:
    continue
  dp[i][0] = (dp[i-1][0]+dp[i-1][1])%MOD
  dp[i][1] = (dp[i-2][0]+dp[i-2][1])%MOD
ans = sum(dp[N-1])%MOD
#print(dp)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = set([]); MOD = pow(10,9)+7
for i in range(M):
  a = int(input())
  A.add(a-1)
dp = [[0]*2 for _ in range(N)] #dp[i][j] i段目(0index)にj=0最後1段でj=1最後2段できた。
if 0 not in A:
  dp[0][0] = 1
if 1 not in A:
  dp[1][0] = dp[0][0]+dp[0][1]
  dp[1][1] = 1
for i in range(2,N):
  if i in A:
    continue
  dp[i][0] = (dp[i-1][0]+dp[i-1][1])%MOD
  dp[i][1] = (dp[i-2][0]+dp[i-2][1])%MOD
ans = sum(dp[N-1])%MOD
#print(dp)
print(ans)
Problem p03426 (python)

Fixed submission:
H,W,D = map(int,input().split())
MAX = H*W
#M = MAX//D+1
dic = {}

for i in range(H):
  temp = list(map(int,input().split()))
  for j in range(W):
    now = temp[j]
    dic[now] = (i,j)
#print(dic)
L = [[0] for _ in range(D)]
for i in range(D): #MODで0からD-1をひたすら見ていく。
  if i == 0:
    now = D
  else:
    now = i
  while now+D <= MAX:
    tsugi = now+D
    np = dic[now] #今の場所
    tp = dic[tsugi]
    dis = abs(np[0]-tp[0])+abs(np[1]-tp[1])
    L[i].append(L[i][-1]+dis)
    now = tsugi
#print(L)
Q = int(input())
for i in range(Q):
  left,right = map(int,input().split())
  MOD = left%D
  #print(L[MOD])
  start = (left-1)//D
  end = (right-1)//D
  ans = L[MOD][end]-L[MOD][start]
  print(ans)

Buggy submission (verdict: Runtime Error):
H,W,D = map(int,input().split())
MAX = H*W
M = MAX//D+1
dic = {}

for i in range(H):
  temp = list(map(int,input().split()))
  for j in range(W):
    now = temp[j]
    dic[now] = (i,j)
#print(dic)
L = [[0] for _ in range(M)]
for i in range(D): #MODで0からD-1をひたすら見ていく。
  if i == 0:
    now = D
  else:
    now = i
  while now+D <= MAX:
    tsugi = now+D
    np = dic[now] #今の場所
    tp = dic[tsugi]
    dis = abs(np[0]-tp[0])+abs(np[1]-tp[1])
    L[i].append(L[i][-1]+dis)
    now = tsugi
#print(L,L[0])
Q = int(input())
for i in range(Q):
  left,right = map(int,input().split())
  MOD = left%D
  #print(L[MOD])
  start = (left-1)//D
  end = (right-1)//D
  ans = L[MOD][end]-L[MOD][start]
  print(ans)
Problem p03725 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500000) #これがないと再帰の回数オーバーでエラー出る。
from collections import deque
INF = float("inf")
H,W,K = map(int,input().split())
Room = []
for i in range(H):
  temp = str(input())
  temp = list(temp)
  for j in range(W):
    if temp[j] == "S":
      sx = i;sy =j
  Room.append(temp)
#print(sx,sy)
d = [(1,0),(-1,0),(0,1),(0,-1)]

R = [[INF]*W for _ in range(H)]
R[sx][sy] = 0
reach = set([])
reach.add((sx,sy))
Q = deque([[sx,sy]])
while Q:
  x,y = Q.popleft()
  if x==0 or x==H-1 or y==0 or y==W-1:
    print(1)
    exit()
  if R[x][y] == K:
    #L.add((x,y))
    #if stp == K:
    continue
  #stp +=1
  for i in range(4):
    nx = x+d[i][0]
    ny = y+d[i][1]
    #print(nx,ny)
    if nx<0 or nx>=H or ny<0 or ny>= W or Room[nx][ny] == "#" or R[nx][ny] != INF:
      continue
    reach.add((nx,ny))
    R[nx][ny] = R[x][y] + 1
    Q.append([nx, ny])
    #print(Q)

ans = INF

for t in reach:
  x,y = t[0],t[1]
  nokori = min(x,H-1-x,y,W-1-y)
  step = (nokori+K-1)//K + 1 #1は最初のステップ
  ans = min(ans,step)
print(ans)

Buggy submission (verdict: Runtime Error):
H,W,K = map(int,input().split())
Room = []
for i in range(H):
  temp = str(input())
  temp = list(temp)
  for j in range(W):
    if temp[j] == "S":
      sx = i;sy =j
  Room.append(temp)
#print(sx,sy)
L = set([])
def dfs(x,y,stp):
  if x<0 or x>= H or y<0 or y>= W:
    print(1)
    exit()
  if Room[x][y] == "#":
    return
  if stp <= K:
    L.add((x,y))
    if stp == K:
      return
  stp +=1
  dfs(x+1,y,stp)
  dfs(x-1,y,stp)
  dfs(x,y+1,stp)
  dfs(x,y-1,stp)

dfs(sx,sy,0)
INF = float("inf")
ans = INF

for t in L:
  x,y = t[0],t[1]
  nokori = min(x,H-x,y,W-y)
  step = (nokori+K-1)//K + 1 #1は最初のステップ
  ans = min(ans,step)
print(ans)
Problem p03805 (python)

Fixed submission:
import itertools
import sys

N, M = map(int,input().split())

if M < N-1:
  print(0)
  sys.exit()

p = [i for i in range(N)] #点の数
root = []
for i in range(M):
  a,b = map(int,input().split())
  root.append((a-1,b-1))

#たどる点の順番の全探索
pattern = list(itertools.permutations(p))
#print(pattern)

ans = 0
for i in range(len(pattern)):
  if pattern[i][0] != 0:
    break
  Flag = True
  for j in range(N-1):
    if (pattern[i][j], pattern[i][j+1]) in root:
      continue
    elif (pattern[i][j+1], pattern[i][j]) in root:
      continue
    else:
      Flag = False
      break
  if Flag:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
import sys

N, M = map(int,input().split())

if M < N-1:
  print(0)
  sys.exit()

p = [i for i in range(N)] #0スタート
root = []

for i in range(M):
  a,b = map(int,input().split())
  root.append([a-1,b-1])

#print(root)
pattern = list(itertools.permutations(p))

ans = 0
for i in range(len(pattern)):
  Flag = [0]*N
  Flag[0] = 1
  now = 0
  last = False
  for j in range(N-1):
    if now == root[pattern[i][j]][0]:
      now = root[pattern[i][j]][1]
    elif now == root[pattern[i][j]][1]:
      now = root[pattern[i][j]][0]
    else:
      break
    if Flag[now] != 0:
      break
    else:
      Flag[now] = 1
      if j == N-2:
        last = True
  if last:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N, M = map(int,input().split())

p = [i for i in range(N)] #0スタート
root = []

for i in range(M):
  a,b = map(int,input().split())
  root.append([a-1,b-1])

#print(root)
pattern = list(itertools.permutations(p))

ans = 0
for i in range(len(pattern)):
  Flag = [0]*N
  Flag[0] = 1
  now = 0
  last = False
  for j in range(N-1):
    if now == root[pattern[i][j]][0]:
      now = root[pattern[i][j]][1]
    elif now == root[pattern[i][j]][1]:
      now = root[pattern[i][j]][0]
    else:
      break
    if Flag[now] != 0:
      break
    else:
      Flag[now] = 1
      if j == N-2:
        last = True
  if last:
    ans += 1
print(ans)
Problem p03834 (python)

Fixed submission:
s = str(input())

for i in range(len(s)):
  if s[i] == ",":
    s = s[:i]+" "+s[i+1:]
print(s)

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

ans = 0
for i in range(0,k+1):
  for j in range(0,k+1):
    if i+j <= s and s-(i+j) <= k:
      ans += 1
print(ans)
Problem p02571 (python)

Fixed submission:
S = input()
T = input()
ls = len(S)
lt = len(T)
ans = lt
for i in range(0,ls-lt+1):
  m = 0
  for j in range(lt):
    if S[i:i+lt][j]!=T[j]:
      m += 1
  ans = min(ans,m)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
l = len(T)
ans = l
print(ans)
for i in range(l):
  for j in range(l):
    if (i<=j):
      if T[i:j+1] in S:
        if f >= i and f + (l-j) <= len(S):
          ans = min(ans, l - (j+1-i))
print(ans)
Problem p03011 (python)

Fixed submission:
P, Q, R = map(int, input().split())
print(min([P+Q,Q+R,R+P]))

Buggy submission (verdict: Runtime Error):
P, Q, R = map(int, input().split())
print(min[P+Q,Q+R,R+P])
Problem p03042 (python)

Fixed submission:
S = input()

f = int(S[0]+S[1])
s = int(S[2]+S[3])

if f >= 1 and f <= 12 and s >= 1 and s <= 12:
  print('AMBIGUOUS')
elif f >= 1 and f <=12 and (s >= 13 or s == 0):
  print('MMYY')
elif (f >= 13 or f == 0) and s >= 1 and s <= 12:
  print('YYMM')
else:
  print('NA')

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

f = int(S[0]+S[1])
s = int(S[2]+S[3])

if f >= 1 and f <= 12 and s >= 1 and s <= 12:
  print('AMBIGUOUS')
elif f >= 1 and f <=12 and (s >= 13 or s == 0):
  print('MMYY')
elif (f >= 13 or f == 0 and s >= 1 and s <= 12:
  print('YYMM')
else:
  print('NA')

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

f = int(S[0]+S[1])
s = int(S[2]+S[3])

if f >= 1 and f <= 12 and s >= 1 and s <= 12:
  print('AMBIGUOUS')
elif f >= 1 and f <=12 and s => 13:
  print('MMYY')
elif f => 13 and s >= 1 and s <= 12:
  print('YYMM')
else:
  print('NA')
Problem p03137 (python)

Fixed submission:
N, M = map(int,input().split())
X = list(map(int, input().split()))
X.sort()
diff = []
if M != 1:
  for i in range(M-1):
    diff.append(X[i+1]-X[i])
else:
  diff = [0]

sorted_diff = sorted(diff)
sorted_diff.reverse()

ans = sum(sorted_diff)
for i in range(min([N,M])-1):
  ans -= sorted_diff[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
X = list(map(int, input().split()))
X.sort()
diff = []
if M != 1:
  for i in range(M-1):
    diff.append(X[i+1]-X[i])
else:
  diff = [0]

sorted_diff = sorted(diff)
sorted_diff.reverse()

ans = sum(sorted_diff)
for i in range(min([N-1,M])):
  ans -= sorted_diff[i]
print(ans)
Problem p03207 (python)

Fixed submission:
N = int(input())
p = [0]*N
for i in range(N):
    p[i] = int(input())

ans = sum(p)-0.5*max(p)
print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
p = [0]*N
for i in range(N):
    p[i] = int(inout())

ans = sum(p)-0.5*max(p)
print(ans)
Problem p03242 (python)

Fixed submission:
n = input()
ans = []
for i in range(len(n)):
    if n[i] == '1':
        ans.append('9')
    elif n[i] == '9':
        ans.append('1')
    else:
        ans.append(n[i])
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
n = input()
ans = ''
for i in n:
    if n[i] == '1':
        ans += '9'
    elif n[i] == '9':
        n[i] += '1'
    else:
        ans += n[i]
print(ans)
Problem p02597 (python)

Fixed submission:
N = int(input())
C = list(input().strip())
count = 0
j = N - 1
for i in range(N):
  if C[i] == "W":
    while i < j:
      if C[j] == "R":
        C[i], C[j] = C[j], C[i]
        count += 1
        break
      else:
        j -= 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
C = list(input().strip())
count = 0
j = N - 1
for i in range(N):
  if C[i] == "W":
    if i < j:
      while True:
        if C[j] == "R":
          C[i], C[j] = C[j], C[i]
          count += 1
          break
        else:
          j -= 1
    else:
      break

print(count)
Problem p03013 (python)

Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))
N, M = map(int,input().split())


def func(n):
    """メモ化フィボナッチ"""
    memo = [0]*(n+1)

    def _fib(n):
        if n <= 1:
            return n
        if memo[n] != 0:
            return memo[n]
        memo[n] = _fib(n-1)%1000000007 + _fib(n-2)%1000000007
        return memo[n]

    return _fib(n)

a_p = 0
result = 1
for i in range(M):
  a_c = int(input()) - 1
  
  if a_c + 1 == a_p: 
    print(0)
    quit()
  result = ((func(a_c - a_p + 1)%1000000007) * (result%1000000007))%1000000007
  a_p = a_c + 2
  
result = ((func(N - a_p + 1)%1000000007) * (result%1000000007))%1000000007
print(result)

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

N, M = map(int,input().split())

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

def func(a_p,a_c):
  if a_p == a_c: return 1
  num_steps = a_c - a_p
  r = 0
  result = 0
  for n in range(num_steps,0,-1):
    result += int(comb(n,r))
    r += 1
    if n <= r: break
  return result

a_p = 0
result = 1
for i in range(M):
  a_c = int(input()) - 1
  
  if a_c + 1 == a_p: 
    result *= 0
  result = ((func(a_p,a_c)%1000000007) * (result%1000000007))%1000000007
  a_p = a_c + 2
  
result = ((func(a_p,N)%1000000007) * (result%1000000007))%1000000007
print(result)

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

N, M = map(int,input().split())

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

def func(a_p,a_c):
  if a_p == a_c: return 1
  num_steps = a_c - a_p
  r = 0
  result = 0
  for n in range(num_steps,0,-1):
    result += int(comb(n,r))
    r += 1
    if n <= r: break
  return result

a_p = 0
result = 1
for i in range(M):
  a_c = int(input()) - 1
  
  if a_c + 1 == a_p: 
    result *= 0
  result *= func(a_p,a_c)
  a_p = a_c + 2
  
result *= func(a_p,N)
print(result%1000000007)
Problem p03038 (python)

Fixed submission:
N, M = map(int,input().split())
As = sorted(list(map(int,input().split())))
BCs = sorted([list(map(int,input().split())) for _ in range(M)],key = lambda x:-x[1])

j = 0
for i in range(N):
  if BCs[j][0] <= 0:
    j += 1
  if j == M or As[i] > BCs[j][1]:
    break
  else:
    As[i] = BCs[j][1]
    BCs[j][0] -= 1


print(sum(As))

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
As = sorted(list(map(int,input().split())))
BCs = sorted([list(map(int,input().split())) for _ in range(M)],key = lambda x:-x[1])

j = 0
for i in range(N):
  if As[i] > BCs[j][1]:
    break
  else:
    As[i] = BCs[j][1]
    BCs[j][0] -= 1
    if BCs[j][0] == 0:
      j += 1

print(sum(As))
Problem p03104 (python)

Fixed submission:
def xor_a2b(a,b) : 
    flg = a % 2 != 0
    
    if flg: 
        a += 1
    mod = (b - a) % 4
    if mod == 0:
        res = b
    elif mod == 1:
        res =  1
    elif mod == 2:
        res = b + 1
    else:
        res = 0
    if flg:
        return (a-1) ^ res
    else:
        return res
      
a,b = map(int,input().split())

print(xor_a2b(a,b))

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

def xor_a2b(a,b) : 
    flg = a % 2 != 0
    
    if flg: a += 1
    mod = (b - a) % 4
    elif mod == 0:
        res = b
    elif mod == 1:
        res =  1
    elif mod == 2:
        res = b + 1
    else:
        res = 0
    if flg:
        return (a-1) ^ res
    else:
        return res
      
print(xor_a2b(a,b))
Problem p02629 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
n-=1

ans = []

def Base_10_to_n(X, n, ans):
    if (int(X/n)):
        ans.append(chr(ord('a')+(X%n)))
        return Base_10_to_n(int(X/n)-1, n, ans)+str(X%n)
    ans.append(chr(ord('a')+(X%n)))
    return str(X%n)

num  = Base_10_to_n(n,26, ans)

ans.reverse()

print(*ans,sep='')

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())

ans = []

def Base_10_to_n(X, n, ans):
    if (int(X/n)):
        if X%n==0:
            ans.append('z')
            return
        else:
            ans.append(chr(ord('a')-1+(X%n)))
            return Base_10_to_n(int(X/n), n, ans)+str(X%n)
    ans.append(chr(ord('a')-1+(X%n)))
    return str(X%n)

num  = Base_10_to_n(n,26, ans)

ans.reverse()

print(*ans,sep='')
Problem p02831 (python)

Fixed submission:
import fractions

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

print( (a * b) // fractions.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

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

print( (a * b) // math.gcd(a, b))
Problem p02833 (python)

Fixed submission:
n = int(input())
ans = 0
if n % 2 != 0:
    print(0)
    exit()
denominator = 10
while n >= denominator:
    ans += n//denominator
    denominator *= 5

print(ans)

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

n = int(input())

if n % 2 != 0:
    print(0)
    exit()

logtenN = int(np.log10(n))


ans = 0
for i in range(1,logtenN+1):
    add10 = n//(10**i)
    ans += add10
    logfiveAddTen = int(np.log10(add10)/np.log10(5))
    for j in range(1,logfiveAddTen):
        add5 = (add10//(5**j))//2
        ans += add5

print(ans)
Problem p02987 (python)

Fixed submission:
S = input()

A = S[0]
ans = 'No'

if A == S[1]:
    B = S[2]
    if B == S[3]:
        ans = 'Yes'
else:
    B = S[1]
    if A == S[2] and B == S[3]:
        ans = 'Yes'
    if B == S[2] and A == S[3]:
        ans = 'Yes'

if A == B:
    ans = 'No'

print(ans)

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

A = S[0]
ans = 'No'

if A == S[1]:
    B = S[2]
    if B == S[4]:
        ans = 'Yes'
else:
    B = S[1]
    if A == S[2] and B == S[3]:
        ans = 'Yes'
    if B == S[2] and A == S[3]:
        ans = 'Yes'

print(ans)
Problem p02990 (python)

Fixed submission:
N, K = [int(_) for _ in input().split()]
import math
MOD = 10**9+7

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
    try:
        print( (combinations_count(K-1,i-1)*combinations_count(N-K+1,i))%MOD )
    except:
        print(0)

Buggy submission (verdict: Runtime Error):
N, K = [int(_) for _ in input().split()]
import math
MOD = 10**9+7


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
    print( (combinations_count(K-1,i-1)*combinations_count(N-K+1,i))%MOD )

Buggy submission (verdict: Runtime Error):
N, K = [int(_) for _ in input().split()]
import math
MOD = 1000000000+7

ans = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
    print( (combinations_count(K-1,i-1)*combinations_count(N-K+1,i))%MOD )
Problem p02831 (python)

Fixed submission:
def get_gcd(a, b):
    if a < b:
        a, b = b, a
    r = -1
    while r:
        r = a % b
        a = b
        b = r
    return a

a, b = map(int, input().split())
g = get_gcd(a, b)
ans = int(a * b / g)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
gcd = math.gcd(a, b)
ans = int(a*b/gcd)
print(ans)
Problem p02598 (python)

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, k = map(int, input().split())
a = [int(x) for x in input().split()]

left = 0
right = 10**9 + 1

while right - left > 1:
    mid = (right + left) // 2
    cnt = 0
    for b in a:
        cnt += b // mid + int(b % mid != 0) - 1
    if cnt <= k:
        right = mid
    else:
        left = mid
print(right)

Buggy submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, k = map(int, input().split())
a = [int(x) for x in input().split()]

left = -1
right = 10**9 + 1

while right - left > 1:
    mid = (right + left) // 2
    cnt = 0
    for b in a:
        cnt += b // mid + int(b % mid != 0) - 1
    if cnt <= k:
        right = mid
    else:
        left = mid
print(right)
Problem p02627 (python)

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

a = input()
al = [chr(i) for i in range(97, 97+26)] # 英小文字
if a in al:
    print("a")
else:
    print("A")

Buggy submission (verdict: Runtime Error):
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define aint(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(15) << fixed;

  char c;
  cin >> c;
  cout << (islower(c) ? 'a' : 'A') << endl;
  
}