Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))
AS = list(set(A))
F = list()
for i in AS:
    F.append(A.count(i))
print(sum(sorted(F)[:len(AS) - k]))

Fixed submission:
from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
AD = sorted(list(Counter(A).values()))
print(sum(AD[:len(AD) - k]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))
AS = set(A)
B = []
for i in AS:
    B.append(A.count(i))
B.sort()
print(sum(B[:len(AS) - k]))

Fixed submission:
from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
AD = sorted(list(Counter(A).values()))
print(sum(AD[:len(AD) - k]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))
B = []
for i in set(A):
    B.append(A.count(i))
B.sort()
print(sum(B[:len(set(A)) - k]))

Fixed submission:
from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
AD = sorted(list(Counter(A).values()))
print(sum(AD[:len(AD) - k]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))
B = []
for i in set(A):
    B.append(A.count(i))
print(sum(sorted(B)[:len(set(A)) - k]))

Fixed submission:
from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
AD = sorted(list(Counter(A).values()))
print(sum(AD[:len(AD) - k]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))
B = []
for i in set(A):
    B.append(A.count(i))
print(sum(sorted(B)[:len(set(A)) - k]))

Fixed submission:
from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
AD = sorted(list(Counter(A).values()))
print(sum(AD[:len(AD) - k]))

Buggy python submission (verdict: Runtime Error):
10 3
5 1 3 2 4 1 1 2 3 4

Fixed submission:
from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
AD = sorted(list(Counter(A).values()))
print(sum(AD[:len(AD) - k]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [input() for _ in range(n)]
AS = set(A)
ASd = set(A)
for i in ASd:
    if A.count(i) % 2 == 0:
        AS.remove(i)
print(len(AS))

Fixed submission:
n = int(input())
A = [input() for _ in range(n)]
AS = set()
for i in A:
    if i not in AS:
        AS.add(i)
    else:
        AS.remove(i)
print(len(AS))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(input()) for _ in range(n)]
As = set(A)
ans = 0
for i in As:
    if A.count(i) % 2 == 0:
        continue
    else:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
A = [input() for _ in range(n)]
AS = set()
for i in A:
    if i not in AS:
        AS.add(i)
    else:
        AS.remove(i)
print(len(AS))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = []
for _ in range(n):
    a = input()
    if a not in A:
        A.append(a)
    else:
        A.remove(a)
print(len(A))

Fixed submission:
n = int(input())
A = [input() for _ in range(n)]
AS = set()
for i in A:
    if i not in AS:
        AS.add(i)
    else:
        AS.remove(i)
print(len(AS))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
ans = 0
for x in range(min(A), max(A)+1):
    ans = max(A.count(x - 1) + A.count(x) + A.count(x + 1), ans)
print(ans)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
C = [0] * 100002
for x in A:
    for i in range(3):
        C[x + i] += 1
print(max(C))
Buggy python submission (verdict: Runtime Error):
s1, s2, s3 = input().split())
print(s1[0].upper() + s2[0].upper() + s3[0].upper())

Fixed submission:
S = list(input().split())
print(S[0][0].upper() + S[1][0].upper() + S[2][0].upper())
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
pwr = 1
for i in range(1, N+1):
    pwr *= i
print(pwr % 1000000007)

Fixed submission:
N = int(input())
pwr = 1
for i in range(1, N+1):
    pwr *= i
    pwr = pwr % 1000000007
print(pwr)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0
for l in range(k+1):
    for m in range(k+1):
        for n in range(k+1):
            if l + m + n == s:
                ans += 1
print(ans)

Fixed submission:
k, s = map(int, input().split())
ans = 0
for l in range(k+1):
    for m in range(k+1):
        if 0 <= s - (l + m) <= k:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ttl1, ttl2, ttl3 = 0, 0, 0
