Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = int((N*(N-1)*(N-2))/6)
# Count Duplicate
hash = {}
for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if hash.get(S[i]+S[j]+S[k]):
                ans -= 1
            else :
                hash[S[i]+S[j]+S[k]] = True
print(ans)

Fixed submission:
def is_passcode_exist(S,passcode):
    passcode_idx = 0
    passcode_is_exist = False
    for c in S:
        if passcode_idx == 3:
            passcode_is_exist = True
            break
        if passcode[passcode_idx] == c:
            passcode_idx += 1
    if passcode_idx == 3:
        passcode_is_exist = True
    return passcode_is_exist

if __name__ == "__main__":
    N = int(input())
    S = input()
    count = 0
    for i in range(0,1000):
        if is_passcode_exist(S,str(i).zfill(3)):
            count += 1
    print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
s[3] = '8'
print(s)

Fixed submission:
s = input()
s = s.replace("2017", "2018")
print(s)
Buggy python submission (verdict: Runtime Error):
s = input();
t = input();

n = len(s);
for i in range(n) :
	print(s[i], end="");
	print(t[i], end="");
print("");


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

n = len(s);
for i in range(n) :
	print(s[i], end="");
	if i < len(t) :
		print(t[i], end="");
print("");
Buggy python submission (verdict: Runtime Error):

def check(s, ans, i) :
    return s[i-1] ^ ans[i-2] ^ ans[i]

def solve(first, second, s) :
    n = len(s)
    ans = [0] * (n)
    ans[-2] = first;
    ans[-1] = second;



    for i in range(0, n-2) :
        nsame = 0
        nsame ^= s[i-1]
        nsame ^= ans[i-1]
        ans[i] = ans[i-2] ^ nsame
    if check( s, ans, -2 ) == 0 and check(s, ans, -1) == 0 :
        ans += [1]
#    print(ans)
    return ans

N = int(input())
s = input()

data = [0] * N
for i in range(N) :
    data[i] = 1 if s[i] == 'o' else 0
ok = 0

for i in range(2) :
    if ok == 1 :
        break
    for j in range(2) :
        if ok == 1 :
            break
        ans = solve(i, j, data)
        ok = len(ans) - N
if ok == 0 :
    print("-1")
else :
    for i in range(N) :
        print('S' if ans[i] == 1 else 'W', end = "")
    print()



Fixed submission:

def check(s, ans, i) :
    return s[i-1] ^ ans[i-1] ^ ans[i-2] ^ ans[i]

def solve(first, second, s) :
    n = len(s)
    ans = [0] * (n)
    ans[-2] = first;
    ans[-1] = second;



    for i in range(0, n-2) :
        nsame = 0
        nsame ^= s[i-1]
        nsame ^= ans[i-1]
        ans[i] = ans[i-2] ^ nsame
    if check( s, ans, n-2 ) == 0 and check(s, ans, n-1) == 0 :
        ans.append(1)
#    print(ans)
    return ans

N = int(input())
s = input()

data = [0] * N
for i in range(N) :
    data[i] = 1 if s[i] == 'x' else 0
ok = 0

for i in range(2) :
    if ok == 1 :
        break
    for j in range(2) :
        if ok == 1 :
            break
        ans = solve(i, j, data)
        ok = len(ans) - N
if ok == 0 :
    print("-1")
else :
    for i in range(N) :
        print('W' if ans[i] == 1 else 'S', end = "")
    print()
Buggy python submission (verdict: Time Limit Exceeded):
n,k = input().split()
d = list(map(int,input().split()))
num = [i for i in range(10)]
poss = list(set(d) ^ set(num))
an = int(n)
while True:
    sum = 0
    for p in poss:
        sum += n.count(str(p))
    if sum ==len(n):
        break
    else:
        an +=1
print(an)

Fixed submission:
n,k = map(int,input().split())
d=set(input().split())
while True:
    if len(set(str(n))&d)!=0:
        n+=1
    else:
        break
print(n)
Buggy python submission (verdict: Runtime Error):
S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

