Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys 
sys.setrecursionlimit(10**6)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
N = int(readline())
K = int(readline())
@lru_cache(None)
def f(N,K):
    if K == -1:
        return 0
    if N < 10:
        if K == 0:
            return 1
        elif K == 1:
            return N
        else:
            return 0
    ans = 0
    q, mod = divmod(N, 10)
    ans += f(q,K) + mod * f(q,K-1) + (9-mod) * f(q-1,K-1) 
    return ans
print(f(N,K))

Fixed submission:
import sys 
from functools import lru_cache
sys.setrecursionlimit(10**6)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
N = int(readline())
K = int(readline())
@lru_cache(None)
def f(N,K):
    if K == -1:
        return 0
    if N < 10:
        if K == 0:
            return 1
        elif K == 1:
            return N
        else:
            return 0
    ans = 0
    q, mod = divmod(N, 10)
    ans += f(q,K) + mod * f(q,K-1) + (9-mod) * f(q-1,K-1) 
    return ans
print(f(N,K))

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
sys.setrecursionlimit(10**6)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
N = int(readline())
K = int(readline())

def f(N,K):
    if K == -1:
        return 0
    if N < 10:
        if K == 0:
            return 1
        elif K == 1:
            return N
        else:
            return 0
    ans = 0
    q, mod = divmod(N, 10)
    ans += f(q,K) + mod * f(q,K-1) + (9-mod) * f(q-1,K-1) 
    return ans
print(f(N,K))

Fixed submission:
import sys 
from functools import lru_cache
sys.setrecursionlimit(10**6)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7
N = int(readline())
K = int(readline())
@lru_cache(None)
def f(N,K):
    if K == -1:
        return 0
    if N < 10:
        if K == 0:
            return 1
        elif K == 1:
            return N
        else:
            return 0
    ans = 0
    q, mod = divmod(N, 10)
    ans += f(q,K) + mod * f(q,K-1) + (9-mod) * f(q-1,K-1) 
    return ans
print(f(N,K))
Buggy python submission (verdict: Time Limit Exceeded):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,M = map(int,readline().split())
WA_cnt = [0]*(N+1)
A = []
cnt = 0
for _ in range(M):
    p,S = readline().decode().split()
    p = int(p)
    if S == 'AC' and (p in A) == False:
        A.append(p) 
        cnt += WA_cnt[p]
    else:
        WA_cnt[p] += 1
        
print(len(set(A)),cnt)

Fixed submission:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,M = map(int,readline().split())
WA_cnt = [0]*(N+1)
WA_use = [0]*(N+1)
A = []
cnt = 0
for _ in range(M):
    p,S = readline().decode().split()
    p = int(p)
    if S == 'AC' and WA_use[p] == 0:
        A.append(p) 
        cnt += WA_cnt[p]
        WA_use[p] = 1
    else:
        WA_cnt[p] += 1
        
print(len(set(A)),cnt)
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,S = read().decode('utf-8').split()
print(N,S)
count = 0
for i in range(1000):
  s = str(i).zfill(3)
  index_all = 0
  for j in range(3):
    index = S[index_all:].find(s[j])
    if index == -1:
      break
    index_all += index+1
    if j ==2:
      count += 1
print(count)import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,S = read().decode('utf-8').split()
count = 0
for i in range(1000):
  s = str(i).zfill(3)
  index_all = 0
  for j in range(3):
    index = S[index_all:].find(s[j])
    if index == -1:
      break
    index_all += index+1
    if j ==2:
      count += 1
print(count)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,S = read().decode('utf-8').split()
count = 0
for i in range(1000):
  s = str(i).zfill(3)
  index_all = 0
  for j in range(3):
    index = S[index_all:].find(s[j])
    if index == -1:
      break
    index_all += index+1
    if j ==2:
      count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
n = int(input())
s = input()
s_list = [i for i in s]
a = list(itertools.combinations(s_list, 3))
print(len(list(set(a))))

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,S = read().decode('utf-8').split()
count = 0
for i in range(1000):
  s = str(i).zfill(3)
  index_all = 0
  for j in range(3):
    index = S[index_all:].find(s[j])
    if index == -1:
      break
    index_all += index+1
    if j ==2:
      count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
B = list(map(int,readline().split()))
N, W = map(int, readline().split())
SS = ['SUN','MON','TUE','WED','THU','FRI','SAT']
S = readline().decode().rstrip()
for i in range(7):
    if S == SS[i]:
        print(7-i)
        sys.exit()