avarage1 = -(-sum(A) // N)
avarage2 = sum(A) // N
for i in A:
    ttl1 += (i - avarage1) ** 2
    ttl2 += (i - avarage2) ** 2
    ttl3 += (i - avarage3) ** 2
print(min(ttl1, ttl2, ttl3))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ttl1, ttl2, ttl3 = 0, 0, 0
avarage1 = -(-sum(A) // N)
avarage2 = sum(A) // N
avarage3 = round(sum(A) / N)
for i in A:
    ttl1 += (i - avarage1) ** 2
    ttl2 += (i - avarage2) ** 2
    ttl3 += (i - avarage3) ** 2
print(min(ttl1, ttl2, ttl3))
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
S = list(input() for i in range(L))
S.sort()
str = ""
for i in S:
    str += i
print(str)


Fixed submission:
N, L = map(int, input().split())
S = list(input() for i in range(N))
str = ""
for i in range(N-1):
    for j in range(N-1):
        if S[j+1] + S[j] <= S[j] + S[j+1]:
            S[j], S[j+1] = S[j+1], S[j]
for i in S:
    str += i
print(str)
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 1000000007

n = int(input())
str_ary = input().split()
ary = [int(c) for c in str_ary]
# ary = []
# queue = [0 for i in range(n)]
# for i int range(n):
#   num = int(str_ary[i])
#   ary.append(num)
#   for j int range(i):
#     pre_queue = []
#     queue.append(pre_queue)

sum = 0
for diff in range(n - 1):
  for i in range(n - diff - 1):
    # print(i, i + diff + 1)
    sum += ary[i] * ary[i + diff + 1] % MOD
# for i in range(n):
#   sum = 0
#   for j in range(n - i - 1):
#     # print(i, j + i + 1)
#     sum += ary[j + i + 1]
#   result += ary[i] * sum

print(sum % MOD)

Fixed submission:
MOD = 1000000007

n = int(input())
str_ary = input().split()
ary = [int(c) for c in str_ary]
# ary = []
# queue = [0 for i in range(n)]
# for i int range(n):
#   num = int(str_ary[i])
#   ary.append(num)
#   for j int range(i):
#     pre_queue = []
#     queue.append(pre_queue)

result = 0
sum = sum(ary[i] for i in range(n))
# for diff in range(1, n):
#   for i in range(n - diff):
#     # print(diff, i, i + diff)
#     sum += ary[i] * ary[i + diff] % MOD
for i in range(n):
  sum -= ary[i]
  result += ary[i] * sum

print(result % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 1000000007

n = int(input())
str_ary = input().split()
ary = [int(c) for c in str_ary]

result = 0
# for diff in range(n - 1):
#   for i in range(n - diff - 1):
#     # print(i, i + diff + 1)
#     sum += ary[i] * ary[i + diff + 1]
for i in range(n):
  sum = 0
  for j in range(n - i - 1):
    # print(i, j + i + 1)
    sum += ary[j + i + 1]
  result += ary[i] * sum

print(result % MOD)

Fixed submission:
MOD = 1000000007

n = int(input())
str_ary = input().split()
ary = [int(c) for c in str_ary]
# ary = []
# queue = [0 for i in range(n)]
# for i int range(n):
#   num = int(str_ary[i])
#   ary.append(num)
#   for j int range(i):
#     pre_queue = []
#     queue.append(pre_queue)

result = 0
sum = sum(ary[i] for i in range(n))
# for diff in range(1, n):
#   for i in range(n - diff):
#     # print(diff, i, i + diff)
#     sum += ary[i] * ary[i + diff] % MOD
for i in range(n):
  sum -= ary[i]
  result += ary[i] * sum

print(result % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 1000000007

n = int(input())
str_ary = input().split()
ary = [int(c) for c in str_ary]

sum = 0
num = len(ary)
for diff in range(num - 1):
  for i in range(num - diff - 1):
    # print(i, i + diff + 1)
    sum += ary[i] * ary[i + diff + 1]

print(sum % MOD)

Fixed submission:
MOD = 1000000007

n = int(input())
str_ary = input().split()
ary = [int(c) for c in str_ary]
# ary = []
# queue = [0 for i in range(n)]
# for i int range(n):
#   num = int(str_ary[i])
#   ary.append(num)
#   for j int range(i):
#     pre_queue = []
#     queue.append(pre_queue)

result = 0
sum = sum(ary[i] for i in range(n))
# for diff in range(1, n):
#   for i in range(n - diff):
#     # print(diff, i, i + diff)
#     sum += ary[i] * ary[i + diff] % MOD
for i in range(n):
  sum -= ary[i]
  result += ary[i] * sum

print(result % MOD)
Buggy python submission (verdict: Runtime Error):
a=input()
if a<=1199:
  print("ABC")
elif a<=2799:
  print("ARC")
else:
  print("AGC")

Fixed submission:
a=input()
if int(a)<=1199:
  print("ABC")
elif int(a)<=2799:
  print("ARC")
else:
  print("AGC")
Buggy python submission (verdict: Runtime Error):
list=input()
list_n=[int(s) for s in list]
print(int(max(list_n))-int(min(list_n)))

Fixed submission:
list=input().split(" ")
list_n=[int(s) for s in list]
print(int(max(list_n))-int(min(list_n)))

Buggy python submission (verdict: Runtime Error):
list=input()
list_n=[int(s) for s in list]
print(max(list_n)-min(list_n))

Fixed submission:
list=input().split(" ")
list_n=[int(s) for s in list]
print(int(max(list_n))-int(min(list_n)))
Buggy python submission (verdict: Runtime Error):
n=input()
if n%2==0:
  print(n)
else:
  print(n*2)

Fixed submission:
n=input()
if int(n)%2==0:
  print(n)
else:
  print(int(n)*2)
Buggy python submission (verdict: Runtime Error):
count=input()
list=int(input()).rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(int(list2[0])-int(list2[int(count)-1]))
if sa<0:
  print(-1*int(sa))
else:
  print(int(sa))

Fixed submission:
count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(int(list2[0])-int(list2[int(count)-1]))
if sa<0:
  print(-1*int(sa))
else:
  print(int(sa))

Buggy python submission (verdict: Runtime Error):
count=input()
list=int(input()).rstrip().split(" ")
list2= sorted(list)
sa=(int(list2[0])-int(list2[int(count)-1]))
if sa<0:
  print(-1*int(sa))
else:
  print(int(sa))

Fixed submission:
count=input()
list=input().rstrip().split(" ")
list_1=[int(s) for s in list]
list2= sorted(list_1)
sa=(int(list2[0])-int(list2[int(count)-1]))
if sa<0:
  print(-1*int(sa))
else:
  print(int(sa))
Buggy python submission (verdict: Runtime Error):
num=input()
j=0
for i in range(1,10):
  j+=num//10^i
print(num%j==0)

Fixed submission:
num=input()
num1=num
j=0
while int(num)>0:
  j+=int(num)%10
  num = int(num)/10
if int(num1)%j==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
n=int(input())
num = list(map(int,input().split()))
ans = 0
for i in combinations(num,2):
  s = (i[0]*i[1])%(10**9+7)
  ans += s

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

Fixed submission:
n=int(input())
A = list(map(int,input().split()))
s=sum(A)
all=0
for i in A:
  s -= i
  all += (i*s)
ans=all%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=int(input())
num = list(map(int,input().split()))
ans=0
for i in itertools.combinations(num,2):
  ans += (i[0]*i[1])
s=ans%(10**9+7)  
print(s)

Fixed submission:
n=int(input())
A = list(map(int,input().split()))
s=sum(A)
all=0
for i in A:
  s -= i
  all += (i*s)
ans=all%(10**9+7)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
A = list(map(int,input().split()))
num = []
for i in range(n-k):
  An = 1
  An2 = 1
  for j in range(k):
    An = An*A[i+j]
    An2 = An2*A[i+j+1]
  if An2 > An:
    print("Yes")
  else:
    print("No")

Fixed submission:
n,k = map(int,input().split())
A = list(map(int,input().split()))
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()))
num = []
for i in range(n-k+1):
  An = 1
  for j in range(k):
    An = An*A[i+j]
  num.append(An)
  

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

Fixed submission:
n,k = map(int,input().split())
A = list(map(int,input().split()))
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 = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
ans = 0
for n in range(1,N):
    for k in range(n,N):
        ans += A[n-1] * A[k]
print(ans % MOD)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
SUM = sum(A) % MOD
ans = 0

for n in A:
    SUM -= n
    SUM %= MOD
    ans += SUM * n
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for n in range(1,N):
    for k in range(n,N):
        ans += A[n-1] * A[k]
print(ans % 1000000007)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
SUM = sum(A) % MOD
ans = 0

for n in A:
    SUM -= n
    SUM %= MOD
    ans += SUM * n
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 0
for n in range(1,N):
    for k in range(n,N):
        ans += A[n-1] * A[k]
print(ans % 1000000007)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
SUM = sum(A) % MOD
ans = 0

for n in A:
    SUM -= n
    SUM %= MOD
    ans += SUM * n
    ans %= MOD

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
A = list(map(int, input().split()))
ans = 0

for pair in itertools.combinations(A, 2):
    ans += pair[0] * pair[1]

print(ans % 1000000007)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
SUM = sum(A) % MOD
ans = 0

for n in A:
    SUM -= n
    SUM %= MOD
    ans += SUM * n
    ans %= MOD

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

K = int(input())
num = 7
cnt = 0
Len = len(str(K))

for n in range(0,10000000):
    cnt += 1
    if (int(num)%K)==0:
        ans = int(num) % K
        break
    else:
        num = num * 10 + 7
print(cnt)


Fixed submission:
K = int(input())
x = 7%K
ans = -1

for n in range(1,K+10):
    if x==0:
        ans = n
        break

    x = (x * 10 + 7)%K
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
a = abs(N%K)
print(min(a, abs(a-K))

Fixed submission:
N, K = map(int, input().split())
a = abs(N%K)
print(min(a, abs(a-K)))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = 0
judge = True

while judge == True:
    if K == 1:
        N = 0
        break

    ans = N - K
    N = abs(ans)

    ans = N - K
    mem = abs(ans)

    if N > mem:
        pass
    else:
        judge = False


print(N)

Fixed submission:
N, K = map(int, input().split())
a = abs(N%K)
print(min(a, abs(a-K)))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = 0
judge = True

while judge == True:
    if K == 1:
        N = 0
        break

    ans = N - K
    N = abs(ans)

    ans = N - K
    mem = abs(ans)

    if N > mem:
        pass
    else:
        judge = False


print(N)

Fixed submission:
N, K = map(int, input().split())
a = abs(N%K)
print(min(a, abs(a-K)))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = 0
judge = True

while judge == True:
    if K == 1:
        N = 0
        break

    ans = N - K
    N = abs(ans)

    ans = N - K
    mem = abs(ans)

    if N > mem:
        pass
    else:
        judge = False


print(N)

Fixed submission:
N, K = map(int, input().split())
a = abs(N%K)
print(min(a, abs(a-K)))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ans = 0
judge = True

while judge == True:
    ans = N - K
    ans = abs(ans)
    N = ans

    ans = N - K
    ans = abs(ans)
    mem = ans
    if N > mem:
        pass
    else:
        judge = False


print(N)



Fixed submission:
N, K = map(int, input().split())
a = abs(N%K)
print(min(a, abs(a-K)))
Buggy python submission (verdict: Runtime Error):
import numpy as np
ans = 0

N = int(input())
X = list(map(int, input().split()))

P = int(round(np.average(X)))

for i in range(N):
    ans += ((X[i] - P)**2)

print(ans)


Fixed submission:
import numpy as np
ans = 0

N = int(input())
X = list(map(int, input().split()))

P = int(round(np.average(X)))

for i in range(N):
    ans += ((X[i] - P)**2)

print(ans)

Buggy python submission (verdict: Runtime Error):
from statistics import mean
ans = 0

N = int(input())
X = list(map(int, input().split()))

P = round(mean(X))

for i in range(N):
    ans += ((X[i] - P)**2)

print(ans)

Fixed submission:
import numpy as np
ans = 0

N = int(input())
X = list(map(int, input().split()))

P = int(round(np.average(X)))

for i in range(N):
    ans += ((X[i] - P)**2)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = len(input())
cnt = "x"
length = 0
a = "x"
while S != length:
    cnt = cnt + a
    length = len(cnt)
print(cnt)

Fixed submission:
S = len(input())
cnt = ""
length = 0
a = "x"
for i in range(S):
    cnt = cnt + a
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
S = len(input())
cnt = "x"
length = 0
a = "x"
while S != length:
    cnt = cnt + a
    length = len(cnt)
print(cnt)


Fixed submission:
S = len(input())
cnt = ""
length = 0
a = "x"
for i in range(S):
    cnt = cnt + a
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
S = len(input())
cnt = "x"
length = 0
a = "x"
while S != length:
    cnt = cnt + a
    length = len(cnt)
print(cnt)


Fixed submission:
S = len(input())
cnt = ""
length = 0
a = "x"
for i in range(S):
    cnt = cnt + a
print(cnt)

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

cnt = "x"
length = 0
a = "x"

while S != length:
    cnt = cnt + a
    length = len(cnt)

print(cnt)


Fixed submission:
S = len(input())
cnt = ""
length = 0
a = "x"
for i in range(S):
    cnt = cnt + a
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))
ans = sum(H)
for n in range(1,min(N+1,K+1)):
    ans -= sorted(H)[-n]
print(ans)


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

cnt = 0
H.sort(reverse=True)

if K >= N:
    print(0)
else:
    print(sum(H[K:]))

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

ans = sum(H)

for n in range(1,min(N+1,K+1)):
    ans -= sorted(H)[-n]

print(ans)


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

cnt = 0
H.sort(reverse=True)

if K >= N:
    print(0)
else:
    print(sum(H[K:]))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split()))