for i in range(s-t + 1):
      count = 0
      U = S[i: i+t]
      for i in range(t):
            if U[j] != T[j]:
                count += 1
      ans.append(count)
print(min(ans))

Fixed submission:
S = str(input())
T = str(input())
lens = len(S)
lent = len(T)
ans = []

for i in range(lens-lent + 1):
      count = 0
      U = S[i: i+lent]
      for j in range(lent):
            if U[j] != T[j]:
                count += 1
      ans.append(count)
print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
def run():
  N, K = map(int, input().split())
  ps = list(map(int, input().split()))
  dp = [0]*(N-K+1)
  ans = 0
  dp[0] = sum(ps[0:K])
  for n in range(1, N-K+1):
    dp[n] = max(dp[n-1], sum(ps[n:n+K]))
  print((dp[-1]+K)/2)

if __name__ == '__main__':
    run()

Fixed submission:
def run():
  N, K = map(int, input().split())
  ps = list(map(int, input().split()))
  dp = [0]*(N-K+1)
  ans = 0
  dp[0] = sum(ps[0:K])
  for n in range(1, N-K+1):
    dp[n] = dp[n-1]+ps[n+K-1]-ps[n-1]
  print((max(dp)+K)/2)

if __name__ == '__main__':
    run()

Buggy python submission (verdict: Time Limit Exceeded):
def run():
  N, K = map(int, input().split())
  ps = list(map(int, input().split()))
  dp = [0]*(N-K+1)
  dp[0] = sum(ps[0:K])
  for n in range(1, N-K+1):
    dp[n] = max(dp[n-1], sum(ps[n:n+K]))
  print((dp[-1]+K)/2)

if __name__ == '__main__':
    run()

Fixed submission:
def run():
  N, K = map(int, input().split())
  ps = list(map(int, input().split()))
  dp = [0]*(N-K+1)
  ans = 0
  dp[0] = sum(ps[0:K])
  for n in range(1, N-K+1):
    dp[n] = dp[n-1]+ps[n+K-1]-ps[n-1]
  print((max(dp)+K)/2)

if __name__ == '__main__':
    run()
Buggy python submission (verdict: Time Limit Exceeded):
def run():
  H, N = map(int, input().split())
  ab = [list(map(int, input().split())) for n in range(N)]
  dp = [float('inf')]*(H+1)
  for h in range(H+1):
    for n in range(N):
      a, b = ab[n]
      if h <= a:
        dp[h] = min(dp[h], b)
      else:
        dp[h] = min(dp[h], dp[h-a]+b)
  print(dp[-1])
    
if __name__ == '__main__':
    run()

Fixed submission:
def run():
  H, N = map(int, input().split())
  ab_li = [tuple(map(int, input().split())) for n in range(N)]
  dp = [0]*(H+1)
  for i in range(1, H+1):
    new_li = []
    for n in range(N):
      a, b = ab_li[n]
      if a <= i:
        new_li.append(dp[i-a]+b)
      else:
        new_li.append(b)
    dp[i] = min(new_li)
  print(dp[-1])
  
if __name__ == '__main__':
  run()

Buggy python submission (verdict: Time Limit Exceeded):
def run():
  H, N = map(int, input().split())
  ab_li = [tuple(map(int, input().split())) for n in range(N)]
  dp = [0]*(H+1)
  for i in range(1, H+1):
    new_li = []
    for n in range(N):
      a, b = ab_li[n]
      if a <= i:
        new_li.append(dp[i-a]+b)
      else:
        new_li.append(b)
    dp[i] = min(new_li)
  print(dp[-1])
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  H, N = map(int, input().split())
  ab_li = [tuple(map(int, input().split())) for n in range(N)]
  dp = [0]*(H+1)
  for i in range(1, H+1):
    new_li = []
    for n in range(N):
      a, b = ab_li[n]
      if a <= i:
        new_li.append(dp[i-a]+b)
      else:
        new_li.append(b)
    dp[i] = min(new_li)
  print(dp[-1])
  
if __name__ == '__main__':
  run()

