Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#写経
#16133681

import sys
input = lambda: sys.stdin.readline().rstrip()
h,w=map(int,input().split())
ch,cw=map(int,input().split())
ch-=1
cw-=1
stack=[(ch,cw)]
dh,dw=map(int,input().split())
dh-=1
dw-=1
b=[w*[-1]for _ in range(h)]
for i in range(h):
  for j,t in enumerate(input()):
    if t=="#":b[i][j]=10**10
b[ch][cw]=0
dxy=((-1,0),(1,0),(0,-1),(0,1))
for ans in range(10**6):
  for x,y in stack:
    b[x][y]=1
    if x==dh and y==dw:
      print(ans)
      exit()
    for dx,dy in dxy:
      if 0<=x+dx<h and 0<=y+dy<w:
        if b[x+dx][y+dy]==10**10:continue
        if b[x+dx][y+dy]==-1:
          stack.append((x+dx,y+dy))
          b[x+dx][y+dy]=1
  stackk=[]
  for x,y in stack:
    for xx in range(max(0,x-2),min(h,x+3)):
      for yy in range(max(0,y-2),min(w,y+3)):
        if b[xx][yy]==-1:stackk.append((xx,yy))
  stack=stackk
print(-1)

Fixed submission:
#写経
#16133681

import sys
input = lambda: sys.stdin.readline().rstrip()
h,w=map(int,input().split())
ch,cw=map(int,input().split())
ch-=1
cw-=1
stack=[(ch,cw)]
dh,dw=map(int,input().split())
dh-=1
dw-=1
b=[w*[-1]for _ in range(h)]
for i in range(h):
  for j,t in enumerate(input()):
    if t=="#":b[i][j]=10**10
b[ch][cw]=0
dxy=((-1,0),(1,0),(0,-1),(0,1))
for ans in range(10**6):
  for x,y in stack:
    b[x][y]=1
    if x==dh and y==dw:
      print(ans)
      exit()
    for dx,dy in dxy:
      if 0<=x+dx<h and 0<=y+dy<w:
        if b[x+dx][y+dy]==10**10:continue
        if b[x+dx][y+dy]==-1:
          stack.append((x+dx,y+dy))
          b[x+dx][y+dy]=1
  stackk=[]
  for x,y in stack:
    for xx in range(max(0,x-2),min(h,x+3)):
      for yy in range(max(0,y-2),min(w,y+3)):
        if b[xx][yy]==-1:stackk.append((xx,yy))
  stack=stackk
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
x, k, d = map(int, input().split())

for _ in range(k):
  if x >= 0:
    x -= d
  elif x < 0:
    x += d

if x < 0:
  x = x * -1
print(x)

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

def sgn(x):
  if x > 0:
    return 1
  if x < 0:
    return -1
  return 0

if x > 0:
  x1 = x - k * d
else:
  x1 = x + k * d

if sgn(x) == sgn(x1):
  print(abs(x1))
  exit()
  