ans = sum(H)

for n in range(1,min(N+1,K+1)):
    ans -= sorted(H)[-n]

print(ans)]


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

cnt = 0
H.sort(reverse=True)

if K >= N:
    print(0)
else:
    print(sum(H[K:]))
Buggy python submission (verdict: Runtime Error):
    A,P = map(int,input().split())
    ans = 0
     
    A = int(A)
    P = int(P)
     
    P = (A*3) + P
    ans = P // 2
     
    print(ans)
     

Fixed submission:
A,P = map(int,input().split())
ans = 0

A = int(A)
P = int(P)

P = (A*3) + P
ans = P // 2

print(ans)

Buggy python submission (verdict: Runtime Error):
    A,P = map(int,input().split())     
    A = int(A)
    P = int(P)
     
    P = (A*3) + P
    ans = P / 2
     
    ans = round(ans)
     
    print(ans)
     

Fixed submission:
A,P = map(int,input().split())
ans = 0

A = int(A)
P = int(P)

P = (A*3) + P
ans = P // 2

print(ans)

Buggy python submission (verdict: Runtime Error):
P = (A*3) + P
ans = P / 2

ans = round(ans)

print(ans)



Fixed submission:
A,P = map(int,input().split())
ans = 0

A = int(A)
P = int(P)