Buggy python submission (verdict: Runtime Error):
def run():
  H, N = map(int, input().split())
  ab_li = [tuple(map(int, input().split())) for n in range(N)]
  dp = [float('inf')]*(H+1)
  for i in range(1, H+1):
    for n in range(N):
      a, b = ab_li[n]
      if i == a:
        dp[i] = min(dp[i], b)
      if (i < a) or (dp[i-a] == float('inf')):
        continue
      dp[i] = min(dp[i], dp[i-a]+b)
  if dp[-1] == float('inf'):
    for h in range(H, 0, -1):
      if dp[h] != float('inf'):
        ans = dp[h]+min(ab_li, key=lambda x:x[1])[1]
        break
  else:
    ans = dp[-1]
  for n in range(N):
    a, b = ab_li[n]
    if a > H:
      ans = min(ans, b)
  print(ans)
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  H, N = map(int, input().split())
  ab_li = [tuple(map(int, input().split())) for n in range(N)]
  dp = [0]*(H+1)
  for i in range(1, H+1):
    new_li = []
    for n in range(N):
      a, b = ab_li[n]
      if a <= i:
        new_li.append(dp[i-a]+b)
      else:
        new_li.append(b)
    dp[i] = min(new_li)
  print(dp[-1])
  
if __name__ == '__main__':
  run()
Buggy python submission (verdict: Time Limit Exceeded):
def run():
  b = 10**9+7
  bit = 60
  N = int(input())
  a_li = list(map(int, input().split()))
  ans = 0
  dp = [[0]*bit for i in range(N)]
  for i in range(bit):
    dp[0][i] = (a_li[0] >> i) & 1
  for i in range(1, N):
    tem = 0
    for j in range(bit):
      a_j = (a_li[i] >> j) & 1
      dp[i][j] = dp[i-1][j] + a_j
      if a_j == 1:
        tem += (i-dp[i-1][j]) << j
      else:
        tem += dp[i-1][j] << j
    #print(ans, tem)
    ans += tem
  #print(dp)
  print(ans%b)

if __name__ == '__main__':
  run()

Fixed submission:
def run():
  b = 10**9+7
  bit = 60
  N = int(input())
  a_li = list(map(int, input().split()))
  ans = 0
  dp = [[0]*bit for i in range(N)]
  for i in range(bit):
    dp[0][i] = (a_li[0] >> i) & 1
  for i in range(1, N):
    tem = 0
    for j in range(bit):
      a_j = (a_li[i] >> j) & 1
      dp[i][j] = dp[i-1][j] + a_j
      if a_j == 1:
        tem += (i-dp[i-1][j]) << j
      else:
        tem += dp[i-1][j] << j
    #print(ans, tem)
    ans += tem
  #print(dp)
  print(ans%b)

if __name__ == '__main__':
  run()

Buggy python submission (verdict: Time Limit Exceeded):
def run():
  b = 10**9+7
  N = int(input())
  a_li = list(map(int, input().split()))
  ans = 0
  for i in range(N-1):
    for j in range(i+1, N):
      ans += a_li[i]^a_li[j]
  print(ans%b)

if __name__ == '__main__':
  run()

Fixed submission:
def run():
  b = 10**9+7
  bit = 60
  N = int(input())
  a_li = list(map(int, input().split()))
  ans = 0
  dp = [[0]*bit for i in range(N)]
  for i in range(bit):
    dp[0][i] = (a_li[0] >> i) & 1
  for i in range(1, N):
    tem = 0
    for j in range(bit):
      a_j = (a_li[i] >> j) & 1
      dp[i][j] = dp[i-1][j] + a_j
      if a_j == 1:
        tem += (i-dp[i-1][j]) << j
      else:
        tem += dp[i-1][j] << j
    #print(ans, tem)
    ans += tem
  #print(dp)
  print(ans%b)