xright = x % d
xleft = x % d - d
#0目前
xr = (abs(x - xright) // d) % 2
if k % 2 == xr:
  print(abs(xright))
elif k % 2 != xr:
  print(abs(xleft))
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
start = 7
def judge(l, x):
  if l % x == 0:
    return True
  else:
    return False

def long7(i):
  x = "7"*i
  return int(x)


if k % 2 == 0:
  print("-1")
  exit()

cnt = len(str(k)) -1
          

          
for i in range(len(str(k)), 10000000):
  l = long7(i)
  cnt += 1
  if judge(l, k) == True:
    print(cnt)
    exit()

Fixed submission:
k = int(input())
start = 7
if k % 2 == 0:
  print("-1")
  exit()
for i in range(k + 1):
  if start % k == 0:
    print(i + 1)
    exit()
  start = (start * 10 + 7) % k
print("-1")
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

l = n - k + 1
lis = [0]*l
#0, 1, 2
for i in range(l):
  z = np.prod(a[i:i+k])
  lis[i] = z
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

Fixed submission:
a = int(input())

if 400 <= a < 600:
  print(8)
elif 600 <= a < 800:
  print(7)
elif 800 <= a < 1000:
  print(6)
elif 1000 <= a < 1200:
  print(5)
elif 1200 <= a < 1400:
  print(4)
elif 1400<= a < 1600:
  print(3)
elif 1600 <= a < 1800:
  print(2)
elif 1800 <= a < 2000:
  print(1)

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

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

l = n - k + 1
lis = [0]*l
#0, 1, 2
for i in range(l):
  z = np.prod(a[i:i+k])
  lis[i] = z
print(lis)
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

Fixed submission:
a = int(input())

if 400 <= a < 600:
  print(8)
elif 600 <= a < 800:
  print(7)
elif 800 <= a < 1000:
  print(6)
elif 1000 <= a < 1200:
  print(5)
elif 1200 <= a < 1400:
  print(4)
elif 1400<= a < 1600:
  print(3)
elif 1600 <= a < 1800:
  print(2)
elif 1800 <= a < 2000:
  print(1)
Buggy python submission (verdict: Time Limit Exceeded):
import operator
import functools
prod = functools.partial(functools.reduce, operator.mul)
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = n - k + 1
lis = [0]*l
#0, 1, 2
for i in range(l):
  lis[i] = prod(a[i:i+k])

for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

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

#0, 1
for i in range(n - k):
  if a[i] < a[i + k]:
    print("Yes")
  else:
    print("No")

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

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

l = n - k + 1
lis = [0]*l
#0, 1, 2
for i in range(l):
  z = np.prod(a[i:i+k])
  lis[i] = z
print(lis)
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

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

#0, 1
for i in range(n - k):
  if a[i] < a[i + k]:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = n - k + 1
lis = [0]*l
s = 1
for i in range(k):
  s = s * a[i]
lis[0] = s

for i in range(1, l):
  lis[i] = lis[i - 1] // a[i - 1] * a[i + k - 1]

for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

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

#0, 1
for i in range(n - k):
  if a[i] < a[i + k]:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = n - k + 1
lis = [0]*l
c = 0
m = 1

for i in range(l):
  for j in range(c, c + k):
    m = m * a[j]
  lis[i] = m
  m = 1
  c += 1
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

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

#0, 1
for i in range(n - k):
  if a[i] < a[i + k]:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = n - k + 1
lis = [0]*l
c = 0
m = 1

for i in range(l):
  for j in range(c, c + k):
    m = m * a[j]
  lis[i] = m
  m = 1
  c += 1
for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

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

#0, 1
for i in range(n - k):
  if a[i] < a[i + k]:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = input()

st = str(a)


if st[1:4] == "000":
  print(0)

else:
  z = st[1:4]
  print(1000 - int(z))


Fixed submission:
a = input()

st = str(a)


if st[-3:] == "000":
  print(0)


else:
  z = st[-3:]
  print(1000 - int(z))

Buggy python submission (verdict: Runtime Error):
a = input()

st = str(a)


if a[1:4] == "000":
  print(0)

else:
  z = a[1:4]
  print(1000 - int(z))


Fixed submission:
a = input()

st = str(a)


if st[-3:] == "000":
  print(0)


else:
  z = st[-3:]
  print(1000 - int(z))

Buggy python submission (verdict: Runtime Error):
a = str(input())

  
if len(a) == 5 or a[1:4] == "000":
  print(0)
  
elif len(a) == 3:
  print(1000 - int(a))
  
else:
  z = a[1:4]
  if z == "000":
    print(0)
  else:
    print(1000 - int(z))


Fixed submission:
a = input()

st = str(a)


if st[-3:] == "000":
  print(0)


else:
  z = st[-3:]
  print(1000 - int(z))

Buggy python submission (verdict: Runtime Error):
a = str(input())

  
if len(a) == 5:
  print(0)
  
elif len(a) == 3:
  print(1000 - int(a))
  
else:
  z = a[1:4]
  if z == "000":
    print(0)
  else:
    print(1000 - int(z))


Fixed submission:
a = input()

st = str(a)


if st[-3:] == "000":
  print(0)


else:
  z = st[-3:]
  print(1000 - int(z))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()

#Aiは、Ai以外の任意の(すべての)Ajで割り切れない
unans = 0
for i in a:
  count = 0
  for j in a:
    if i % j == 0:
      count += 1
    if count >= 2:
      unans += 1
      break
   
print(n - unans)

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

for i in range(len(x)):
  if x[i] == 0:
    print(i + 1)
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
a.sort()

#Aiは、Ai以外の任意の(すべての)Ajで割り切れない
unans = 0
for i in a:
  count = 0
  for j in a:
    if i % j == 0:
      count += 1
    if count >= 2:
      unans += 1
      break
   
print(n - unans)

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

m = max(a)
#約分できちゃう数値リスト
lis = [0]*(m + 1)
for i in a:
  for j in range(i, m + 1, i):
    lis[j] += 1
#iが1なら、lisの要素全てに+1されてる。
count = 0
for i in a:
  if lis[i] == 1:
    count += 1
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
a.sort()

#Aiは、Ai以外の任意の(すべての)Ajで割り切れない
unans = 0
for i in a:
  count = 0
  for j in a:
    if i % j == 0:
      count += 1
    if count >= 2:
      unans += 1
      break
   
print(n - unans)

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

m = max(a)
#約分できちゃう数値リスト
lis = [0]*(m + 1)
for i in a:
  for j in range(i, m + 1, i):
    lis[j] += 1
#iが1なら、lisの要素全てに+1されてる。
count = 0
for i in a:
  if lis[i] == 1:
    count += 1
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

#Aiは、Ai以外の任意の(すべての)Ajで割り切れない
unans = 0
for i in a:
  count = 0
  for j in a:
    if i % j == 0:
      count += 1
    if count >= 2:
      unans += 1
      break
   
print(n - unans)

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

m = max(a)
#約分できちゃう数値リスト
lis = [0]*(m + 1)
for i in a:
  for j in range(i, m + 1, i):
    lis[j] += 1
#iが1なら、lisの要素全てに+1されてる。
count = 0
for i in a:
  if lis[i] == 1:
    count += 1
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

#Aiは、Ai以外の任意の(すべての)Ajで割り切れない
unans = 0
for i in a:
  count = 0
  for j in a:
    if i % j == 0:
      count += 1
    if count >= 2:
      unans += 1
      break
   
print(n - unans)

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

m = max(a)
#約分できちゃう数値リスト
lis = [0]*(m + 1)
for i in a:
  for j in range(i, m + 1, i):
    lis[j] += 1
#iが1なら、lisの要素全てに+1されてる。
count = 0
for i in a:
  if lis[i] == 1:
    count += 1
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input()) 
a = list(map(int, input().split()))