P = (A*3) + P
ans = P // 2

print(ans)

Buggy python submission (verdict: Runtime Error):
ans = 0


A = int(A)
P = int(P)
 
P = (A*3) + P
ans = P / 2

ans = round(ans)

print(ans)



Fixed submission:
A,P = map(int,input().split())
ans = 0

A = int(A)
P = int(P)

P = (A*3) + P
ans = P // 2

print(ans)

Buggy python submission (verdict: Runtime Error):
A = 0
P = 0
ans = 0

A = input("りんごの個数を入力してください。")
P = input("りんごの破片の個数を入力してください。")

A = int(A)
P = int(P)
 
P = (A*3) + P
ans = P / 2

ans = round(ans)

print(ans)



Fixed submission:
A,P = map(int,input().split())
ans = 0

A = int(A)
P = int(P)

P = (A*3) + P
ans = P // 2

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

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

A = np.array(A)
MOD = 10**9 + 7

res = 0
for i in range(N-1):
    res += np.sum(np.mod(A[i] * A[i+1:], MOD)) % MOD

print(res % MOD)

Fixed submission:
import numpy as np

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

A = np.array(A)
MOD = 10**9 + 7

ruisekiwa = np.zeros(N, dtype='int')
for i in range(1, N):
    ruisekiwa[i] = ruisekiwa[i-1] + A[i]