Fixed submission:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
SS = ['SUN','MON','TUE','WED','THU','FRI','SAT']
S = readline().decode().rstrip()
for i in range(7):
    if S == SS[i]:
        print(7-i)
        sys.exit()
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10**9+7
X,Y = map(int,readline().split())
if X > Y:
    X,Y = Y,X
Z = X+Y
if Z % 3 == 0 and X <= Y <= 2*X:
    N = Z//3
    r = min(Y-X+1,N-Y+X-1)
else:
    print(0)
    sys.exit()
f = [1]*(N+1)
for i in range(1,N+1):
    f[i] = i * f[i-1] % mod
a = pow(f[r],mod-2,mod)
b = pow(f[N-r],mod-2,mod)
ans = f[N] * a * b % mod
print(ans)
    
    

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10**9+7
X,Y = map(int,readline().split())
if X > Y:
    X,Y = Y,X
Z = X+Y
if Z % 3 == 0 and X <= Y <= 2*X:
    N = Z//3
    r = (N-(Y-X)) // 2
else:
    print(0)
    sys.exit()
f = [1]*(N+1)
for i in range(1,N+1):
    f[i] = i * f[i-1] % mod
a = pow(f[r],mod-2,mod)
b = pow(f[N-r],mod-2,mod)
ans = f[N] * a * b % mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
H,W = map(int,sys.stdin.readline().rstrip().split())
map = [[i for i in map(str,sys.stdin.readline().rstrip())] for _ in range(H)]
dist = [[-1]*W for _ in range(H)]
q = deque()
for i in range(H):
  for j in range(W):
    if map[i][j] == '#':
      q.append((i,j))
      dist[i][j] = 0

def bfs():
  while q:
    x,y = q.popleft()
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]
    for i in range(4):
      nx = x + dx[i]
      ny = y + dy[i]
      if 0<= nx < H and 0 <= ny < W and map[nx][ny] == '.' and dist[nx][ny] == -1:
        dist[nx][ny] = dist[x][y] + 1
        q.append((nx,ny))
bfs()
ans = 0
for i in range(H):
  ans = max(max(dist[i][:]),ans)
print(ans)

Fixed submission:
import sys
from collections import deque
H,W = map(int,sys.stdin.readline().rstrip().split())
map = [[i for i in map(str,sys.stdin.readline().rstrip())] for _ in range(H)]
dist = [[-1]*W for _ in range(H)]
q = deque()
for i in range(H):
  for j in range(W):
    if map[i][j] == '#':
      q.append((i,j))
      dist[i][j] = 0

def bfs():
  while q:
    x,y = q.popleft()
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]
    for i in range(4):
      nx = x + dx[i]
      ny = y + dy[i]
      if 0<= nx < H and 0 <= ny < W and map[nx][ny] == '.' and dist[nx][ny] == -1:
        dist[nx][ny] = dist[x][y] + 1
        q.append((nx,ny))
bfs()
ans = 0
for i in range(H):
  ans = max(max(dist[i][:]),ans)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,W = map(int, readline().split())
w=[];v=[]
for _ in range(N):
  a,b = map(int, readline().split())
  w.append(a)
  v.append(b)
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
for i in range(N):
  for j in range(W+1):
    if j >= w[i]:
      dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]]+v[i])
    else:
      dp[i+1][j] = dp[i][j]
print(dp[N][W])

Fixed submission:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,W = map(int, readline().split())
w=[];v=[]
for _ in range(N):
  a,b = map(int, readline().split())
  w.append(a)
  v.append(b)
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
for i in range(N):
  for j in range(W+1):
    if j >= w[i]:
      dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]]+v[i])
    else:
      dp[i+1][j] = dp[i][j]
print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
#D - Good Grid
import sys 
from itertools import permutations
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,C = map(int,readline().split())
D = []
for _ in range(C):
    row = list(map(int,readline().split()))
    D.append(row)
data = []
for _ in range(N):
    row = list(map(int,readline().split()))
    data.append(row)

INF = 10**31
ans = INF
A = [i for i in range(C)]