z = 1
for i in range(0, n):
  z = z * a[i]


if z > 1000000000000000000:
  print("-1")
else:
  print(z)


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

y = 1
q = 1
z = 1
for i in range(0, n):
  if a[i] == 0:
    q = 0

for i in range(0, n):
  z = z * a[i]
  if z > 1000000000000000000:
    y = -1
    break
 
if q == 0:
  print(0)
elif z <= 1000000000000000000:
  print(z)
else:
  print("-1")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
lis = []
for _ in range(a):
  lis.append(1)
for _ in range(b):
  lis.append(0)
for _ in range(c):
  lis.append(-1)
sum = 0
for _ in range(k):
  sum += max(lis)
  lis.remove(max(lis))
print(sum)

Fixed submission:
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
elif k <= a + b:
    print(a)
else:
    print(a -1*(k - a - b))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
h = list(map(int, input().split())) 
a = [0]*m
b = [0]*m
for i in range(m):
  a[i], b[i] = map(int, input().split())

badcnt = 0
for i in range(n):
  for j in range(m):
    if (i+1 == a[j]) or (i+1 == b[j]):
      if min(h[a[j]-1], h[b[j]-1]) == h[i]:
        badcnt += 1
        break
ans = n - badcnt        
print(ans)

Fixed submission:
 #12716015

n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = [1]*n
for i in range(m):
  a, b= map(int, input().split())
  a -= 1
  b -= 1
  if h[a] > h[b]:
    ans[b] = 0
  elif h[a] < h[b]:
    ans[a] = 0
  if h[a] == h[b]:
    ans[a] = 0
    ans[b] = 0