res = 0
for i in range(N-1):
    # res += np.sum(np.mod(A[i] * A[i+1:], MOD))
    res += (ruisekiwa[N-1] - ruisekiwa[i]) % MOD * A[i] % MOD
print(res % MOD)

# FIXME TLE

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

MOD = 10**9 + 7

res = 0
for i in range(N-1):
    for j in range(i+1, N):
        res += A[i] * A[j] % MOD

print(res % MOD)

Fixed submission:
import numpy as np

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

A = np.array(A)
MOD = 10**9 + 7

ruisekiwa = np.zeros(N, dtype='int')
for i in range(1, N):
    ruisekiwa[i] = ruisekiwa[i-1] + A[i]

res = 0
for i in range(N-1):
    # res += np.sum(np.mod(A[i] * A[i+1:], MOD))
    res += (ruisekiwa[N-1] - ruisekiwa[i]) % MOD * A[i] % MOD
print(res % MOD)

# FIXME TLE
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N = int(input())
A = tuple(map(int, input().split()))

for ai, aj in combinations(A, 2):
    if ai != aj:
        continue
    else:
        print('NO')
        break
else:
    print('YES')


Fixed submission:
import numpy as np

N = int(input())
A = tuple(map(int, input().split()))
A = np.array(A)
A = np.sort(A)

