Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  t = input().split(" ")
  N, M = int(t[0]), int(t[1])
  x = [0]
  n = [1]*N
  for i in range(M):
    t = input().split(" ")
    fr, to = int(t[0])-1, int(t[1])-1
    if (fr in x) and (to not in x):
      x.append(to)
    n[fr] -= 1
    n[to] += 1
    if (fr in x) and n[fr] == 0:
        x.remove(fr)
  print(len(x))

main()


Fixed submission:
def main():
  t = input().split(" ")
  N, M = int(t[0]), int(t[1])
  x = set([0])
  n = [1]*N
  for i in range(M):
    t = input().split(" ")
    fr, to = int(t[0])-1, int(t[1])-1
    if fr in x:
      x.add(to)
    n[fr] -= 1
    n[to] += 1
    if (fr in x) and n[fr] == 0:
        x.remove(fr)
  print(len(x))

main()
Buggy python submission (verdict: Runtime Error):
S = str(input())
if(S[3]==S[4] and S[5]==S[6])
	print('Yes')
else
	print('No')
	

Fixed submission:
S = str(input())
print('Yes' if S[2]==S[3] and S[4]==S[5] else 'No')
Buggy python submission (verdict: Runtime Error):
num = int(input())
point = 0
while num >= 500:
    point+=1000
    num-=500
while num >=5:
    point+=5
    num-=5
print(re)

Fixed submission:
num = int(input())
re = 0
while num >= 500:
    re+=1000
    num-=500
while num >=5:
    re+=5
    num-=5
print(re)
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S ;
    int Q;
    string query1,query;
    cin>>S;
    cin>>Q;
    for(int i = 1; i <= Q;i++){
        getline(cin, query1);
        query = query1;
        if(query[0]=='1'){
            reverse(S.begin(), S.end()); 
        }else{
            if(query[2]=='1'){
                S = query[4] + S;
            }else
            {
                S = S + query[4];
            }
            
        }
    }
    cout<<S<<endl;
	return 0;
}

Fixed submission:
n, a, b = map(int, input().split())
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print(times*a + n)
Buggy python submission (verdict: Runtime Error):
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        int N = input.nextInt();
        int[] myArray = new int[N];
        for(int i=0;i<N;i++)
        {
            myArray[i] = input.nextInt();
        }
        for(int i : myArray)
        {
            if(i%3==0||i%5==0)
                System.out.println("APPROVED");
            else
                System.out.println("DENIED");
        }

    }
}

Fixed submission:
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")
Buggy python submission (verdict: Runtime Error):
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

Fixed submission:
from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
Buggy python submission (verdict: Runtime Error):
import math

A = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
print(math.ceil(H/A))

Fixed submission:
import math

H, A = [int(x) for x in input().split()]
print(math.ceil(H/A))

Buggy python submission (verdict: Runtime Error):
import math
A = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
print(math.ceil(H))

Fixed submission:
import math

H, A = [int(x) for x in input().split()]
print(math.ceil(H/A))
Buggy python submission (verdict: Runtime Error):
N = [int(x) for x in input().split()]
attacks = [int(x) for x in input().split()]
print("Yes" if H - sum(attacks) <= 0 else "No")

Fixed submission:
H, N = [int(x) for x in input().split()]
attacks = [int(x) for x in input().split()]
print("Yes" if H - sum(attacks) <= 0 else "No")
Buggy python submission (verdict: Runtime Error):
int N = input()
int S = input()
print(S.count("ABC"))

Fixed submission:
N = input()
S = input()
print(S.count("ABC"))

Buggy python submission (verdict: Runtime Error):
int N = input()
str S = input()

res = count("ABC")
print(res)


Fixed submission:
N = input()
S = input()
print(S.count("ABC"))
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    return b 
  if a == 0 
  else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))

Fixed submission:
def gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    return b if a == 0 else gcd(b%a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))

Fixed submission:
def gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))
Buggy python submission (verdict: Runtime Error):
num, 
bricks,
count, 
smash = int(input()), [int(x) for x in input().split(" ")], 1, 0
for x in bricks:
    if count == x: 
      count = 1
    else: 
      smash += 1
print(smash if smash != len(bricks) else 0 if len(bricks) == 1 else -1)

Fixed submission:
num, bricks, count, smash = int(input()), [int(x) for x in input().split(" ")], 1, 0
for x in bricks:
    if count == x: 
      count += 1
    else: 
      smash += 1
