Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

import math
print(ceil((N-1)/(K-1)))

Fixed submission:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

import math
print(math.ceil((N-1)/(K-1)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

from statistics import median 
for i in range(len(A)):
    tmp = A.pop(0)
    print(median(A))
    A.append(tmp)

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
copy_X = X.copy()
X.sort()
for i in copy_X:
    if(i<X[N//2]):
        print(X[N//2])
    else:
        print(X[(N//2)-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
d,x=map(int,input().split())
res = x
for i in range(n):
    a=int(input())
    if a == 1:
        res +=d
    else :
        res += (d-1)//a + 1
print(res)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))

Buggy python submission (verdict: Runtime Error):
n = int(input())
d, x = map(int,input().split())
res = x
for i in range(n):
    a = int(input())
    if a == 1:
        res +=d
    else :
        res += (d-1)//a + 1
print(res)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))

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

for i in range(n):
  a = int(input())
  if a == 1:
    res +=d
  else :
    res += (d-1)//a + 1
print(res)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))

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

for i in range(n):
    a = int(input())
    if a == 1:
        res +=d
    else :
        res += (d-1)//a + 1
print(res)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))
Buggy python submission (verdict: Time Limit Exceeded):
N, Y = list(map(int, input().split()))

ans = 0
for y in range(N +1):
    for w in range(N +1):
        for n in range(N +1):
            if y*10000+w*5000+n*1000 == Y and y+w+n ==N:
                ans = str(y)+" "+str(w)+" "+str(n)

if ans == 0:
    print(-1, -1, -1)
else:
    print(ans)

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

ans = 0
for y in range(N +1):
    for w in range(N +1):
        if y*10000+w*5000+(N-y-w)*1000 == Y and N-y-w >= 0:
            ans = str(y)+" "+str(w)+" "+str(N-y-w)

if ans == 0:
    print(-1, -1, -1)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def ryuka(N):    
    if N == 0:
        return 2
    elif N == 1:
        return 1
    else:
        N = ryuka(N-1) + ryuka(N-2)
        return N

print(ryuka(N))

Fixed submission:
N = int(input())
L = [2, 1]
for i in range(2, N+1):
    L.append(L[i-1] + L[i-2])
print(L[N])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for a in A:
    for b in B:
        for c in C:
            if a<b<c:
                ans += 1

print(ans)

Fixed submission:
import bisect
 
n = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
 
ans = 0
for b in B:
    a_ind = bisect.bisect_left(A, b)
    c_ind = bisect.bisect_right(C, b)
    ans += a_ind*(n-c_ind)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split())) 

ans = 0
for n in a:
    ans = max(a.count(n-1) + a.count(n) + a.count(n+1), ans)

print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
A = [0] * (10 ** 5 + 5)
for ai in a:
    A[ai - 1] += 1
    A[ai] += 1
    A[ai + 1] += 1
print(max(A))

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

a.sort()

ans = 0
for n in a:
    ans = max(a.count(n) + a.count(n+1) + a.count(n+2), ans)

print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
A = [0] * (10 ** 5 + 5)
for ai in a:
    A[ai - 1] += 1
    A[ai] += 1
    A[ai + 1] += 1
print(max(A))
Buggy python submission (verdict: Runtime Error):
A, B = list(map(str,input().split()))

if (A+B)<10:
    print(A+B)
else:
    print("error")

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

if (A+B)<10:
    print(A+B)
else:
    print("error")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for _ in range(N)]

op_cnt = len(a)

ans = 0
for i in range(2 ** op_cnt):
    op = [0] * op_cnt  
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = a[j]
    temp = sum(op)
    if sum(op)%10 == 0:
        temp = 0
    if temp > ans:
        ans = temp

print(ans)

Fixed submission:
N = int(input())
s1 = []
s2 = []
 
for i in range(N):
    a = int(input())
    if a % 10 != 0:
        s1.append(a)
    else:
        s2.append(a)

if len(s1) == 0:
    print(0)
