Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input().rstrip)
count = 0
for i in N:
  if i == 7:
    count += 1
if count > 0:
  print("Yes")
else:
  print("No")

Fixed submission:
N = input()
word = "7"
if word in N:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math

k = int(input())
ans = 0

for i in range(1, k + 1):
    for j in range(1, k + 1):
        for m in range(1, k + 1):
            ans += math.gcd(math.gcd(i, j), m)
print(ans)

Fixed submission:
import math
 
K = int(input())
 
lists = []
for i in range(1, K + 1):
    for j in range(1, K + 1):
        mid = math.gcd(i, j)
        for k in range(1, K + 1):
            lists.append(math.gcd(mid, k))
 
print(sum(lists))

Buggy python submission (verdict: Time Limit Exceeded):
import math
k = int(input())
ans = 0
 
for i in range(1,k+1):
    for j in range(1,k+1):
        for m in range(1,k+1):
           
            ans +=math.gcd(math.gcd(i,j),m)
 
print(ans)

Fixed submission:
import math
 
K = int(input())
 
lists = []
for i in range(1, K + 1):
    for j in range(1, K + 1):
        mid = math.gcd(i, j)
        for k in range(1, K + 1):
            lists.append(math.gcd(mid, k))
 
print(sum(lists))
Buggy python submission (verdict: Runtime Error):
a, b, c = int(input().split())
if a >= 1 and a <= 100:
    if b >= 1 and b <= 100:
        if c >= 1 and c <= 100:
            a, b = b, a
            a, c = c, a
print(a, b, c)

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

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
if a >= 1 and a <= 100:
    if b >= 1 and b <= 100:
        if c >= 1 and c <= 100:
            a, b = b, a
            a, c = c, a
print(a, b, c)

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

Buggy python submission (verdict: Runtime Error):
int a, b, c
a, b, c = c, a, b
print(a, b, c)


Fixed submission:
a, b, c = map(int, input().split())
print(c, a, b)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
acc = n+m
arr = list(map(int, input().split()))
sums = 0
count = 0
for i in arr:
    sums = sums + i
check = (1 / (4*m))*sums
for i in arr:
    if i < check:
        count += 1
    else:
        if i == sums
            count = 0
            break
        continue
if count >= 1:
    print("No")
else:
    print("Yes")

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

check = ((1 / (4 * M)) * sum(A))
x = 0
for item in A:
    if item < check:
        x += 1

ans = N - x

if ans >= M :
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
def s():return int(input())
def mp():return map(int,input().split())
# a =s()
# b =s()
# ans = ""
# for i in range(len(b)):
# 	ans+=b[i]
# 	if ans in a:
# 		pass
# 	else:
# 		print(len(b)-i)
# 		break

a = s()
b = list(mp())
ans=0
for i in range(a):
	for j in range(i+1,a):
		ans+=b[i]*b[j]
		ans%=((10**9)+7)
print(ans)