for a,b,c in permutations(A,3):
    total = 0
    for i in range(N):
        for j in range(N):
            pre_c = data[i][j]-1
            if (i+j) % 3 == 0:
                total += D[pre_c][a]   
            elif (i+j) % 3 == 1:
                total += D[pre_c][b]
            else:
                total += D[pre_c][c]
    ans = min(ans,total)

print(ans)
                 

Fixed submission:
# -*- coding: utf-8 -*-
#D - Good Grid
import sys 
from itertools import permutations
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,C = map(int,readline().split())
D = []
for _ in range(C):
    row = list(map(int,readline().split()))
    D.append(row)
data = []
for _ in range(N):
    row = list(map(int,readline().split()))
    data.append(row)

INF = 10**31
ans = INF
X = defaultdict(int)
Y = defaultdict(int)
Z = defaultdict(int)

for i in range(N):
    for j in range(N):
        pre_c = data[i][j]-1
        if (i+j) % 3 == 0:
            X[pre_c] += 1   
        elif (i+j) % 3 == 1:
            Y[pre_c] += 1
        else:
            Z[pre_c] += 1

M = [i for i in range(C)]
for a,b,c in permutations(M,3):
    total = 0
    for k,v in X.items():
        total += D[k][a]*v
    for k,v in Y.items():
        total += D[k][b]*v
    for k,v in Z.items():
        total += D[k][c]*v
    
    ans = min(ans,total)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
#D - Static Sushi 
import sys 
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
bit = [[0]*20 for _ in range(N)]
for i in range(N):
    for j in range(20):
            if (A[i] >> j) & 1:
                bit[i][j] += 1

r = 1
ans = 0
tmp = np.zeros(20,np.int64)

for l in range(N):
    while r<=N and np.all((tmp+bit[r-1]) <= 1) == True:
        tmp += bit[r-1]
        r += 1 
    if l == r-1:
        r += 1
    else:
        ans += r-l-1
        tmp -= bit[l]
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
#D - Static Sushi 
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

right = 0
ans = 0
total = 0
#尺取法 閉区間
for left in range(N):
    while right < N and (total ^ A[right]) == (total + A[right]):
        total += A[right]
        right += 1
    ans += right-left
    if left == right:
        right += 1
    else:
        total -= A[left]
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
H,W=map(int,input().split())
map = [[i for i in map(str,sys.stdin.readline().rstrip())] for _ in range(H)]
count_dot = 0
dist = [[0]*W for _ in range(H)]
for i in range(H):
  for j in range(W):
    if map[i][j] == '.':
      count_dot +=1
def bfs():
  while True:
    x,y = q.popleft()
    if x == H-1 and y ==W-1:
      break
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]
    for i in range(4):
      nx = x + dx[i]
      ny = y + dy[i]
      if 0 <= nx < H and 0 <= ny < W and map[nx][ny]=='.' and dist[nx][ny] == 0:
        q.append((nx,ny))
        dist[nx][ny] = dist[x][y] + 1
q = deque()
q.append((0,0))
bfs()
dist_min = dist[H-1][W-1]
if dist_min ==0:
  print(-1)
else:
  print(count_dot-dist_min-1)

Fixed submission:
import sys
from collections import deque
H,W=map(int,input().split())
map = [[i for i in map(str,sys.stdin.readline().rstrip())] for _ in range(H)]
count_dot = 0
dist = [[0]*W for _ in range(H)]
for i in range(H):
  for j in range(W):
    if map[i][j] == '.':
      count_dot +=1
def bfs():
  while q:
    x,y = q.popleft()
    if x == H-1 and y ==W-1:
      break
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]
    for i in range(4):
      nx = x + dx[i]
      ny = y + dy[i]
      if 0 <= nx < H and 0 <= ny < W and map[nx][ny]=='.' and dist[nx][ny] == 0:
        q.append((nx,ny))
        dist[nx][ny] = dist[x][y] + 1
q = deque()
q.append((0,0))
bfs()
dist_min = dist[H-1][W-1]
if dist_min ==0:
  print(-1)
else:
  print(count_dot-dist_min-1)

Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
H,W=map(int,input().split())
map = [[i for i in map(str,sys.stdin.readline().rstrip())] for _ in range(H)]
count_dot = 0
dist = [[0]*W for _ in range(H)]
for i in range(H):
  for j in range(W):
    if map[i][j] == '.':
      count_dot +=1