print(ans.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
h = list(map(int, input().split())) 
a = [0]*m
b = [0]*m
for i in range(m):
  a[i], b[i] = map(int, input().split())

badcnt = 0
for i in range(n):
  for j in range(m):
    if (i+1 == a[j]) or (i+1 == b[j]):
      if min(h[a[j]-1], h[b[j]-1]) == h[i]:
        badcnt += 1
        break
ans = n - badcnt        
print(ans)

Fixed submission:
 #12716015

n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = [1]*n
for i in range(m):
  a, b= map(int, input().split())
  a -= 1
  b -= 1
  if h[a] > h[b]:
    ans[b] = 0
  elif h[a] < h[b]:
    ans[a] = 0
  if h[a] == h[b]:
    ans[a] = 0
    ans[b] = 0
print(ans.count(1))
Buggy python submission (verdict: Runtime Error):

import random
n, m, q = list(map(int,input().split()))

a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

A = [0]*60

    

l = [0]*60
for z in range(60):
  x = 0
  for j in range(q - 1):
    if A[z[b[j] - 1]] - A[z[a[j] - 1]] == c[j]:
      x = x + int(d[j])
    l[j] = x
    
    
x = 0
for j in range(q - 1):
  if A[b[j] - 1] - A[a[j] - 1] == c[j]:
    x = x + int(d[j])
  l[j] = x

print(max(l))

Fixed submission:
#12653415
#わからんが、とてもきれいですね

N, M, Q = list(map(int, input().split()))
 
conditions = [list(map(int, input().split())) for _ in range(Q)]
 
def dfs(A, max_a):
    if len(A) == N:
        num = 0
        for a, b, c, d in conditions:
            if A[b-1] - A[a-1] == c:
                num += d
        return num
    ans = 0
    for i in range(max_a, M+1):
        ans = max(ans, dfs(A + [i], i))
    return ans
 
print(dfs([1], 1))
Buggy python submission (verdict: Runtime Error):
sw = input().split()

if sw[0] > w[1]:
    print("safe")
else:
    print("unsafe")

Fixed submission:
sw = input().split()

if int(sw[0]) > int(sw[1]):
    print("safe")
else:
    print("unsafe")
Buggy python submission (verdict: Runtime Error):
s = [int(a) for a in input()[::-1]]

m = 2019
n = len(S)

f = 0

p = 1

X = [0] * 2019

X[0] = 1

q = 0

for a in S:
    f = (f + a * p) % m
    q += X[f]
    
    X[s] += 1
    
    p = p * 10 % m
 

print(q)

Fixed submission:
S = [int(a) for a in input()[::-1]]
m = 2019
N = len(S)
s = 0
p = 1
X = [0] * 2019
X[0] = 1
ans = 0
for a in S:
    s = (s + a * p) % m
    ans += X[s]
    X[s] += 1
    p = p * 10 % m
 
print(ans)

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


def judge(x):
  
  if x % 2019 == 0:
    return(1)
  else:
    return(0)

a = 0
for i in range(1,len(n)):
  for j in range(i, len(n)):
    s = n[i:j]
    d = int("s")
    a = a + judge(d)
    
print(a)
    

Fixed submission:
S = [int(a) for a in input()[::-1]]
m = 2019
N = len(S)
s = 0
p = 1
X = [0] * 2019
X[0] = 1
ans = 0
for a in S:
    s = (s + a * p) % m
    ans += X[s]
    X[s] += 1
    p = p * 10 % m
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

for i in range(1, n + 1):
  print(a.count(i))
  [n for n in a if n!= i ]

Fixed submission:
n = int(input())

a = list(map(int,input().split()))
 
res = [0] * n
 
for i in a:
  res[i - 1] += 1
  
for i in res:
  print(i)
Buggy python submission (verdict: Runtime Error):
n = input().split
 
if n[len(n)] == 7:
  print("Yes")
elif n[len(n)- 1] == 7:
  print("Yes")
elif n[len(n)- 2] == 7:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
n = str(n)
  
if n[len(n) - 1] == str("7"):
  print("Yes")
elif n[len(n)- 2] == str("7"):
  print("Yes")
elif n[len(n)- 3] == str("7"):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = input().split

if len(n) = 7:
  print("Yes")
elif len(n - 1) = 7:
  print("Yes")
elif len(n - 2) = 7:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
n = str(n)
  
if n[len(n) - 1] == str("7"):
  print("Yes")
elif n[len(n)- 2] == str("7"):
  print("Yes")
elif n[len(n)- 3] == str("7"):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
#Nは偶数。偶数２つの場合
n = 0
for i in range(0, N):
  n = n + i - 1
 
#Mは奇数。奇数２つの場合
m = 0
for j in range(0, M):
  m = m + j - 1
 
return n + m

Fixed submission:
N, M = map(int, input().split())
#Nは偶数。偶数２つの場合
n = 0
for i in range(1, N):
  n = n + i
 
#Mは奇数。奇数２つの場合
m = 0
for j in range(1, M):
  m = m + j
  
print("{}".format(n + m))
Buggy python submission (verdict: Runtime Error):
a = input()
if a % 2 == 0:
  print(a // 2)
else:
  print((a + 1) // 2)

Fixed submission:
n = int(input())
if n % 2 != 0:
  n = n + 1
  
print(n // 2)
Buggy python submission (verdict: Runtime Error):
import pandas
 
n = int(input())
s = [input() for _ in range(n)]

x = pandas.Series(s)
lis = x.mode().tolist()
 
for i in range(len(lis)):
  print(lis[i])

Fixed submission:
import sys 
from collections import Counter
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
l = read().decode().split()
c = Counter(l)
 
max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]
 
print('\n'.join(sorted(ans)))

Buggy python submission (verdict: Runtime Error):
import pandas
 
n = int(input())
s = [input() for _ in range(n)]
 
x = pandas.Series(s)
lis = x.mode().tolist()

for i in range(len(lis)):
  print(lis[i])

Fixed submission:
import sys 
from collections import Counter
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
l = read().decode().split()
c = Counter(l)
 
max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]
 
print('\n'.join(sorted(ans)))

Buggy python submission (verdict: Runtime Error):
import pandas
 
n = int(input())
s = [input() for _ in range(n)]
 
x = pandas.Series(s)
lis = x.mode().tolist()
lis = sort(lis)
for i in range(len(lis)):
  print(lis[i])

Fixed submission:
import sys 
from collections import Counter
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
l = read().decode().split()
c = Counter(l)
 
max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]
 
print('\n'.join(sorted(ans)))

Buggy python submission (verdict: Runtime Error):
import pandas

n = int(input())
s = [input() for _ in range(n)]

x = pandas.Series(s)
lis = x.mode().tolist()
lis = sort(lis)
for i in range(len(lis)):
  print(lis[i])

Fixed submission:
import sys 
from collections import Counter
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
l = read().decode().split()
c = Counter(l)
 
max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]
 