Fixed submission:
def s():return int(input())
def mp():return map(int,input().split())
a = s()
b = list(mp())
ans=0
t = sum(b)%(10**9+7)
for i in range(a):
	t-=b[i]
	ans+=b[i]*t
	ans%=(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if a<b and v<=w:print("NO")
else:
	z = (b-a)/(v-w)
	if z==int(z) and z<=t:print("YES")
	else:print("NO")

Fixed submission:
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
# if (v-w)*t>=(b-a):print("YES")
# else:print("NO")
q = abs(a-b)
e = (v-w)*t
if q<=e:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
s = set()
for _ in range(int(input()):
               a = input()
               s.add(a)
print(len(s)) 

Fixed submission:
s = set()
for _ in range(int(input())):
				a = input()
				s.add(a)
print(len(s))

Buggy python submission (verdict: Runtime Error):
s = set()
for _ in range(int(input()):
               a = input()
               s.add(a)
print(len(a))               

Fixed submission:
s = set()
for _ in range(int(input())):
				a = input()
				s.add(a)
print(len(s))
Buggy python submission (verdict: Runtime Error):
S = input()

if S == "RRR":
    print(3)
elif S[0,1] == "R" or S[1,2] == "R":
    print(2)
elif S[0,1] == "S" or S[1,2] == "S":
    print(1)
else:
    print(0)


Fixed submission:
S = input()

if S == "RRR":
    print(3)
elif S == "SSS":
    print(0)
elif S[0:2] == "RR" or S[1:3] == "RR":
    print(2)
else:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())

X = abs(X) 
cnt = 0

if X == 0:
    if K%2==0:
        ans = 0
    elif K%2==1:
        ans = D
elif X >= K*D:
    ans = X-K*D
else:
    while K > cnt:
        X = X - D
        cnt += 1
        if X<=0:
            if (K-cnt)%2 == 0:
                ans = abs(X)
                break
            elif (K-cnt)%2 == 1:
                ans = abs(X+D)
                break
        ans = X

print(abs(ans))


Fixed submission:
X,K,D = map(int,input().split())

X = abs(X) 

if X >= K*D:
    ans = X-K*D
else:
    x = X//D 
    if (K - x)%2 == 0:
        ans = X - x*D
    else:
        ans = abs(X - x*D -D)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())

X = abs(X) 
cnt = 0

if X == 0:
    if K%2==0:
        ans = 0
    elif K%2==1:
        ans = D
else:
    while K > cnt:
        X = X - D
        cnt += 1
        if X<=0:
            if (K-cnt)%2 == 0:
                ans = abs(X)
                break
            elif (K-cnt)%2 == 1:
                ans = abs(X+D)
                break
        ans = X
               
print(abs(ans))

Fixed submission:
X,K,D = map(int,input().split())

X = abs(X) 

if X >= K*D:
    ans = X-K*D
else:
    x = X//D 
    if (K - x)%2 == 0:
        ans = X - x*D
    else:
        ans = abs(X - x*D -D)

print(ans)
Buggy python submission (verdict: Runtime Error):
x = input()

if x >= 30:
    print("Yes")
else:
    print("No")

Fixed submission:
x = int(input())

if x >= 30:
    print("Yes")
else:
    print("No")

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

if x >= 30:
    print("Yes")
else:
    print("No")

Fixed submission:
x = int(input())

if x >= 30:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

num = ""
cnt = 0
ans = False

while range(10000000):
    num = int(num + "7")
    cnt += 1
    if num % K == 0:
        ans = True 
        print(cnt)
        break
    else:
        num = str(num)
    
if ans == False :
    print(-1)

Fixed submission:
K = int(input())

cnt = 0
a = 0
ans = False

for i in range(K):
    a = 10 * a +7
    cnt += 1
    if a % K == 0 :
        print(cnt)
        ans = True
        break
    else:
        a = a % K

if ans == False:
    print(-1)
Buggy python submission (verdict: Runtime Error):
A = input()

B = A.Upper()

if A == B:
    print("A")
else:
    print("a")

Fixed submission:
A = str(input())

if A == A.upper():
    print("A")
else:
    print("a")
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal

X = int(input())

money = 100
cnt = 0

while money < X:
    money = Decimal(money*1.01)
    cnt += 1
print(cnt)

Fixed submission:
X = int(input())

money = 100
cnt = 0

while money < X:
    money += money//100
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
S = input()

if S[2]==S[3]andS[4]==S[5]:
    print("Yes")
else:
    print("No")
    

Fixed submission:
S = input()

if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
drink = []
cost = 0
count = 0
d_count = 0
rest = 0


for _ in range(N):
    Drink = list(map(int, input().split()))
    drink.append(Drink)
    drink.sort()

for i in range(N):
    cost += drink[i][0] * drink[i][1]
    d_count += drink[i][1]
    count += 1
    if d_count > M:
      break
      
cost -= drink[count-1][0] * drink[count-1][1]
d_count -= drink[count-1][1]
rest = M - d_count
cost += rest * drink[count-1][0]
print(cost)
    


Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())

h2 = H - h
w2 = W - w

print(h2*w2)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
list = []

for i in range(1, 101):
  if a%i == 0 and b %i == 0:
    list.append(i)
    list.sort(reverse=True)
    
print(list[k-1])

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

num = b // a

if num <= c:
  print(num)
else:
  print(c)

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

num1 = 11 // 2

if num <= c:
  print(num)
else:
  print(c)

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

num = b // a

if num <= c:
  print(num)
else:
  print(c)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = []
sum = 0
  
for i in range(0, k+1):
  for j in a:
    sum += i ^ j
  l.append(sum)
  sum = 0


print(max(l))

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

print(t/x)

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

