Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
    n = int(input())
    l_a = list(map(int, input().split()))
    s_a = list(set(l_a))

    s_a.sort()

    dub_a = [0]*(max(s_a)+1)

    for i in l_a:
        dub_a[i] += 1

    dp = [1]*(max(s_a)+1)

    for i in s_a:
        if dp[i] == 0:
            pass
        else:
            for j in range(2*i, len(dp), i):
                dp[j] = 0


    count = 0
    for i in s_a:
        if dp[i]==1 and dub_a[i]==1:
            count += 1
    print(count)

Fixed submission:
if __name__ == "__main__":
    s = input().split()
    for i, num in enumerate(s):
        if num == "0":
            print(i+1)
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
    a, b, h, m = input().split()

    a = float(a)
    b = float(b)
    h = float(h)
    m = float(m)

    theta = 2.0 * math.pi * h / 12.0
    phi = 2.0 * math.pi * m / 60.0

    xa = a * math.sin(theta)
    ya = a * math.cos(theta)

    xb = b * math.sin(phi)
    yb = b * math.cos(phi)

    print(xa, ya)
    print(xb, yb)
    distance = math.sqrt(math.pow(xa-xb, 2) + math.pow(ya-yb, 2))

    print(distance)

Fixed submission:
import math


if __name__ == "__main__":
    a, b, h, m = input().split()

    a = int(a)
    b = int(b)
    h = int(h)
    m = int(m)

    theta = 2.0 * math.pi * (h + m / 60.0) / 12.0
    phi = 2.0 * math.pi * m / 60.0

    xa = a * math.sin(theta)
    ya = a * math.cos(theta)

    xb = b * math.sin(phi)
    yb = b * math.cos(phi)

    distance = math.sqrt(math.pow(xa-xb, 2) + math.pow(ya-yb, 2))

    print(distance)
Buggy python submission (verdict: Runtime Error):
N,X,T=input(),input(),input()