if __name__ == '__main__':
  run()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def run():
  H, W = map(int, input().split())
  df = np.zeros((H, W)).astype(int)
  M = min(H, W)
  dp = [[[] for w in range(W)] for h in range(H)]
  for h in range(H):
      for w, v in enumerate(map(int, input().split())):
          df[h][w] = v
  for h in range(H):
      for w, v in enumerate(map(int, input().split())):
          df[h][w] = abs(df[h][w]-v)
  for h in range(H):
      for w in range(W):
          diff = df[h][w]
          if h == w and h == 0:
              dp[h][w] = [diff]
              continue
          temp = []
          for x, y in [[h-1, w], [h, w-1]]:
              if 0 > min(x, y): continue
              for v in dp[x][y]:
                  temp.append(abs(v + diff))
                  temp.append(abs(v - diff))
          dp[h][w] = set(temp)
  print(min(dp[-1][-1]))
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  ofs = 1000
  H, W = map(int, input().split())
  dp = [[0 for w in range(W)] for h in range(H)]
  a = [list(map(int, input().split())) for i in range(H)]
  b = [list(map(int, input().split())) for i in range(H)]
  c = [[abs(a[i][j] - b[i][j]) for j in range(W)] for i in range(H)]
  dp[0][0] = (1 << ofs + c[0][0]) | (1 << ofs - c[0][0])
  for h in range(1, H):
    dp[h][0] = (dp[h-1][0] << c[h][0]) | (dp[h-1][0] >> c[h][0])
  for w in range(1, W):
    dp[0][w] = (dp[0][w-1] << c[0][w]) | (dp[0][w-1] >> c[0][w])
  for h in range(1, H):
    for w in range(1, W):
      v = c[h][w]
      dp[h][w] = (dp[h-1][w] << v) | (dp[h-1][w] >> v)
      dp[h][w] |= (dp[h][w-1] << v) | (dp[h][w-1] >> v)
  s = list(bin(dp[-1][-1] >> ofs))
  for i in range(len(s)):
    if s[-1-i] == '1':
      print(i)
      break

if __name__ == '__main__':
  run()
Buggy python submission (verdict: Runtime Error):
import sys
from math import factorial
#nCi
def com(n, i):
    return int(factorial(n)/factorial(i)/factorial(n-i))
    
def cal1(num):
    total = 1
    if num < 1: return total
    if num == 1: return 2
    large_num = num
    for small_num in range(1, num):
        if small_num > large_num: break
        total += com(large_num, small_num)
        large_num -= 1
    return total

def main():
    N, M = map(int, input().split())
    len_list = []
    pre_a = -1
    for m in range(M):
        a = int(input())
        if (pre_a + 1) == a: sys.exit("0")
        len_list.append(a-(pre_a+3))
        pre_a = a
    len_list.append(N-(pre_a+2))
    ans = 1
    for num in len_list:
        ans *= cal1(num)
    print(ans%1000000007)
    
main()

Fixed submission:
def run():
  N, M = map(int, input().split())
  stairs = [1] * (N+1)
  for m in range(M):
    a = int(input())
    stairs[a] = 0
  #print(stairs)
  for n in range(2, N+1):
    stairs[n] = (stairs[n-1] + stairs[n-2])*stairs[n]
  print(stairs[N]%1000000007)
  
if __name__ == '__main__':
  run()

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

def cal2(n, i):
    return int(factorial(n)/factorial(i)/factorial(n-i))
    
def cal1(num):
    total = 1
    if num < 1: return total
    if num == 1: return 2
    i = num
    for n in range(1, num):
        if n > i: return total
        total += cal2(i, n)
        i -= 1

def main():
    N, M = map(int, input().split())
    len_list = []
    pre_a = -1
    for m in range(M):
        a = int(input())
        if (pre_a + 1) == a: sys.exit("0")
        len_list.append(a-(pre_a+3))
        pre_a = a
    len_list.append(N-(pre_a+2))
    ans = 1
    for num in len_list:
        ans *= cal1(num)
    print(ans%1000000007)
    
main()