l = []
sum = 0
  
for i in range(0, k+1):
  for j in a:
    sum += i ^ j
  l.append(sum)
  sum = 0


print(max(l))

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

print(t/x)
Buggy python submission (verdict: Runtime Error):
num = input()
li = []

for i in range(len(num) - 2):
  li.append(abs(int(num[i]) * 100 + int(num[i+1]) * 10 + int(num[i+2]) - 753))

print(min(li))


Fixed submission:
num = int(input())

if num == 3or num == 5 or num == 7:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input()) 
row = input().split()
max = row[0]
min = row[0]


for i in range(n-1):
        if(max < row[i]):
            max = row[i]

for i in range(n-1):
        if(min > row[i]):
            min = row[i]


print (int(max)-int(min))
    





Fixed submission:
n = int(input())

if (n%2 == 0):
    print(n)
else:
    print(2*n)

Buggy python submission (verdict: Runtime Error):
n = int(input()) 
row = input().split()
max = row[0]
min = row[0]

for j in range(n-1):
    for i in range(n-1):
        if(row[j] < row[i+1]):
            max = row[i+1]


    for i in range(n-1):
        if(min > row[n-1]):
            min = row[n-1]


print (int(max)-int(min))
    



Fixed submission:
n = int(input())

if (n%2 == 0):
    print(n)
else:
    print(2*n)

Buggy python submission (verdict: Runtime Error):
n = int(input()) 
row = input().split()
max = row[0]
min = row[0]


    for i in range(n-1):
        if(max < row[n-1]):
            max = row[n-1]


    for i in range(n-1):
        if(min > row[n-1]):
            min = row[n-1]


print (min)
    




Fixed submission:
n = int(input())

if (n%2 == 0):
    print(n)
else:
    print(2*n)

Buggy python submission (verdict: Runtime Error):
n = int(input()) 
row = input().split()
max = row[0]
min = row[0]

for i  in range(n-1):
    if(row[i] < row[i+1]):
        max = row[i+1]

for i in range(n-1):
    if(row[i] > row[i+1]):
        min = row[i+1]


print(int(max)-int(min))
    


Fixed submission:
n = int(input())

if (n%2 == 0):
    print(n)
else:
    print(2*n)

Buggy python submission (verdict: Runtime Error):
n = int(input()) 
row = map(int, input().split())
max = row[0]
min = 0

for i in range(n-1):
    if(row[i] < row[i+1]):
        max = row[i+1]

for i in range(n-1):
    if(row[i] > row[i+1]):
        min = row[i+1]

print(max-min)
    




Fixed submission:
n = int(input())

if (n%2 == 0):
    print(n)
else:
    print(2*n)

Buggy python submission (verdict: Runtime Error):
if N%2==0:
    print(2)
else:
    print(2*N)

Fixed submission:
n = int(input())

if (n%2 == 0):
    print(n)
else:
    print(2*n)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))
def calc_mod(n):
    return n %(10**9+7)
AA=list(map(calc_mod, A))
X=0
for i in range(N-1):
  X+=AA[i]*sum(AA[i+1:N])
  X=X%(10**9+7)
print(X)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
def calc_mod(n):
    return n %(10**9+7)
AA=list(map(calc_mod, A))
X=0
XX=0
for i in range(N-1):
  XX+=AA[N-i-1]
  X+=AA[N-i-2]*XX
  X=X%(10**9+7)
print(X)

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

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
def calc_mod(n):
    return n %(10**9+7)
AA=list(map(calc_mod, A))
X=0
XX=0
for i in range(N-1):
  XX+=AA[N-i-1]
  X+=AA[N-i-2]*XX
  X=X%(10**9+7)
print(X)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))
X=0
for i in range(N-1):
  for ii in range(N-i-1):
    X+=A[i]*A[i+ii+1]
    X=X%(10**9+7)
print(X)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
def calc_mod(n):
    return n %(10**9+7)
AA=list(map(calc_mod, A))
X=0
XX=0
for i in range(N-1):
  XX+=AA[N-i-1]
  X+=AA[N-i-2]*XX
  X=X%(10**9+7)
print(X)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))
X=0
for i in range(N-1):
  for ii in range(N-i-1):
    X+=A[i]*A[i+ii+1]
    X=X%(10**9+7)
print(X)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
def calc_mod(n):
    return n %(10**9+7)
