{"problem":{"name":"Banned K","description":{"content":"We have $N$ balls. The $i$\\-th ball has an integer $A_i$ written on it.   For each $k=1, 2, ..., N$, solve the following problem and print the answer. *   Find the number of ways to choose two distin","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc159_d"},"statements":[{"statement_type":"Markdown","content":"We have $N$ balls. The $i$\\-th ball has an integer $A_i$ written on it.  \nFor each $k=1, 2, ..., N$, solve the following problem and print the answer.\n\n*   Find the number of ways to choose two distinct balls (disregarding order) from the $N-1$ balls other than the $k$\\-th ball so that the integers written on them are equal.\n\n## Constraints\n\n*   $3 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq A_i \\leq N$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $...$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc159_d","tags":[],"sample_group":[["5\n1 1 2 1 2","2\n2\n3\n2\n3\n\nConsider the case $k=1$ for example. The numbers written on the remaining balls are $1,2,1,2$.  \nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.  \nThus, the answer for $k=1$ is $2$."],["4\n1 2 3 4","0\n0\n0\n0\n\nNo two balls have equal numbers written on them."],["5\n3 3 3 3 3","6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them."],["8\n1 2 1 4 2 1 4 1","5\n7\n5\n7\n7\n5\n7\n5"]],"created_at":"2026-03-03 11:01:14"}}