for i in range(N):
    if (i > 0 and A[i-1] == A[i]) or (i < N-1 and A[i] == A[i+1]):
        print('NO')
        break
else:
    print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
from math import floor
import numpy as np

H, N = map(int, input().split())
A, B = np.zeros(N, dtype='int'), np.zeros(N, dtype='int')
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b

dp = np.zeros(H, dtype='int')
# dp[h-1] は、体力hのモンスターを倒すのにかかる最小コスト
minimum_cost_magic = np.argmin(B)
minA, minB = A[minimum_cost_magic], B[minimum_cost_magic]
dp[:minA] = minB
for h in range(minA, H):
    # dp[h] を求める i.e. 体力h+1のモンスターを倒すのにかかる最小コスト
    mincost = 1e8
    for mj in range(N):
        dp_minusAmj = dp[h - A[mj]] if h - A[mj] >= 0 else 0
        if dp_minusAmj + B[mj] < mincost:
            mincost = dp_minusAmj + B[mj]
    dp[h] = mincost

print(dp[H-1])

Fixed submission:
import numpy as np

H, N = map(int, input().split())
A, B = np.zeros(N, dtype='int'), np.zeros(N, dtype='int')
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b

dp = np.zeros(H, dtype='int')
minimum_cost_magic = np.argmin(B)
minA, minB = A[minimum_cost_magic], B[minimum_cost_magic]
dp[:minA] = minB
for h in range(minA, H):
    mincost = 10*dp[h-1]
    dp_minusAmj = dp[h - A]
    dp_minusAmj[h - A < 0] = 0
    dp[h] = np.min(dp_minusAmj + B)

print(dp[H-1])