AA=list(map(calc_mod, A))
X=0
XX=0
for i in range(N-1):
  XX+=AA[N-i-1]
  X+=AA[N-i-2]*XX
  X=X%(10**9+7)
print(X)
Buggy python submission (verdict: Runtime Error):
N = int(input())
C=list(input())
L=0
R=0
X=0
for i in range(N):
  L=i
  if L==N-1-R:
    break
  if C[i]=='W':
    for ii in range(N-L-R):
      R+=ii 
      if C[N-1-R]=='R':
        C[L]='R'
        C[N-1-R]='W'
        X+=1
        R+=1
        if L==N-1-R:
          break
        break
print(X)


Fixed submission:
X=int(input())
if X>=30:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=1
for i in range(K,N):
  for j in range(K):
    B=B*A[0+i-K+j]
  if B*A[i]/A[i-K]>B:
    print ('Yes')
  else:
    print ('No')

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
for i in range(K,N):
  if A[i]/A[i-K]>1:
    print ('Yes')
  else:
    print ('No')

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=1
for i in range(K,N):
  for j in range(K):
    B=B*A[0+i-K+j]
  if B*A[i]/A[i-K]>B:
    print ('Yes')
  else:
    print ('No')

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
for i in range(K,N):
  if A[i]/A[i-K]>1:
    print ('Yes')
  else:
    print ('No')
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=a%1000
if b==0 : c=0
else :c=1000-b n
print(str(c))

Fixed submission:
a=int(input())
b=a%1000
if b==0 : c=0
else :c=1000-b
print(str(c))
Buggy python submission (verdict: Runtime Error):
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "g\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "A='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n",
    "a='abcdefghijklmnopqrstuvwxyz'\n",
    "\n",
    "n=input()\n",
    "\n",
    "if n in A:\n",
    "    print(\"A\")\n",
    "\n",
    "if n in a:\n",
    "    print(\"a\")\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}


Fixed submission:
A='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
a='abcdefghijklmnopqrstuvwxyz'

n=input()

if n in A:
    print("A")

if n in a:
    print("a")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))

if 0 in a:
    print(0)
else:
    m=1
    for i in a:
        m*=a[i]
        if m> 10**18:
            print(-1)
            break
        else:
            print(m)
        




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

if 0 in a:
    print(0)
else:
    m=1
    for i in a:
        m*=i
        if 10**18 < m:
            print(-1)
            break
    else:
        print(m)

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

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

if m > 10**18:
    print("-1")
else:
    print(m)



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

if 0 in a:
    print(0)
else:
    m=1
    for i in a:
        m*=i
        if 10**18 < m:
            print(-1)
            break
    else:
        print(m)

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

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

if m > 10**18:
    print("-1")
else:
    print(m)



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

if 0 in a:
    print(0)
else:
    m=1
    for i in a:
        m*=i
        if 10**18 < m:
            print(-1)
            break
    else:
        print(m)
Buggy python submission (verdict: Runtime Error):
a=input().split()

fa=int(a[0])
fb=int(a[1]*100)