Fixed submission:
def run():
  N, M = map(int, input().split())
  stairs = [1] * (N+1)
  for m in range(M):
    a = int(input())
    stairs[a] = 0
  #print(stairs)
  for n in range(2, N+1):
    stairs[n] = (stairs[n-1] + stairs[n-2])*stairs[n]
  print(stairs[N]%1000000007)
  
if __name__ == '__main__':
  run()
Buggy python submission (verdict: Time Limit Exceeded):
def run():
  N, K = map(int, input().split())
  h_li = [int(h) for h in input().split()]
  cost_li = [0] * (N)
  cost_li[1] = abs(h_li[0] - h_li[1])
  for n in range(2, N):
    if n < K: k = n
    else: k = K
    cost = float('inf')
    h = h_li[n]
    for _k in range(1, k+1):
      cost = min(cost, cost_li[n-_k] + abs(h_li[n-_k]-h))
    cost_li[n] = cost
  print(cost_li[N-1])
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  N, K = map(int, input().split())
  h_li = [int(h) for h in input().split()]
  cost_li = [0] * (N)
  cost_li[1] = abs(h_li[0] - h_li[1])
  for n in range(2, N):
    if n < K: k = n
    else: k = K
    cost = float('inf')
    h = h_li[n]
    for _k in range(1, k+1):
      cost = min(cost, cost_li[n-_k] + abs(h_li[n-_k]-h))
    cost_li[n] = cost
  print(cost_li[N-1])
  
if __name__ == '__main__':
  run()
Buggy python submission (verdict: Time Limit Exceeded):
def run():
  N = int(input())
  abc_li = [[int(i) for i in input().split()] for n in range(N)]
  dp = [0] * N
  dp[0] = [(abc_li[0][k], k) for k in range(3)]
  for n in range(1, N):
    len_dp = len(dp[n-1])
    dp[n] = [(0, 0) for _ in range(len_dp)]
    for k in range(len_dp):
      value, pre_abc = dp[n-1][k] 
      for abc, abc_value in enumerate(abc_li[n]):
        if pre_abc == abc: continue
        if dp[n][k][0] == (value + abc_value):
          dp[n].append((value + abc_value, abc))
          continue
        dp[n][k] = max([dp[n][k], (value + abc_value, abc)],
                      key=lambda x:x[0])
    dp[n] = list(set(dp[n]))
  print(max(dp[-1])[0])
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  N = int(input())
  abc_li = [[int(i) for i in input().split()] for n in range(N)]
  dp = [[0]*3 for n in range(N)]
  dp[0] = abc_li[0]
  for n in range(1, N):
    for next_abc in range(3):
      for pre_abc in range(3):
        if pre_abc == next_abc: continue
        dp[n][next_abc] = max(dp[n][next_abc], dp[n-1][pre_abc]+abc_li[n][next_abc])
  print(max(dp[N-1]))
  
if __name__ == '__main__':
  run()
Buggy python submission (verdict: Time Limit Exceeded):
def run():
  N, W = map(int, input().split())
  wv_li = [tuple(map(int, input().split())) for n in range(N)]
  dp = [[0]*N for w in range(W+1)]
  for w in range(W+1):
    for n in range(N):
      pre_w = max(-1, w-wv_li[n][0])
      if pre_w < 0: dp[w][n] = dp[w][n-1]
      else: dp[w][n] = max(dp[w][n-1], dp[pre_w][n-1] + wv_li[n][1])
  print(max(dp[-1]))
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  N, W = map(int, input().split())
  wv_li = [[0, 0]]+[list(map(int, input().split())) for n in range(N)]
  dp = [[0]*(N+1) for w in range(W+1)]
  #print(wv_li)
  #print(dp)
  for w in range(1, W+1):
    for n in range(1, N+1):
      wn, vn = wv_li[n]
      if w < wn:
        dp[w][n] = dp[w][n-1]
      else:
        dp[w][n] = max(dp[w][n-1], dp[w-wn][n-1]+vn)
  print(dp[W][N])
      
  
if __name__ == '__main__':
  run()