print('\n'.join(sorted(ans)))
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
#素数の列を、つ、つくるわよ
prime_list = [2]
for num in range(3, x + 1, 2):
  if all(num % prime != 0 for prime in prime_list):
    prime_list.append(num)

#xが素数である場合
if x == prime_list[-1]:
  print(x)
  exit()

#素数は奇数だけ
if x % 2 == 0:
  p = 1
else:
  p = 0
  
#xから、x未満の最大の素数ｘ２の範囲について調べるわ
#素数ｎ<素数ｍ<素数２ｎは常識？
for i in range(x - p, prime_list[-1] * 2 + 1, 2):
  if all(i % j != 0 for j in prime_list):
    print(i)
    exit()

Fixed submission:
#pypyなら通るとか、そんなことないですよね？大人げなく泣き叫びますけど。
x = int(input())
#素数の列を、つくるわよ
prime_list = [2]
for num in range(3, x + 1, 2):
  if all(num % prime != 0 for prime in prime_list):
    prime_list.append(num)

#２は特殊な例よね
if x == prime_list[-1]:
  print(x)
  exit()

#素数は奇数だけ
if x % 2 == 0:
  p = 1
else:
  p = 0
  
#xから、x未満の最大の素数ｘ２の範囲について調べるわ
#素数ｎ<素数ｍ<素数２ｎは常識？
for i in range(x + p, prime_list[-1] * 2 + 1, 2):
  if all(i % j != 0 for j in prime_list):
    print(i)
    exit()