print(smash if smash != len(bricks) else 0 if len(bricks) == 1 else -1)
Buggy python submission (verdict: Runtime Error):
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")
Buggy python submission (verdict: Runtime Error):
import statistics
K,N = map(int,input().split())
A = [int(n) for n in input().split()]

a1 = max(A)-min(A)

for i in range(len(A)-1):
    max_v = 0
    index = None
    if (A[i+1]-A[i])>max_v:
        max_v = A[i+1]-A[i]
        index = i+1

a2 = A[index-1]+abs(K-A[index])
print(a1) if a1<a2 else print(a2)

Fixed submission:
a = input()
if a[2] == a[3] and a[4] == a[5]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a = input()
if a[2] == a[3] && a[4] == a[5]:
    print("Yes")
else:
    print("No")

Fixed submission:
a = input()
if a[2] == a[3] and a[4] == a[5]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a = input()
print(a[2])
if a[2] == a[3] && a[4] == a[5]:
    print("Yes")
else:
    print("No")

Fixed submission:
a = input()
if a[2] == a[3] and a[4] == a[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import statistics
K,N = map(int,input().split())
A = [int(n) for n in input().split()]

a1 = max(A)-min(A)

max_v = 0
for i in range(len(A)-1):
    A_i = None
    if (A[i+1]-A[i])>max_v:
        max_v = A[i+1]-A[i]
        A_i = i+1

a2 = A[A_i-1]+abs(K-A[A_i])
print(a2) if a1>a2 else print(a1)

Fixed submission:
import statistics
K,N = map(int,input().split())
A = [int(n) for n in input().split()]

a1 = max(A)-min(A)

max_v = 0
A_i = None
for i in range(len(A)-1):
    if (A[i+1]-A[i])>max_v:
        max_v = A[i+1]-A[i]
        A_i = i+1

a2 = A[A_i-1]+abs(K-A[A_i])
print(a2) if a1>a2 else print(a1)

Buggy python submission (verdict: Runtime Error):
import statistics
K,N = map(int,input().split())
A = [int(n) for n in input().split()]

a1 = max(A)-min(A)

for i in range(len(A)-1):
    max_v = 0
    index = None
    if (A[i+1]-A[i])>max_v:
        max_v = A[i+1]-A[i]
        index = i+1

a2 = A[index-1]+abs(K-A[index])
print(a2) if a1>a2 else print(a1)

Fixed submission:
import statistics
K,N = map(int,input().split())
A = [int(n) for n in input().split()]

a1 = max(A)-min(A)

max_v = 0
A_i = None
for i in range(len(A)-1):
    if (A[i+1]-A[i])>max_v:
        max_v = A[i+1]-A[i]
        A_i = i+1

a2 = A[A_i-1]+abs(K-A[A_i])
print(a2) if a1>a2 else print(a1)
Buggy python submission (verdict: Runtime Error):
A,B,X = list(map(int,input().split()))

for i in reversed(range(len(str(A)))):
    num = int("1"+"0"*i)-1
    for N in reversed(range(num)):
        if X > A*N+B*i:
            print(A*N+B*i)

Fixed submission:
a = ["SUN","MON","TUE","WED","THU","FRI","SAT"][::-1]
S = input()
print(a.index(S)+1)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ans = n//(a+b)*a
rem = n%(a+b)
if rem>=a:
    print(ans+a)
else 
    print(ans + rem)

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

ans = n//(a+b)*a
ans += min(a, n%(a+b))

print(ans)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ball= ("b"*a+"r"*b)*(n//(a+b)+1)
print(ball[0:n].count("b"))

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

ans = n//(a+b)*a
ans += min(a, n%(a+b))

print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(int(i) for i in input().split())

kitai = list(map(lambda x: (x+1)/2, p))

gokei = 0

for i in range(n-k+1):
    wa = sum(kitai[i:i+k])
    if gokei < wa:
        gokei = wa

print(gokei)

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

if s==u:
    a=a-1
else:
    b=b-1

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

flg = 0

for i in range(100000):
    if (i*a)%b = c:
        flg+=1
    break

if flg==0:
    print("NO")
else:
    print("YES")

Fixed submission:
a, b, c = input().split()
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

flg = 0

for i in range(100000000):
    if (i*a)%b = c:
        flg+=1
    break

if flg==0:
    print("NO")
else:
    print("YES")

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

flg = 0

for i in range(100000):
    if (i*a)%b == c:
        flg+=1
        break

if flg==0:
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
pow=1
for i in range(1,n+1):
    pow = pow*i
print(pow%(10**9+7))

Fixed submission:
n = int(input())
pow=1
for i in range(1,n+1):
    pow = (pow%(10**9+7)*i)%(10**9+7)
print(pow)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
x=0
ans=0
for i in range(n):
    if s[i]=="I":
        x += 1
    else:
        x -= 1
    ans = max(ans,x)
print(ans)

Fixed submission:
a, b, c, d = map(int, input().split())
if a*b==c*d:
    print(a*b)
else:
    print(max(a*b, c*d))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
x=0
max=0
for i in range(n):
    if s[i]=="I":
        x += 1
    else:
        x -= 1
    max = max(max,x)
print(max)

Fixed submission:
a, b, c, d = map(int, input().split())
if a*b==c*d:
    print(a*b)
else:
    print(max(a*b, c*d))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())

count=0

for i in range(a, b+1):
    if i%x==0:
        count +=1

print(count) 

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

if a%x==0:
    print(b//x-a//x+1)
else:
    print(b//x-a//x)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n, a = map(int, input().split())
x = [int(b) for b in input().split()]

count = 0

for i in range(1,n+1):

    for data in itertools.combinations(x, i):
        
        if sum(data)/i == a:

            count += 1

print(count)

Fixed submission:
n,a=map(int,input().split())
lists=list(map(int,input().split()))
 
for i in range(n):
    lists[i]-=a
answer=0
dp=[[0 for i in range(5001)] for _ in range(51)]
#dp[i][j]で0からi枚目まで好きなように選択してそのそうわがｊ-2500となるような撮り方の総数
#最終的に求めるのはdp[i][0]である
 
for i in range(n+1):
    for j in range(4951):
        if i>=1 and j>=lists[i-1]:
            dp[i][j]=dp[i-1][j-lists[i-1]]+dp[i-1][j]
        if i>=1 and j<lists[i-1]:
            dp[i][j]=dp[i-1][j]
        else:
            if j==2500 and i==0:
                dp[i][j]=1
            elif j!=2500 and i==0:
                dp[i][j]=0
print(dp[n][2500]-1)

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

n, a = map(int, input().split())
x = [int(b) for b in input().split()]

count = 0

for i in range(1,n+1):

    for data in itertools.combinations(x, i):
        
        if sum(data)/i == a:

            count += 1

print(count)

Fixed submission:
n,a=map(int,input().split())
lists=list(map(int,input().split()))
 
for i in range(n):
    lists[i]-=a
answer=0
dp=[[0 for i in range(5001)] for _ in range(51)]
#dp[i][j]で0からi枚目まで好きなように選択してそのそうわがｊ-2500となるような撮り方の総数
#最終的に求めるのはdp[i][0]である
 
for i in range(n+1):
    for j in range(4951):
        if i>=1 and j>=lists[i-1]:
            dp[i][j]=dp[i-1][j-lists[i-1]]+dp[i-1][j]
        if i>=1 and j<lists[i-1]:
            dp[i][j]=dp[i-1][j]
        else:
            if j==2500 and i==0:
                dp[i][j]=1
            elif j!=2500 and i==0:
                dp[i][j]=0
print(dp[n][2500]-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if N < 10:
    print(R+100*(10-N))
else:
    print(R)


Fixed submission:
N,R= map(int,input().split())
if N < 10:
    print(R+100*(10-N))
else:
    print(R)

Buggy python submission (verdict: Runtime Error):
N = int(input())
R = int(input())
if N < 10:
    print(1000-100*N)
else:
    print(R)

Fixed submission:
N,R= map(int,input().split())
if N < 10:
    print(R+100*(10-N))
else:
    print(R)
Buggy python submission (verdict: Runtime Error):
k, n = input().split()
a = input().split()
max = 0
for i in range(len(a)):
    if i==0:
        continue
    d = int(a[i])-int(a[i-1])
    if d>max:
        max=d
print(k-max)

Fixed submission:
k, n = input().split()
a = input().split()
max = 0
for i in range(0,len(a)):
    if i==0:
        max = int(k)-int(a[len(a)-1])+int(a[0])
    d = int(a[i])-int(a[i-1])
    if d>max:
        max=d
print(int(k)-max)

Buggy python submission (verdict: Runtime Error):
k, n = input().split()
a = input().split()
max = 0
for i in range(len(a)):
    if i==0:
        continue
    d = a[i]-a[i-1]
    if d>max:
        max=d
print(k-max)

Fixed submission:
k, n = input().split()
a = input().split()
max = 0
for i in range(0,len(a)):
    if i==0:
        max = int(k)-int(a[len(a)-1])+int(a[0])
    d = int(a[i])-int(a[i-1])
    if d>max:
        max=d
print(int(k)-max)

Buggy python submission (verdict: Runtime Error):
k, n = input().split()
a = input().split()
max = 0
for i in range(len(a)):
    d = a[i]-a[i-1]
    if d>max:
        max=d
print(k-max)

Fixed submission:
k, n = input().split()
a = input().split()
max = 0
for i in range(0,len(a)):
    if i==0:
        max = int(k)-int(a[len(a)-1])+int(a[0])
    d = int(a[i])-int(a[i-1])
    if d>max:
        max=d
print(int(k)-max)

Buggy python submission (verdict: Time Limit Exceeded):
K, N = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = []
for i in range(len(A)):
    ans.append(max(A) - min(A))
    A[i] += K

print(min(ans))


Fixed submission:
import sys
import random

def test(K, N, A):
    ans = []
    maxp = N-1
    minp = 0
    for i in range(len(A)):
        ans.append(A[maxp] - A[minp])
        A[i] += K
        maxp = (maxp + 1) % (N)
        minp = (minp + 1) % (N)
    print(min(ans))

if __name__ == "__main__":
    if "random" in sys.argv:
        K = int(random.random() * 20000)
        N = int(random.random() * 65536)
        A = sorted([int(random.random() * K) for _ in range(N)])
    else:
        K, N = [int(x) for x in input().split()]
        A = [int(x) for x in input().split()]
    test(K,N,A)
    pass
Buggy python submission (verdict: Runtime Error):
import math
import itertools


N, D = (int(i) for i in input().split())
X = [0]*N


for n in range(N):
    l = input().split()
    X[n]=[0]*D
    for d in range(D):
        X[n][d] = int(l[d])


count = 0
for y, z in itertools.combinations(X, 2):
    print(f"y={y}, z={z}")
    d = math.sqrt(sum(pow(y[i] - z[i], 2) for i in range(D)))
    if d.is_integer():
        count += 1

print(count)


Fixed submission:
import math
import itertools


N, D = (int(i) for i in input().split())
X = [0]*N


for n in range(N):
    l = input().split()
    X[n] = [0]*D
    for d in range(D):
        X[n][d] = int(l[d])


count = 0
for y, z in itertools.combinations(X, 2):
    d = math.sqrt(sum(pow(y[i] - z[i], 2) for i in range(D)))
    if d.is_integer():
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
a=list(input())
if(a[3]==a[4]) and (a[5]==a[6]):
  print('YES')
else:
  print('NO')


Fixed submission:
a=list(input())
if(a[2]==a[3]) and (a[4]==a[5]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False
if debug_mode:
    import os
    infile = open(os.path.basename(__file__).replace(".py", ".in"))

    def input():
        return infile.readline()


# ==============================================================


def main():
    a, b, c = list(map(int, input().strip().split()))
    s = sum(a, b, c)
    x = min(a, b, c)
    steps = 0
    while True:
        if s + steps * 2 == 3 * x:
            break
        elif s + steps * 2 < 3 * x:
            steps += 1
        elif s + steps * 2 > 3 * x:
            x += 1
    print(steps)


main()

# ==============================================================

if debug_mode:
    infile.close()


Fixed submission:
import sys
sys.setrecursionlimit(10**6)

debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False
if debug_mode:
    import os
    infile = open(os.path.basename(__file__).replace(".py", ".in"))

    def input():
        return infile.readline()


# ==============================================================


def main():
    a, b, c = list(map(int, input().strip().split()))
    s = sum((a, b, c))
    x = max(a, b, c)
    steps = 0
    while True:
        if s + steps * 2 == 3 * x:
            break
        elif s + steps * 2 < 3 * x:
            steps += 1
        elif s + steps * 2 > 3 * x:
            x += 1
    print(steps)


main()

# ==============================================================

if debug_mode:
    infile.close()
Buggy python submission (verdict: Runtime Error):
import sys

debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False
if debug_mode:
    import os
    inf = open(os.path.basename(__file__).replace(".py", ".in"))

    def input():
        return inf.readline()
else:
    inf = sys.stdin

# ==============================================================

def main():
    n, k = [int(x) for x in input().strip().split()]
    d = [x for x in input().strip().split()]

    while True:
        str_n = str(n)
        if any(i in str_n for i in d):
            n += 1
        else:
            break
    
    print(n)


main()

# ==============================================================

if debug_mode:
    inf.close()


Fixed submission:
import sys

debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False
if debug_mode:
    import os
    inf = open(os.path.basename(__file__).replace(".py", ".in"))

    def input():
        return inf.readline()
else:
    inf = sys.stdin

# ==============================================================

def solve():
    abc = input()
    if abc.count("7") == 1 and abc.count("5") == 2:
        print("YES")
    else:
        print("NO")


solve()

# ==============================================================

if debug_mode:
    inf.close()
Buggy python submission (verdict: Runtime Error):
import math


def nCr(n,r):
    result = math.factorial(n)//math.factorial(r)//math.factorial(n-r)
    return result

N,M = map(int,input().split())

total = nCr(N,2) + nCr(M,2)

print(total)




Fixed submission:
import math


def nCr(n,r):
    if n<r:
        return 0
    
    result = math.factorial(n)//math.factorial(r)//math.factorial(n-r)
    return result

N,M = map(int,input().split())

total = nCr(N,2) + nCr(M,2)

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
import math
 


def nC2(i):
    if i<=1:
        return 0
    return i*(i-1)//2

def compute(count):
    total = 0
    for i in count:
        total += nC2(i)
    return total


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

count = [0] * (N+1)

for value in data:
    count[value] += 1
    

for i in range(len(data)):
    count[data[i]] -= 1
    
    total = compute(count)
    print(total)
          
          
    count[data[i]] += 1


Fixed submission:
import math
 


def nC2(i):
    if i<=1:
        return 0
    return i*(i-1)//2

def compute(count):
    total = 0
    for i in count:
        total += nC2(i)
    return total


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

count = [0] * (N+1)

for value in data:
    count[value] += 1
    
    
total = compute(count)    

for value in data:
    remove = nC2(count[value])
    add = nC2(count[value]-1)

    print(total-remove+add)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import functools
 

@functools.lru_cache(maxsize=8128)
def nCr(n,r):
    if n<r:
        return 0
    
    result = math.factorial(n)//math.factorial(r)//math.factorial(n-r)
    return result

def compute(count):
    total = 0
    for i in count:
        total += nCr(i,2)
    return total


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

count = [0] * (N+1)

for value in data:
    count[value] += 1
    

for i in range(len(data)):
    count[data[i]] -= 1
    
    total = compute(count)
    print(total)
          
          
    count[data[i]] += 1


Fixed submission:
import math
 


def nC2(i):
    if i<=1:
        return 0
    return i*(i-1)//2

def compute(count):
    total = 0
    for i in count:
        total += nC2(i)
    return total


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

count = [0] * (N+1)

for value in data:
    count[value] += 1
    
    
total = compute(count)    

for value in data:
    remove = nC2(count[value])
    add = nC2(count[value]-1)

    print(total-remove+add)

Buggy python submission (verdict: Time Limit Exceeded):
import math
 
 
def nCr(n,r):
    if n<r:
        return 0
    
    result = math.factorial(n)//math.factorial(r)//math.factorial(n-r)
    return result

def compute(count):
    total = 0
    for i in count:
        total += nCr(i,2)
    return total


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

count = [0] * (N+1)

for value in data:
    count[value] += 1
    

for i in range(len(data)):
    count[data[i]] -= 1
    
    total = compute(count)
    print(total)
          
          
    count[data[i]] += 1


Fixed submission:
import math
 


def nC2(i):
    if i<=1:
        return 0
    return i*(i-1)//2

def compute(count):
    total = 0
    for i in count:
        total += nC2(i)
    return total


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

count = [0] * (N+1)

for value in data:
    count[value] += 1
    
    
total = compute(count)    

for value in data:
    remove = nC2(count[value])
    add = nC2(count[value]-1)

    print(total-remove+add)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(float,input().split())


if math.sqrt(A)+math.sqrt(B)<math.sqrt(C):
    print("YES")
else:
    print("NO")
    

Fixed submission:
import math

from decimal import Decimal

A,B,C = map(int,input().split())

a = Decimal(A).sqrt()
b = Decimal(B).sqrt()
c = Decimal(C).sqrt()


#if math.sqrt(A)+math.sqrt(B)<math.sqrt(C):
if a+b<c:
    print("Yes")
else:
    print("No")