m=(N//X) 
m1=m*T

if N%X==0:
  print(m)
else:
  print(m+1)


Fixed submission:
N,X,T = map(int, input().split())  # 3個の数字の入力を受け取る


m=(N//X) 
m1=m*T


if N%X==0:
  print(m1)
else:
  print(m1+T)

Buggy python submission (verdict: Runtime Error):
N,X,T=input(),input(),input()

m=(N//X)*T

if N%X==0:
  print(m)
else:
  print(m+1)

Fixed submission:
N,X,T = map(int, input().split())  # 3個の数字の入力を受け取る


m=(N//X) 
m1=m*T


if N%X==0:
  print(m1)
else:
  print(m1+T)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

sum=0

while N>=1:
  sum+=N%10
  N=N//10
  sum=sum%9
  
if sum == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
N=int(input())
if N%9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	long long ans = 0;
	int MaxNum = 0;
	for (int i = 0; i < N-1; i++)
	{
      if(A[i]>=A[i+1])
		ans += A[i]-A[i+1];
      A[i+1]=A[i]
	}

	cout << ans << endl;
}




Fixed submission:
N=int(input())
A= list(map(int,input().split()))
sum=0
for i in range(N-1):
  if A[i]>=A[i+1]:
    sum+=A[i]-A[i+1]
    A[i+1]=A[i]
    
print(sum)
Buggy python submission (verdict: Runtime Error):
n = input()
if n >= 30:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
if n >= 30:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import sys
K = int(input())
A, B = map(int, input().split())

for i in range(1000):
    s = K * i
    if A <= s <= B:
        print("OK")
        sys.exit()
print("NG")

Fixed submission:
X = int(input())
x = 100
i = 0
while x < X:
    x += x//100 
    i += 1

print(i)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())
remain_A = K-A
if remain_A<=0:
    print(K)
else:
    remain_B = remain_A - B
    if remain_B <= 0:
        print(A)
    else:
        ans = (A*1) + (B*0) + (remain_B * (-1))
        print(ans)

Fixed submission:
A,B,C,K=(int(x) for x in input().split())
remain_A = K-A
if remain_A<=0:
    print(K)
else:
    remain_B = remain_A - B
    if remain_B <= 0:
        print(A)
    else:
        ans = (A*1) + (B*0) + (remain_B * (-1))
        print(ans)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())
if A > K:
    print(K)
elif B > K:
    print(A)
else:
    ans = (A*1) + (B*0) + (K-(A+B))*(-1)
    print(ans)

Fixed submission:
A,B,C,K=(int(x) for x in input().split())
remain_A = K-A
if remain_A<=0:
    print(K)
else:
    remain_B = remain_A - B
    if remain_B <= 0:
        print(A)
    else:
        ans = (A*1) + (B*0) + (remain_B * (-1))
        print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
for _ in range(n):
    s.append(int(input))

print(len(set(s)))

Fixed submission:
n = int(input())
s = []
for _ in range(n):
    s.append(input())

print(len(set(s)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))

for i in range(n-1):
    i = i + 1
    cnt = 0
    for j in range(n-1):
        if i == A[j]:
            cnt += 1
    print(cnt)
print("0")

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

ans = [0] * N
for a in A:
    ans[a-1] += 1

for a in ans:
    print(a)

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

for i in range(n-1):
    i = i + 1
    cnt = 0
    for j in range(n-1):
        if i == A[j]:
            cnt += 1
    print(cnt)
print("0")

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

ans = [0] * N
for a in A:
    ans[a-1] += 1

for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
import gcd from math
n = int(input())

ans = 0
if n == 1:
    ans = 1
else:
    for i in range(n):
        i = i + 1
        for j in range(n):
            j = j + 1
            for k in range(n):
                k = k + 1
                ij = gcd(i,j)
                ans = ans + gcd(ij,k)

print(ans)


Fixed submission:
n = int(input())

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a

ans = 0
if n == 1:
    ans = 1
else:
    for i in range(n):
        i = i + 1
        for j in range(n):
            j = j + 1
            for k in range(n):
                k = k + 1
                ij = gcd(i,j)
                ans = ans + gcd(ij,k)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a

ans = 0
if n == 1:
    ans = 1
else:
    for i in range(n):
        i = i + 1
        #ans = ans + i #(i,i,i)
        for j in range(n):
            j = j + 1
            for k in range(n):
                k = k + 1
                ij = gcd(i,j)
                ans = ans + gcd(ij,k)

print(ans)

Fixed submission:
n = int(input())

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a

ans = 0
if n == 1:
    ans = 1
else:
    for i in range(n):
        i = i + 1
        for j in range(n):
            j = j + 1
            for k in range(n):
                k = k + 1
                ij = gcd(i,j)
                ans = ans + gcd(ij,k)

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

all_length = k*2
point = []
for i in range(n):
    a_left  = k-a[i]
    a_right = k+a[i]
    point.append(a_left)
    point.append(a_right)
point = list(set(point))
point.sort()

num = len(point)
num = round(num/2)
distance = []
for i in range(num):
    dis = 0
    for j in range(n-1):
        dis += point[i+j+1] - point[i+j]
    distance.append(dis)
mindis = min(distance)
print(mindis)

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

A.append(A[0]+k)
l = 0
for i in range(n):
    l = max(l, A[i+1]-A[i])
print(k-l)

Buggy python submission (verdict: Runtime Error):
k, n = map(int, input().split())
a = list(map(int, input().split()))

all_length = k*2
point = []
for i in range(n):
    a_left  = k-a[i]
    a_right = k+a[i]
    point.append(a_left)
    point.append(a_right)
point = list(set(point))
point.sort()

num = len(point)
num = round(num)
distance = []
for i in range(num):
    dis = 0
    for j in range(n-1):
        dis += point[i+j+1] - point[i+j]
    distance.append(dis)
mindis = min(distance)
print(mindis)

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

A.append(A[0]+k)
l = 0
for i in range(n):
    l = max(l, A[i+1]-A[i])
print(k-l)

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

all_length = k*2
point = []
for i in range(n):
    a_left  = k-a[i]
    a_right = k+a[i]
    point.append(a_left)
    point.append(a_right)
point = list(set(point))
point.sort()

num = len(point)
distance = []
for i in range(num-2):
    dis = 0
    for j in range(n-1):
        dis += point[i+j+1] - point[i+j]
    distance.append(dis)
mindis = min(distance)
print(mindis)

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

A.append(A[0]+k)
l = 0
for i in range(n):
    l = max(l, A[i+1]-A[i])
print(k-l)
Buggy python submission (verdict: Runtime Error):
import math
N, X, T = input()
S = math.ceil(N/X)
Ans = S * T
print(Ans)

Fixed submission:
import math
N, X, T = map(int, input().split())
S = math.ceil(N/X)
Ans = S * T
print(Ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
for i in range(N-1):
  if A[i] > A[i+1]:
    S = A[i] - A[i+1]
    K = A[i+1] + abs(S)
  else:
    S = A[i] - A[i+1]
    K = abs(S)
print(K)


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
K = 0
for i in range(N-1):
  if A[i] > A[i+1]:
    S = A[i] - A[i+1]
    # リストの前の最大値を取得して比較しないといけない。
    A[i+1] += S
    K += S
  else:
    pass
print(K)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
for i in range(N-1):
  if A[i] > A[i+1]:
    S = A[i] - A[i+1]
    K = A[i+1] + S
  else:
    K = 0
print(K)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
K = 0
for i in range(N-1):
  if A[i] > A[i+1]:
    S = A[i] - A[i+1]
    # リストの前の最大値を取得して比較しないといけない。
    A[i+1] += S
    K += S
  else:
    pass
print(K)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
h=list(map(int,input().split()))
road=[]
for i in range(m):
    road.append(list(map(int,input().split())))
tall=[1 for _ in range(n)]
def max(a,b):
    if a>b:
        return a
    elif a==b:
        return -1
    else:    
        return b
for i in range(n):
    for j in range(m):
        if i+1 in road[j]:
            if max(h[road[j][0]-1],h[road[j][1]-1]) != h[i]:
                tall[i]=0
counter=0
for i in range(n):
    if tall[i] == 1:
        counter+=1
print(counter)

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
road=[]
for i in range(m):
    road.append(list(map(int,input().split())))
tall=[1 for _ in range(n)]
for i in range(m):
    if h[road[i][0]-1]>h[road[i][1]-1]:
        tall[road[i][1]-1]=0
    elif h[road[i][0]-1]==h[road[i][1]-1]:
        tall[road[i][1]-1]=0
        tall[road[i][0]-1]=0
    else:
        tall[road[i][0]-1]=0
counter=0
for i in range(n):
    if tall[i] == 1:
        counter+=1
print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(input().split())
for i in range(1,n+1):
    print(a.count(str(i)))

Fixed submission:
n=int(input())
counter=[0 for _ in range(n)]
a=list(input().split())
for i in a:
    counter[int(i)-1]+=1
for j in counter:
    print(j)
Buggy python submission (verdict: Runtime Error):
x,y,z=map(int,input().split())
print(z,x,y)

Fixed submission:
n,k=map(int,input().split())
print(min(n%k,abs((-1*n)%k)))
Buggy python submission (verdict: Runtime Error):
def mysqrt(x):
    g = 1.0
    while True:
        if abs(g**2 - x) < 0.000000000001:
            return g
        g = (g+x/g)/2 
print('Yes' if mysqrt(a) + mysqrt(b) < mysqrt(c) else 'No')

Fixed submission:
a,b,c = map(int,input().split())
if (c>a+b) and (c>2):
  print('Yes' if (c-a-b)**2 > 4*a*b else 'No')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
print(int(n/(a+b))*a + n%(a+b) - (n%(a+b)%a))

Fixed submission:
n,a,b = map(int,input().split())
uni = int(n/(a+b))
if n > (a+b)*uni + a:
  print(a*uni + a)
else:
  print(a*uni + n%(a+b))
Buggy python submission (verdict: Runtime Error):
s,t = map(str,input().split())
a,b = map(int,input().split())
u = input()
if u == s:
  a -= 1
elif u == t:
  t -= 1 
print('{0} {1}'.format(a,b))


Fixed submission:
s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == s:
  a -= 1
elif u == t:
  b -= 1
print('{0} {1}'.format(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
p=list(map(int,input().split()))
ave=[]
for i in range(N-K+1):
    tmp=0
    for j in range(K):
        tmp+=(p[i+j]+1)/2
    ave.append(tmp)
print(max(ave))

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
ave=[0]*(N-K+1)
tmp=0
for i in range(K):
    tmp+=(p[i]+1)/2
ave[0]=tmp
for i in range(1,N-K+1):
    ave[i]=ave[i-1]-(p[i-1]+1)/2 + (p[i+K-1]+1)/2
print(max(ave))

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
li = list(map(int, input().split()))
max = 0
for i in range(n-k+1):
  tmp = (sum(li[i:i+k])+k)/2
  if tmp > max:
    max = tmp
print(max)

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
ave=[0]*(N-K+1)
tmp=0
for i in range(K):
    tmp+=(p[i]+1)/2
ave[0]=tmp
for i in range(1,N-K+1):
    ave[i]=ave[i-1]-(p[i-1]+1)/2 + (p[i+K-1]+1)/2
print(max(ave))

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
list = input().split()
expectation = []
for i in range(len(list)):
  expectation.append((1+int(list[i]))/2)
max = 0
for i in range(n-k+1):
  tmp = sum(expectation[i:i+k])
  if tmp > max:
    max = tmp
print(max)


Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
ave=[0]*(N-K+1)
tmp=0
for i in range(K):
    tmp+=(p[i]+1)/2
ave[0]=tmp
for i in range(1,N-K+1):
    ave[i]=ave[i-1]-(p[i-1]+1)/2 + (p[i+K-1]+1)/2
print(max(ave))

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
list = input().split()
expectation = []
for i in range(len(list)):
  expectation.append((1+int(list[i]))/2)
max = 0
for i in range(n-k+1):
  tmp = sum(expectation[i:i+k])
  if tmp > max:
    max = tmp
print(max)

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
ave=[0]*(N-K+1)
tmp=0
for i in range(K):
    tmp+=(p[i]+1)/2
ave[0]=tmp
for i in range(1,N-K+1):
    ave[i]=ave[i-1]-(p[i-1]+1)/2 + (p[i+K-1]+1)/2
print(max(ave))

Buggy python submission (verdict: Time Limit Exceeded):
from statistics import mean
n,k = map(int,input().split())
list = input().split()
expectation = []
for i in range(len(list)):
  expectation.append((1+int(list[i]))/2)
max = 0
for i in range(n-k+1):
  tmp = sum(expectation[i:i+k])
  if tmp > max:
    max = tmp
print(max)

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
ave=[0]*(N-K+1)
tmp=0
for i in range(K):
    tmp+=(p[i]+1)/2
ave[0]=tmp
for i in range(1,N-K+1):
    ave[i]=ave[i-1]-(p[i-1]+1)/2 + (p[i+K-1]+1)/2
print(max(ave))
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
counter = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k == S:
        counter += 1
print(counter)

Fixed submission:
K,S = map(int,input().split())
counter = 0
for i in range(K+1):
  for j in range(K+1):
    k = S - i - j
    if(k >= 0) and (k <= K):
      counter += 1
print(counter)
Buggy python submission (verdict: Runtime Error):
import math
N,K=map(int,input().split())
print(int(math.factorial(N)/math.factorial(N-K)))

Fixed submission:
N,K=map(int,input().split())
print(K*(K-1)**(N-1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = list(map(int, input().split()))
zero = False
fl = False
x = 1
for i in lst:
    if(i==0):
        zero = True
        break
    x*=i
    if(x>1e18):
        fl = True
if zero:
    print(0)
elif fl:
    print(-1)
else:
    print(x)

Fixed submission:
n = int(input())
lst = list(map(int, input().split()))
zero = False
fl = False
x = 1
for i in lst:
    if(i==0):
        zero = True
        break
    if not fl:
        x*=i
    if(x>1e18):
        fl = True
if zero:
    print(0)
elif fl:
    print(-1)
else:
    print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = list(map(int, input().split()))
x = 1
for i in lst:
    x*=i
if(x>1e18):
    print(-1)
else:
    print(x)

Fixed submission:
n = int(input())
lst = list(map(int, input().split()))
zero = False
fl = False
x = 1
for i in lst:
    if(i==0):
        zero = True
        break
    if not fl:
        x*=i
    if(x>1e18):
        fl = True
if zero:
    print(0)
elif fl:
    print(-1)
else:
    print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]

a.append(str(input()))

for i in range(n-1):
  flag = 1
  tmp = str(input())
  for j in range(len(a)):
    if a[j] == tmp:
      flag = 0
      break
  if flag == 1:
    a.append(tmp)

print(len(a))

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  a.append(str(input()))

ans=1
a=sorted(a)
tmp=a[0]
for i in range(n-1):
  if a[i+1] != tmp:
    ans += 1
    tmp=a[i+1]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]

a.append(str(input()))

for i in range(n-1):
  flag = 1
  tmp = str(input())
  for j in range(len(a)):
    if a[j] == tmp:
      flag = 0
  if flag == 1:
    a.append(tmp)

print(len(a))

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  a.append(str(input()))

ans=1
a=sorted(a)
tmp=a[0]
for i in range(n-1):
  if a[i+1] != tmp:
    ans += 1
    tmp=a[i+1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n=int(input())
a=[]
for i in range(n):
  a.append(str(input()))

a=sorted(a)
b=[]
c=[]

tmp="."
count=0

for i in range(n):
  if tmp != a[i]:
    b.append(tmp)
    c.append(count)
    tmp=a[i]
    count=1
  else:
    count += 1
 
b.append(tmp)
c.append(count)

for i in range(len(b)):
  if c[i]==np.max(c):
    print(b[i])

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  a.append(str(input()))

a=sorted(a)
b=[]
c=[]

tmp="."
count=0

for i in range(n):
  if tmp != a[i]:
    b.append(tmp)
    c.append(count)
    tmp=a[i]
    count=1
  else:
    count += 1
 
b.append(tmp)
c.append(count)
k=sorted(c)[-1]
for i in range(len(b)):
  if c[i]==k:
    print(b[i])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k=list(map(int,input().split()))
a=(np.array(list(map(int,input().split())))+1)/2
  
ans=0
for i in range(n-k+1):
  tmp=np.sum(a[i:i+k])
  if ans<tmp:
    ans=tmp
    
print(ans)

Fixed submission:
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
  
ans=0
for i in range(k):
  ans += (a[i]+1)/2
past=ans
for i in range(1,n-k+1):
  tmp = past - (a[i-1]+1)/2 +  (a[i+k-1]+1)/2
  if ans<tmp:
    ans=tmp
  past = tmp
    
print(ans)

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

b=[]
for i in range(n):
  b.append((1+a[i])/2)
  
ans=0
for i in range(n-k+1):
  tmp=np.sum(b[i:i+k])
  if ans<tmp:
    ans=tmp
    
print(ans)

Fixed submission:
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
  
ans=0
for i in range(k):
  ans += (a[i]+1)/2
past=ans
for i in range(1,n-k+1):
  tmp = past - (a[i-1]+1)/2 +  (a[i+k-1]+1)/2
  if ans<tmp:
    ans=tmp
  past = tmp
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n=int(input())
x=np.zeros(n+1)

def find(a,n,x):
  k =[]
  l =[]
  for j in range(a,n):
    if j % 10!= 0:
      if a%10 == j//(10**(len(str(j))-1)) and j%10 == a//(10**(len(str(a))-1)):
        k.append(j)
        x[j] = 1
      if a%10 == j%10 and j//(10**(len(str(j))-1)) == a//(10**(len(str(a))-1)):
        l.append(j)
        x[j] = 1
  if k[0] == l[0]:
    return len(k)*len(l)
  return 2*len(k)*len(l)

ans=0
for i in range(1,n+1):
  if x[i] == 0 and i%10!=0:
    ans += find(i,n+1,x)

print(ans)

Fixed submission:
n=int(input())
x=[0 for i in range(n+1)]

def find(a,n,x):
  k =0
  l =0
  for j in range(a,n):
    if j % 10!= 0:
      if a%10 == j//(10**(len(str(j))-1)) and j%10 == a//(10**(len(str(a))-1)):
        k+=1
        x[j] = 1
      if a%10 == j%10 and j//(10**(len(str(j))-1)) == a//(10**(len(str(a))-1)):
        l+=1
        x[j] = 1
  if a%10 == a//(10**(len(str(a))-1)):
    return k*l
  return 2*k*l

ans=0
for i in range(1,n+1):
  if x[i] == 0 and i%10!=0:
    ans += find(i,n+1,x)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
f=sorted(list(map(int,input().split())),reverse=True)

left = -1
right = 10**18+1
 
 
while right - left > 1:
    mid = left + (right - left) // 2
 
 
    train = k
    for i in range(n):
        req = mid // f[i]
        if req < a[i]:
            train -= a[i] - req
 
 
    if train >= 0:
        right = mid
    else:
        left = mid
 
 
 
print(right)

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

left = -1
right = 10**18+1
 
 
while right - left > 1:
    mid = left + (right - left) // 2
 
 
    train = k
    for i in range(n):
        req = mid // f[i]
        if req < a[i]:
            train -= a[i] - req
 
 
    if train >= 0:
        right = mid
    else:
        left = mid
 
 
 
print(right)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

s=0
for i in range(n):
    s += i
    
print(s)

Fixed submission:
n=int(input())

s=int(n*(n-1)//2)
    
print(s)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n=int(input())
a1=[0,0]
a2=[0,0]
a3=[0,0]
a4=[0,0]

def d1(a):
    return np.sqrt((a[0])**2+(a[1])**2)

def d2(a,b):
    return np.sqrt((a[0]+b[0])**2+(a[1]+b[1])**2)

def d3(a,b,c):
    return np.sqrt((a[0]+b[0]+c[0])**2+(a[1]+b[1]+c[1])**2)

def d4(a,b,c,d):
    return np.sqrt((a[0]+b[0]+c[0]+d[0])**2+(a[1]+b[1]+c[1]+d[1])**2)

for i in range(n):
    x=list(map(int,input().split()))
    if ((x[0]<0 and x[1]<0)or(x[0]<0 and x[1]==0)or(x[0]==0 and x[1]<0)):
        a3[0] += x[0]
        a3[1] += x[1]
    if x[0]<0 and x[1]>0:
        a2[0] += x[0]
        a2[1] += x[1]
    if x[0]>0 and x[1]<0:
        a4[0] += x[0]
        a4[1] += x[1]
    if ((x[0]>0 and x[1]>0)or(x[0]>0 and x[1]==0)or(x[0]==0 and x[1]>0)):
        a1[0] += x[0]
        a1[1] += x[1]

k1=max(d1(a1),d1(a2),d1(a3),d1(a4))
k2=max(d2(a1,a4),d2(a1,a2),d2(a2,a3),d2(a3,a4))
k3=max(d3(a1,a2,a4),d3(a1,a2,a3),d3(a2,a3,a4),d2(a3,a4,a1))

k=max(k1,k2,k3,d4(a1,a2,a3,a4))

print('{:.12f}'.format(k))

Fixed submission:
import numpy as np

n=int(input())

def div2(x,y):
    if x>0:
        return (1,y/x)
    elif x<0:
        return (-1,y/x)
    else:
        if y>0:
            return (-1,-float("inf"))
        else:
            return (1,-float("inf"))
    

L=[list(map(int,input().split())) for i in range(n)]

L.sort(key=lambda x:div2(x[0],x[1]))

m=0
for i in range(n):
    for j in range(i,n):
        x0=y0=0
        x1=y1=0
        for k in range(n):
            if i<=k<=j:
                x0+=L[k][0]
                y0+=L[k][1]
            else:
                x1+=L[k][0]
                y1+=L[k][1]
        m=max(m,x0**2+y0**2,x1**2+y1**2)

print('{:.12f}'.format(np.sqrt(m)))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(float,input().split()))
s=1

for i in range(n):
  s *= a[i]

b=s/a

Fixed submission:
import numpy as np

n=int(input())
a=list(map(float,input().split()))
s=1

for i in range(n):
  s *= a[i]

b=[s/a[j] for j in range(n)]

print(s/np.sum(b))