Buggy python submission (verdict: Runtime Error):
N = int(input())
hen = []

hen = list(int(x) for x in input().split())

#print(hen)
hen_u = set(hen.sort())
#print(hen_u)
tri = 0

for a in hen_u:
    for b in hen_u:
        if(a == b):
            continue
        for c in hen_u:
            if(a == c)or(b == c):
                continue
            if(a+b >c)and(b+c >a)and(c+a >b):
                tri += 1

print(tri)

Fixed submission:
N = int(input())
hen = []

hen = list(int(x) for x in input().split())
hen.sort()
#print(hen)
#hen_u = set(hen)
#print(hen_u)
tri = 0

for a in hen:
    for b in hen:
        if(a == b)or (a > b):
            continue
        for c in hen:
            if(a == c)or(b == c) or (a > c) or (b > c):
                continue
            if(a+b >c)and(b+c >a)and(c+a >b):
                tri += 1

print(tri)
Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())
for i in range(K):
    if X >= 0:
        X -= D
    else:
        X += D
print(abs(X))

Fixed submission:
X,K,D = map(int,input().split())
X = abs(X)
if X >= K*D:
    print(X-K*D)
else:
    if (K - X//D) % 2 == 0:
        print(X-X//D*D)
    else:
        print((X//D+1)*D-X)

Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())
for i in range(K):
    if X >= 0:
        X -= D
    else:
        X += D
print(abs(X))

Fixed submission:
X,K,D = map(int,input().split())
X = abs(X)
if X >= K*D:
    print(X-K*D)
else:
    if (K - X//D) % 2 == 0:
        print(X-X//D*D)
    else:
        print((X//D+1)*D-X)
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
count = 1


while A < B:
    A += A
    count += 1
    if A > B:
        break

print(count)

Fixed submission:
s = list(input())
t = list(input())
count = 0
if s[0] == t[0]:
    count += 1
if s[1] == t[1]:
    count += 1
if s[2] == t[2]:
    count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
count = 1

while A < B:
    A += A
    count += 1
    if A > B:
        break

print(count)


Fixed submission:
A = input().split()
count = 1
a = int(A[0])
b = int(A[1])
c = a

if b == 1:
    print(0)
else:
    while a < b:
        a += c - 1
        count += 1
        if a > b:
            break
    print(count)

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
count = 1


while A < B:
    A += A
    count += 1
    if A > B:
        break

print(count)

Fixed submission:
A = input().split()
count = 1
a = int(A[0])
b = int(A[1])
c = a

if b == 1:
    print(0)
else:
    while a < b:
        a += c - 1
        count += 1
        if a > b:
            break
    print(count)

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
count = 1

while A < B:
    A += A
    count += 1


print(count)


Fixed submission:
A = input().split()
count = 1
a = int(A[0])
b = int(A[1])
c = a

if b == 1:
    print(0)
else:
    while a < b:
        a += c - 1
        count += 1
        if a > b:
            break
    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = 0

while (True):
    a += n % 10
    n = n // 10
    if n == 0:
        break

if a % 9 == 0:
    print("Yes")
else:
    print("No")


Fixed submission:
n = input()
a = 0

for i in n:
    a += int(i)

if a % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

e_max = 0

for i in range(n - k + 1):
    e = 0
    for j in range(k):
        e += p[i+j]
    if e > e_max:
        e_max = e

r = e_max/2 + (0.5 * k)
print(str(r))


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

e_max = 0
e_prev = 0

for i in range(n - k + 1):
    e = 0
    if i == 0:
        for j in range(k):
            e += p[i + j]
    else:
        e = e_prev - p[i-1] + p[i+k-1]
    if e > e_max:
        e_max = e
    e_prev = e

r = e_max/2 + (0.5 * k)
print(str(r))