Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = []
for i in range(6):
  s.append(int(input()))
if(s[4]-s[0]) < k:
  print("Yay!")
else:
  print(":(")

Fixed submission:
s = []
for i in range(6):
  s.append(int(input()))
if(s[4]-s[0]) <= s[5]:
  print("Yay!")
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
if(a==b==c):
  print("Yes")
else:
  print("No")

Fixed submission:
a, b, c = map(int, input().split())
if(a==b==c):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
cnt = 0
like = []
frag = 1
for i in range(n):
  s = list(map(int, input().split()))
for i in range(m):
  for j in range(n):
    if(not(i+1 in like[j])):
      frag = 0
      break
  if(frag == 1):
    cnt += 1
  frag = 1
print(cnt)
  

Fixed submission:
n, m = map(int, input().split())
cnt = 0
like = []
frag = 1
for i in range(n):
  s = list(map(int, input().split()))
  like.append(s[1:])
for i in range(m):
  for j in range(n):
    if(not(i+1 in like[j])):
      frag = 0
      break
  if(frag == 1):
    cnt += 1
  frag = 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
cnt = 0
like = []
frag = 1
for i in range(n):
  s = list(map(int, input().split()))
  like.append(s[1:])
for i in range(m):
  for j in range(n):
  	if(!(i+1 in like[j])):
      frag = 0
    if(frag == 0):
      break
  if(frag == 1):
    cnt += 1
print(cnt)
  

Fixed submission:
n, m = map(int, input().split())
cnt = 0
like = []
frag = 1
for i in range(n):
  s = list(map(int, input().split()))
  like.append(s[1:])
for i in range(m):
  for j in range(n):
    if(not(i+1 in like[j])):
      frag = 0
      break
  if(frag == 1):
    cnt += 1
  frag = 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input()))
ans = a[0]
for i in range(n):
  ans = fractions.gcd(ans, a[i])
print(ans)