print(fa*fb//100)


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

fa=int(a[0])
fb=int(a[1].replace(".", ""))

print(fa*fb//100)

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

fa=int(a[0])
fb=int(a[1]*100)

print((fa*fb//100)

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

fa=int(a[0])
fb=int(a[1].replace(".", ""))

print(fa*fb//100)
Buggy python submission (verdict: Time Limit Exceeded):
m = 1000000007
n = int(input())
A = list(map(int, input().split()))
sum = 0
for i in range(n-1):
  for j in range(n-i-1):
    sum += A[i]*A[j+i+1]
print(sum%m)

Fixed submission:
def square(list):
    return [i ** 2 for i in list]
m = 1000000007
n = int(input())
A = list(map(int, input().split()))
sq = square(A)
s1 = sum(A)
s2 = sum(sq)
 
result = (s1**2-s2)//2
print(result%m)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = ''
while N > 0:
N -= 1
ans += chr(ord('a') + N % 26)
N //= 26
print(ans[::-1])

Fixed submission:
N = int(input())
ans = ''
for i in range(1, 99):
	if N <= 26 ** i:
		N -= 1
		for j in range(i):
			ans += chr(ord('a') + N % 26)
			N //= 26
		break
	else:
		N -= 26 ** i
print(ans[::-1]) # reversed
Buggy python submission (verdict: Runtime Error):
from math import factorial
N = int(input())
P = {}
ans = 0
def counter(s):
    ret = [0]*26
    for ss in s:
        ret[ord(ss)-ord('a')] += 1
    return tuple(ret)
for _ in range(N):
    s = input()
    c = counter(s)
    if not c in P.keys():
        P[c] = 1
    else:
        P[c] += 1
for v in P.values():
    ans += factorial(v) // factorial(2) // factorial(v-2)
print(ans)


Fixed submission:
from math import factorial
N = int(input())
P = {}
ans = 0
def counter(s):
    ret = [0]*26
    for ss in s:
        ret[ord(ss)-ord('a')] += 1
    return tuple(ret)
for _ in range(N):
    s = input()
    c = counter(s)
    if not c in P.keys():
        P[c] = 1
    else:
        P[c] += 1
for v in P.values():
    if v > 1:
        ans += factorial(v) // factorial(2) // factorial(v-2)
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import factorial
N = int(input())
P = {}
ans = 0
def counter(s):
    ret = [0]*26
    for ss in s:
        ret[ord(ss)-ord('a')] += 1
    return tuple(ret)
for _ in range(N):
    s = input()
    c = counter(s)
    if not c in P.keys():
        P[c] = 1
    else:
        P[c] += 1
for v in P.values():
    ans += factorial(v) / factorial(2) / factorial(v-2)
print(int(ans))


Fixed submission:
from math import factorial
N = int(input())
P = {}
ans = 0
def counter(s):
    ret = [0]*26
    for ss in s:
        ret[ord(ss)-ord('a')] += 1
    return tuple(ret)
for _ in range(N):
    s = input()
    c = counter(s)
    if not c in P.keys():
        P[c] = 1
    else:
        P[c] += 1
for v in P.values():
    if v > 1:
        ans += factorial(v) // factorial(2) // factorial(v-2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
P = []
ans = 0
for _ in range(N):
    s = input()
    c = Counter(s)
    for p in P:
        if p == c:
            ans += 1
    P.append(c)
print(ans)



Fixed submission:
from math import factorial
N = int(input())
P = {}
ans = 0
def counter(s):
    ret = [0]*26
    for ss in s:
        ret[ord(ss)-ord('a')] += 1
    return tuple(ret)
for _ in range(N):
    s = input()
    c = counter(s)
    if not c in P.keys():
        P[c] = 1
    else:
        P[c] += 1
for v in P.values():
    if v > 1:
        ans += factorial(v) // factorial(2) // factorial(v-2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import deque
N, M = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
C = zip(A,B)
C = sorted(C)
A, B = zip(*C)
A = deque(A)
B = deque(B)
Q = np.array([])
ans = 0
for m in range(1, M+1):
    while len(A)>0:
        a = A.popleft()
        b = B.popleft()
        if a <= m:
            Q = np.append(Q, b)
        else:
            A.appendleft(a)
            B.appendleft(b)
            break
    if Q.size:
        ans += np.max(Q)
        Q = np.delete(Q, np.argmax(Q))
print(int(ans))



Fixed submission:
from collections import defaultdict
from heapq import heappush, heappop

N, M = list(map(int, input().split()))
jobs = defaultdict(list)
heap = []
ans = 0
for _ in range(N):
    a, b = list(map(int, input().split()))
    if a <= M:
        jobs[a].append(b)

for m in range(1, M+1):
    for b in jobs[m]:
        heappush(heap, -b)
    if heap:
        maxb = -heappop(heap)
        ans += maxb
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
s = sum(A)
flag = False
def make_divisors(n):
    divisors = []
    for i in range(int(n**0.5), 0, -1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    return sorted(divisors, reverse=True)
divs = make_divisors(s)
for x in divs:
    if flag:
        break
    sortedA = sorted([a%x for a in A])
    sumA = sum(sortedA)
    index_len = len(sortedA)
    sump = 0
    for i, a in enumerate(sortedA):
        sump += a
        summ = x*(index_len - (i+1)) - (sumA - sump)
        if sump == summ and sump <= K:
            print(x)
            flag = True
            break



Fixed submission:
A, B, C = list(map(int, input().split()))
tmp = C-(A-B)
print(max(0, tmp))