def bfs():
  while True:
    x,y = q.popleft()
    if x == H-1 and y ==W-1:
      break
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]
    for i in range(4):
      nx = x + dx[i]
      ny = y + dy[i]
      if 0 <= nx < H and 0 <= ny < W and map[nx][ny]=='.' and dist[nx][ny] == 0:
        q.append((nx,ny))
        dist[nx][ny] = dist[x][y] + 1
q = deque()
q.append((0,0))
bfs()
dist_min = dist[H-1][W-1]
print(count_dot-dist_min-1)

Fixed submission:
import sys
from collections import deque
H,W=map(int,input().split())
map = [[i for i in map(str,sys.stdin.readline().rstrip())] for _ in range(H)]
count_dot = 0
dist = [[0]*W for _ in range(H)]
for i in range(H):
  for j in range(W):
    if map[i][j] == '.':
      count_dot +=1
def bfs():
  while q:
    x,y = q.popleft()
    if x == H-1 and y ==W-1:
      break
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]
    for i in range(4):
      nx = x + dx[i]
      ny = y + dy[i]
      if 0 <= nx < H and 0 <= ny < W and map[nx][ny]=='.' and dist[nx][ny] == 0:
        q.append((nx,ny))
        dist[nx][ny] = dist[x][y] + 1
q = deque()
q.append((0,0))
bfs()
dist_min = dist[H-1][W-1]
if dist_min ==0:
  print(-1)
else:
  print(count_dot-dist_min-1)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys 
from heapq import heappop,heappush
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
data = []
for i in range(N):
    A = list(map(int,readline().split()))
    for j in range(i):
        data.append((A[j],j+1,i+1))
        
def dijkstra(q,edges,dist):
    while q:
        cost, v_from = heappop(q)
        if dist[v_from] < cost:
            continue
        for _cost,v_to in edges[v_from]:
            newcost = cost+_cost
            if newcost < dist[v_to]:
                dist[v_to] = newcost
                heappush(q,(newcost,v_to))             
    return 

data = sorted(data)
edges = [[] for _ in range(N+1)]
INF = 10**31
ans = 0
for c,i,j in data:
    dist = [INF]*(N+1)
    dist[i] = 0
    q = [(0,i)]
    dijkstra(q,edges,dist)
    if c < dist[j]:
        edges[i].append((c,j))
        edges[j].append((c,i))
        ans += c
    elif c > dist[j]:
        print(-1)
        sys.exit()

print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
import sys 
from heapq import heappop,heappush
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
# INF = 10**31
cost = [[0]*(N+1) for _ in range(N+1)] 
tmp = [[0]*(N+1) for _ in range(N+1)] 
for i in range(N):
    A = list(map(int,readline().split()))
    for j in range(N):
        cost[i+1][j+1] = A[j]
        tmp[i+1][j+1] = A[j]
        

for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            if cost[i][j] > cost[i][k] + cost[k][j]:
                print(-1)
                sys.exit()
            if cost[i][k] and cost[k][j] and cost[i][j] == cost[i][k] + cost[k][j]:
                tmp[i][j] = 0

