buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k |
|---|---|---|---|---|
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i ... | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i ... | [["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 25]] | 1 | 425 |
import collections
def C(n):
return n * (n-1) // 2
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
d = {}
sm = 0
for k,v in c.most_common():
d[k] = v
sm += C(v)
for a in A:
print (sm - 1 + d[a]) | import collections
def C(n):
return n * (n-1) // 2
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
d = {}
sm = 0
for k,v in c.most_common():
d[k] = v
sm += C(v)
for a in A:
print (sm - d[a] + 1) | [["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 97 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll nC2(ll x) {
if (x <= 1)
return 0;
return x * (x - 1) / 2;
}
int main() {
ll n;
cin >> n;
int a[n];
map<ll, ll> b;
for (ll i = 0; i < n; i++) {
cin >> a[i];
b[a[i]]++;
}
ll sum = 0;
for (auto x : b) {
sum += nC2... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll nC2(ll x) {
if (x <= 1)
return 0;
return x * (x - 1) / 2;
}
int main() {
ll n;
cin >> n;
int a[n];
map<ll, ll> b;
for (ll i = 0; i < n; i++) {
cin >> a[i];
b[a[i]]++;
}
ll sum = 0;
for (auto x : b) {
sum += nC2... | [["-", 31, 16, 12, 16, 31, 16, 12, 2, 63, 22], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72]] | 1 | 160 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int i = (s); (i) < (int)(e); ++(i))
#define REP(i, e) FOR(i, 0, e)
#define each(it, c) \
for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define all(o) (o).begin(), (... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int i = (s); (i) < (int)(e); ++(i))
#define REP(i, e) FOR(i, 0, e)
#define each(it, c) \
for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define all(o) (o).begin(), (... | [["-", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13]] | 1 | 233 |
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import Counter
from bisect import bisect_left
def f(i, d, dsum, n):
return func(i, d) + dsum[i] + dsum[n] - dsum[i+1]
def func(i, w):
return w[i][1] * max(0, w[i][1]-1) // 2
def... | import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import Counter
from bisect import bisect_left
def f(i, d, dsum, n):
return func(i, d) + dsum[i] + dsum[n] - dsum[i+1]
def func(i, w):
return w[i][1] * max(0, w[i][1]-1) // 2
def... | [["+", 0, 1, 0, 662, 12, 658, 8, 206, 0, 70], ["+", 0, 1, 0, 662, 12, 658, 8, 206, 206, 612], ["+", 0, 1, 0, 662, 12, 658, 8, 206, 0, 73], ["-", 0, 662, 12, 658, 0, 659, 12, 206, 0, 70], ["-", 0, 662, 12, 658, 0, 659, 12, 206, 206, 612], ["-", 0, 662, 12, 658, 0, 659, 12, 206, 0, 73]] | 5 | 295 |
def CountFrequency_mod(my_list):
# Creating an empty dictionary
freq = {}
for item in my_list:
if (item in freq):
freq[item] += 1
else:
freq[item] = 1
freq_mod = freq
freq_val = list(freq.values())
all_sum=0
for i in freq_val:
... | def CountFrequency_mod(my_list):
# Creating an empty dictionary
freq = {}
for item in my_list:
if (item in freq):
freq[item] += 1
else:
freq[item] = 1
freq_mod = freq
freq_val = list(freq.values())
all_sum=0
for i in freq_val:
... | [["+", 8, 196, 0, 1, 0, 662, 31, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 206, 0, 73], ["+", 0, 652, 3, 4, 0, 206, 206, 652, 63, 22], ["+", 3, 4, 0, 206, 206, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 206, 206, 652, 3, 4, 0, 25]] | 5 | 162 |
import heapdict
n = int(input())
la = list(map(int, input().split()))
ct = [0] * (2*10**5+1)
ans = [0] * (n+1)
ld = [0] * (n+1)
for i in range(len(la)):
ct[la[i]] += 1
sa = set(la)
for j in sa:
ans[j] = ct[j] * (ct[j]-1) // 2
ld[j] = ans[j] - ((ct[j]-2) * (ct[j]-1) // 2)
total = sum(ans)
# print(ct[0... | n = int(input())
la = list(map(int, input().split()))
ct = [0] * (2*10**5+1)
ans = [0] * (n+1)
ld = [0] * (n+1)
for i in range(len(la)):
ct[la[i]] += 1
sa = set(la)
for j in sa:
ans[j] = ct[j] * (ct[j]-1) // 2
ld[j] = ans[j] - ((ct[j]-2) * (ct[j]-1) // 2)
total = sum(ans)
# print(ct[0:10])
# print(ans... | [["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]] | 5 | 177 |
N = int(input())
A = list(map(int, input().split()))
m = [0] * N
for i in range(N):
m[A[i]] += 1
ans = 0
for i in range(len(m)):
ans += (m[i] * (m[i] - 1) // 2)
for i in range(N):
print(ans - m[A[i]] + 1)
| N = int(input())
A = list(map(int, input().split()))
m = [0] * (N + 1)
for i in range(N):
m[A[i]] += 1
ans = 0
for i in range(len(m)):
ans += (m[i] * (m[i] - 1) // 2)
for i in range(N):
print(ans - m[A[i]] + 1)
| [["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]] | 5 | 104 |
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
nsum=0
for i in range(n):
b[a[i]]+=1
for k in range(n):
nsum+=max(b[k]*(b[k]-1)//2,0)
for j in range(n):
print((nsum+1-b[a[j]]))
| n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
nsum=0
for i in range(n):
b[a[i]]+=1
for k in range(n+1):
nsum+=max(b[k]*(b[k]-1)//2,0)
for j in range(n):
print((nsum+1-b[a[j]]))
| [["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 106 |
n = int(input())
a = list(map(int, input().split()))
import collections
c = collections.Counter(a)
values, counts = zip(*c.most_common())
if counts[-1] == 1:
k = counts.index(1)
del counts[k:]
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over =... | n = int(input())
a = list(map(int, input().split()))
import collections
c = collections.Counter(a)
values, counts = zip(*c.most_common())
counts = list(counts)
if counts[-1] == 1:
k = counts.index(1)
del counts[k:]
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == ... | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 194 |
n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*n
for i in a:
al[i]+=1
for j in aset:
k=al[j]
ans+=(k*(k-1))//2
for u in a:
print(ans-al[u]+1) | n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
al[i]+=1
for j in aset:
k=al[j]
ans+=(k*(k-1))//2
for u in a:
print(ans-al[u]+1) | [["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 95 |
def xc2(x)
return 0 if x <= 1
return x*(x-1)/2
end
n=gets.chomp.to_i
x=Array.new(n,0)
a=gets.chomp.split(" ").map{|i|i.to_i}
a.each{|i|x[i] += 1}
y=x.map{|i|xc2(i)}
sum=0
y.map{|i|sum += i}
0.upto(n-1) do |k|
puts sum - (1*y[a[k]] - xc2(x[a[k]]-1))
end
| def xc2(x)
return 0 if x <= 1
return x*(x-1)/2
end
n=gets.chomp.to_i
x=Array.new(n+1,0)
a=gets.chomp.split(" ").map{|i|i.to_i}
a.each{|i|x[i] += 1}
y=x.map{|i|xc2(i)}
sum=0
y.map{|i|sum += i}
0.upto(n-1) do |k|
puts sum - (1*y[a[k]] - xc2(x[a[k]]-1))
end | [["+", 0, 662, 12, 652, 3, 4, 0, 738, 17, 72], ["+", 0, 662, 12, 652, 3, 4, 0, 738, 12, 612]] | 4 | 143 |
from collections import Collection
import math
N = int(input())
A = list(map(int, input().split()))
c = Collection(A)
all_ans = 0
for n in c.values():
if n <= 1:
continue
all_ans += math.factorial(n)//(math.factorial(n-2)*math.factorial(2))
for n in A:
print(all_ans - (c[n]-1)) | from collections import Counter
import math
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
all_ans = 0
for n in c.values():
if n <= 1:
continue
all_ans += math.factorial(n)//(math.factorial(n-2)*math.factorial(2))
for n in A:
print(all_ans - (c[n]-1)) | [["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]] | 5 | 99 |
import collections
n = int(input())
a_list = list(map(int,input().split()))
c=collections.Counter(a_list)
result=0
print(c)
for i in c.values():
result+=i * (i - 1)//2
for a in a_list:
print(result - c[a] + 1) | import collections
n = int(input())
a_list = list(map(int,input().split()))
c=collections.Counter(a_list)
result=0
for i in c.values():
result+=i * (i - 1)//2
for a in a_list:
print(result - c[a] + 1) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 78 |
N = int(input())
A = [int(a)-1 for a in input().split()]
X = [0] * N
for a in A:
X[a] += 1
s = 0
for x in X:
s += x * (x-1) // 2
print(s)
for a in A:
print(s - (X[a] - 1))
| N = int(input())
A = [int(a)-1 for a in input().split()]
X = [0] * N
for a in A:
X[a] += 1
s = 0
for x in X:
s += x * (x-1) // 2
for a in A:
print(s - (X[a] - 1))
| [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 87 |
#D ACして欲しい
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)#出現回数を辞書で取り出す
val=0
for i in c.values():#辞書に含まれる値をすべて取り出す
print(i) #1,2,3・・・の回数
val += i * (i - 1) // 2 #整数が同じボールを選ぶ組み合わせ
# val+=sum(range(i-1))
for i in range(n):
b = c[a[i]] #i番目の出現回数
p... | #D AC
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)#出現回数を辞書で取り出す
val=0
for i in c.values():#辞書に含まれる値をすべて取り出す
# print(i) #1,2,3・・・の回数
val += i * (i - 1) // 2 #整数が同じボールを選ぶ組み合わせ
# val+=sum(range(i-1))
for i in range(n):
b = c[a[i]] #i番目の出現回数
prin... | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 95 |
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int64_t solve(int64_t n) {
if (n == 0 || n == 1) {
return 0;
}
return n * (n - 1) / 2;
}
int main(void) {
int N;
cin >> N;
vector<int> A;
map<int, int> Am;
for (int i... | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int64_t solve(int64_t n) {
if (n == 0 || n == 1) {
return 0;
}
return n * (n - 1) / 2;
}
int main(void) {
int N;
cin >> N;
vector<int> A;
map<int, int> Am;
for (int i... | [["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 51, 69, 341, 342, 0, 69, 341, 342, 0, 73]] | 1 | 199 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
const int _max = 2e5 + 50;
long long num[_max];
using namespace std;
using LL = long long;
int main() {
LL n;
map<LL, LL> mp;
cin >> n;
for (LL i = 0; i < n; i++) {
cin >> num[i];
mp[num[i]] = 0... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
const int _max = 2e5 + 50;
long long num[_max];
using namespace std;
using LL = long long;
int main() {
LL n;
map<LL, LL> mp;
cin >> n;
for (LL i = 0; i < n; i++) {
cin >> num[i];
mp[num[i]] = 0... | [["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]] | 1 | 343 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll b[200000];
ll compute(ll n) { return (n * (n - 1)) / 2; }
int main() {
ll i, j, n, sum = 0;
cin >> n;
ll a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
b[a[i]]++;
}
for (i = 0; i < n; i++) {
sum += compute(b[i]);
}
for (i ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll b[500000];
ll compute(ll n) { return (n * (n - 1)) / 2; }
int main() {
ll i, j, n, sum = 0;
cin >> n;
ll a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
b[a[i]]++;
}
for (i = 0; i < n + 1; i++) {
sum += compute(b[i]);
}
for... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 151 |
import collections
from collections import defaultdict
n = int(input())
l = list(map(int, input().split()))
dict = defaultdict(int)
for i in l:
dict[i]+=1
print(dict)
ans = 0
for v in dict.values():
ans += int((v*(v-1)) // 2)
for k in l:
print(ans - (dict[k] - 1))
| import collections
from collections import defaultdict
n = int(input())
l = list(map(int, input().split()))
dict = defaultdict(int)
for i in l:
dict[i]+=1
ans = 0
for v in dict.values():
ans += int((v*(v-1)) // 2)
for k in l:
print(ans - (dict[k] - 1))
| [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 98 |
import collections
def resolve():
N = int(input())
A = sorted(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print(ans - (count * (count - 1) // 2) +
... | import collections
def resolve():
N = int(input())
A = list(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print(ans - (count * (count - 1) // 2) +
((... | [["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]] | 5 | 109 |
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
d = [0] * n
s = {}
for i in a:
d[i] += 1
sum = 0
for k in d:
if k>1:
sum += (k*(k-1))//2
for i in range(n):
nd = d[a[i]]
ans = sum-(nd*(nd-1))//2
nd -= 1
if nd>1:
ans += (nd*(nd-1))//2
print(ans)
| import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}
for i in a:
d[i] += 1
sum = 0
for k in d:
if k>1:
sum += (k*(k-1))//2
for i in range(n):
nd = d[a[i]]
ans = sum-(nd*(nd-1))//2
nd -= 1
if nd>1:
ans += (nd*(nd-1))//2
print(ans)
| [["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]] | 5 | 139 |
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
// template
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(v) (v).begin(), (v).end()
typedef long long int ll;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;
c... | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
// template
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(v) (v).begin(), (v).end()
typedef long long int ll;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;
c... | [["+", 0, 11, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13]] | 1 | 497 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%lld", &x);
int main() {
ll n, x, ans, tmp;
sc(n) map<ll, ll> mp;
queue<ll> q;
for (int i = 0; i < n; i++) {
sc(x)++ mp[x];
q.push(x);
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%lld", &x);
int main() {
ll n, x, ans = 0, tmp;
sc(n) map<ll, ll> mp;
queue<ll> q;
for (int i = 0; i < n; i++) {
sc(x)++ mp[x];
q.push(x... | [["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 338, 0, 153, 0, 154], ["-", 12, 16, 31, 16, 31, 16, 12, 23, 0, 24], ["-", 12, 16, 31, 16, 31, 16, 12, 23, 0, 25]] | 1 | 204 |
// Template //
#include <bits/stdc++.h>
using namespace std;
// マクロ //
#define rep(i, N) for (int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout <<... | // Template //
#include <bits/stdc++.h>
using namespace std;
// マクロ //
#define rep(i, N) for (long long int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 577 |
n = int(input())
nums = list(map(int, input().split()))
print(nums)
values = {}
for i in nums:
if i in values: values[i] += 1
else: values[i] = 1
sums={} # 各値ごとの組み合わせ数
subsums={} # 各値ごとの組み合わせ数(ボールがないとき版
allsum = 0
for k,v in values.items():
sums[k] = v * (v - 1) / 2
undersum = (v - 2) * (v - 1) / 2 if v > 1 ... | n = int(input())
nums = list(map(int, input().split()))
values = {}
for i in nums:
if i in values: values[i] += 1
else: values[i] = 1
sums={} # 各値ごとの組み合わせ数
subsums={} # 各値ごとの組み合わせ数(ボールがないとき版
allsum = 0
for k,v in values.items():
sums[k] = v * (v - 1) / 2
undersum = (v - 2) * (v - 1) / 2 if v > 1 else 0
subs... | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 152 |
N = int(input())
A = list(map(int,input().split()))
B = [0]*(N+1)
for a in A:
B[a]+=1
C = [0]*(N+1)
for i in range(N):
C[i] = (B[i]-1)*B[i]//2
S = sum(C)
for k in range(N):
s = A[k]
ans = S-C[s]
b = B[s]-1
print(ans+(b-1)*b//2) | N = int(input())
A = list(map(int,input().split()))
B = [0]*(N+1)
for a in A:
B[a]+=1
C = [0]*(N+1)
for i in range(N+1):
C[i] = (B[i]-1)*B[i]//2
S = sum(C)
for k in range(N):
s = A[k]
ans = S-C[s]
b = B[s]-1
print(ans+(b-1)*b//2)
| [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 136 |
#!/usr/bin/env python3
import math
import collections
def C(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input().split()[0])
a_list = list(map(int, input().split()))
counter = collections.Counter(a_list)
ans_dict_1 = {}
ans_dict_2 = {}
for k, v in counter.items():
... | import math
import collections
def C(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input().split()[0])
a_list = list(map(int, input().split()))
counter = collections.Counter(a_list)
ans_dict_1 = {}
ans_dict_2 = {}
for k, v in counter.items():
if v >= 2:
ans... | [["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]] | 5 | 201 |
#include <stdio.h>
#include <string.h>
long k[200000];
long kk[200100];
int main() {
long i, N, j;
long long sum = 0;
long max = -1, min = 200100;
scanf("%ld", &N);
for (i = 0; i < N; i++) {
scanf("%ld", kk + i);
k[kk[i]]++;
if (max < kk[i])
max = kk[i];
if (min > kk[i])
min = kk... | #include <stdio.h>
#include <string.h>
long k[200100];
long kk[200100];
int main() {
long i, N, j;
long long sum = 0;
long max = -1, min = 200100;
scanf("%ld", &N);
for (i = 0; i < N; i++) {
scanf("%ld", kk + i);
k[kk[i]]++;
if (max < kk[i])
max = kk[i];
if (min > kk[i])
min = kk... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 57, 75, 76, 0, 1, 0, 35]] | 0 | 269 |
def main():
N = int(input())
A = [int(v) for v in input().split()]
C = [0] * (N + 1)
for i in A:
C[i] += 1
b = 0
print(C)
for cnt in C:
b += ((cnt * (cnt - 1)) // 2)
for i in range(N):
p = ((C[A[i]] - 1) * (C[A[i]] - 2)) >> 1
m = (C[A[i]] * (C[A[i]] - ... | def main():
N = int(input())
A = [int(v) for v in input().split()]
C = [0] * (N + 1)
for i in A:
C[i] += 1
b = 0
for cnt in C:
b += ((cnt * (cnt - 1)) // 2)
for i in range(N):
p = ((C[A[i]] - 1) * (C[A[i]] - 2)) >> 1
m = (C[A[i]] * (C[A[i]] - 1)) >> 1
... | [["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 160 |
N=int(input())
A=list(map(int,input().split()))
S=[0 for j in range(N+1)]
count=0
for i in range(N):
S[A[i]]+=1
for i in range(N):
count+=S[i]*(S[i]-1)//2
for i in range(N):
print(count-(S[A[i]]-1))
| N=int(input())
A=list(map(int,input().split()))
S=[0 for j in range(N+1)]
count=0
for i in range(N):
S[A[i]]+=1
for i in range(N+1):
count+=S[i]*(S[i]-1)//2
for i in range(N):
print(count-(S[A[i]]-1)) | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 108 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int N, a, sum, ans;
cin >> N;
sum = 0;
vector<long long int> num;
map<int, long long int> A;
for (int i = 0; i < N; i++) {
cin >> a;
A[a]++;
num.push_back(a);
}
for (int i = 0; i < N; i++) {
sum += A[i] * (A[i] - 1) / 2... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int N, a, sum, ans;
cin >> N;
sum = 0;
vector<long long int> num;
map<long long int, long long int> A;
for (int i = 0; i < N; i++) {
cin >> a;
A[a]++;
num.push_back(a);
}
for (int i = 0; i < N + 1; i++) {
sum += A[i] * ... | [["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 152 |
N_max = 2*(10**5)
N = int(input())
A = list(map(int, input().split()))
array = sorted(A)
quantity_of_num = [0]*(N_max + 1) # kという値がquantity_of_num[k]個あることを示す
type_index = list() # 文字の種類を昇順で記録していく配列。 len(type_index)が文字の種類数
count = 1 # 各文字が何個あるかの記録作業
for i in range(N-1):
if array[i] == array[i+1]:
count +=... | N_max = 2*(10**5)
N = int(input())
A = list(map(int, input().split()))
array = sorted(A)
quantity_of_num = [0]*(N_max + 1) # kという値がquantity_of_num[k]個あることを示す
type_index = list() # 文字の種類を昇順で記録していく配列。 len(type_index)が文字の種類数
count = 1 # 各文字が何個あるかの記録作業
for i in range(N-1):
if array[i] == array[i+1]:
count +=... | [["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612], ["+", 0, 662, 31, 206, 206, 206, 206, 657, 17, 72], ["+", 0, 662, 31, 206, 206, 206, 206, 657, 12, 612]] | 5 | 225 |
n = int(input())
a = list(map(int, input().split()))
lis = [0] * (n *2)
for i in range(n):
lis[a[i]] += 1
#print(lis)
cum = [0] * len(lis)
for i in range(n):
cnt = (lis[i] * (lis[i]-1)) // 2
cum[i] = cnt
ans = sum(cum)
cum2 = [0] * len(lis)
for i in range(2,(n*2)):
cum2[i] = (i * (i-1)) // 2
#print(cum)... | n = int(input())
a = list(map(int, input().split()))
lis = [0] * (n *3)
for i in range(n):
lis[a[i]] += 1
#print(lis)
cum = [0] * len(lis)
for i in range(n*3):
cnt = (lis[i] * (lis[i]-1)) // 2
cum[i] = cnt
ans = sum(cum)
cum2 = [0] * len(lis)
for i in range(2,(n*3)):
cum2[i] = (i * (i-1)) // 2
#print(cu... | [["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 48], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 12, 652, 3, 4, 0, 23, 0, 657, 12, 612], ["+", 12, 652, 3, 4, 0, 23, 0, 657, 12, 612]] | 5 | 187 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin >> n;
ll a[200005] = {};
REP(i, n) cin >> a[i];
ll map[200005] = {};
REP(i, n) { map[a[i]]++; }
ll sum = 0;
REP(i, n) { sum += map[i] * (map[i] - 1) / 2; }
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin >> n;
ll a[200005] = {};
REP(i, n) cin >> a[i];
ll map[200005] = {};
REP(i, n) { map[a[i]]++; }
ll sum = 0;
REP(i, n + 1) { sum += map[i] * (map[i] - 1) / 2; ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 184 |
import collections
N = int(input())
A = list(map(int, input().split()))
ctr_A = collections.Counter(A).most_common()
less_A = collections.Counter(A)
total = 0
for i in range(len(ctr_A)):
n = ctr_A[i][1]
total += n * (n - 1) // 2
for i in range(N):
summ = total
num = A[i]
n = less_A[num]
if... | import collections
N = int(input())
A = list(map(int, input().split()))
ctr_A = collections.Counter(A).most_common()
less_A = collections.Counter(A)
total = 0
for i in range(len(ctr_A)):
n = ctr_A[i][1]
total += n * (n - 1) // 2
for i in range(N):
summ = total
num = A[i]
n = less_A[num]
if... | [["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 19], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 60]] | 5 | 159 |
n = int(input())
k = [int(i) for i in input().split()]
pair = {}
for i in range(n):
pair.setdefault(k[i], []).append(i)
sum = 0
for value in pair.values():
l = len(value)
sum += l*(l-1)//2
for i in range(n):
ans = 0
len_pair = len(pair[k[i]])
if len_pair != 1:
ans = sum - ((len_pair*(... | n = int(input())
k = [int(i) for i in input().split()]
pair = {}
for i in range(n):
pair.setdefault(k[i], []).append(i)
sum = 0
for value in pair.values():
l = len(value)
sum += l*(l-1)//2
for i in range(n):
len_pair = len(pair[k[i]])
if len_pair != 1:
ans = sum - ((len_pair*(len_pair-1)/... | [["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 155 |
def conbination_2(n):
if n <= 1:
return 0
else:
return int(n * (n - 1) / 2)
N = int(input())
A = list(map(int,input().split()))
S = 0
Count = [0] * (N - 1)
for i in range(N):
Count[A[i] - 1] += 1
for i in range(N - 1):
S += conbination_2(Count[i])
for i in range(N):
Ans = S - (Count[A[i] - 1]... | def conbination_2(n):
if n <= 1:
return 0
else:
return int(n * (n - 1) / 2)
N = int(input())
A = list(map(int,input().split()))
S = 0
Count = [0] * N
for i in range(N):
Count[A[i] - 1] += 1
for i in range(N):
S += conbination_2(Count[i])
for i in range(N):
Ans = S - (Count[A[i] - 1] - 1)
pr... | [["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 134 |
from collections import Counter
def choose(n: int) -> int:
if n < 2:
return 0
else:
return (n * (n - 1)) // 2
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
d = {key: choose(value) for key, value in c.items()}
if len(d) > 1:
sum_d = sum(d.values())
for a in A:
... | from collections import Counter
def choose(n: int) -> int:
if n < 2:
return 0
else:
return (n * (n - 1)) // 2
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
d = {key: choose(value) for key, value in c.items()}
if len(d) > 1:
sum_d = sum(d.values())
for a in A:
... | [["+", 0, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["-", 0, 657, 12, 23, 0, 657, 31, 206, 51, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 206, 51, 22], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 676], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 657, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 657, 12, 652, 3, 4, 0, 657, 12,... | 5 | 149 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
const ll INF = ll(1e18) + 1;
const double PI = 3.14159265358979323846;
ll m[2000000] = {};
int... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
const ll INF = ll(1e18) + 1;
const double PI = 3.14159265358979323846;
ll m[2000000] = {};
int... | [["-", 0, 1, 0, 11, 31, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 31, 2, 3, 4, 0, 13]] | 1 | 204 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int z[200005];
int x[200005];
int main() {
int a;
ll b, c;
scanf("%d", &a);
b = 0;
memset(z, 0, sizeof(z));
for (int i = 0; i < a; i++) {
scanf("%d", &x[i]);
z[x[i]]++;
}
for (int i = 0; i < a; i++) {
if (z[i] != 0)
b... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int z[200005];
int x[200005];
int main() {
int a;
ll b, c;
scanf("%d", &a);
b = 0;
memset(z, 0, sizeof(z));
for (int i = 0; i < a; i++) {
scanf("%d", &x[i]);
z[x[i]]++;
}
for (int i = 0; i < 200005; i++) {
if (z[i] != 0)
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 232 |
N = int(input())
A = list(map(int, input().split()))
lis = [0 for _ in range(N+1)]
lis1 = [0 for _ in range(N+1)]
lis2 = [0 for _ in range(N+1)]
for i in range(N):
lis[A[i]] += 1
for i in range(N):
num = lis[i]
if num != 0:
lis1[i] = int(num*(num-1)/2)
lis2[i] = int((num-1)*(num-2)/2) - li... | N = int(input())
A = list(map(int, input().split()))
lis = [0 for _ in range(N+1)]
lis1 = [0 for _ in range(N+1)]
lis2 = [0 for _ in range(N+1)]
for i in range(N):
lis[A[i]] += 1
for i in range(N+1):
num = lis[i]
if num != 0:
lis1[i] = int(num*(num-1)/2)
lis2[i] = int((num-1)*(num-2)/2) - ... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 175 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end() // 昇順ソート
#define rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S se... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end() // 昇順ソート
#define rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S se... | [["+", 0, 11, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13]] | 1 | 355 |
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = dict(Counter(a))
ans = 0
for v in c.values():
ans += v*(v-1)//2
for i in range(n):
print(ans-a[i]-1)
| from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = dict(Counter(a))
ans = 0
for v in c.values():
ans += v*(v-1)//2
for i in range(n):
print(ans-c[a[i]]+1)
| [["+", 3, 4, 0, 657, 31, 657, 12, 206, 51, 22], ["+", 3, 4, 0, 657, 31, 657, 12, 206, 0, 70], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 657, 12, 206, 0, 73], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72]] | 5 | 80 |
import collections
import math
N = int(input())
A = list(map(int, input().split(' ')))
c = collections.Counter(A)
d1 = {}
d2 = {}
for i in c:
d1[str(i)] = (c[i]*(c[i]-1))/2
d2[str(i)] = ((c[i]-1)*(c[i]-2))/2
s = sum(d1.values())
print(c)
for i in range(N):
ans = s - d1[str(A[i])]+d2[str(A[i])]
print(i... | import collections
import math
N = int(input())
A = list(map(int, input().split(' ')))
c = collections.Counter(A)
d1 = {}
d2 = {}
for i in c:
d1[str(i)] = (c[i]*(c[i]-1))/2
d2[str(i)] = ((c[i]-1)*(c[i]-2))/2
s = sum(d1.values())
for i in range(N):
ans = s - d1[str(A[i])]+d2[str(A[i])]
print(int(ans))
| [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 161 |
import collections
n=int(input())
As=list(map(int,input().split()))
ls=collections.Counter(As)
subd={}
an=ls.values()
for k in l:
ans+=k*(k-1)//2
sans=ans
for i in As:
ans=sans+1-ls[i]
print(ans)
| import collections
n=int(input())
As=list(map(int,input().split()))
ls=collections.Counter(As)
subd={}
an=ls.values()
ans=0
for k in an:
ans+=k*(k-1)//2
sans=ans
for i in As:
ans=sans+1-ls[i]
print(ans) | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22]] | 5 | 84 |
from collections import Counter
n = int(input())
s = [int(i) for i in input().split()]
s_set = set(s)
counted = Counter(s)
ans = sum(i*(i-1)/2 for i in counted.values())
print(ans)
for i in s:
x = counted[i]
print(int(ans - x + 1)) | from collections import Counter
n = int(input())
s = [int(i) for i in input().split()]
s_set = set(s)
counted = Counter(s)
ans = sum(i*(i-1)/2 for i in counted.values())
for i in s:
x = counted[i]
print(int(ans - x + 1)) | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 90 |
import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(... | import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(... | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 399 |
N = int(input())
A = list(map(int, input().split()))
B = [[] for i in range(N)]
ans = [0]*N
for k, a in enumerate(A):
a = a - 1
B[a].append(k)
S = 0
for b in B:
lenb = len(b)
if lenb >= 1:
S += lenb * (lenb-1) / 2
for i, b in enumerate(B):
for j, k in enumerate(b):
ans[k] = int(S ... | N = int(input())
A = list(map(int, input().split()))
B = [[] for i in range(N)]
ans = [0]*N
for k, a in enumerate(A):
a = a - 1
B[a].append(k)
S = 0
for b in B:
lenb = len(b)
if lenb >= 1:
S += lenb * (lenb-1) / 2
for i, b in enumerate(B):
for j, k in enumerate(b):
ans[k] = int(S ... | [["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 141 |
def nCr(n, r):
import math
# nCrのr>nは組み合わせが存在しないので0を返す
# raiseすべきのこともあるかも
if r > n:
return 0
return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))
memo = [-1] * 300000
memo2 = [-1] * 300000
memo3 = [-1] * 300000
n = int(input())
dat = list(map(int, input().split()))
fro... | def nCr(n, r):
import math
# nCrのr>nは組み合わせが存在しないので0を返す
# raiseすべきのこともあるかも
if r > n:
return 0
return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))
memo = [-1] * 300000
memo2 = [-1] * 300000
memo3 = [-1] * 300000
n = int(input())
dat = list(map(int, input().split()))
fro... | [["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 213 |
n=int(input())
A=list(map(int,input().split()))
X=[0]*(n+1)
for i in range(n):
X[A[i]]+=1
ans=0
for i in range(n):
if X[i]>1:
ans+=X[i]*(X[i]-1)//2
for i in range(n):
if X[A[i]]==1:
print(ans)
elif X[A[i]]>1:
print(ans-(X[A[i]]-1)) | n=int(input())
A=list(map(int,input().split()))
X=[0]*(n+1)
for i in range(n):
X[A[i]]+=1
ans=0
for i in range(n+1):
if X[i]>1:
ans+=X[i]*(X[i]-1)//2
for i in range(n):
if X[A[i]]==1:
print(ans)
elif X[A[i]]>1:
print(ans-(X[A[i]]-1)) | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 139 |
import collections
N = int(input())
A = list(map(int, input().split()))
ct = collections.Counter(A)
ret = []
total = 0
for k,count in ct.items():
if count > 1:
total += count * (count-1) // 2
for i,v in enumerate(A):
if ct[v] > 1:
count = ct[v]
adjust = (count-1) * (count-2) // 2 - (... |
import collections
N = int(input())
A = list(map(int, input().split()))
ct = collections.Counter(A)
ret = []
total = 0
for k,count in ct.items():
if count > 1:
total += count * (count-1) // 2
for i,v in enumerate(A):
if ct[v] > 1:
count = ct[v]
adjust = (count-1) * (count-2) // 2 - ... | [["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 22]] | 5 | 132 |
def fun(a):
return a*(a-1)//2
import sys
def main():
n = int(input())
l = [int(j) for j in sys.stdin.readline().split()]
d = dict()
for i in range(n):
if l[i] in d:
d[l[i]]+=1
else:
d[l[i]]=1
print(d)
ans = 0
for key in d:
ans+=fun(d[key])
... | def fun(a):
return a*(a-1)//2
import sys
def main():
n = int(input())
l = [int(j) for j in sys.stdin.readline().split()]
d = dict()
for i in range(n):
if l[i] in d:
d[l[i]]+=1
else:
d[l[i]]=1
# print(d)
ans = 0
for key in d:
ans+=fun(d[key]... | [["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 173 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> numbers(n);
vector<int> occ(n + 1, 0);
for (int i = 0; i < n; i++) {
cin >> numbers[i];
occ[numbers[i]]++;
}
long long s = 0;
for (int i = 0; i < n; i++) {
s = s + ((((long long)occ[i]) * (occ[i] - 1)) ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> numbers(n);
vector<int> occ(n + 1, 0);
for (int i = 0; i < n; i++) {
cin >> numbers[i];
occ[numbers[i]]++;
}
long long s = 0;
for (int i = 0; i < n + 1; i++) {
s = s + ((((long long)occ[i]) * (occ[i] - ... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]] | 1 | 168 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ty... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ty... | [["-", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 375 |
#include <algorithm>
#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#includ... | #include <algorithm>
#include <bits/stdc++.h>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#includ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 383 |
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define srep(i, n, m) for (int i = n; i < m; i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int m = 0, n, aa[220000], a, b, cn... | #include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define srep(i, n, m) for (int i = n; i < m; i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int m = 0, n, aa[220000], a, b, cn... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 197 |
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ll a[200005];
ll b[200005] = {0};
int main() {
ll n;
scanf("%lld", &n);
for (ll i = 0; i < n; i++) {
scanf("%lld", &a[i]);
... | #include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ll a[200005];
ll b[200005] = {0};
int main() {
ll n;
scanf("%lld", &n);
for (ll i = 0; i < n; i++) {
scanf("%lld", &a[i]);
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 234 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;
ll a[200010];
ll s[200010];
// s[i]でiと描かれたボールの数
void solve() {
ll n;
cin >> n;
rep(i, n) { s[i] = 0; }
rep(i, n) {
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;
ll a[200010];
ll s[200010];
// s[i]でiと描かれたボールの数
void solve() {
ll n;
cin >> n;
rep(i, n + 2) { s[i] = 0; }
rep(i, n) {... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 221 |
import collections
n=int(input())
a=list(map(int,input().split()))
ct=[0 for i in range(n+1)]
for i in range(n):
ct[a[i]]+=1
ans=0
for i in range(n):
ans+=ct[i]*(ct[i]-1)//2
for i in range(n):
print(ans-ct[a[i]]+1) | n=int(input())
a=list(map(int,input().split()))
ct=[0 for i in range(n+1)]
for i in range(n):
ct[a[i]]+=1
ans=0
for i in range(n+1):
ans+=(ct[i]*(ct[i]-1))//2
for i in range(n):
print(ans-ct[a[i]]+1) | [["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["+", 12, 657, 31, 23, 0, 657, 12, 23, 0, 25]] | 5 | 108 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vector <ll> vec
#define pair <ll, ll> pa
#define make_pair mp
#define push_back pb
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n, arr[200234], freq[200234];
cin >> n;
ll i;
memset(freq, 0, sizeo... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vector <ll> vec
#define pair <ll, ll> pa
#define make_pair mp
#define push_back pb
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n, arr[200234], freq[200234];
cin >> n;
ll i;
memset(freq, 0, sizeo... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 228 |
N = int(input())
K = list(map(int,input().rstrip().split()))
CK = [0 for i in range(N + 1)]
ans = 0
for i in K:
CK[i] += 1
for i in range(N):
ans += CK[i] * (CK[i] -1) /2
for i in range(N):
bans = ans - CK[K[i]] * (CK[K[i]] -1 ) /2 + (CK[K[i]] -1) * (CK[K[i]] -2) /2
print(int(bans)) | N = int(input())
K = list(map(int,input().rstrip().split()))
CK = [0 for i in range(N + 1)]
ans = 0
for i in K:
CK[i] += 1
for i in range(N + 1):
ans += CK[i] * (CK[i] - 1) /2
for i in range(N):
bans = ans - CK[K[i]] * (CK[K[i]] -1 ) / 2 + (CK[K[i]] -1) * (CK[K[i]] -2) / 2
print(int(bans)) | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 148 |
#include <bits/stdc++.h>
#include <iostream>
#define int long long
#define sc(x) scanf("%lld", &(x));
#define sci(x) scanf("%d", &(x));
#define si signed
#define P pair<int, int>
#define fi first
#define se second
using namespace std;
int n, m;
int A[299995];
int B[200005];
si main() {
sc(n) int x;
for (int i = 0;... | #include <bits/stdc++.h>
#include <iostream>
#define int long long
#define sc(x) scanf("%lld", &(x));
#define sci(x) scanf("%d", &(x));
#define si signed
#define P pair<int, int>
#define fi first
#define se second
using namespace std;
int n, m;
int A[299995];
int B[200005];
si main() {
sc(n) int x;
for (int i = 0;... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 256 |
n=int(input())
arr= list(map(int,input().split(' ')))
count={}
for i in range(len(arr)):
val=arr[i]
if val not in count.keys():
count[val]=1
else:
count[val]+=1
big_sum=0
for d in count.keys():
big_sum+= count[d]*(count[d]-1)/2
for a in arr:
if a in count.keys():
if count[... | n=int(input())
arr= list(map(int,input().split(' ')))
count={}
for i in range(len(arr)):
val=arr[i]
if val not in count.keys():
count[val]=1
else:
count[val]+=1
big_sum=0
for d in count.keys():
big_sum+= count[d]*(count[d]-1)/2
for a in arr:
if a in count.keys():
if count[... | [["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 146 |
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int;
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
typedef pair<int, int> P;
typedef pair<ll, ll> PL... | #include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int;
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
typedef pair<int, int> P;
typedef pair<ll, ll> PL... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]] | 1 | 529 |
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
using namespace std;
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb(X) push_back(X)
#define x first
#define y second
#define all(x) (x).begin(), (x).end()
#def... | #pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
using namespace std;
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb(X) push_back(X)
#define x first
#define y second
#define all(x) (x).begin(), (x).end()
#def... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 64, 9, 0, 1, 0, 16, 12, 103, 0, 104]] | 1 | 328 |
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespac... | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespac... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 261 |
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define mod1 1000000009
#define line cout << "----------------------" << endl
#define mp make_pair
#define fast \
... | #include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define mod1 1000000009
#define line cout << "----------------------" << endl
#define mp make_pair
#define fast \
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 210 |
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include ... | #include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include ... | [["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 301 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define INF 20000... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define INF 20000... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 336 |
n = int(input())
a = [int(i) for i in input().split()]
ball = [0]*(n+1)
for i in range(n):
ball[a[i]] += 1
zenbu = 0
for i in range(n):
tmp = ball[i]
if tmp > 1:
zenbu += (tmp*(tmp-1))//2
for i in range(n):
tmp = ball[a[i]]
if tmp > 1:
#sabun = (tmp*(tmp-1))//2 - ((t... | n = int(input())
a = [int(i) for i in input().split()]
ball = [0]*(n+1)
for i in range(n):
ball[a[i]] += 1
zenbu = 0
for i in range(n+1):
tmp = ball[i]
if tmp > 1:
zenbu += (tmp*(tmp-1))//2
for i in range(n):
tmp = ball[a[i]]
if tmp > 1:
#sabun = (tmp*(tmp-1))//2 - (... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 128 |
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
... | #include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 252 |
n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in a:
s.add(i)
if i in dic:
dic[i] +=1
else:
dic[i] = 1
ans = 0
for i in dic.values():
ans += i * (i - 1) // 2
for i in a:
sa = dic[i] * (dic[i] - 1) // 2 - ((dic[i] - 1) * (dic[i] - 2) // 2)
print(ans - sa) | n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in a:
if i in dic:
dic[i] +=1
else:
dic[i] = 1
ans = 0
for i in dic.values():
ans += i * (i - 1) // 2
for i in a:
sa = dic[i] * (dic[i] - 1) // 2 - ((dic[i] - 1) * (dic[i] - 2) // 2)
print(ans - sa) | [["-", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 132 |
N=int(input())
A=list(map(int,input().split()))
B=[0 for i in range(N+1)]
for i in range(N):
B[A[i]] += 1
S=0
for i in range(N):
if B[i]!=0:
S += int(B[i]*(B[i]-1)/2)
for i in range(N):
print(S - (B[A[i]] -1))
| N=int(input())
A=list(map(int,input().split()))
B=[0 for i in range(N+1)]
for i in range(N):
B[A[i]] += 1
S=0
for i in range(N+1):
if B[i]!=0:
S += int(B[i]*(B[i]-1)/2)
for i in range(N):
print(S - (B[A[i]] -1))
| [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 119 |
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define change(a, b) \
do { ... | #include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define change(a, b) \
do { ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 324 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
int main() {
int N;
cin >> N;
map<int, LL> m;
int number[200010];
rep(i, N) {
int A;
cin >> A;
m[A]++;
number[i] = A;
}
LL num[200010] = {0};... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
int main() {
int N;
cin >> N;
map<int, LL> m;
int number[200010];
rep(i, N) {
int A;
cin >> A;
m[A]++;
number[i] = A;
}
LL num[200010] = {0};... | [["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 197 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
templ... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
templ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 401 |
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, a, b) for ((i) = a; i < (int)(... | #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, a, b) for ((i) = a; i < (int)(... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 319 |
import sys
#input = sys.stdin.readline
def main():
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
s=0
for i in range(n):
l[a[i]]+=1
for i in range(n):
if l[i]==0:
continue
else:
s+=l[i]*(l[i]-1)//2
for i in range(n):
print... | import sys
#input = sys.stdin.readline
def main():
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
s=0
for i in range(n):
l[a[i]]+=1
for i in range(n+1):
if l[i]==0:
continue
else:
s+=l[i]*(l[i]-1)//2
for i in range(n):
pri... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 134 |
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define FOR(i, a, n) for (i = a; i < n;... | #include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define FOR(i, a, n) for (i = a; i < n;... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 31, 2, 3, 4, 0, 16, 12, 13]] | 0 | 1,044 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int d[200001];
int a[200001];
int main() {
int n;
cin >> n;
for (int i = 0; i <= n; i++) {
d[i] = 0;
}
for (int i = 0; i < n; i++) {
cin >> a[i];
d[a[i]]++;
}
int count = 0;
for (int i = 1; i <... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
ll d[200001];
int a[200001];
int main() {
int n;
cin >> n;
for (int i = 0; i <= n; i++) {
d[i] = 0;
}
for (int i = 0; i < n; i++) {
cin >> a[i];
d[a[i]]++;
}
ll count = 0;
for (int i = 0; i <= ... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 175 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf ... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf ... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 234 |
n = gets.to_i
a = gets.split.map(&:to_i)
h = a.group_by(&:itself).map{|k,v| [k, v.count]}.to_h
total = h.values.map{|i| i*(i-1)/2}.inject(:+)
a.each{|ai|
hi = h[ai]
p hi==1 ? 0 : total - hi*(hi-1)/2 + (hi-1)*(hi-2)/2
}
| n = gets.to_i
a = gets.split.map(&:to_i)
h = a.group_by(&:itself).map{|k,v| [k, v.count]}.to_h
total = h.values.map{|i| i*(i-1)/2}.inject(:+)
a.each{|ai|
hi = h[ai]
p hi==1 ? total : total - hi*(hi-1)/2 + (hi-1)*(hi-2)/2
}
| [["-", 8, 734, 0, 652, 3, 4, 0, 754, 64, 612], ["+", 8, 734, 0, 652, 3, 4, 0, 754, 64, 22]] | 4 | 115 |
N = int(input())
A = list(map(int, input().split()))
#L = [0 for i in range(N)]
dict = {}
for i in A:
if i in dict:
dict[i] = dict[i] + 1
else:
dict[i] = 1
print(dict)
total = 0;
for i in dict:
# print("i:" + str(i) + " " + str(dict[i]))
total += dict[i]*(dict[i]-1) // 2
#print("T:" + str(total))
for... | N = int(input())
A = list(map(int, input().split()))
#L = [0 for i in range(N)]
dict = {}
for i in A:
if i in dict:
dict[i] = dict[i] + 1
else:
dict[i] = 1
#print(dict)
total = 0;
for i in dict:
# print("i:" + str(i) + " " + str(dict[i]))
total += dict[i]*(dict[i]-1) // 2
#print("T:" + str(total))
fo... | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 107 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <ve... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <ve... | [["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 351 |
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define str string
#define ALL(a) (a).begin(), (a).end()
#define P pair<ll, ll>
using Graph = vector<vector<int>>;
const int dy[] = {0, 0, 1, -1}, dx[] = {1, -1, 0, 0};
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a... | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define str string
#define ALL(a) (a).begin(), (a).end()
#define P pair<ll, ll>
using Graph = vector<vector<int>>;
const int dy[] = {0, 0, 1, -1}, dx[] = {1, -1, 0, 0};
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 327 |
def main():
n=int(input())
a=list(map(int,input().split()))
cnt=[0]*n
for i in range(n):
cnt[a[i]-1]+=1
res=0
for i in range(n):
if cnt[i]>1:
res+=cnt[i]*(cnt[i]-1)//2
ans=[0]*n
for i in range(n):
if cnt[i]>1:
ans[i]=res-(cnt[i]-1)
for ... | def main():
n=int(input())
a=list(map(int,input().split()))
cnt=[0]*n
for i in range(n):
cnt[a[i]-1]+=1
res=0
for i in range(n):
if cnt[i]>1:
res+=cnt[i]*(cnt[i]-1)//2
ans=[0]*n
for i in range(n):
if cnt[i]>=1:
ans[i]=res-(cnt[i]-1)
for... | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]] | 5 | 160 |
#include <bits/stdc++.h>
#define f1(n) for (int i = 0; i < n; ++i)
#define f2(n) for (int i = 1; i <= n; ++i)
#define lson(x) x << 1
#define rson(x) x << 1 | 1
#define mp make_pair
using namespace std;
typedef long long ll;
typedef long double llf;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int... | #include <bits/stdc++.h>
#define f1(n) for (int i = 0; i < n; ++i)
#define f2(n) for (int i = 1; i <= n; ++i)
#define lson(x) x << 1
#define rson(x) x << 1 | 1
#define mp make_pair
using namespace std;
typedef long long ll;
typedef long double llf;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 292 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
static const int MAX = 300000;
ll A[MAX], B[MAX], n, ans;
void print(int k) { cout << ans - (B[A[k]] - 1) << endl; }
int main() {
ans = 0;
cin... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
static const int MAX = 300000;
ll A[MAX], B[MAX], n, ans;
void print(int k) { cout << ans - (B[A[k]] - 1) << endl; }
int main() {
ans = 0;
cin... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 175 |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define pb push_back
#define mp make_pair
#define BIG_NUM 2000000000
... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i, j, k) for (int i = j; i < k; i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define pb push_back
#define mp make_pair
#define BIG_NUM 2000000000
... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 1,060 |
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
map<int, int> ma;
for (int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
A.at(i) = tmp;
ma[tmp]++;
}
long long ans = 0;
for (auto x : ma) {
int tmp = x.second;
a... | #include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
map<int, int> ma;
for (int i = 0; i < N; i++) {
int tmp;
cin >> tmp;
A.at(i) = tmp;
ma[tmp]++;
}
long long ans = 0;
for (auto x : ma) {
long long tmp = x.second;... | [["-", 8, 9, 0, 338, 8, 9, 0, 43, 39, 40], ["+", 0, 338, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 207 |
n = int(input())
b = list(map(int,input().split()))
balls = [0]*(n+1)
for i in range(n):
balls[b[i]] += 1
su = 0
for i in range(n):
su += (balls[i]*(balls[i]-1))//2
for i in range(n):
bb = balls[b[i]]
print(su - bb+1)
| n = int(input())
b = list(map(int,input().split()))
balls = [0]*(n+1)
for i in range(n):
balls[b[i]] += 1
su = 0
for i in range(n+1):
su += (balls[i]*(balls[i]-1))//2
for i in range(n):
bb = balls[b[i]]
print(su - bb+1)
| [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 108 |
N=int(input())
A=[int(i) for i in input().split()]
ok=[0]*(N+1)
# print(ok)
for i in range(N):
ok[A[i]]+=1
# print(ok)
ans=0
sum=0
for i in range(N):
if ok[i]!=0:
sum+=int(ok[i]*(ok[i]-1)/2)
# print("sum ",sum)
for i in range(N):
# print(i,A[i])
if ok[A[i]]<=1:
ans=sum
elif ok[A[i... | N=int(input())
A=[int(i) for i in input().split()]
ok=[0]*(N+1)
# print(ok)
for i in range(N):
ok[A[i]]+=1
# print(ok)
ans=0
sum=0
for i in range(N+1):
if ok[i]>=2:
sum+=int(ok[i]*(ok[i]-1)/2)
# print("sum ",sum)
for i in range(N):
# print(i,A[i])
if ok[A[i]]<=1:
ans=sum
elif ok[A... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 79], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]] | 5 | 201 |
import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))
B = [0] * (n+1)
for i in range(n):
B[A[i]] += 1
C = [0] * (n+1)
for i in range(n):
C[i] = B[i]*(B[i]-1)//2
su = sum(C)
for i in range(n):
print(su - C[A[i]] + (B[A[i]]-1)*(B[A[i]]-2)//2) | import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))
B = [0] * (n+1)
for i in range(n):
B[A[i]] += 1
C = [0] * (n+1)
for i in range(n+1):
C[i] = B[i]*(B[i]-1)//2
su = sum(C)
for i in range(n):
print(su - C[A[i]] + (B[A[i]]-1)*(B[A[i]]-2)//2) | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 153 |
N = int(input())
A = list(map(int, input().split()))
count = [0] * 200005
for a in A:
count[a] += 1
s = 0
for c in count:
s += c * (c - 1) // 2
print(s)
for a in A:
c = count[a]
x = c * (c - 1) // 2
c -= 1
y = c * (c - 1) // 2
print(s - x + y)
| N = int(input())
A = list(map(int, input().split()))
count = [0] * 200005
for a in A:
count[a] += 1
s = 0
for c in count:
s += c * (c - 1) // 2
for a in A:
c = count[a]
x = c * (c - 1) // 2
c -= 1
y = c * (c - 1) // 2
print(s - x + y)
| [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 110 |
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 200010
using namespace std;
ll n, a[N]... | #include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 200010
using namespace std;
ll n, a[N]... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 167 |
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const int... | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const int... | [["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22]] | 1 | 397 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const ... | [["+", 15, 16, 12, 23, 0, 16, 12, 16, 17, 72], ["+", 15, 16, 12, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 999 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define pb push_back
void solve() {
int h, w, k;
cin >> h >> w >> k;
string ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define pb push_back
void solve() {
int h, w, k;
cin >> h >> w >> k;
string ... | [["+", 0, 14, 8, 9, 0, 9, 0, 57, 0, 121], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 51, 22], ["+", 8, 9, 0, 9, 0, 57, 15, 339, 0, 25], ["+", 8, 9, 0, 9, 0, 57, 64, 93, 0, 94], ["+", 8, 9, 0, 9, 0, 57, 64, 93, 0, 35]] | 1 | 375 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int h, w, k;
cin >> h >> w >> k;
string choco[h];
for (int i = 0; i < h; i++)
cin >> choco[i];
int ans = h + w;
for (int bit = 0; bit < (2 << h - 1); bit++) {
int m = __builtin_popcount(bit);
int cnt = m;
int count[m + 1];
vect... | #include <bits/stdc++.h>
using namespace std;
int main() {
int h, w, k;
cin >> h >> w >> k;
string choco[h];
for (int i = 0; i < h; i++)
cin >> choco[i];
int ans = h + w;
for (int bit = 0; bit < (2 << h - 1); bit++) {
int m = __builtin_popcount(bit);
int cnt = m;
int count[m + 1];
vect... | [["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25]] | 1 | 346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.