Buggy python submission (verdict: Time Limit Exceeded):
def run():
  N, W = map(int, input().split())
  wv_li = [[0, 0]]+[list(map(int, input().split())) for n in range(N)]
  dp = [[0]*(N+1) for w in range(W+1)]
  #print(wv_li)
  #print(dp)
  for w in range(1, W+1):
    for n in range(1, N+1):
      wn, vn = wv_li[n]
      if w < wn:
        dp[w][n] = dp[w][n-1]
      else:
        dp[w][n] = max(dp[w][n-1], dp[w-wn][n-1]+vn)
  print(dp[W][N])
      
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  N, W = map(int, input().split())
  wv_li = [[0, 0]]+[list(map(int, input().split())) for n in range(N)]
  dp = [[0]*(N+1) for w in range(W+1)]
  #print(wv_li)
  #print(dp)
  for w in range(1, W+1):
    for n in range(1, N+1):
      wn, vn = wv_li[n]
      if w < wn:
        dp[w][n] = dp[w][n-1]
      else:
        dp[w][n] = max(dp[w][n-1], dp[w-wn][n-1]+vn)
  print(dp[W][N])
      
  
if __name__ == '__main__':
  run()
Buggy python submission (verdict: Runtime Error):
num = map(int, input().split())
num = sorted(num, reverce = True)
print(num[0]*10 + num[1] + num[2])

Fixed submission:
num = map(int, input().split())
num = sorted(num, reverse = True)
print(num[0]*10 + num[1] + num[2])
Buggy python submission (verdict: Runtime Error):
K = int(input())

if K%2 == 0:
  even_num = odd_num = K/2
eles:
  even_num = K/2
  odd_num = even_num + 1

print(even_num * odd_num)

Fixed submission:
K = int(input())

if K%2 == 0:
  even_num = odd_num = K//2
else:
  even_num = K//2
  odd_num = even_num + 1

print(even_num * odd_num)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
x_coordinate = list(map(int, input().split()))
zero_pos = 0
distance = []

while True:
  if x_coordinate[zero_pos] >= 0:
    break
  else:
    zero_pos += 1

for i in range(zero_pos - K, zero_pos + 1):
  if (i >= 0) and (i + K - 1 < N):
    start_pos = x_coordinate[i]
    end_pos = x_coordinate[i + K - 1]
    if start_pos*end_pos >= 0:
      if abs(start_pos) >= abs(end_pos):
        distance.append(abs(start_pos))
      else:
        distance.append(abs(end_pos))
    else:
      if abs(start_pos) >= abs(end_pos):
        total = abs(start_pos) + 2*abs(end_pos)
        distance.append(total)
      else:
        total = 2*abs(start_pos) + abs(end_pos)
        distance.append(total)
      
print(min(distance))

Fixed submission:
N, K = map(int, input().split())
x_coordinate = list(map(int, input().split()))
zero_pos = 0
distance = []

while True:
  try:
    if x_coordinate[zero_pos] >= 0:
      break
    else:
      zero_pos += 1
  except:
    zero_pos = N - 1
    break

for i in range(zero_pos - K, zero_pos + 1):
  if (i >= 0) and (i + K - 1 < N):
    start_pos = x_coordinate[i]
    end_pos = x_coordinate[i + K - 1]
    if start_pos*end_pos >= 0:
      if abs(start_pos) > abs(end_pos):
        distance.append(abs(start_pos))
      else:
        distance.append(abs(end_pos))
    else:
      if abs(start_pos) >= abs(end_pos):
        total = abs(start_pos) + 2*abs(end_pos)
        distance.append(total)
      else:
        total = 2*abs(start_pos) + abs(end_pos)
        distance.append(total)
      
print(min(distance))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
if N%500 =< A:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
A = int(input())
if N%500 <= A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input().split("/")
S[0] = "2018"
print(S.join("/"))


Fixed submission:
S = input().split("/")
S[0] = "2018"
print("/".join(S))
Buggy python submission (verdict: Runtime Error):
N = int(imput())
a_list = []
for i in range(N):
  a_list.append(input())
a_set = set(a_list)
print(len(a_set))