ans = sum([sum([c for c in row]) for row in tmp])
print(ans//2)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys 
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

S1 = np.cumsum(A)
S2 = np.cumsum(A)
ans1 = 0
ans2 = 0
# 偶数項-,奇数項を+にする
for i in range(N):
    if i & 1: 
        if S1[i] >= 0:
            ans1 += S1[i]+1
            S1 -= S1[i]+1
        if S2[i] <= 0:
            ans2 += 1-S2[i]
            S2 += 1-S2[i]
    else: 
        if S1[i] <= 0:
            ans1 += 1-S1[i]
            S1 += 1-S1[i]
        if S2[i] >= 0:
            ans2 += S2[i]+1
            S2 -= S2[i]+1

print(min(ans1,ans2))   

Fixed submission:
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

ans1 = 0
ans2 = 0
S1 = 0
S2 = 0
# 偶数項-,奇数項を+にする
for i in range(N):
    S1 += A[i]
    S2 += A[i]
    if i & 1: 
        if S1 >= 0:
            ans1 += S1+1
            S1 = -1
        if S2 <= 0:
            ans2 += 1-S2
            S2 = 1
    else: 
        if S1 <= 0:
            ans1 += 1-S1
            S1 = 1
        if S2 >= 0:
            ans2 += S2+1
            S2 = -1
print(min(ans1,ans2))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys 
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

S = np.cumsum(A)
ans1 = 0
ans2 = 0
# 偶数項-,奇数項を+にする
for i in range(N):
    if i & 1: 
        if S[i] >= 0:
            ans1 += S[i]+1
            S -= S[i]+1
    else: 
        if S[i] <= 0:
            ans1 += 1-S[i]
            S += 1-S[i]

S = np.cumsum(A)

for i in range(N):
    if i & 1: 
        if S[i] <= 0:
            ans2 += 1-S[i]
            S += 1-S[i]
    else: 
        if S[i] >= 0:
            ans2 += S[i]+1
            S -= S[i]+1
            
print(min(ans1,ans2))   

Fixed submission:
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

ans1 = 0
ans2 = 0
S1 = 0
S2 = 0
# 偶数項-,奇数項を+にする
for i in range(N):
    S1 += A[i]
    S2 += A[i]
    if i & 1: 
        if S1 >= 0:
            ans1 += S1+1
            S1 = -1
        if S2 <= 0:
            ans2 += 1-S2
            S2 = 1
    else: 
        if S1 <= 0:
            ans1 += 1-S1
            S1 = 1
        if S2 >= 0:
            ans2 += S2+1
            S2 = -1
print(min(ans1,ans2))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def make_divisors(n): #約数列挙の関数を一部改変
    lower_divisors , upper_divisors = [], [] 
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    if i == 1:
        return 1
    else:
        return upper_divisors[-1]

N = int(readline())
ans = make_divisors(N)
print(len(str(ans)))

Fixed submission:
n = int(input())
ans = float('inf')
for i in range(1,int(n**0.5) + 1):
  if n % i == 0:
    ans = min(ans,len(str(n // i)))
print(ans)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def make_divisors(n): #約数列挙の関数を一部改変
    lower_divisors , upper_divisors = [], [] 
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return upper_divisors[-1]

N = int(readline())
ans = make_divisors(N)
print(len(str(ans)))

Fixed submission:
n = int(input())
ans = float('inf')
for i in range(1,int(n**0.5) + 1):
  if n % i == 0:
    ans = min(ans,len(str(n // i)))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys 
from collections import deque
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, T = map(int, readline().split())
A = list(map(int,readline().split()))
B = sorted(A,reverse = True)

d = defaultdict(int)
for i in range(N-1):
    a = A[i]
    p = B[0] - a
    d[p] += 1
    B.remove(a)
d = sorted(d.items(),reverse=True)
print(d[0][1])

Fixed submission:
# -*- coding: utf-8 -*-
import sys 
from collections import deque
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, T = map(int, readline().split())
A = list(map(int,readline().split()))

### セグメント木
# 0-index
# N: 処理する区間の長さ
N0 = 2**(N-1).bit_length()
data = [0]*(2*N0)

# 初期化
def init(A):
    for i in range(N):
        data[i+N0-1] = A[i]
    for i in range(N0-2,-1,-1):
        data[i] = max(data[2*i+1],data[2*i+2])

# a_k の値を x に更新
def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = max(data[2*k+1], data[2*k+2])

# 区間[l, r)の最小値
def query(l, r):
    L = l + N0; R = r + N0
    s = 0
    while L < R:
        if R & 1:
            R -= 1
            s = max(s, data[R-1])

        if L & 1:
            s = max(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s

init(A)
d = defaultdict(int)
for i in range(N-1):
    a = A[i]
    high = query(i+1,N+1)
    p = high - a
    d[p] += 1
d = sorted(d.items(),reverse=True)
print(d[0][1])
Buggy python submission (verdict: Runtime Error):
print(sum(a!=b for a,b in zip(input(),input()))


Fixed submission:
print(sum(a!=b for a,b in zip(input(),input())))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for x in a:
  ans *= x
if ans > pow(10, 18):
  print(-1)
else:
  print(ans)
  

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 1
ul = pow(10, 18)
if 0 in a:
  print(0)
  exit(0)
for x in a:
  ans *= x
  if ans > ul:
    print(-1)
    exit(0)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
for x in a:
  if x >= sum(a)/(4*m):
  	res += x

if res >= m:
  print('Yes')
else:
  print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
if sum(x >= sum(a)/(4*m) for x in a) >= m:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print((ab+1)//2)

Fixed submission:
a,b=map(int,input().split())
if a==1 or b == 1:
  print(1)
else:
  print((a*b+1)//2)