else:
    if sum(s1) % 10 == 0:
        print(sum(s1)-min(s1)+sum(s2))
    else:
        print(sum(s1)+sum(s2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

ans = 1
for i in range(1,n+1):
    ans *= i

print(ans %(10**9+7))

Fixed submission:
mod = 10**9 + 7
 
N = int(input())
 
ans = 1
 
for i in range(N):
    ans = ans*(i+1) % mod

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

if ((a+b)==c) or ((b+c)==a ) or ((c+a)==b):
    print("Yes")
else:
    print("No")

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

if a+b==c or b+c==a or c+a==b:
    print("Yes")
else:
    print("No")

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

if (a+b)==c or (b+c)==a or (c+a)==b:
    print("Yes")
else:
    print("No")

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

if a+b==c or b+c==a or c+a==b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
aa=list(map(int,input().split()))
accumulation=[]
total=0

for i in range(n):
    aacut=aa[:(i+1)]
    accumulation.append(sum(aacut))

for i in range(n):
    total+=aa[i]*(accumulation[n-1]-accumulation[i])

x=10**9+7
ans=total%x
print(ans)

Fixed submission:
n=int(input())
aa=list(map(int,input().split()))
su=sum(aa)
new=[n**2 for n in aa]
sa=sum(new)
x=10**9+7
print((su**2-sa)//2%x)
sa

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
aa=list(map(int,input().split()))
ans=0
list=[]
for i in range(n-1):
    list=aa[i+1:n]
    ans+=aa[i]*(sum(list))
    list=[]
        
x=10**9+7
print(ans%x)

Fixed submission:
n=int(input())
aa=list(map(int,input().split()))
su=sum(aa)
new=[n**2 for n in aa]
sa=sum(new)
x=10**9+7
print((su**2-sa)//2%x)
sa

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


Fixed submission:
n=int(input())
aa=list(map(int,input().split()))
su=sum(aa)
new=[n**2 for n in aa]
sa=sum(new)
x=10**9+7
print((su**2-sa)//2%x)
sa
Buggy python submission (verdict: Runtime Error):
#N円の商品を1000円札で支払う時のおつり。

price=int(print())
surpus=price%1000
return surpus

Fixed submission:
#N円の商品を1000円札で支払う時のおつり。

price=int(input())
surpus=price%1000
print((1000-surpus)%1000)
Buggy python submission (verdict: Runtime Error):
'AC x',str(count_AC)\n'WA x',str(count_WA)\n'TLE x',str(count_TLE)\n'RE x',str(count_RE)

Fixed submission:
num=int(input())
count_AC=0
count_WA=0
count_TLE=0
count_RE=0

def judge(x):
        global count_AC
        global count_WA
        global count_TLE
        global count_RE
        if x=='AC':
            count_AC+=1
        if x=='WA':
            count_WA+=1
        if x=='TLE':
            count_TLE+=1
        if x=='RE':
            count_RE+=1

for i in range(num):
        judge(input())

print('AC x',str(count_AC),'\nWA x',str(count_WA),'\nTLE x',str(count_TLE),'\nRE x',str(count_RE))
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
pin=sys.stdin.readline

def main():
  N,X,M=map(int,pin().split())
  A=X
  d=[X]
  su=X
  for i in range(N-1):
    A=(A**2)%M
    if A in d:
      t=d.index(A)
      T=N-i-1
      d=d[t:]
      l=len(d)
      su+=sum(d)*(T//l)
      T=T%(T//l)
      su+=sum(d[:T])
      print(su)
      return
    d.append(A)
    su+=A
  print(su)
  return
main()

Fixed submission:
import math
import sys
pin=sys.stdin.readline

def main():
  N,X,M=map(int,pin().split())
  A=X
  d=[X]
  su=X
  for i in range(N-1):
    A=(A**2)%M
    if A in d:
      t=d.index(A)
      T=N-i-1
      d=d[t:]
      l=len(d)
      su+=sum(d)*(T//l)
      T=T%(T//l)
      su+=sum(d[:T])
      print(su)
      return
    d.append(A)
    su+=A
  print(su)
  return
main()
Buggy python submission (verdict: Runtime Error):
import sys
pin=sys.stdin.readline

N=int(pin())
A=list(map(int,pin().split()))
B=list(map(int,pin().split()))
C=reversed(B)

for i in range(N):
  if A[i]==C[i]:
    break
else:
  print("Yes")
  for k in C:
    sys.stdout.write(f"{k} ")
  print()
  sys.exit()
D=B[N//2:]+B[:N//2]
for j in range(N):
  if A[j]==D[j]:
    print("No")
    break
else:
  print("Yes")
  for l in D:
    sys.stdout.write(f"{l} ")
  print()
  sys.exit()


Fixed submission:
import sys
pin=sys.stdin.readline

N=int(pin())
A=list(map(int,pin().split()))
B=list(map(int,pin().split()))
C=list(reversed(B))

for i in range(N):
  if A[i]==C[i]:
    break
else:
  print("Yes")
  for k in C:
    sys.stdout.write(f"{k} ")
  print()
  sys.exit()
D=B[N//2:]+B[:N//2]
for j in range(N):
  if A[j]==D[j]:
    print("No")
    break
else:
  print("Yes")
  for l in D:
    sys.stdout.write(f"{l} ")
  print()
  sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
'''
Created on 2020/09/08

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  T=int(pin())
  for j in range(T):
    N,M,A,B=map(int,pin().split())
    ans=0
    for i in range(N):
      ans+=(A*i+B)//M
    print(ans)
  return
main()

Fixed submission:
'''
Created on 2020/09/08

@author: harurun
'''
def floor_sum(n,m,a,b):
  ans=0
  if a>=m:
    ans+=(n-1)*n*(a//m)//2
    a%=m
  if b>=m:
    ans+=n*(b//m)
    b%=m
  
  y_max=(a*n+b)//m
  x_max=y_max*m-b
  
  if y_max==0:
    return ans
  ans+=(n-(x_max+a-1)//a)*y_max
  ans+=floor_sum(y_max,a,m,(a-x_max%a)%a)
  return ans



def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  ansl=[]
  T=int(pin())
  for j in range(T):
    N,M,A,B=pin().split()
    ansl.append(str(floor_sum(int(N),int(M),int(A),int(B))))
  ans="\n".join(ansl)
  print(ans)
  return
main()

Buggy python submission (verdict: Time Limit Exceeded):
'''
Created on 2020/09/08

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  T=int(pin())
  for j in range(T):
    N,M,A,B=map(int,pin().split())
    ans=0
    for i in range(N):
      ans+=(A*i+B)//M
    print(ans)
  return
main()

Fixed submission:
'''
Created on 2020/09/08

@author: harurun
'''
def floor_sum(n,m,a,b):
  ans=0
  if a>=m:
    ans+=(n-1)*n*(a//m)//2
    a%=m
  if b>=m:
    ans+=n*(b//m)
    b%=m
  
  y_max=(a*n+b)//m
  x_max=y_max*m-b
  
  if y_max==0:
    return ans
  ans+=(n-(x_max+a-1)//a)*y_max
  ans+=floor_sum(y_max,a,m,(a-x_max%a)%a)
  return ans



def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  ansl=[]
  T=int(pin())
  for j in range(T):
    N,M,A,B=pin().split()
    ansl.append(str(floor_sum(int(N),int(M),int(A),int(B))))
  ans="\n".join(ansl)
  print(ans)
  return
main()
Buggy python submission (verdict: Time Limit Exceeded):
'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,M=map(int,pin().split())
  cnt=[0]*N 
  dp=[[0]*N for _ in range(N)]
  for i in range(M):
    A,B=map(int,pin().split())
    t=max(A,B)
    s=min(A,B)
    if dp[s-1][t-1]==0:
      cnt[s-1]+=1
      cnt[t-1]+=1
      dp[s-1][t-1]=1
  print(max(cnt)+1)
  return 
main()

Fixed submission:
'''
Created on 2020/09/03

@author: harurun
'''
from dataclasses import *
@dataclass
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
  import sys
  pin=sys.stdin.readline

  N,M=map(int,pin().split())
  uf=UnionFind(N)
  for i in range(M):
    A,B=map(int,pin().split())
    A-=1
    B-=1
    uf.union(A, B)

  ans=0
  for j in range(N):
    ans=max(ans,uf.size(j))
  print(ans)
  return

main()

#解説AC
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=list(map(int,input().split()))
s=1
for x in range(K):
  s*=A[x]
B=[]
for y in range(N-K):
  B.append(s)
  s=(s//A[y])*A[K+y]
B.append(s)
for z in range(N-K):
  if B[z]<B[z+1]:
    print("Yes")
  else:
    print("No")
    

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
for x in range(N-K):
  if A[x]<A[K+x]:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
for m in range(N):
  n=m+1
  f=0
  for x in range(1,n+1):
    if x*x>=n:
      break
    for y in range(1,n+1):
      if x*x+y*y>=n:
        break
      for z in range(1,n+1):
        if x*x + y*y + z*z >=n:
          break
        t=x**2 + y**2 + z**2 + x*y + y*z + z*x
        if t==n:
          f += 1
  print(f)

Fixed submission:
N=int(input())
a=[]
for i in range(N):
  a.append(0)
for x in range(1,N+1):
  if x**2>=N:
    break
  for y in range(1,N+1):
    if x**2 + y**2 >= N:
      break
    for z in range(1,N+1):
      if x**2+y**2+z**2>=N:
        break
      t=x**2+y**2+z**2+x*y+y*z+z*x
      if t<=N:
        a[t-1] += 1
for m in range(N):
  print(a[m])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
for m in range(N):
  n=m+1
  f=0
  for x in range(1,n+1):
    for y in range(1,n+1):
      for z in range(1,n+1):
        t=x**2 + y**2 + z**2 + x*y + y*z + z*x
        if t==n:
          f += 1
  print(f)

Fixed submission:
N=int(input())
a=[]
for i in range(N):
  a.append(0)
for x in range(1,N+1):
  if x**2>=N:
    break
  for y in range(1,N+1):
    if x**2 + y**2 >= N:
      break
    for z in range(1,N+1):
      if x**2+y**2+z**2>=N:
        break
      t=x**2+y**2+z**2+x*y+y*z+z*x
      if t<=N:
        a[t-1] += 1
for m in range(N):
  print(a[m])
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2147483647)
N=int(input())
A=[26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286,95428956661682176]
B=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
a=0
for x in range(12):
  if N<=A[x]:
    a=x
    break
for y in range(a):
  b=N//(26**(a-y))
  print(B[b-1],end="")
  N=N-b*(26**(a-y))
print(B[N-1])
  

Fixed submission:
'''
Created on 2020/08/31

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  ans=""
  while N:
    N-=1
    ans+=chr(97+N%26)
    N=N//26
  print(ans[::-1])
  return
main()
#解説AC

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286,95428956661682176]
B=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
a=0
for x in range(12):
  if N<=A[x]:
    a=x
    break
for y in range(a):
  b=N//(26**(a-y))
  print(B[b-1],end="")
  N=N-b*(26**(a-y))
print(B[N-1])
  

Fixed submission:
'''
Created on 2020/08/31

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  ans=""
  while N:
    N-=1
    ans+=chr(97+N%26)
    N=N//26
  print(ans[::-1])
  return
main()
#解説AC

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134,146813779479510,3817158266467286]
B=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
a=0
for x in range(11):
  if N<=A[x]:
    a=x
    break
for y in range(a):
  b=N//(26**(a-y))
  print(B[b-1],end="")
  N=N-b*(26**(a-y))
print(B[N-1])
  
  

Fixed submission:
'''
Created on 2020/08/31

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  ans=""
  while N:
    N-=1
    ans+=chr(97+N%26)
    N=N//26
  print(ans[::-1])
  return
main()
#解説AC
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
alist = list(map(int,input().split()))
s = 0
i = 0
for x in alist:
  num = 0
  i += 1
  j = 0
  for y in alist:
    j += 1
    if i != j:
      if x % y == 0:
        break
      else:
        num += 1
  if num == int(N)-1:
    s += 1
print(s)

Fixed submission:
'''
Created on 2020/08/23

@author: harurun
'''
def main():
  from collections import Counter
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  ans=0
  N=int(pin())
  A=list(map(int,pin().split()))
  c=Counter(A)
  t=max(A)
  dp=[True]*t
  for i in A:
    if dp[i-1]:
      n=2*i
      while n<=t:
        dp[n-1]=False
        n+=i
  for k in A:
    if c[k]==1 and dp[k-1]:
      ans+=1
  print(ans)
  return
main()

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
alist = list(map(int,input().split()))
s = 0
i = 0
for x in alist:
  num = 0
  i += 1
  j = 0
  for y in alist:
    j += 1
    if i != j:
      if x % y == 0:
        break
      else:
        num += 1
  if num == int(N)-1:
    s += 1
print(s)

Fixed submission:
'''
Created on 2020/08/23

@author: harurun
'''
def main():
  from collections import Counter
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  ans=0
  N=int(pin())
  A=list(map(int,pin().split()))
  c=Counter(A)
  t=max(A)
  dp=[True]*t
  for i in A:
    if dp[i-1]:
      n=2*i
      while n<=t:
        dp[n-1]=False
        n+=i
  for k in A:
    if c[k]==1 and dp[k-1]:
      ans+=1
  print(ans)
  return
main()

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
alist = list(map(int,input().split()))
s = 0
i = 0
for x in alist:
  num = 0
  i += 1
  j = 0
  for y in alist:
    j += 1
    if i != j:
      if x % y != 0:
        num += 1
  if num == int(N)-1:
    s += 1
print(s)
       

Fixed submission:
'''
Created on 2020/08/23

@author: harurun
'''
def main():
  from collections import Counter
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  ans=0
  N=int(pin())
  A=list(map(int,pin().split()))
  c=Counter(A)
  t=max(A)
  dp=[True]*t
  for i in A:
    if dp[i-1]:
      n=2*i
      while n<=t:
        dp[n-1]=False
        n+=i
  for k in A:
    if c[k]==1 and dp[k-1]:
      ans+=1
  print(ans)
  return
main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    num_1 = input()
    lis = list(input().split())
    s = 1
    num_2 = int (num_1)
    if 0 in lis:
        return 0
    for x in range(num_2):
        s = s * int(lis[x])
    if s > 10**18:
        return -1
    return s

print(main())

Fixed submission:
def main():
    num_1 = input()
    lis = list(map(int,input().split()))
    s = 1
    num_2 = int (num_1)
    num = 10 ** 18
    if 0 in lis:
        print(0)
        return
    for x in range(num_2):
        s = s * int(lis[x])
        if s > num:
            print(-1)
            return
    print(s)
    return

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    num_1 = input()
    lis = list(input().split())
    s = 1
    num_2 = int (num_1)
    for x in range(num_2):
        s = s * int(lis[x])
    if s > 10**18:
        return -1
    return s

print(main())

Fixed submission:
def main():
    num_1 = input()
    lis = list(map(int,input().split()))
    s = 1
    num_2 = int (num_1)
    num = 10 ** 18
    if 0 in lis:
        print(0)
        return
    for x in range(num_2):
        s = s * int(lis[x])
        if s > num:
            print(-1)
            return
    print(s)
    return

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

A = int (a)
B = int (b)

x = a*b

y = int(x)

print(x)

Fixed submission:
A,B=input().split()
A = int(A)
B1,B2 = B.split(".")
t = A*(int(B1)*100 + int(B2))
print(int(t//100))

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

x = a*b

y = int(x)

print(x)

Fixed submission:
A,B=input().split()
A = int(A)
B1,B2 = B.split(".")
t = A*(int(B1)*100 + int(B2))
print(int(t//100))
Buggy python submission (verdict: Time Limit Exceeded):
'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  A,B,N=map(int,pin().split())
  t=int(B/A)
  ans=0
  for x in range(t,N+1):
    ans=max(ans,int(A*x/B)-A*int(x/B))
  print(ans)
  return 
main()

Fixed submission:
'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  A,B,N=map(int,pin().split())
  x=min(B-1,N)
  ans=int(A*x/B)-A*int(x/B)
  print(ans)
  return
main()
#解説AC
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
for x in range(N):
  S=input()
  if S in A:
    pass
  else:  
    A.append(S)
print(len(A))    

Fixed submission:
N=int(input())
d=[]
for x in range(N):
  S=input()
  d.append(S)
print(len(set(d)))
Buggy python submission (verdict: Runtime Error):
S=input()
t=len(S)
m=t//2
S1=""
S2=""
for x1 in range(m):
  S1 += S[x1]
for x2 in range(m+1,2*m+1):
  S2 += S[x2]
S2=S2[::-1]
if S1==S2:
  t1=len(S1)
  t2=len(S2)
  m1=t1//2
  m2=t2//2
  R11=""
  R12=""
  for y1 in range(m1):
    R11 += S1[y1]
  for y2 in range(m1+1,2*m1+1):
    R12 += S1[y2]
  R12=R12[::-1]
  if R11==R12:
    R21=""
    R22=""
    for z1 in range(m2):
      R21 += S2[z1]
    for z2 in range(m2+1,2*m2+1):
      R22 += S2[z2]
    R22=R22[::-1]
    if R21==R22:
      print('Yes')
    else:
      print('No')
  else:
    print('No')
else:
  print('No')
  
  

Fixed submission:
import sys
S=input()
N=len(S)
if S[:N//2]==S[N//2+1:][::-1]:
  if N==3:
    print("Yes")
  elif (N//2)%2==1:
    if S[:(N//2)//2]==S[(N//2)//2+1:N//2][::-1] and S[N//2+1:-(N//2)//2]==S[-(N//2)//2+1:][::-1]:
      print("Yes")
    else:
#      sys.stderr.write("2\n")
      print("No")
  else:
    if S[:(N//2)//2]==S[(N//2)//2:N//2][::-1] and S[N//2+1:-(N//2)//2]==S[-(N//2)//2:][::-1]:
      print("Yes")
    else:
      print("No")
else:
#  sys.stderr.write("1\n")
  print("No")