Fixed submission:
import fractions
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(n):
  ans = fractions.gcd(ans, a[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
if(max(a) > (sum(a) - max(a)):
   print("NO")
else:
   print("YES")

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
if(max(a) >= (sum(a) - max(a))):
   print("No")
else:
   print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
dp = [1e9 for _ in range(n+1)]
#dp[i]...コストの最小
dp[0] = 0
dp[1] = a[0]
for i in range(n-1):
  dp[i+2] = min(dp[i+1] + abs(a[i+1] - a[i]), dp[i] + abs(a[i+2] - a[i]))
print(dp[n])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
dp = [1e9]*n
dp[0] = 0
for i in range(1, n):
  dp[i] = min(dp[i], dp[i-1] + abs(a[i] - a[i-1]))
  if i > 1:
    dp[i] = min(dp[i], dp[i-2] + abs(a[i] - a[i-2]))
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [1e9 for _ in range(n)]
dp[0] = 0
for i in range(1, n):
  if(i < k):
    for j in range(i):
      dp[i] = min(dp[0] + abs(h[i] - h[0]), dp[i])
  else:
    for j in range(k):
      dp[i] = min(dp[i+j-k] + abs(h[i] - h[i+j-k]), dp[i])
print(dp[n-1])

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

dp = [1e9 for _ in range(n)]
dp[0] = 0
for i in range(1, n):
  if(i < k):
    for j in range(i):
      dp[i] = min(dp[0] + abs(h[i] - h[0]), dp[i])
  else:
    for j in range(k):
      dp[i] = min(dp[i+j-k] + abs(h[i] - h[i+j-k]), dp[i])
print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(Christmas, end = " ")
while n < 25:
  print(Eve, end = " ")
  n += 1

Fixed submission:
n = int(input())
print("Christmas", end = " ")
while n < 25:
  print("Eve", end = " ")
  n += 1
Buggy python submission (verdict: Runtime Error):
nums = list(map(int, input().split()))
sums = [sum(nums[i:i+3]) for i in range(len(nums)-1)]
poyo = [abs(x-753) for x in sums]
print(min(poyo))

Fixed submission:
s = input()
list = [int(c) for c in s]
num = []
ans = 753
for i in range(len(list)-2):
	num.append((list[i] * 100) + (list[i+1] * 10) + list[i+2])
	if(num[i] >= 753):
		if(ans >= (num[i] - 753)):
			ans = num[i] - 753
	else:
		if(ans > (753 - num[i])):
			ans = 753 - num[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
nums = map(int, input().split())
sums = [sum(nums[i:i+3]) for i in range(len(nums)-1)]
poyo = [abs(x-753) for x in sums]
print(min(poyo))

Fixed submission:
s = input()
list = [int(c) for c in s]
num = []
ans = 753
for i in range(len(list)-2):
	num.append((list[i] * 100) + (list[i+1] * 10) + list[i+2])
	if(num[i] >= 753):
		if(ans >= (num[i] - 753)):
			ans = num[i] - 753
	else:
		if(ans > (753 - num[i])):
			ans = 753 - num[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
nums = map(int, input().split())
sums = [sum(nums[i:i+3] for i in range(len(nums)-1))]
poyo = [abs(x-753) for x in sums]
print(min(poyo))

Fixed submission:
s = input()
list = [int(c) for c in s]
num = []
ans = 753
for i in range(len(list)-2):
	num.append((list[i] * 100) + (list[i+1] * 10) + list[i+2])
	if(num[i] >= 753):
		if(ans >= (num[i] - 753)):
			ans = num[i] - 753
	else:
		if(ans > (753 - num[i])):
			ans = 753 - num[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
list = int(input().split())
num = []
ans = 753
for i in range(len(list)-2):
  num.append((list[i] * 100) + (list[i+1] * 10) + list[i+2])
  if(num[i] >= 753):
    if(ans >= (num[i] - 753)):
      ans = num[i] - 753
  else:
    if(ans > (753 - ans[i])):
      ans = 753 - ans[i]
print(ans)

Fixed submission:
s = input()
list = [int(c) for c in s]
num = []
ans = 753
for i in range(len(list)-2):
	num.append((list[i] * 100) + (list[i+1] * 10) + list[i+2])
	if(num[i] >= 753):
		if(ans >= (num[i] - 753)):
			ans = num[i] - 753
	else:
		if(ans > (753 - num[i])):
			ans = 753 - num[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
other = ['0', '1', '2', '4', '6', '8', '9']
def dfs(sss):
  if(int(sss) > n):
    return 0
  r = 1 if(sss == all(s.count(c) > 0 for c in '753')) else 0
  for c in '357':
    r += dfs(sss+c)
  return r
print(dfs('0'))

Fixed submission:
n = int(input())
def dfs(sss):
  if(int(sss) > n):
    return 0
  r = 1 if(all(sss.count(c) > 0 for c in '753')) else 0
  for c in '357':
    r += dfs(sss+c)
  return r
print(dfs('0'))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
i=1
sum=0
num = []
for i in range(1,1000000000):
  while i>0:
    amari = i % 10
    if(amari != 3 or amari != 5 or amari != 7):
      break
    i = int(i / 10)    
  num.append(i)
j = 0
while num[j] <= n:
  sum += num[j]
  j += 1
print(sum)


Fixed submission:
n = int(input())
def dfs(sss):
  if(int(sss) > n):
    return 0
  r = 1 if(all(sss.count(c) > 0 for c in '753')) else 0
  for c in '357':
    r += dfs(sss+c)
  return r
print(dfs('0'))
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
b = a.pop(max(a))
print(b*10+sum(a))

Fixed submission:
a = list(map(int, input().split()))
b = a.pop(a.index(max(a)))
print(b*10+sum(a))
Buggy python submission (verdict: Runtime Error):
    a, b = [int(i) for i in input().split()]
    if(a == 2 or b == 2):
      print("No")
    else:
      print("Yes")

Fixed submission:
a, b = [int(i) for i in input().split()]
if(a == 2) or( b == 2):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
import math

n, x = [int(i) for i in input().split()]
point = list(map(int, input().split()))
dif = []

if(len(point) == 1):
  ans = abs(point[0] - x)
else:
  gcd = abs(point[0] - x)
  for i in range(len(point) - 1):
    dif.append(abs(point[i+1] - point[i]))
    gcd = math.gcd(gcd, dif[i])
  ans = gcd
print(ans)

Fixed submission:
def gcd(a, b):
  if a < b:
    a, b = b, a
  if b == 0:
    return a
  c = a % b
  return gcd(b, c)
n, x = [int(i) for i in input().split()]
point = list(map(int, input().split()))
dif = []

if(len(point) == 1):
  ans = abs(point[0] - x)
else:
  gcd_now = abs(point[0] - x)
  for i in range(len(point) - 1):
    dif.append(abs(point[i+1] - point[i]))
    gcd_now = gcd(gcd_now, dif[i])
  ans = gcd_now
print(ans)

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

n, x = [int(i) for i in input().split()]
point = list(map(int, input().split()))
dif = []

if(len(point) == 1):
  ans = abs(point[0] - x)
else:
  gcd = abs(point[0] - x)
  for i in range(len(point) - 1):
    dif.append(point[i+1] - point[i])
    gcd = math.gcd(gcd, dif[i])
  ans = gcd
print(ans)
    

Fixed submission:
def gcd(a, b):
  if a < b:
    a, b = b, a
  if b == 0:
    return a
  c = a % b
  return gcd(b, c)
n, x = [int(i) for i in input().split()]
point = list(map(int, input().split()))
dif = []

if(len(point) == 1):
  ans = abs(point[0] - x)
else:
  gcd_now = abs(point[0] - x)
  for i in range(len(point) - 1):
    dif.append(abs(point[i+1] - point[i]))
    gcd_now = gcd(gcd_now, dif[i])
  ans = gcd_now
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
k = int(input())

if(k == 1):
    print(n[0])
elif(len(n)==1):
    print(n)
elif(n[0]== '1'):
    i = 1
    while(n[i] == '1' or i + 1 < len(n)):
        i += 1
    if(k <= i):
        print(1)
    else:
        print(n[i])
else:
    print(n[0])

Fixed submission:
n = input()
k = int(input())

if(k == 1):
    print(n[0])
elif(len(n)==1):
    print(n)
elif(n[0]== '1'):
    i = 1
    while(n[i] == '1'):
        i += 1
        if(i == len(n)):
            break
    if(k <= i):
        print(1)
    else:
        print(n[i])
else:
    print(n[0])

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

if(k == 1):
    print(n[0])
elif(len(n)==1):
    print(n)
elif(n[0]== '1'):
    i = 1
    while(n[i] == '1'):
        i += 1
    if(k <= i):
        print(1)
    else:
        print(n[i])
else:
    print(n[0])

Fixed submission:
n = input()
k = int(input())

if(k == 1):
    print(n[0])
elif(len(n)==1):
    print(n)
elif(n[0]== '1'):
    i = 1
    while(n[i] == '1'):
        i += 1
        if(i == len(n)):
            break
    if(k <= i):
        print(1)
    else:
        print(n[i])
else:
    print(n[0])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
if(len(s)==1):
    print(s)
else:
    if(k == 1):
        print(s[0])
    else:
        if(s[0]=='1'):
            i = 1
            while(s[i]=='1'):
                i += 1
            print(s[i])
        else:
            print(s[0])

Fixed submission:
n = input()
k = int(input())

if(k == 1):
    print(n[0])
elif(len(n)==1):
    print(n)
elif(n[0]== '1'):
    i = 1
    while(n[i] == '1'):
        i += 1
        if(i == len(n)):
            break
    if(k <= i):
        print(1)
    else:
        print(n[i])
else:
    print(n[0])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 1e6
for i in range(len(s)):
    ans = min(ans, s[:i].count('W')+s[i+1:].count('E'))
print(ans)

Fixed submission:
n = int(input())
s = input()
ans_min = s[1:].count('E')
ans = s[1:].count('E')
for i in range(1, len(s)):
    if(s[i] == 'E'):
        ans -= 1   
    if(s[i-1] == 'W'):
        ans += 1
    ans_min = min(ans_min, ans)
print(ans_min)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())

if(a>b):
  print(a-1)
else:
  print(a)

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

if(a>b):
  print(a-1)
else:
  print(a)
Buggy python submission (verdict: Runtime Error):
print(n//3)

Fixed submission:
print(int(input())//3)
Buggy python submission (verdict: Runtime Error):
s = input()
if((t[0:1] == t[1:2] == t[2:3]) or (t[1:2] == t[2:3] == t[3:4])):
   print("Yes")
else:
   print("No")


Fixed submission:
t = input()
if((t[0:1] == t[1:2] == t[2:3]) or (t[1:2] == t[2:3] == t[3:4])):
   print("Yes")
else:
   print("No")

Buggy python submission (verdict: Runtime Error):
s = input()
if((t[0:1] == t[1:2] == t[2:3]) or (t[1:2] == t[2:3] == t[3:4]):
   print("Yes")
else:
   print("No")

Fixed submission:
t = input()
if((t[0:1] == t[1:2] == t[2:3]) or (t[1:2] == t[2:3] == t[3:4])):
   print("Yes")
else:
   print("No")
Buggy python submission (verdict: Runtime Error):
n, z, w = map(int, input().split())
a = list(map(int, input().split()))

print(max(abs(a[n-1] - w), abs(a[n-2] - a[n-1])

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

print(max(abs(a[n-1] - w), abs(a[n-2] - a[n-1])))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
ans = 0
now = 1
while(now != 2):
  ans += 1
  now = a[now-1]
  if(now == 1):
    ans = -1
    break
print(ans)


Fixed submission:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
frag = [True for _ in range(n)]
frag[0] = False
ans = 0
now = 1
while(now != 2):
  ans += 1
  now = a[now-1]
  if(frag[now-1]):
    frag[now-1] = False
  else:
    ans = -1
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
list = input()
i = 0
while True:
	if i>3:
    	break
	print(list[0][0:1],end='')
    i += 1

Fixed submission:
list = input().split()
i = 0
while True:
	if i>2:
		break
	print(list[i][0:1],end='')
	i += 1

Buggy python submission (verdict: Time Limit Exceeded):
list = input()
i=0
while True:
  if i>2:
    break
    print(list[0][0:1],end='')

Fixed submission:
list = input().split()
i = 0
while True:
	if i>2:
		break
	print(list[i][0:1],end='')
	i += 1

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

i=0
while True:
  if i>2:
    break
  print(list[i][0:1])
  i++
  


Fixed submission:
list = input().split()
i = 0
while True:
	if i>2:
		break
	print(list[i][0:1],end='')
	i += 1
Buggy python submission (verdict: Runtime Error):
print(ren(set(list(map(int, input().split()))))


Fixed submission:
print(len(set(list(map(int, input().split())))))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = list(map(int, input().split()))
other = [i for i in range(10)] - d
m = 0
def dfs(m, now):
  m = int(m)
  if(m >= n):
    print(int(now))
  else:
    if(m == 0):
      m = ""
    m = str(m)
    for(o in other):
      dfs(m, m + o)
  

Fixed submission:
n, k = map(int, input().split())
dd = list(map(int, input().split()))
frag = 1
for i in range(n, 10*n+1):
  frag = 1
  for d in dd:
    if(str(d) in str(i)):
      frag = 0
  if(frag):
    print(i)
    break
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N=int(input());
Q=int(input());
s = input();
charList=list(s);
AClist=[0]*N;

for i in range(N-1):
 if charList[i]=='A' and charList[i+1]=='C':
  AClist[i+1]=AClist[i]+1;
 else:
  AClist[i+1]=AClist[i];

result=[0]*Q;
for i in range(Q):
 l, r = map(int, input().split())
 result[i]=AClist[r-1]-AClist[l];
 if result[i]<0:
  result[i]=0;
for i in range(Q):
 print(result[i]);


Fixed submission:
# -*- coding: utf-8 -*-
N,Q=map(int, input().split())
s = input();
charList=list(s);
AClist=[0]*N;

for i in range(N-1):
 if charList[i]=='A' and charList[i+1]=='C':
  AClist[i+1]=AClist[i]+1;
 else:
  AClist[i+1]=AClist[i];

result=[0]*Q;
for i in range(Q):
 l, r = map(int, input().split())
 result[i]=AClist[r-1]-AClist[l-1];
 if result[i]<0:
  result[i]=0;
for i in range(Q):
 print(result[i]);
Buggy python submission (verdict: Time Limit Exceeded):
def longestRepeatedSubstring(str): 
  
    n = len(str) 
    LCSRe = [[0 for x in range(n + 1)]  
                for y in range(n + 1)] 
  
    res = "" # To store result 
    res_length = 0 # To store length of result 
  
    # building table in bottom-up manner 
    index = 0
    for i in range(1, n + 1): 
        for j in range(i + 1, n + 1): 
              
            # (j-i) > LCSRe[i-1][j-1] to remove 
            # overlapping 
            if (str[i - 1] == str[j - 1] and
                LCSRe[i - 1][j - 1] < (j - i)): 
                LCSRe[i][j] = LCSRe[i - 1][j - 1] + 1
  
                # updating maximum length of the 
                # substring and updating the finishing 
                # index of the suffix 
                if (LCSRe[i][j] > res_length): 
                    res_length = LCSRe[i][j] 
                    index = max(i, index) 
                  
            else: 
                LCSRe[i][j] = 0
  
    # If we have non-empty result, then insert  
    # all characters from first character to  
    # last character of string 
    if (res_length > 0): 
        for i in range(index - res_length + 1, 
                                    index + 1): 
            res = res + str[i - 1] 
  
    return res 
  
# Driver Code 
if __name__ == "__main__": 
  n=int(input())
  str=input()
  print(len(longestRepeatedSubstring(str)))

Fixed submission:
def longestRepeatedSubstring(str): 
  
    n = len(str) 
    LCSRe = [[0 for x in range(n + 1)]  
                for y in range(n + 1)] 
  
    res = "" # To store result 
    res_length = 0 # To store length of result 
  
    # building table in bottom-up manner 
    index = 0
    for i in range(1, n + 1): 
        for j in range(i + 1, n + 1): 
              
            # (j-i) > LCSRe[i-1][j-1] to remove 
            # overlapping 
            if (str[i - 1] == str[j - 1] and
                LCSRe[i - 1][j - 1] < (j - i)): 
                LCSRe[i][j] = LCSRe[i - 1][j - 1] + 1
  
                # updating maximum length of the 
                # substring and updating the finishing 
                # index of the suffix 
                if (LCSRe[i][j] > res_length): 
                    res_length = LCSRe[i][j] 
                    index = max(i, index) 
                  
            else: 
                LCSRe[i][j] = 0
  
    # If we have non-empty result, then insert  
    # all characters from first character to  
    # last character of string 
    if (res_length > 0): 
        for i in range(index - res_length + 1, 
                                    index + 1): 
            res = res + str[i - 1] 
  
    return res 
  
# Driver Code 
if __name__ == "__main__": 
  n=int(input())
  str=input()
  print(len(longestRepeatedSubstring(str)))
Buggy python submission (verdict: Time Limit Exceeded):
#abc174_e
from math import ceil
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()

if k==0:
    ans=max(a)
    print(ans)
    exit()
if k==1:
    if n==1:
        print(-(-a[0]//2))
        exit()
    ans=max(a[-1]/2,a[-2])
    print(ceil(ans))
    
ok=10**9+1
ng=1
def check(x):
    k_cnt=0
    for q in a:
        k_cnt+=ceil(q/x-1)
    if k_cnt<=k:
        return True
    else:
        return False

    
for i in range(1000):
    mid=(ok+ng)/2
    if check(mid):
        ok=mid
    else:
        ng=mid
    # print(ok,ng)
print(ceil(ok))


Fixed submission:
#abc174_e
from math import ceil
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()

if k==0:
    ans=max(a)
    print(ans)
    exit()
if k==1:
    if n==1:
        print(-(-a[0]//2))
        exit()
    ans=max(a[-1]/2,a[-2])
    print(ceil(ans))
    exit()
    
ok=10**9+1
ng=1
def check(x):
    k_cnt=0
    for q in a:
        k_cnt+=ceil(q/x-1)
    if k_cnt<=k:
        return True
    else:
        return False

    
for i in range(100):
    mid=(ok+ng)/2
    if check(mid):
        ok=mid
    else:
        ng=mid
    # print(ok,ng)
print(ceil(ok))
Buggy python submission (verdict: Time Limit Exceeded):
def LI():
  return list(map(int,input().split()))
  
n,k=LI()
a=LI()

fir=1
for i in range(k):
    fir*=a[i]

# print(fir)

for i in range(k,n):
    sec=fir*a[i]
    sec=sec//a[i-k]
    if sec>fir:
        print("Yes")
    else:
        print("No")
    fir=sec
    # print(sec)

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

for i in range(n-k):
    if a[i]<a[i+k]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
45tokabaguruna

Fixed submission:
x=int(input())
from math import gcd
g=gcd(x,360)
print(360//g)
Buggy python submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
a.sort(reverse=True)
cnt=0
for q in a:
  flg=True
  for j in range(0,int(q**0.5)+1):
    if q%j==0:
      if q//j in a or j in a:
        flg=False
  if flg:
    cnt+=1
print(cnt)

Fixed submission:
n,*a=map(int,open(0).read().split())

ma=1001001
nums=[0]*ma

for i in a:
    nums[i]+=1
    if nums[i]==1: # 一回だけ出てきた場合
        for j in range(i+i,ma,i):
            nums[j]+=2
            
ans=nums.count(1)
print(ans)

Buggy python submission (verdict: Runtime Error):
# O(N*sqrt(A))
n,*a=map(int,open(0).read().split())
from collections import defaultdict, deque
import sympy

dd=defaultdict(set)

for q in a:
    dd[q]=set(sympy.divisors(q))
cnt=0
a.sort()
b=deque(a)
while b:
    p=b.pop()
    if len(dd[p]&set(b))==0:
        cnt+=1
print(cnt)


Fixed submission:
n,*a=map(int,open(0).read().split())

ma=1001001
nums=[0]*ma

for i in a:
    nums[i]+=1
    if nums[i]==1: # 一回だけ出てきた場合
        for j in range(i+i,ma,i):
            nums[j]+=2
            
ans=nums.count(1)
print(ans)

Buggy python submission (verdict: Runtime Error):
# O(N*sqrt(A))
n,*a=map(int,open(0).read().split())
from collections import defaultdict, deque
import sympy

dd=defaultdict(set)

for q in a:
    dd[q]=set(sympy.divisors(q))
cnt=0
a.sort()
b=deque(a)
while b:
    p=b.pop()
    if len(dd[p]&set(b))==0:
        cnt+=1
print(cnt)


Fixed submission:
n,*a=map(int,open(0).read().split())

ma=1001001
nums=[0]*ma

for i in a:
    nums[i]+=1
    if nums[i]==1: # 一回だけ出てきた場合
        for j in range(i+i,ma,i):
            nums[j]+=2
            
ans=nums.count(1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def LI():return list(map(int,input().split()))
def yes():return print("Yes")
def no():return print("No")
from collections import deque, defaultdict, Counter
from heapq import heappop, heappush
# import math
# pi=math.pi
# print(pi)
# yes()
# no()
n=int(input())

# s=input()
a=LI()
ans=1
for q in a:
    ans*=q
if ans>10**18:
    ans=-1
print(ans)



Fixed submission:
def LI():return list(map(int,input().split()))
def yes():return print("Yes")
def no():return print("No")
from collections import deque, defaultdict, Counter
from heapq import heappop, heappush
# import math
# pi=math.pi
# print(pi)
# yes()
# no()
n=int(input())

# s=input()
a=LI()
a.sort()
if a[0]==0:
    print(0)
    exit()

ans=1
for q in a:
    ans*=q
    if ans>10**18:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input());a=map(int,input().split());b,c,f=[],[],0
for i,q in enumerate(a):b+=i+q,;c+=i-q,
from collections import*
for d,e in Counter(b).items():f+=e*Counter(c)[d]
print(f)

Fixed submission:
n,*a=map(int,open(0).read().split())

# mx=n*(n-1)//2
# n <=2*10**5
from collections import Counter
b=[]
c=[]
for i,q in enumerate(a):
    b.append(i+q)
    c.append(i-q)
# print(b,c)
bb=Counter(b).items()
cc=Counter(c)

# print(bb,cc)
ans=0
for (bi,bj) in bb:
    ans+=bj*cc[bi]
print(ans)
Buggy python submission (verdict: Runtime Error):
x,m=int(input()),100
for d in range(4000):m+=m//100
 if x<=m:print(d+1);exit()


Fixed submission:
def LI():return list(map(int,input().split()))

# for i in range(10):
#     print(i&1^0)

x=int(input())
m=100
for i in range(5000):
    m=int(m*1.01)
    if m>=x:
        print(i+1)
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
s=input()

cnts=[0]*2019

cnts[0]=1

for i in range(len(s)):
  tmp=int(s[i:])%2019
  cnts[tmp]+=1

ans=0
for cnt in cnts:
  ans+=cnt*(cnt-1)//2
  
print(ans)

Fixed submission:
# coding: utf-8
# Your code here!
# s=input()
#https://atcoder.jp/contests/abc158/tasks/abc158_e p=2019 copype
P=2019

# N,P=map(int,input().split());
S,a,i,j,c=input(),0,0,1,[1]+[0]*P
if 10%P:
	for v in S[::-1]:i,j=(i+int(v)*j)%P,j*10%P;a+=c[i];c[i]+=1
else:
	for v in S:
		i+=1
		if int(v)%P<1:a+=i
print(a)

#honto???