Fixed submission:
N = int(input())
a_list = []
for i in range(N):
  a_list.append(input())
a_set = set(a_list)
print(len(a_set))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
i = int(N**(1/2))
while N%i != 0:
  i += 1
print(len(str(i)))

Fixed submission:
N = int(input())
i = int(N**(1/2))
while N%i != 0:
  i -= 1
print(len(str(N//i)))
Buggy python submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
a_list =[] 
for i in range(N):
  a_list.append(list(map(int, input().split())))
a1_list = [i[0] for i in a_list if i[2] == 1 ]
a2_list = [i[0] for i in a_list if i[2] == 2 ]
a3_list = [i[1] for i in a_list if i[2] == 3 ]
a4_list = [i[1] for i in a_list if i[2] == 4 ]
if a1_list == []:
  a1_max = 0
else:
  a1_max = max(a1_list)
if a2_list == []:
  a2_min = W
else:
  a2_min = min(a2_list)
if a3_list ==[]:
  a3_max = 0
else:
  a3_max = max(a3_list)
if a4_list == []:
  a4_min = H
else:
  a4_min = min(a4_list)
S = (a2_min - a1_max)*(a4_min - a3_max)
if (a2_min - a1_max) >= 0 and (a4_min - a3_max) >= 0):
  print(S)
else:
  print(0)

Fixed submission:
W, H, N = map(int, input().split())
a_list =[] 
for i in range(N):
  a_list.append(list(map(int, input().split())))
a1_list = [i[0] for i in a_list if i[2] == 1 ]
a2_list = [i[0] for i in a_list if i[2] == 2 ]
a3_list = [i[1] for i in a_list if i[2] == 3 ]
a4_list = [i[1] for i in a_list if i[2] == 4 ]
if a1_list == []:
  a1_max = 0
else:
  a1_max = max(a1_list)
if a2_list == []:
  a2_min = W
else:
  a2_min = min(a2_list)
if a3_list ==[]:
  a3_max = 0
else:
  a3_max = max(a3_list)
if a4_list == []:
  a4_min = H
else:
  a4_min = min(a4_list)
S = (a2_min - a1_max)*(a4_min - a3_max)
if (a2_min - a1_max) >= 0 and (a4_min - a3_max) >= 0:
  print(S)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
def run():
  N, X = map(int, input().split())
  y = N-X
  ans = y+X
  while True:
    a = y//X
    ans += a*X*2
    if y%X == 0:
      break
    y, X = max(X, a), min(X, a)
  print(ans-X)
  
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  N, X = map(int, input().split())
  y = N-X
  ans = N
  while True:
    y, X = max(y, X), min(y, X)
    a = y//X
    b = y%X
    ans += a*X*2
    if b == 0:
      break
    y, X = X, b
  print(ans-X)
  
  
if __name__ == '__main__':
  run()

Buggy python submission (verdict: Runtime Error):
def run():
  N, X = map(int, input().split())
  y = N-X
  ans = y+X
  while True:
    a = y//X
    ans += a*X*2
    if y%X == 0:
      break
    y, X = X, a
  print(ans-X)
  
  
if __name__ == '__main__':
  run()

Fixed submission:
def run():
  N, X = map(int, input().split())
  y = N-X
  ans = N
  while True:
    y, X = max(y, X), min(y, X)
    a = y//X
    b = y%X
    ans += a*X*2
    if b == 0:
      break
    y, X = X, b
  print(ans-X)
  
  
if __name__ == '__main__':
  run()
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
m = len(s)
n = len(t)
did = m -n
li = []
for i in range(did+1):
  su = 0
  for j in range(n):
    if t[j] ==s[i+j]:
      su +=0
    else:
      su +=1
  li.append(su)
print(min(li))

Fixed submission:
d,t,s = map(int,input().split())
if d/s > t:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
d ,t,s = map(int.input().split())
if d/s > t:
  print(No)
else:
  print(Yes)

Fixed submission:
d,t,s = map(int,input().split())
if d/s > t:
  print("No")
else:
  print("Yes")