problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k โ | fixed_code stringlengths 12 526k โ | labels listlengths 0 15 โ | buggy_submission_id int64 1 1.54M โ | fixed_submission_id int64 2 1.54M โ | user_id stringlengths 10 10 โ | language stringclasses 9 values |
|---|---|---|---|---|---|---|---|
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define yesno(flg) \
if (flg) { \
cout << 'YES' << endl; \
} else { \
cout << 'NO' << endl; \
}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<Pii, int> Piii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<string, int> Psi;
typedef pair<Psi, int> Psii;
const int inf = 1000000000;
struct edge {
int myc, to, c, cost;
};
struct pos {
int to, cost, color;
};
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
vector<string> v;
int main() {
string s;
int n;
int t = 1;
int res = 0;
cin >> n;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
v.push_back(s);
}
sort(v.begin(), v.end());
rep(i, n - 1) {
if (v[i] == v[i + 1]) {
t++;
} else {
res += (t * (t - 1)) / 2;
t = 1;
}
}
res += (t * (t - 1)) / 2;
cout << res << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define yesno(flg) \
if (flg) { \
cout << 'YES' << endl; \
} else { \
cout << 'NO' << endl; \
}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<Pii, int> Piii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<string, int> Psi;
typedef pair<Psi, int> Psii;
const int inf = 1000000000;
struct edge {
int myc, to, c, cost;
};
struct pos {
int to, cost, color;
};
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
vector<string> v;
int main() {
string s;
int n;
ll t = 1;
ll res = 0;
cin >> n;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
v.push_back(s);
}
sort(v.begin(), v.end());
rep(i, n - 1) {
if (v[i] == v[i + 1]) {
t++;
} else {
res += (t * (t - 1)) / 2;
t = 1;
}
}
res += (t * (t - 1)) / 2;
cout << res << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 746,479 | 746,480 | u707053380 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define M 1000000007
#define fors(i, n) for (int i = 0; i < n; ++i)
#define fore(i, a, b) for (int i = a; i <= b; ++i)
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define vv vector<int>
#define endl "\n"
#define test(i) cout << i << endl
#define tests(i) cout << "i: " << i << endl;
#define itrt \
int t; \
cin >> t; \
fors(i, t)
#define itr1 \
int t; \
cin >> t;
#define ff first
#define ss second
#define pb push_back
#define vmp make_pair
#define ppb pop_back
#define sorta(a, n) sort(arr, arr + n)
#define sortv(x) sort(x.begin(), x.end())
void file() {
#ifdef LOCAL
freopen("demo.in", "r", stdin);
freopen("demo.out", "w", stdout);
#endif
}
bool sortdes(const pair<int, int> &a, const pair<int, int> &b) {
return a.ss < b.ss;
}
bool sortasc(const pair<int, int> &a, const pair<int, int> &b) {
return a.ss > b.ss;
}
int gcd(int x, int y) { return __gcd(x, y); }
lld fact(lld n);
lld nCr(lld n, lld r) { return fact(n) / (fact(r) * fact(n - r)); }
lld fact(lld n) {
lld res = 1;
for (lld i = 2; i <= n; i++)
res = res * i;
return res;
}
// const int maxi = 1e6+10;
// vector<int> v[maxi];
// long long a[maxi];
// void dfs(int x,int y){
// a[x]+=a[y];
// for(int i:v[x]){
// if(i!=y){
// dfs(i,x);
// }
// }
// }
void test_case() {
int n;
cin >> n;
// vector<string> v;
unordered_map<string, int> ump;
for (int i = 0; i < n; ++i) {
string temp;
cin >> temp;
sort(temp.begin(), temp.end());
ump[temp]++;
}
// for(auto x:ump){
// cout<<x.ff<<" "<<x.ss<<endl;
// }
long long sum = 0;
for (auto x : ump) {
sum += ((x.ss) * (x.ss - 1)) / 2;
}
test(sum);
// int cnt=0;
// for(int i=0;i<n;++i){
// for(int j=i+1;j<n;++j){
// if(v[i]==v[j]){
// ++cnt;
// }
// }
// }
// test(cnt);
}
int main() {
fastio;
file();
int T = 1;
// int T;
// cin>>T;
for (int nr = 1; nr <= T; ++nr) {
// cout<<"Case #"<<nr<<": ";
test_case();
}
} | #include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define M 1000000007
#define fors(i, n) for (int i = 0; i < n; ++i)
#define fore(i, a, b) for (int i = a; i <= b; ++i)
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define vv vector<int>
#define endl "\n"
#define test(i) cout << i << endl
#define tests(i) cout << "i: " << i << endl;
#define itrt \
int t; \
cin >> t; \
fors(i, t)
#define itr1 \
int t; \
cin >> t;
#define ff first
#define ss second
#define pb push_back
#define vmp make_pair
#define ppb pop_back
#define sorta(a, n) sort(arr, arr + n)
#define sortv(x) sort(x.begin(), x.end())
void file() {
#ifdef LOCAL
freopen("demo.in", "r", stdin);
freopen("demo.out", "w", stdout);
#endif
}
bool sortdes(const pair<int, int> &a, const pair<int, int> &b) {
return a.ss < b.ss;
}
bool sortasc(const pair<int, int> &a, const pair<int, int> &b) {
return a.ss > b.ss;
}
int gcd(int x, int y) { return __gcd(x, y); }
lld fact(lld n);
lld nCr(lld n, lld r) { return fact(n) / (fact(r) * fact(n - r)); }
lld fact(lld n) {
lld res = 1;
for (lld i = 2; i <= n; i++)
res = res * i;
return res;
}
// const int maxi = 1e6+10;
// vector<int> v[maxi];
// long long a[maxi];
// void dfs(int x,int y){
// a[x]+=a[y];
// for(int i:v[x]){
// if(i!=y){
// dfs(i,x);
// }
// }
// }
void test_case() {
int n;
cin >> n;
// vector<string> v;
unordered_map<string, int> ump;
for (int i = 0; i < n; ++i) {
string temp;
cin >> temp;
sort(temp.begin(), temp.end());
ump[temp]++;
}
// for(auto x:ump){
// cout<<x.ff<<" "<<x.ss<<endl;
// }
long long sum = 0;
for (auto x : ump) {
sum += (long long)(x.ss) * (x.ss - 1) / 2;
}
test(sum);
// int cnt=0;
// for(int i=0;i<n;++i){
// for(int j=i+1;j<n;++j){
// if(v[i]==v[j]){
// ++cnt;
// }
// }
// }
// test(cnt);
}
int main() {
fastio;
file();
int T = 1;
// int T;
// cin>>T;
for (int nr = 1; nr <= T; ++nr) {
// cout<<"Case #"<<nr<<": ";
test_case();
}
} | [
"type_conversion.add"
] | 746,481 | 746,482 | u998008108 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define M 1000000007
#define fors(i, n) for (int i = 0; i < n; ++i)
#define fore(i, a, b) for (int i = a; i <= b; ++i)
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define vv vector<int>
#define endl "\n"
#define test(i) cout << i << endl
#define tests(i) cout << "i: " << i << endl;
#define itrt \
int t; \
cin >> t; \
fors(i, t)
#define itr1 \
int t; \
cin >> t;
#define ff first
#define ss second
#define pb push_back
#define vmp make_pair
#define ppb pop_back
#define sorta(a, n) sort(arr, arr + n)
#define sortv(x) sort(x.begin(), x.end())
void file() {
#ifdef LOCAL
freopen("demo.in", "r", stdin);
freopen("demo.out", "w", stdout);
#endif
}
bool sortdes(const pair<int, int> &a, const pair<int, int> &b) {
return a.ss < b.ss;
}
bool sortasc(const pair<int, int> &a, const pair<int, int> &b) {
return a.ss > b.ss;
}
int gcd(int x, int y) { return __gcd(x, y); }
lld fact(lld n);
lld nCr(lld n, lld r) { return fact(n) / (fact(r) * fact(n - r)); }
lld fact(lld n) {
lld res = 1;
for (lld i = 2; i <= n; i++)
res = res * i;
return res;
}
// const int maxi = 1e6+10;
// vector<int> v[maxi];
// long long a[maxi];
// void dfs(int x,int y){
// a[x]+=a[y];
// for(int i:v[x]){
// if(i!=y){
// dfs(i,x);
// }
// }
// }
void test_case() {
int n;
cin >> n;
// vector<string> v;
unordered_map<string, int> ump;
for (int i = 0; i < n; ++i) {
string temp;
cin >> temp;
sort(temp.begin(), temp.end());
ump[temp]++;
}
// for(auto x:ump){
// cout<<x.ff<<" "<<x.ss<<endl;
// }
lld sum = 0;
for (auto x : ump) {
sum += ((x.ss) * (x.ss - 1)) / 2;
}
test(sum);
// int cnt=0;
// for(int i=0;i<n;++i){
// for(int j=i+1;j<n;++j){
// if(v[i]==v[j]){
// ++cnt;
// }
// }
// }
// test(cnt);
}
int main() {
fastio;
file();
int T = 1;
// int T;
// cin>>T;
for (int nr = 1; nr <= T; ++nr) {
// cout<<"Case #"<<nr<<": ";
test_case();
}
} | #include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define M 1000000007
#define fors(i, n) for (int i = 0; i < n; ++i)
#define fore(i, a, b) for (int i = a; i <= b; ++i)
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define vv vector<int>
#define endl "\n"
#define test(i) cout << i << endl
#define tests(i) cout << "i: " << i << endl;
#define itrt \
int t; \
cin >> t; \
fors(i, t)
#define itr1 \
int t; \
cin >> t;
#define ff first
#define ss second
#define pb push_back
#define vmp make_pair
#define ppb pop_back
#define sorta(a, n) sort(arr, arr + n)
#define sortv(x) sort(x.begin(), x.end())
void file() {
#ifdef LOCAL
freopen("demo.in", "r", stdin);
freopen("demo.out", "w", stdout);
#endif
}
bool sortdes(const pair<int, int> &a, const pair<int, int> &b) {
return a.ss < b.ss;
}
bool sortasc(const pair<int, int> &a, const pair<int, int> &b) {
return a.ss > b.ss;
}
int gcd(int x, int y) { return __gcd(x, y); }
lld fact(lld n);
lld nCr(lld n, lld r) { return fact(n) / (fact(r) * fact(n - r)); }
lld fact(lld n) {
lld res = 1;
for (lld i = 2; i <= n; i++)
res = res * i;
return res;
}
// const int maxi = 1e6+10;
// vector<int> v[maxi];
// long long a[maxi];
// void dfs(int x,int y){
// a[x]+=a[y];
// for(int i:v[x]){
// if(i!=y){
// dfs(i,x);
// }
// }
// }
void test_case() {
int n;
cin >> n;
// vector<string> v;
unordered_map<string, int> ump;
for (int i = 0; i < n; ++i) {
string temp;
cin >> temp;
sort(temp.begin(), temp.end());
ump[temp]++;
}
// for(auto x:ump){
// cout<<x.ff<<" "<<x.ss<<endl;
// }
long long sum = 0;
for (auto x : ump) {
sum += (long long)(x.ss) * (x.ss - 1) / 2;
}
test(sum);
// int cnt=0;
// for(int i=0;i<n;++i){
// for(int j=i+1;j<n;++j){
// if(v[i]==v[j]){
// ++cnt;
// }
// }
// }
// test(cnt);
}
int main() {
fastio;
file();
int T = 1;
// int T;
// cin>>T;
for (int nr = 1; nr <= T; ++nr) {
// cout<<"Case #"<<nr<<": ";
test_case();
}
} | [
"variable_declaration.type.widen.change"
] | 746,483 | 746,482 | u998008108 | cpp |
p02947 | #include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
template <typename T> void fin(T const &t) {
std::cout << t << std::endl;
exit(0);
}
int main() {
std::map<std::string, int> m;
int N;
std::cin >> N;
for (int i = 0; i < N; ++i) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
++m[s];
}
int64_t ans = 0;
for (auto k : m)
ans += k.second * (k.second - 1) / 2;
fin(ans);
return 0;
}
| #include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
template <typename T> void fin(T const &t) {
std::cout << t << std::endl;
exit(0);
}
int main() {
std::map<std::string, int> m;
int N;
std::cin >> N;
for (int i = 0; i < N; ++i) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
++m[s];
}
int64_t ans = 0;
for (auto k : m)
ans += (int64_t)k.second * (k.second - 1) / 2;
fin(ans);
return 0;
}
| [
"type_conversion.add"
] | 746,484 | 746,485 | u294638337 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int main() {
ios::sync_with_stdio(false);
int n;
string str;
int count = 0;
map<string, int> mp;
cin >> n;
vector<string> a(n);
for (int i = 1; i <= n; i++) {
cin >> str;
sort(str.begin(), str.end());
// cout << str << endl;
count += mp[str];
mp[str]++;
}
// for(auto i = mp.begin(); i != mp.end() ; ++i ) {
// count += i->second;
// }
cout << count << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int main() {
ios::sync_with_stdio(false);
int n;
string str;
ll count = 0;
map<string, int> mp;
cin >> n;
vector<string> a(n);
for (int i = 1; i <= n; i++) {
cin >> str;
sort(str.begin(), str.end());
// cout << str << endl;
count += mp[str];
mp[str]++;
}
cout << count << endl;
}
| [
"variable_declaration.type.change"
] | 746,486 | 746,487 | u415671616 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> dic;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
dic[s]++;
}
long long ans = 0;
for (auto val : dic) {
int value = val.second;
ans += (value * (value - 1) / 2);
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, long long int> dic;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
dic[s]++;
}
long long ans = 0;
for (auto val : dic) {
long long int value = val.second;
ans += (value * (value - 1) / 2);
}
cout << ans << endl;
} | [
"variable_declaration.type.widen.change"
] | 746,488 | 746,489 | u384300282 | cpp |
p02947 | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)
int main() {
ll n;
cin >> n;
vector<string> v(n);
ll ans = 0;
rep(i, n) {
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
sort(v.begin(), v.end());
ll memo = 0;
rep(i, n) {
if (i == 0) {
memo++;
} else if (v[i] == v[i - 1]) {
memo++;
} else {
ans += memo * (memo - 1) / 2;
memo = 1;
}
if (i == n - 1) {
ans += memo * (memo - 1) / 2;
}
cout << ans << endl;
}
} | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)
int main() {
ll n;
cin >> n;
vector<string> v(n);
ll ans = 0;
rep(i, n) {
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
sort(v.begin(), v.end());
ll memo = 0;
rep(i, n) {
if (i == 0) {
memo++;
} else if (v[i] == v[i - 1]) {
memo++;
} else {
ans += memo * (memo - 1) / 2;
memo = 1;
}
if (i == n - 1) {
ans += memo * (memo - 1) / 2;
}
}
cout << ans << endl;
}
| [] | 746,490 | 746,491 | u831954260 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
long long ans = 0;
for (auto p : m) {
if (p.second > 1)
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
map<string, long long> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
long long ans = 0;
for (auto p : m) {
if (p.second > 1)
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,492 | 746,493 | u936558609 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
long long ans = 0;
for (auto p : m) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
int main() {
int n;
cin >> n;
map<string, long long> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
long long ans = 0;
for (auto p : m) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,494 | 746,495 | u936558609 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int n = p.second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int n = p.second;
ans += (long long)n * (n - 1) / 2;
}
cout << ans << endl;
} | [
"type_conversion.add"
] | 746,496 | 746,497 | u936558609 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long ans = 0;
for (auto &p : mp) {
int n = p.second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int n = p.second;
ans += (long long)n * (n - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.widen.change"
] | 746,498 | 746,497 | u936558609 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//ใขใใฐใฉใ ใซใชใฃใฆใใใชใใใฝใผใใใใๅใๆๅญใซใชใ
int main() {
//ๅ
ฅๅ
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s.at(i);
//ๅฆ็
rep(i, n) sort(s.at(i).begin(), s.at(i).end()); //ๅๆๅญๅใซใคใใฆใฝใผใ
sort(s.begin(), s.end()); //ๅ
จใฆใฎๆๅญๅใซใคใใฆใฝใผใ
long long ans = 0; // intๅใซๅใพใใชใๅ ดๅใใใ
int cnt = 1;
//้ฃ็ถใใๅใๆๅญๅใๆฐใใ
rep(i, n - 1) {
if (s.at(i) == s.at(i + 1)) {
cnt++;
} else {
ans += cnt * (cnt - 1) /
2; //ๅใๆๅญๅใnๅ็ถใใใใใใ2ๅใใจใ็ตใฟๅใใ
cnt = 1;
}
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//ใขใใฐใฉใ ใซใชใฃใฆใใใชใใใฝใผใใใใๅใๆๅญใซใชใ
int main() {
//ๅ
ฅๅ
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s.at(i);
//ๅฆ็
rep(i, n) sort(s.at(i).begin(), s.at(i).end()); //ๅๆๅญๅใซใคใใฆใฝใผใ
sort(s.begin(), s.end()); //ๅ
จใฆใฎๆๅญๅใซใคใใฆใฝใผใ
long long ans = 0; // intๅใซๅใพใใชใๅ ดๅใใใ
long long cnt = 1;
//้ฃ็ถใใๅใๆๅญๅใๆฐใใ
rep(i, n - 1) {
if (s.at(i) == s.at(i + 1)) {
cnt++;
} else {
ans += cnt * (cnt - 1) /
2; //ๅใๆๅญๅใnๅ็ถใใใใใใ2ๅใใจใ็ตใฟๅใใ
cnt = 1;
}
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,499 | 746,500 | u474760662 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
int res = 0;
unordered_map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
res += mp[s]++;
}
cout << res << '\n';
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
int64_t res = 0;
unordered_map<string, int64_t> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
res += mp[s]++;
}
cout << res << '\n';
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 746,501 | 746,502 | u782098901 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
map<string, ll> cnt;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
cnt[s]++;
}
ll ans = 0;
for (pair<string, ll> p : cnt) {
ans += p.second * (p.second - 1);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
map<string, ll> cnt;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
cnt[s]++;
}
ll ans = 0;
for (pair<string, ll> p : cnt) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"assignment.change"
] | 746,503 | 746,504 | u656771711 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
map<string, ll> cnt;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
cnt[s]++;
}
ll ans = 0;
for (pair<string, int> p : cnt) {
ans += p.second * (p.second - 1);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
map<string, ll> cnt;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
cnt[s]++;
}
ll ans = 0;
for (pair<string, ll> p : cnt) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"assignment.change"
] | 746,505 | 746,504 | u656771711 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
int k = x.second;
ans += k * (k - 1) / 2;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
int k = x.second;
ans += (ll)k * (k - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"type_conversion.add"
] | 746,508 | 746,509 | u074488832 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vin = vector<int>;
using vll = vector<long long>;
using vvin = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vstr = vector<string>;
using vvstr = vector<vector<string>>;
using vch = vector<char>;
using vvch = vector<vector<char>>;
using vbo = vector<bool>;
using vvbo = vector<vector<bool>>;
using vpii = vector<pair<int, int>>;
using pqsin = priority_queue<int, vector<int>, greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(), v.end()
#define decp(n) cout << fixed << setprecision((int)n)
#define _GLIBCXX_DEBUG
const int inf = 1e9 + 7;
int main() {
int n;
cin >> n;
vstr s(n + 1);
rep(i, n) cin >> s[i];
s[n] = "zzzzzzzzzzzzzzzzzzzzzzzzz";
rep(i, n) sort(all(s[i]));
sort(all(s));
int sum = 0;
int tmp = 1;
rep(i, n) {
if (s[i] == s[i + 1])
tmp++;
else {
sum += tmp * (tmp - 1) / 2;
tmp = 1;
}
}
cout << sum << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vin = vector<int>;
using vll = vector<long long>;
using vvin = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vstr = vector<string>;
using vvstr = vector<vector<string>>;
using vch = vector<char>;
using vvch = vector<vector<char>>;
using vbo = vector<bool>;
using vvbo = vector<vector<bool>>;
using vpii = vector<pair<int, int>>;
using pqsin = priority_queue<int, vector<int>, greater<int>>;
#define mp make_pair
#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++)
#define all(v) v.begin(), v.end()
#define decp(n) cout << fixed << setprecision((int)n)
#define _GLIBCXX_DEBUG
const int inf = 1e9 + 7;
int main() {
int n;
cin >> n;
vstr s(n + 1);
rep(i, n) cin >> s[i];
s[n] = "zzzzzzzzzzzzzzzzzzzzzzzzz";
rep(i, n) sort(all(s[i]));
sort(all(s));
ll sum = 0;
ll tmp = 1;
rep(i, n) {
if (s[i] == s[i + 1])
tmp++;
else {
sum += tmp * (tmp - 1) / 2;
tmp = 1;
}
}
cout << sum << endl;
} | [
"variable_declaration.type.change"
] | 746,510 | 746,511 | u919867411 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d", &x)
#define scll(x) scanf("%lld", &x)
int main() {
ll n, ans = 0;
scll(n);
map<string, int> mp;
string s;
rep(i, 0, n) {
cin >> s;
sort(s.begin(), s.end());
++mp[s];
}
for (const auto &x : mp) {
if (x.second == 1)
continue;
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d", &x)
#define scll(x) scanf("%lld", &x)
int main() {
ll n, ans = 0;
scll(n);
map<string, ll> mp;
string s;
rep(i, 0, n) {
cin >> s;
sort(s.begin(), s.end());
++mp[s];
}
for (const auto &x : mp) {
if (x.second == 1)
continue;
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | [] | 746,512 | 746,513 | u920543723 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
map<string, int> m;
rep(i, N) {
string x;
cin >> x;
sort(x.begin(), x.end());
m[x]++;
}
long long ans = 0;
for (auto p : m) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
long long N;
cin >> N;
map<string, long long> m;
rep(i, N) {
string x;
cin >> x;
sort(x.begin(), x.end());
m[x]++;
}
long long ans = 0;
for (auto p : m) {
ans += p.second * (p.second - 1) / 2LL;
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"literal.number.type.widen.change"
] | 746,514 | 746,515 | u093973314 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
int main() {
map<string, int> m;
int n;
cin >> n;
string s;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto i = m.begin(); i != m.end(); i++) {
ans += (i->second * (i->second - 1) / 2);
}
co(ans);
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
int main() {
map<string, ll> m;
int n;
cin >> n;
string s;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto i = m.begin(); i != m.end(); i++) {
ans += (i->second * (i->second - 1) / 2);
}
co(ans);
}
| [] | 746,516 | 746,517 | u789075914 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> P;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
map<string, int> m;
for (int i = 0; i < n; i++) {
sort(s[i].begin(), s[i].end());
m[s[i]]++;
}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); it++) {
ans += (it->second) * (it->second - 1) / 2;
}
cout << ans << endl;
} | #include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> P;
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
map<string, ll> m;
for (int i = 0; i < n; i++) {
sort(s[i].begin(), s[i].end());
m[s[i]]++;
}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); it++) {
ans += (it->second) * (it->second - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.change"
] | 746,518 | 746,519 | u225474226 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s[i];
}
int ans = 0;
for (int i = 0; i < n; i++) {
string ss = s[i];
sort(ss.begin(), ss.end());
ans += mp[ss];
mp[ss]++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s[i];
}
ll ans = 0;
for (int i = 0; i < n; i++) {
string ss = s[i];
sort(ss.begin(), ss.end());
ans += mp[ss];
mp[ss]++;
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 746,522 | 746,523 | u167755809 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(int argc, char *argv[]) {
int N;
cin >> N;
map<string, int> m;
for (int i = 0; i < N; ++i) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
if (m.find(tmp) == m.end())
m[tmp] = 0;
++m[tmp];
}
int ret = 0;
for (map<string, int>::iterator i = m.begin(); i != m.end(); ++i) {
if (i->second == 1)
continue;
ret += i->second * (i->second - 1) / 2;
}
cout << ret << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(int argc, char *argv[]) {
int N;
cin >> N;
map<string, long long> m;
for (int i = 0; i < N; ++i) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
if (m.find(tmp) == m.end())
m[tmp] = 0;
++m[tmp];
}
long long ret = 0;
for (map<string, long long>::iterator i = m.begin(); i != m.end(); ++i) {
if (i->second == 1)
continue;
ret += i->second * (i->second - 1) / 2;
}
cout << ret << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"control_flow.loop.for.initializer.change"
] | 746,524 | 746,525 | u894471318 | cpp |
p02947 | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(), a.end()
#define rall(a) (a).rbegin(), (a).rend()
#define PI 3.14159265359
#define mod 1000000007
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define B vector<bool>
#define endl '\n'
using namespace std;
using graph = vector<vector<ll>>;
const ll MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// ใใผใใซใไฝใๅๅฆ็
void cominit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// mod. m ใงใฎ a ใฎ้ๅ
a^{-1} ใ่จ็ฎใใ
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// ไบ้
ไฟๆฐ่จ็ฎnCk,n<=10^7,k<=10^7ใพใง
ll com(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
//ไบ้
ไฟๆฐnCk,n<=10^9,k<=10^7ใพใง
ll com2(ll n, ll k) {
ll res, bs = 1, bb = 1;
for (ll i = 0; i < k; i++) {
bs = (bs * (n - i)) % mod;
bb = (bb * (i + 1)) % mod;
}
res = modinv(bb, mod) % mod;
res = (res * bs) % mod;
return res;
}
// ไบ้
ไฟๆฐ่จ็ฎnPk
ll per(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[n - k] % MOD) % MOD;
}
/* ใฆใผใฏใชใใใฎไบ้คๆณ ๆๅคงๅ
ฌ็ดๆฐ*/
/*ll gcd(ll a, ll b)
{
return b ? gcd(b, a % b) : a;
}*/
/*ๆๅฐๅ
ฌๅๆฐ*/
/*
ll lcm(ll a, ll b)
{
return a / gcd(a, b) * b;
}*/
/*ไบ็น้ใฎ่ท้ข*/
double dist(pair<double, double> a, pair<double, double> b) {
return sqrt(pow((a.first - b.first), 2) + pow((a.second - b.second), 2));
}
//็นฐใ่ฟใ่ชไนๆณ
double ism(double aa, ll p) {
double ap = aa;
double ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { //ๅฅๆฐใ็
ans *= ap;
}
p /= 2;
ap = ap * ap;
}
return ans;
}
//็นฐใ่ฟใ่ชไนๆณ(ใขใใชใใชใใผใธใงใณ)
ll ismm(ll aa, ll p) {
ll ap = aa;
ll ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { //ๅฅๆฐใ็
ans = (ans * ap) % mod;
}
p /= 2;
ap = (ap * ap) % mod;
}
return ans;
}
struct UnionFind {
vector<ll> par;
UnionFind(ll n) : par(n, -1) {}
ll root(ll x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(ll x, ll y) { return root(x) == root(y); }
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) { return -par[root(x)]; }
};
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator++(auto) noexcept {
++a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator--(auto) noexcept {
--a;
if (a < 0) {
a += Modulus;
}
return *this;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
//ๅฐๆฐ็น12ๆก
struct all_init {
all_init() { cout << fixed << setprecision(9); }
} All_init;
int main() {
ll n, sum = 0;
cin >> n;
cominit();
vector<string> s(n);
rep(i, 0, n) { cin >> s[i]; }
rep(i, 0, n) { sort(all(s[i])); }
sort(all(s));
map<string, ll> mp;
rep(i, 0, n) { mp[s[i]]++; }
for (auto x : mp) {
if (x.second >= 2) {
sum += (x.second * x.second - 1) / 2;
}
}
cout << sum << endl;
}
| #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(), a.end()
#define rall(a) (a).rbegin(), (a).rend()
#define PI 3.14159265359
#define mod 1000000007
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define B vector<bool>
#define endl '\n'
using namespace std;
using graph = vector<vector<ll>>;
const ll MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// ใใผใใซใไฝใๅๅฆ็
void cominit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// mod. m ใงใฎ a ใฎ้ๅ
a^{-1} ใ่จ็ฎใใ
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// ไบ้
ไฟๆฐ่จ็ฎnCk,n<=10^7,k<=10^7ใพใง
ll com(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
//ไบ้
ไฟๆฐnCk,n<=10^9,k<=10^7ใพใง
ll com2(ll n, ll k) {
ll res, bs = 1, bb = 1;
for (ll i = 0; i < k; i++) {
bs = (bs * (n - i)) % mod;
bb = (bb * (i + 1)) % mod;
}
res = modinv(bb, mod) % mod;
res = (res * bs) % mod;
return res;
}
// ไบ้
ไฟๆฐ่จ็ฎnPk
ll per(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[n - k] % MOD) % MOD;
}
/* ใฆใผใฏใชใใใฎไบ้คๆณ ๆๅคงๅ
ฌ็ดๆฐ*/
/*ll gcd(ll a, ll b)
{
return b ? gcd(b, a % b) : a;
}*/
/*ๆๅฐๅ
ฌๅๆฐ*/
/*
ll lcm(ll a, ll b)
{
return a / gcd(a, b) * b;
}*/
/*ไบ็น้ใฎ่ท้ข*/
double dist(pair<double, double> a, pair<double, double> b) {
return sqrt(pow((a.first - b.first), 2) + pow((a.second - b.second), 2));
}
//็นฐใ่ฟใ่ชไนๆณ
double ism(double aa, ll p) {
double ap = aa;
double ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { //ๅฅๆฐใ็
ans *= ap;
}
p /= 2;
ap = ap * ap;
}
return ans;
}
//็นฐใ่ฟใ่ชไนๆณ(ใขใใชใใชใใผใธใงใณ)
ll ismm(ll aa, ll p) {
ll ap = aa;
ll ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { //ๅฅๆฐใ็
ans = (ans * ap) % mod;
}
p /= 2;
ap = (ap * ap) % mod;
}
return ans;
}
struct UnionFind {
vector<ll> par;
UnionFind(ll n) : par(n, -1) {}
ll root(ll x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(ll x, ll y) { return root(x) == root(y); }
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) { return -par[root(x)]; }
};
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator++(auto) noexcept {
++a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator--(auto) noexcept {
--a;
if (a < 0) {
a += Modulus;
}
return *this;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
//ๅฐๆฐ็น12ๆก
struct all_init {
all_init() { cout << fixed << setprecision(9); }
} All_init;
int main() {
ll n, sum = 0;
cin >> n;
// cominit();
vector<string> s(n);
rep(i, 0, n) { cin >> s[i]; }
rep(i, 0, n) { sort(all(s[i])); }
sort(all(s));
map<string, ll> mp;
rep(i, 0, n) { mp[s[i]]++; }
for (auto x : mp) {
if (x.second >= 2) {
sum += x.second * (x.second - 1) / 2;
}
}
cout << sum << endl;
}
| [
"call.remove"
] | 746,526 | 746,527 | u553461888 | cpp |
p02947 | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(), a.end()
#define rall(a) (a).rbegin(), (a).rend()
#define PI 3.14159265359
#define mod 1000000007
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define B vector<bool>
#define endl '\n'
using namespace std;
using graph = vector<vector<ll>>;
const ll MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// ใใผใใซใไฝใๅๅฆ็
void cominit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// mod. m ใงใฎ a ใฎ้ๅ
a^{-1} ใ่จ็ฎใใ
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// ไบ้
ไฟๆฐ่จ็ฎnCk,n<=10^7,k<=10^7ใพใง
ll com(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
//ไบ้
ไฟๆฐnCk,n<=10^9,k<=10^7ใพใง
ll com2(ll n, ll k) {
ll res, bs = 1, bb = 1;
for (ll i = 0; i < k; i++) {
bs = (bs * (n - i)) % mod;
bb = (bb * (i + 1)) % mod;
}
res = modinv(bb, mod) % mod;
res = (res * bs) % mod;
return res;
}
// ไบ้
ไฟๆฐ่จ็ฎnPk
ll per(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[n - k] % MOD) % MOD;
}
/* ใฆใผใฏใชใใใฎไบ้คๆณ ๆๅคงๅ
ฌ็ดๆฐ*/
/*ll gcd(ll a, ll b)
{
return b ? gcd(b, a % b) : a;
}*/
/*ๆๅฐๅ
ฌๅๆฐ*/
/*
ll lcm(ll a, ll b)
{
return a / gcd(a, b) * b;
}*/
/*ไบ็น้ใฎ่ท้ข*/
double dist(pair<double, double> a, pair<double, double> b) {
return sqrt(pow((a.first - b.first), 2) + pow((a.second - b.second), 2));
}
//็นฐใ่ฟใ่ชไนๆณ
double ism(double aa, ll p) {
double ap = aa;
double ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { //ๅฅๆฐใ็
ans *= ap;
}
p /= 2;
ap = ap * ap;
}
return ans;
}
//็นฐใ่ฟใ่ชไนๆณ(ใขใใชใใชใใผใธใงใณ)
ll ismm(ll aa, ll p) {
ll ap = aa;
ll ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { //ๅฅๆฐใ็
ans = (ans * ap) % mod;
}
p /= 2;
ap = (ap * ap) % mod;
}
return ans;
}
struct UnionFind {
vector<ll> par;
UnionFind(ll n) : par(n, -1) {}
ll root(ll x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(ll x, ll y) { return root(x) == root(y); }
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) { return -par[root(x)]; }
};
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator++(auto) noexcept {
++a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator--(auto) noexcept {
--a;
if (a < 0) {
a += Modulus;
}
return *this;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
//ๅฐๆฐ็น12ๆก
struct all_init {
all_init() { cout << fixed << setprecision(9); }
} All_init;
int main() {
ll n, sum = 0;
cin >> n;
cominit();
vector<string> s(n);
rep(i, 0, n) { cin >> s[i]; }
rep(i, 0, n) { sort(all(s[i])); }
sort(all(s));
map<string, ll> mp;
rep(i, 0, n) { mp[s[i]]++; }
for (auto x : mp) {
if (x.second >= 2) {
sum += (x.second * x.second - 1) / 2;
}
}
cout << sum << endl;
}
| #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(), a.end()
#define rall(a) (a).rbegin(), (a).rend()
#define PI 3.14159265359
#define mod 1000000007
#define P pair<ll, ll>
#define V vector<ll>
#define C vector<char>
#define B vector<bool>
#define endl '\n'
using namespace std;
using graph = vector<vector<ll>>;
const ll MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// ใใผใใซใไฝใๅๅฆ็
void cominit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// mod. m ใงใฎ a ใฎ้ๅ
a^{-1} ใ่จ็ฎใใ
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// ไบ้
ไฟๆฐ่จ็ฎnCk,n<=10^7,k<=10^7ใพใง
ll com(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
//ไบ้
ไฟๆฐnCk,n<=10^9,k<=10^7ใพใง
ll com2(ll n, ll k) {
ll res, bs = 1, bb = 1;
for (ll i = 0; i < k; i++) {
bs = (bs * (n - i)) % mod;
bb = (bb * (i + 1)) % mod;
}
res = modinv(bb, mod) % mod;
res = (res * bs) % mod;
return res;
}
// ไบ้
ไฟๆฐ่จ็ฎnPk
ll per(ll n, ll k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[n - k] % MOD) % MOD;
}
/* ใฆใผใฏใชใใใฎไบ้คๆณ ๆๅคงๅ
ฌ็ดๆฐ*/
/*ll gcd(ll a, ll b)
{
return b ? gcd(b, a % b) : a;
}*/
/*ๆๅฐๅ
ฌๅๆฐ*/
/*
ll lcm(ll a, ll b)
{
return a / gcd(a, b) * b;
}*/
/*ไบ็น้ใฎ่ท้ข*/
double dist(pair<double, double> a, pair<double, double> b) {
return sqrt(pow((a.first - b.first), 2) + pow((a.second - b.second), 2));
}
//็นฐใ่ฟใ่ชไนๆณ
double ism(double aa, ll p) {
double ap = aa;
double ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { //ๅฅๆฐใ็
ans *= ap;
}
p /= 2;
ap = ap * ap;
}
return ans;
}
//็นฐใ่ฟใ่ชไนๆณ(ใขใใชใใชใใผใธใงใณ)
ll ismm(ll aa, ll p) {
ll ap = aa;
ll ans = 1;
while (p > 0) {
// cout<<"p="<<p<<",ap="<<ap<<endl;
if (p & 1) { //ๅฅๆฐใ็
ans = (ans * ap) % mod;
}
p /= 2;
ap = (ap * ap) % mod;
}
return ans;
}
struct UnionFind {
vector<ll> par;
UnionFind(ll n) : par(n, -1) {}
ll root(ll x) {
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(ll x, ll y) { return root(x) == root(y); }
bool merge(ll x, ll y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) { return -par[root(x)]; }
};
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator++(auto) noexcept {
++a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator--(auto) noexcept {
--a;
if (a < 0) {
a += Modulus;
}
return *this;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
//ๅฐๆฐ็น12ๆก
struct all_init {
all_init() { cout << fixed << setprecision(9); }
} All_init;
int main() {
ll n, sum = 0;
cin >> n;
cominit();
vector<string> s(n);
rep(i, 0, n) { cin >> s[i]; }
rep(i, 0, n) { sort(all(s[i])); }
sort(all(s));
map<string, ll> mp;
rep(i, 0, n) { mp[s[i]]++; }
for (auto x : mp) {
if (x.second >= 2) {
sum += (x.second * (x.second - 1)) / 2;
}
}
cout << sum << endl;
}
| [] | 746,526 | 746,528 | u553461888 | cpp |
p02947 | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexedๆ้
int main() {
int N;
cin >> N;
map<string, int> MAP;
rep(i, N) {
string s;
cin >> s;
sort(begin(s), end(s));
MAP[s]++;
}
ll cnt = 0;
for (auto &x : MAP) {
if (x.second > 1) {
cnt += (x.second * (x.second - 1)) / 2;
}
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
#include <iostream>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexedๆ้
int main() {
int N;
cin >> N;
map<string, int> MAP;
rep(i, N) {
string s;
cin >> s;
sort(begin(s), end(s));
MAP[s]++;
}
ll cnt = 0;
for (auto &x : MAP) {
if (x.second > 1) {
cnt += ((ll)x.second * (x.second - 1)) / 2;
}
}
cout << cnt << endl;
}
| [
"type_conversion.add"
] | 746,531 | 746,532 | u823855263 | cpp |
p02947 | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int counter(int x) {
if (x == 0)
return 0;
return counter(x >> 1) + (x & 1);
}
ll nC2(ll n) {
if (n < 2)
return 0;
return n * (n - 1) / 2;
}
void solve() {
// remove the bottom 3 lines when you submit this code.
std::ifstream in("sample.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, ll> anag;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
if (anag.count(s)) {
anag[s]++;
} else {
anag.emplace(s, 1);
}
}
int ans = 0;
for (auto itr = anag.begin(); itr != anag.end(); itr++) {
ans += nC2(itr->second);
}
cout << ans << endl;
}
signed main() {
solve();
return 0;
}
| #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int counter(int x) {
if (x == 0)
return 0;
return counter(x >> 1) + (x & 1);
}
ll nC2(ll n) {
if (n < 2)
return 0;
return n * (n - 1) / 2;
}
void solve() {
// remove the bottom 3 lines when you submit this code.
std::ifstream in("sample.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, ll> anag;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
if (anag.count(s)) {
anag[s]++;
} else {
anag.emplace(s, 1);
}
}
ll ans = 0;
for (auto itr = anag.begin(); itr != anag.end(); itr++) {
ans += nC2(itr->second);
}
cout << ans << endl;
}
signed main() {
solve();
return 0;
}
| [
"variable_declaration.type.change"
] | 746,535 | 746,536 | u914047482 | cpp |
p02947 | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int counter(int x) {
if (x == 0)
return 0;
return counter(x >> 1) + (x & 1);
}
ll nC2(ll n) {
if (n < 2)
return 0;
return n * (n - 1) / 2;
}
void solve() {
// remove the bottom 3 lines when you submit this code.
std::ifstream in("sample.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> anag;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
if (anag.count(s)) {
anag[s]++;
} else {
anag.emplace(s, 1);
}
}
int ans = 0;
for (auto itr = anag.begin(); itr != anag.end(); itr++) {
ans += nC2(itr->second);
}
cout << ans << endl;
}
signed main() {
solve();
return 0;
}
| #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int counter(int x) {
if (x == 0)
return 0;
return counter(x >> 1) + (x & 1);
}
ll nC2(ll n) {
if (n < 2)
return 0;
return n * (n - 1) / 2;
}
void solve() {
// remove the bottom 3 lines when you submit this code.
std::ifstream in("sample.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, ll> anag;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
if (anag.count(s)) {
anag[s]++;
} else {
anag.emplace(s, 1);
}
}
ll ans = 0;
for (auto itr = anag.begin(); itr != anag.end(); itr++) {
ans += nC2(itr->second);
}
cout << ans << endl;
}
signed main() {
solve();
return 0;
}
| [
"variable_declaration.type.change"
] | 746,537 | 746,536 | u914047482 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
int n;
cin >> n;
int res = 0;
unordered_map<string, int> count;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
res += count[s];
count[s]++;
}
cout << res << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
int n;
cin >> n;
long res = 0;
unordered_map<string, int> count;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
res += count[s];
count[s]++;
}
cout << res << endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 746,538 | 746,539 | u213143275 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
// cin.tie(0);
// ios::sync_with_stdio(false);
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
for (int i = 0; i < N; i++) {
// cout << s[i] << '\n';
}
long long ret = 0;
int streak = 1;
for (int i = 1; i < N; i++) {
if (s[i] == s[i - 1]) {
streak++;
} else {
ret += streak * (streak - 1) / 2;
streak = 1;
}
}
ret += streak * (streak - 1) / 2;
cout << ret;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
// cin.tie(0);
// ios::sync_with_stdio(false);
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
for (int i = 0; i < N; i++) {
// cout << s[i] << '\n';
}
long long ret = 0;
long long streak = 1;
for (int i = 1; i < N; i++) {
if (s[i] == s[i - 1]) {
streak++;
} else {
ret += streak * (streak - 1) / 2;
streak = 1;
}
}
ret += streak * (streak - 1) / 2;
cout << ret;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,544 | 746,545 | u603067482 | cpp |
p02947 | #include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for (int i = a; i < b; i++)
int main() {
int n;
cin >> n;
int count = 0;
map<string, int> data;
vector<string> s(n);
queue<string> q;
rep(i, 0, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (data[s[i]] == 0)
q.push(s[i]);
data[s[i]]++;
}
while (!q.empty()) {
string str = q.front();
if (data[str] > 1) {
int x = data[str];
x *= (x - 1);
x /= 2;
count += x;
}
q.pop();
}
cout << count << endl;
return 0;
}
| #include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for (int i = a; i < b; i++)
int main() {
int n;
cin >> n;
ll count = 0;
map<string, int> data;
vector<string> s(n);
queue<string> q;
rep(i, 0, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (data[s[i]] == 0)
q.push(s[i]);
data[s[i]]++;
}
while (!q.empty()) {
string str = q.front();
if (data[str] > 1) {
ll x = data[str];
x *= (x - 1);
x /= 2;
count += x;
}
q.pop();
}
cout << count << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 746,546 | 746,547 | u870074807 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \
c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef DEBBY
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define rep(i, a, b) for (int i = int(a); i <= int(b); i++)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define pi pair<int, int>
#define vi vector<int>
#define vpi vector<pi>
#define fs first
#define sd second
#define pb push_back
int comb(int n) { return n * (n - 1) / 2; }
void solve() {
int n;
cin >> n;
map<string, int> m;
rep(i, 1, n) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
int count = 0;
for (auto q : m) {
count += comb(q.second);
}
cout << count;
debug() << imie(m);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \
c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef DEBBY
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define rep(i, a, b) for (int i = int(a); i <= int(b); i++)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define pi pair<int, int>
#define vi vector<int>
#define vpi vector<pi>
#define fs first
#define sd second
#define pb push_back
ll comb(ll n) { return n * (n - 1) / 2; }
void solve() {
int n;
cin >> n;
map<string, int> m;
rep(i, 1, n) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
ll count = 0LL;
for (auto q : m) {
count += comb(q.second);
}
cout << count;
debug() << imie(m);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}
| [
"variable_declaration.type.change",
"literal.number.type.widen.change"
] | 746,548 | 746,549 | u967963596 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PB push_back
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
multiset<map<char, int>> fs;
set<map<char, int>> unq;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
map<char, int> f;
for (auto j : s)
f[j]++;
fs.insert(f);
unq.insert(f);
}
int ans = 0;
for (auto i : unq) {
int c = fs.count(i);
ans += c * (c - 1) / 2;
}
cout << ans << "\n";
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PB push_back
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
multiset<map<char, int>> fs;
set<map<char, int>> unq;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
map<char, int> f;
for (auto j : s)
f[j]++;
fs.insert(f);
unq.insert(f);
}
ll ans = 0;
for (auto i : unq) {
ll c = fs.count(i);
ans += c * (c - 1) / 2;
}
cout << ans << "\n";
} | [
"variable_declaration.type.change"
] | 746,553 | 746,554 | u393879608 | cpp |
p02947 | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <ciso646>
#include <cmath>
#include <complex>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;
#define stop \
char nyaa; \
cin >> nyaa;
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define Rep(i, sta, n) for (int i = sta; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define per1(i, n) for (int i = n; i >= 1; i--)
#define Rep1(i, sta, n) for (int i = sta; i <= n; i++)
#define all(v) (v).begin(), (v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
// int qp(int a,ll b){int
// ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a, ll b, int mo) {
int ans = 1;
do {
if (b & 1)
ans = 1ll * ans * a % mo;
a = 1ll * a * a % mo;
} while (b >>= 1);
return ans;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } // ๆๅคงๅ
ฌ็ดๆฐ
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } // ๆๅฐๅ
ฌๅๆฐ
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
for (auto &v : vec)
is >> v;
return is;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "[";
for (auto v : vec)
os << v << ",";
os << "]";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) {
os << "deq[";
for (auto v : vec)
os << v << ",";
os << "]";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &vec) {
os << "{";
for (auto v : vec)
os << v << ",";
os << "}";
return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &vec) {
os << "{";
for (auto v : vec)
os << v << ",";
os << "}";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &vec) {
os << "{";
for (auto v : vec)
os << v << ",";
os << "}";
return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) {
os << "{";
for (auto v : vec)
os << v << ",";
os << "}";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &pa) {
os << "(" << pa.first << "," << pa.second << ")";
return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &mp) {
os << "{";
for (auto v : mp)
os << v.first << "=>" << v.second << ",";
os << "}";
return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp) {
os << "{";
for (auto v : mp)
os << v.first << "=>" << v.second << ",";
os << "}";
return os;
}
template <typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template <typename T, typename... Args>
void ndarray(vector<T> &vec, int len, Args... args) {
vec.resize(len);
for (auto &v : vec)
ndarray(v, args...);
}
template <typename T> bool chmax(T &m, const T q) {
if (m < q) {
m = q;
return true;
} else
return false;
}
template <typename T> bool chmin(T &m, const T q) {
if (q < m) {
m = q;
return true;
} else
return false;
}
template <typename T1, typename T2>
pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) {
return make_pair(l.first + r.first, l.second + r.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) {
return make_pair(l.first - r.first, l.second - r.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator<(const pair<T1, T2> l, const pair<T1, T2> r) {
return (l.first < r.first);
}
template <typename T1, typename T2>
pair<T1, T2> operator>(const pair<T1, T2> l, const pair<T1, T2> r) {
return (l.first > r.first);
}
void solve() {
ll N;
cin >> N;
map<map<char, int>, int> co;
rep(i, N) {
string s;
cin >> s;
map<char, int> num;
for (auto c : s)
num[c]++;
co[num]++;
}
ll ans = 0;
for (auto a : co)
ans += a.second * (a.second - 1) / 2;
cout << ans << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
std::cout << fixed << setprecision(10);
solve();
// stop
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <ciso646>
#include <cmath>
#include <complex>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;
#define stop \
char nyaa; \
cin >> nyaa;
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define Rep(i, sta, n) for (int i = sta; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define per1(i, n) for (int i = n; i >= 1; i--)
#define Rep1(i, sta, n) for (int i = sta; i <= n; i++)
#define all(v) (v).begin(), (v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
// int qp(int a,ll b){int
// ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a, ll b, int mo) {
int ans = 1;
do {
if (b & 1)
ans = 1ll * ans * a % mo;
a = 1ll * a * a % mo;
} while (b >>= 1);
return ans;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } // ๆๅคงๅ
ฌ็ดๆฐ
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } // ๆๅฐๅ
ฌๅๆฐ
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
for (auto &v : vec)
is >> v;
return is;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "[";
for (auto v : vec)
os << v << ",";
os << "]";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) {
os << "deq[";
for (auto v : vec)
os << v << ",";
os << "]";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &vec) {
os << "{";
for (auto v : vec)
os << v << ",";
os << "}";
return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &vec) {
os << "{";
for (auto v : vec)
os << v << ",";
os << "}";
return os;
}
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &vec) {
os << "{";
for (auto v : vec)
os << v << ",";
os << "}";
return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) {
os << "{";
for (auto v : vec)
os << v << ",";
os << "}";
return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &pa) {
os << "(" << pa.first << "," << pa.second << ")";
return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &mp) {
os << "{";
for (auto v : mp)
os << v.first << "=>" << v.second << ",";
os << "}";
return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp) {
os << "{";
for (auto v : mp)
os << v.first << "=>" << v.second << ",";
os << "}";
return os;
}
template <typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template <typename T, typename... Args>
void ndarray(vector<T> &vec, int len, Args... args) {
vec.resize(len);
for (auto &v : vec)
ndarray(v, args...);
}
template <typename T> bool chmax(T &m, const T q) {
if (m < q) {
m = q;
return true;
} else
return false;
}
template <typename T> bool chmin(T &m, const T q) {
if (q < m) {
m = q;
return true;
} else
return false;
}
template <typename T1, typename T2>
pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) {
return make_pair(l.first + r.first, l.second + r.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) {
return make_pair(l.first - r.first, l.second - r.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator<(const pair<T1, T2> l, const pair<T1, T2> r) {
return (l.first < r.first);
}
template <typename T1, typename T2>
pair<T1, T2> operator>(const pair<T1, T2> l, const pair<T1, T2> r) {
return (l.first > r.first);
}
void solve() {
ll N;
cin >> N;
map<map<char, ll>, ll> co;
rep(i, N) {
string s;
cin >> s;
map<char, ll> num;
for (auto c : s)
num[c]++;
co[num]++;
}
ll ans = 0;
for (auto a : co)
ans += a.second * (a.second - 1) / 2;
cout << ans << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
std::cout << fixed << setprecision(10);
solve();
// stop
return 0;
} | [] | 746,555 | 746,556 | u114137758 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <stdio.h>
using namespace std;
/*
https://atcoder.jp/contests/abc137/tasks/abc137_c
ๆๅญๅใฝใผใใใฆใ้
ๅใใจใฝใผใใใฆใๆฏในใฆใใ
*/
int main() {
int N, count = 0;
string temp;
map<string, long long> mp;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> temp;
sort(temp.begin(), temp.end());
mp[temp]++;
}
for (auto x : mp) {
count += (x.second * (x.second - 1)) / 2;
}
cout << count << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <stdio.h>
using namespace std;
/*
https://atcoder.jp/contests/abc137/tasks/abc137_c
ๆๅญๅใฝใผใใใฆใ้
ๅใใจใฝใผใใใฆใๆฏในใฆใใ
*/
int main() {
long int N, count = 0;
string temp;
map<string, long long> mp;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> temp;
sort(temp.begin(), temp.end());
mp[temp]++;
}
for (auto x : mp) {
count += (x.second * (x.second - 1)) / 2;
}
cout << count << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 746,563 | 746,564 | u568426505 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
sort(S.at(i).begin(), S.at(i).end());
}
sort(S.begin(), S.end());
vector<int> A;
int count = 1;
for (int i = 0; i < N - 1; i++) {
if (S.at(i) == S.at(i + 1)) {
count = count + 1;
if (i == N - 2) {
A.push_back(count);
}
} else {
A.push_back(count);
count = 1;
}
}
long long sum = 0;
for (int i = 0; i < A.size(); i++) {
sum = sum + (A.at(i) * (A.at(i) - 1)) / 2;
}
cout << sum << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
sort(S.at(i).begin(), S.at(i).end());
}
sort(S.begin(), S.end());
vector<long long> A;
long long count = 1;
for (int i = 0; i < N - 1; i++) {
if (S.at(i) == S.at(i + 1)) {
count = count + 1;
if (i == N - 2) {
A.push_back(count);
}
} else {
A.push_back(count);
count = 1;
}
}
long long sum = 0;
for (int i = 0; i < A.size(); i++) {
sum = sum + (A.at(i) * (A.at(i) - 1)) / 2;
}
cout << sum << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,565 | 746,566 | u028061225 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
sort(S.at(i).begin(), S.at(i).end());
}
sort(S.begin(), S.end());
vector<long long> A;
long long count = 1;
for (int i = 0; i < N - 1; i++) {
if (S.at(i) == S.at(i + 1)) {
count = count + 1;
if (i == N - 2) {
A.push_back(count);
}
} else {
A.push_back(count);
count = 1;
}
}
long long sum;
for (int i = 0; i < A.size(); i++) {
sum = sum + (A.at(i) * (A.at(i) - 1)) / 2;
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
sort(S.at(i).begin(), S.at(i).end());
}
sort(S.begin(), S.end());
vector<long long> A;
long long count = 1;
for (int i = 0; i < N - 1; i++) {
if (S.at(i) == S.at(i + 1)) {
count = count + 1;
if (i == N - 2) {
A.push_back(count);
}
} else {
A.push_back(count);
count = 1;
}
}
long long sum = 0;
for (int i = 0; i < A.size(); i++) {
sum = sum + (A.at(i) * (A.at(i) - 1)) / 2;
}
cout << sum << endl;
} | [
"variable_declaration.value.change"
] | 746,567 | 746,566 | u028061225 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a = 0;
string s;
map<string, int> m;
cin >> n;
while (n--) {
cin >> s;
sort(s.begin(), s.end());
a += m[s]++;
}
cout << a;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a = 0;
string s;
map<string, int> m;
cin >> n;
while (n--) {
cin >> s;
sort(s.begin(), s.end());
a += m[s]++;
}
cout << a;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,571 | 746,572 | u232429509 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a;
string s;
map<string, int> m;
cin >> n;
while (n--) {
cin >> s;
sort(s.begin(), s.end());
a += m[s]++;
}
cout << a;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a = 0;
string s;
map<string, int> m;
cin >> n;
while (n--) {
cin >> s;
sort(s.begin(), s.end());
a += m[s]++;
}
cout << a;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"variable_declaration.value.change"
] | 746,573 | 746,572 | u232429509 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;
int main() {
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> memo; // {s_N}ใซ็ปๅ ดใใๆๅญๅใจใใฎ็ปๅ ดๅๆฐ
for (int i = 0; i < N; i++) {
if (memo.count(s[i]))
memo[s[i]]++;
else
memo[s[i]] = 1;
}
ll ans = 0LL;
for (auto p : memo) {
auto value = p.second;
ans += value * (value - 1) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;
int main() {
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, ll> memo; // {s_N}ใซ็ปๅ ดใใๆๅญๅใจใใฎ็ปๅ ดๅๆฐ
for (int i = 0; i < N; i++) {
if (memo.count(s[i]))
memo[s[i]]++;
else
memo[s[i]] = 1LL;
}
ll ans = 0LL;
for (auto p : memo) {
auto value = p.second;
ans += value * (value - 1) / 2;
}
cout << ans << endl;
} | [
"literal.number.type.widen.change"
] | 746,574 | 746,575 | u852770206 | cpp |
p02947 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ARB \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define bp __builtin_popcount
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
indexed_set;
const int maxn = 1e5 + 5;
const double EPS = 1e-14;
int main() {
ARB ll n;
cin >> n;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &it : mp) {
int cur = it.second;
ans += (cur * (cur - 1)) / 2;
}
cout << ans;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ARB \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define bp __builtin_popcount
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
indexed_set;
const int maxn = 1e5 + 5;
const double EPS = 1e-14;
int main() {
ARB ll n;
cin >> n;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &it : mp) {
ll cur = it.second;
ans += 1LL * ((cur * (cur - 1)) / 2);
}
cout << ans;
}
| [
"variable_declaration.type.change",
"assignment.change"
] | 746,576 | 746,577 | u973466769 | cpp |
p02947 | //----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
//----------------------------------------------------------------------
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main(void) {
int n;
cin >> n;
vector<string> s(n);
map<string, int> m;
REP(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]]++;
}
ll ans = 0;
for (auto v : m) {
ans += (v.second - 1) * v.second / 2;
}
cout << ans << endl;
return 0;
} | //----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
//----------------------------------------------------------------------
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main(void) {
int n;
cin >> n;
vector<string> s(n);
map<string, ll> m;
REP(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]]++;
}
ll ans = 0;
for (auto v : m) {
ans += (v.second - 1) * v.second / 2;
}
cout << ans << endl;
return 0;
} | [] | 746,580 | 746,581 | u539826121 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s] += 1;
}
ll ans = 0;
for (auto x : mp)
ans += x.second * (x.second - 1) / 2;
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s] += 1;
}
ll ans = 0;
for (auto x : mp)
ans += x.second * (x.second - 1) / 2;
cout << ans << endl;
} | [] | 746,582 | 746,583 | u050087249 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll x) {
if (x == 1)
return 1;
return x * f(x - 1);
}
int main() {
ll n;
cin >> n;
vector<vector<char>> alpha(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < s.size(); j++)
alpha.at(i).push_back(s.at(j));
sort(alpha.at(i).begin(), alpha.at(i).end());
}
sort(alpha.begin(), alpha.end());
ll cnt = 0, i = 0;
vector<ll> x;
while (i < n - 1) {
int j = i + 1, cc = 1;
while (alpha[i] == alpha[j] && j < n) {
cc += 1;
j += 1;
}
cnt += cc * (cc - 1) / 2;
i = j;
}
cout << cnt << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll x) {
if (x == 1)
return 1;
return x * f(x - 1);
}
int main() {
ll n;
cin >> n;
vector<vector<char>> alpha(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < s.size(); j++)
alpha.at(i).push_back(s.at(j));
sort(alpha.at(i).begin(), alpha.at(i).end());
}
sort(alpha.begin(), alpha.end());
ll cnt = 0, i = 0;
vector<ll> x;
while (i < n - 1) {
ll j = i + 1, cc = 1;
while (alpha[i] == alpha[j] && j < n) {
cc += 1;
j += 1;
}
cnt += cc * (cc - 1) / 2;
i = j;
}
cout << cnt << endl;
} | [
"variable_declaration.type.change"
] | 746,584 | 746,585 | u050087249 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using ll = long long;
template <class T> using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;
int main() {
int N;
std::cin >> N;
vt<std::string> s(N);
vt<int> tl(N);
rep(i, N) {
std::string moji;
std::cin >> moji;
sort(moji.begin(), moji.end());
s[i] = moji;
}
sort(s.begin(), s.end());
int k = 0;
for (int i = 0; i < N - 1; i = k) {
for (int j = i + 1; j < N; j++) {
if (s[i] == s[j]) {
tl[i]++;
k = j;
} else {
++k;
break;
}
}
}
ll ans = 0;
rep(i, N) {
if (tl[i] != 0)
ans += (tl[i] + 1) * tl[i] / 2;
}
std::cout << ans << '\n';
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using ll = long long;
template <class T> using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;
int main() {
int N;
std::cin >> N;
vt<std::string> s(N);
vt<ll> tl(N);
rep(i, N) {
std::string moji;
std::cin >> moji;
sort(moji.begin(), moji.end());
s[i] = moji;
}
sort(s.begin(), s.end());
int k = 0;
for (int i = 0; i < N - 1; i = k) {
for (int j = i + 1; j < N; j++) {
if (s[i] == s[j]) {
tl[i]++;
k = j;
} else {
++k;
break;
}
}
}
ll ans = 0;
rep(i, N) {
if (tl[i] != 0)
ans += (tl[i] + 1) * tl[i] / 2;
}
std::cout << ans << '\n';
return 0;
}
| [] | 746,586 | 746,587 | u228943017 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using ll = long long;
template <class T> using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;
int main() {
int N;
std::cin >> N;
vt<std::string> s(N);
vt<int> tl(N);
rep(i, N) {
std::string moji;
std::cin >> moji;
sort(moji.begin(), moji.end());
s[i] = moji;
}
sort(s.begin(), s.end());
int k;
for (int i = 0; i < N - 1; i = k) {
for (int j = i + 1; j < N; j++) {
if (s[i] == s[j]) {
tl[i]++;
k = j;
} else {
++k;
break;
}
}
}
ll ans = 0;
rep(i, N) {
if (tl[i] != 0)
ans += (tl[i] + 1) * tl[i] / 2;
}
std::cout << ans << '\n';
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using ll = long long;
template <class T> using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;
int main() {
int N;
std::cin >> N;
vt<std::string> s(N);
vt<ll> tl(N);
rep(i, N) {
std::string moji;
std::cin >> moji;
sort(moji.begin(), moji.end());
s[i] = moji;
}
sort(s.begin(), s.end());
int k = 0;
for (int i = 0; i < N - 1; i = k) {
for (int j = i + 1; j < N; j++) {
if (s[i] == s[j]) {
tl[i]++;
k = j;
} else {
++k;
break;
}
}
}
ll ans = 0;
rep(i, N) {
if (tl[i] != 0)
ans += (tl[i] + 1) * tl[i] / 2;
}
std::cout << ans << '\n';
return 0;
}
| [
"variable_declaration.value.change"
] | 746,588 | 746,587 | u228943017 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll, int> P;
typedef set<int> S;
ll n;
map<string, int> msi;
int main() {
cin >> n;
// map<string,int> msi;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
msi[s]++;
}
ll sum = 0;
for (auto u : msi) {
sum += (u.second - 1) * u.second / 2;
}
cout << sum << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll, int> P;
typedef set<int> S;
ll n;
map<string, ll> msi;
int main() {
cin >> n;
// map<string,int> msi;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
msi[s]++;
}
ll sum = 0;
for (auto u : msi) {
sum += (u.second - 1) * u.second / 2;
}
cout << sum << endl;
return 0;
} | [] | 746,589 | 746,590 | u418810472 | cpp |
p02947 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) begin(a), end(a)
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1000000007;
const ll mod = 1000000007;
const double PI = 3.14159265358979323846;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int cans(bool f) {
if (f)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
map<string, ll> mp;
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto itr : mp) {
int n = itr.second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) begin(a), end(a)
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1000000007;
const ll mod = 1000000007;
const double PI = 3.14159265358979323846;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int cans(bool f) {
if (f)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
map<string, ll> mp;
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto itr : mp) {
ll n = itr.second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 746,591 | 746,592 | u950174376 | cpp |
p02947 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) begin(a), end(a)
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1000000007;
const ll mod = 1000000007;
const double PI = 3.14159265358979323846;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int cans(bool f) {
if (f)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
map<string, int> mp;
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto itr : mp) {
int n = itr.second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) begin(a), end(a)
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1000000007;
const ll mod = 1000000007;
const double PI = 3.14159265358979323846;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
ll gcd(ll a, ll b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int cans(bool f) {
if (f)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
map<string, ll> mp;
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto itr : mp) {
ll n = itr.second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 746,593 | 746,592 | u950174376 | cpp |
p02947 | #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()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
}
sort(all(s));
vector<int> res;
int cnt = 1;
string now = s.front();
for (int i = 1; i < n; ++i) {
if (s[i] == now)
cnt++;
else {
res.emplace_back(cnt);
cnt = 1;
now = s[i];
}
}
res.emplace_back(cnt);
ll ans = 0;
for (auto &c : res) {
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #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()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
}
sort(all(s));
vector<ll> res;
ll cnt = 1;
string now = s.front();
for (int i = 1; i < n; ++i) {
if (s[i] == now)
cnt++;
else {
res.emplace_back(cnt);
cnt = 1;
now = s[i];
}
}
res.emplace_back(cnt);
ll ans = 0;
for (auto &c : res) {
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 746,594 | 746,595 | u274883254 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
//*rep(i, n) cout << s[i] << endl;*//
sort(s.begin(), s.end());
int ans = 0;
int count = 1;
for (int i = 0; i < n - 1; i++) {
if (s[i] == s[i + 1]) {
count++;
} else {
ans += (count * (count - 1)) / 2;
count = 1;
}
}
if (count != 1) {
ans += (count * (count - 1)) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
//*rep(i, n) cout << s[i] << endl;*//
sort(s.begin(), s.end());
ll ans = 0;
ll count = 1;
for (int i = 0; i < n - 1; i++) {
if (s[i] == s[i + 1]) {
count++;
} else {
ans += (count * (count - 1)) / 2;
count = 1;
}
}
if (count != 1) {
ans += (count * (count - 1)) / 2;
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 746,596 | 746,597 | u274883254 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = int(1e9) + 7;
using V = vector<int>;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string a;
cin >> a;
sort(all(a));
s[i] = a;
}
sort(all(s));
V l;
int co = 1;
rep(i, n) {
if (i == n - 1) {
l.push_back(co);
continue;
}
if (s[i] == s[i + 1])
co++;
else {
l.push_back(co);
co = 1;
}
}
ll ans = 0;
for (int i : l) {
ans += i * (i - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = int(1e9) + 7;
using V = vector<int>;
using P = pair<int, int>;
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string a;
cin >> a;
sort(all(a));
s[i] = a;
}
sort(all(s));
vector<ll> l;
int co = 1;
rep(i, n) {
if (i == n - 1) {
l.push_back(co);
continue;
}
if (s[i] == s[i + 1])
co++;
else {
l.push_back(co);
co = 1;
}
}
ll ans = 0;
for (ll i : l) {
ans += i * (i - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 746,598 | 746,599 | u525008368 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0, cnt = 0;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
for (int i = 0; i < n - 1; i++) {
int a = 0, b = 0;
if (s[i] == s[i + 1]) {
cnt++;
if (i == n - 2) {
cnt++;
a = cnt * (cnt - 1);
b = 2;
ans += a / b;
}
} else {
cnt++;
a = cnt * (cnt - 1);
b = 2;
ans += a / b;
cnt = 0;
}
}
cout << ans;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, ans = 0, cnt = 0;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
for (int i = 0; i < n - 1; i++) {
long long int a = 0, b = 0;
if (s[i] == s[i + 1]) {
cnt++;
if (i == n - 2) {
cnt++;
a = cnt * (cnt - 1);
b = 2;
ans += a / b;
}
} else {
cnt++;
a = cnt * (cnt - 1);
b = 2;
ans += a / b;
cnt = 0;
}
}
cout << ans;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 746,602 | 746,603 | u125051909 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> smap;
ll ans = 0;
rep(i, n) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
smap[s.at(i)]++;
}
for (auto p : smap) {
ans += ll(p.second * (p.second - 1) / 2);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, ll> smap;
ll ans = 0;
rep(i, n) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
smap[s.at(i)]++;
}
for (auto p : smap) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"call.remove",
"call.arguments.change"
] | 746,604 | 746,605 | u915797797 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }
// typedef
//------------------------------------------
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef map<int, int> MII;
typedef queue<int> QI;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef stack<PII> SPII;
typedef deque<int> DI;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define PF push_front
#define POB pop_back()
#define POF pop_front()
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a) * (a))
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
#define FI first
#define SE second
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define FORR(i, a, b) for (int i = (b - 1); i >= a; i--)
#define REPR(i, n) FORR(i, 0, n)
// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const LL INF = INT_MAX;
const LL LINF = LLONG_MAX;
const LL MOD = 1e9 + 7;
const LL MODD = 998244353;
const int MAX = 510000;
// other
//-------------------------------------------
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
#define SEP(a) cout << fixed << setprecision(a)
#define COUT(x) cout << (x) << endl
#define END cout << endl
VI dx = {1, 0, -1, 0, 1, 1, -1, -1};
VI dy = {0, 1, 0, -1, 1, -1, 1, -1};
VC dc = {'R', 'D', 'L', 'U'};
VS ds = {"R", "D", "L", "U", "RD", "RU", "LD", "LU"};
LL Gcd(LL a, LL b) { return __gcd(a, b); }
LL Lcm(LL a, LL b) {
LL abd = Gcd(a, b);
LL x = a / abd, y = b / abd;
return x * y * abd;
}
LL ModPow(LL A, LL N, LL M) {
LL res = 1;
while (N > 0) {
if (N & 1)
res = res * A % M;
A = A * A % M;
N >>= 1;
}
return res;
}
LL fac[MAX], finv[MAX], inv[MAX];
void ConInit(LL M) {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % M;
inv[i] = M - inv[M % i] * (M / i) % M;
finv[i] = finv[i - 1] * inv[i] % M;
}
}
LL COM(int n, int k, LL M) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % M) % M;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
LL ans = 0;
VS vs(N);
VI kin;
REP(i, N) {
string S;
cin >> S;
SORT(S);
vs.at(i) = S;
}
SORT(vs);
int t = 1;
string T = vs.at(0);
FOR(i, 1, N) {
if (T == vs.at(i)) {
t++;
if (i == N - 1) {
kin.PB(t);
}
} else {
T = vs.at(i);
kin.PB(t);
t = 1;
}
}
REP(i, SZ(kin)) { ans += kin.at(i) * (kin.at(i) - 1) / 2; }
COUT(ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }
// typedef
//------------------------------------------
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef map<int, int> MII;
typedef queue<int> QI;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef stack<PII> SPII;
typedef deque<int> DI;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define PF push_front
#define POB pop_back()
#define POF pop_front()
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a) * (a))
#define EACH(i, c) \
for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
#define FI first
#define SE second
// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define FORR(i, a, b) for (int i = (b - 1); i >= a; i--)
#define REPR(i, n) FORR(i, 0, n)
// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const LL INF = INT_MAX;
const LL LINF = LLONG_MAX;
const LL MOD = 1e9 + 7;
const LL MODD = 998244353;
const int MAX = 510000;
// other
//-------------------------------------------
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
#define SEP(a) cout << fixed << setprecision(a)
#define COUT(x) cout << (x) << endl
#define END cout << endl
VI dx = {1, 0, -1, 0, 1, 1, -1, -1};
VI dy = {0, 1, 0, -1, 1, -1, 1, -1};
VC dc = {'R', 'D', 'L', 'U'};
VS ds = {"R", "D", "L", "U", "RD", "RU", "LD", "LU"};
LL Gcd(LL a, LL b) { return __gcd(a, b); }
LL Lcm(LL a, LL b) {
LL abd = Gcd(a, b);
LL x = a / abd, y = b / abd;
return x * y * abd;
}
LL ModPow(LL A, LL N, LL M) {
LL res = 1;
while (N > 0) {
if (N & 1)
res = res * A % M;
A = A * A % M;
N >>= 1;
}
return res;
}
LL fac[MAX], finv[MAX], inv[MAX];
void ConInit(LL M) {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % M;
inv[i] = M - inv[M % i] * (M / i) % M;
finv[i] = finv[i - 1] * inv[i] % M;
}
}
LL COM(int n, int k, LL M) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % M) % M;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
LL ans = 0;
VS vs(N);
VI kin;
REP(i, N) {
string S;
cin >> S;
SORT(S);
vs.at(i) = S;
}
SORT(vs);
int t = 1;
string T = vs.at(0);
FOR(i, 1, N) {
if (T == vs.at(i)) {
t++;
if (i == N - 1) {
kin.PB(t);
}
} else {
T = vs.at(i);
kin.PB(t);
t = 1;
}
}
REP(i, SZ(kin)) { ans += (LL)kin.at(i) * (kin.at(i) - 1) / 2; }
COUT(ans);
return 0;
} | [
"type_conversion.add"
] | 746,606 | 746,607 | u276588887 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long
int main() {
int n;
cin >> n;
vector<string> arr(n + 1, "");
for (int i = 0; i < n; i++) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr.begin(), arr.end() - 1);
int ans = 0, sum = 1;
for (int i = 0; i < n; i++) {
if (arr[i] == arr[i + 1])
sum++;
else {
ans += (sum * (sum - 1)) / 2;
sum = 1;
}
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long
int main() {
ll n;
cin >> n;
vector<string> arr(n + 1, "");
for (ll i = 0; i < n; i++) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr.begin(), arr.end() - 1);
ll ans = 0, sum = 1;
for (ll i = 0; i < n; i++) {
if (arr[i] == arr[i + 1])
sum++;
else {
ans += (sum * (sum - 1)) / 2;
sum = 1;
}
}
cout << ans << endl;
}
| [
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 746,608 | 746,609 | u764378605 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long
int main() {
int n;
cin >> n;
vector<string> arr(n + 1, "");
for (int i = 0; i < n; i++) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr.begin(), arr.end());
int ans = 0, sum = 1;
for (int i = 0; i < n; i++) {
if (arr[i] == arr[i + 1])
sum++;
else {
ans += (sum * (sum - 1)) / 2;
sum = 1;
}
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long
int main() {
ll n;
cin >> n;
vector<string> arr(n + 1, "");
for (ll i = 0; i < n; i++) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr.begin(), arr.end() - 1);
ll ans = 0, sum = 1;
for (ll i = 0; i < n; i++) {
if (arr[i] == arr[i + 1])
sum++;
else {
ans += (sum * (sum - 1)) / 2;
sum = 1;
}
}
cout << ans << endl;
}
| [
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 746,610 | 746,609 | u764378605 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i, s, f) for (ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define F first
#define S second
int main() {
FAST int n;
cin >> n;
vector<string> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
sort(v.begin(), v.end());
ll ans = 0;
for (int i = 0; i < n; i++) {
string s = v[i];
int cnt = 0;
while (s == v[i]) {
i++;
cnt++;
if (i == n)
break;
}
i--;
ans += cnt * (cnt - 1) / 2;
}
cout << ans;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i, s, f) for (ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define F first
#define S second
int main() {
FAST int n;
cin >> n;
vector<string> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
sort(v.begin(), v.end());
ll ans = 0;
for (int i = 0; i < n; i++) {
string s = v[i];
ll cnt = 0;
while (s == v[i]) {
i++;
cnt++;
if (i == n)
break;
}
i--;
ans += cnt * (cnt - 1) / 2;
}
cout << ans;
return 0;
}
| [
"variable_declaration.type.change"
] | 746,611 | 746,612 | u021108615 | cpp |
p02947 | #include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;
int64_t sub(int64_t n) {
int a = (n + 1) * n / 2;
return a;
}
int main() {
int64_t N;
cin >> N;
map<string, int64_t> m;
for (int64_t i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
if (m.count(S) == 0) {
m[S] = 1;
} else {
m.at(S)++;
}
}
int64_t ret = 0;
for (auto a : m) {
int64_t n = a.second;
// cout << n << endl;
if (n == 1)
continue;
ret += sub(n - 1);
// cout << ret << endl;
}
cout << ret << endl;
} | #include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;
int64_t sub(int64_t n) {
int64_t a = (n + 1) * n / 2;
return a;
}
int main() {
int64_t N;
cin >> N;
map<string, int64_t> m;
for (int64_t i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
if (m.count(S) == 0) {
m[S] = 1;
} else {
m.at(S)++;
}
}
int64_t ret = 0;
for (auto a : m) {
int64_t n = a.second;
// cout << n << endl;
if (n == 1)
continue;
ret += sub(n - 1);
// cout << ret << endl;
}
cout << ret << endl;
} | [
"variable_declaration.type.primitive.change"
] | 746,614 | 746,615 | u295279251 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <memory>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
double min_double(double a, double b) {
if (a < b)
return a;
else
return b;
}
void swap(int *x, int *y) {
int tmp;
tmp = *x;
*x = *y;
*y = tmp;
}
int gcd(int a, int b) {
if (a < b)
swap(&a, &b);
if (b < 1)
return -1;
if (a % b == 0)
return b;
return gcd(b, a % b);
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
std::unordered_map<std::string, int> map;
int N;
int ans = 0;
std::cin >> N;
std::string str;
for (int i = 0; i < N; i++) {
std::cin >> str;
std::sort(str.begin(), str.end());
// std::cout<<str<<std::endl;
auto itr = map.find(str);
if (itr != map.end()) {
ans += map[str];
map[str]++;
} else
map[str] = 1;
}
std::cout << ans << std::endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <memory>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
double min_double(double a, double b) {
if (a < b)
return a;
else
return b;
}
void swap(int *x, int *y) {
int tmp;
tmp = *x;
*x = *y;
*y = tmp;
}
int gcd(int a, int b) {
if (a < b)
swap(&a, &b);
if (b < 1)
return -1;
if (a % b == 0)
return b;
return gcd(b, a % b);
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
std::unordered_map<std::string, long> map;
int N;
long ans = 0;
std::cin >> N;
std::string str;
for (int i = 0; i < N; i++) {
std::cin >> str;
std::sort(str.begin(), str.end());
// std::cout<<str<<std::endl;
auto itr = map.find(str);
if (itr != map.end()) {
ans += map[str];
map[str]++;
} else
map[str] = 1;
}
std::cout << ans << std::endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 746,618 | 746,619 | u389834932 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define Rep(i, s, n) for (ll i = (ll)s; i < (ll)n; i++)
typedef long long ll;
using namespace std;
int main(void) {
int n;
cin >> n;
string s;
set<string> set;
unordered_map<string, int> map;
ll res = 0;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
set.insert(s);
map[s]++;
}
for (auto itr = set.begin(); itr != set.end(); ++itr) {
int n = map[*itr];
res += n * (n - 1) / 2;
}
cout << res << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define Rep(i, s, n) for (ll i = (ll)s; i < (ll)n; i++)
typedef long long ll;
using namespace std;
int main(void) {
int n;
cin >> n;
string s;
set<string> set;
unordered_map<string, int> map;
ll res = 0;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
set.insert(s);
map[s]++;
}
for (auto itr = set.begin(); itr != set.end(); ++itr) {
ll n = map[*itr];
res += n * (n - 1) / 2;
}
cout << res << endl;
} | [
"variable_declaration.type.change"
] | 746,620 | 746,621 | u154465766 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define Rep(i, s, n) for (int i = (int)s; i < (int)n; i++)
typedef long long ll;
using namespace std;
int main(void) {
int n;
cin >> n;
string s;
set<string> set;
unordered_map<string, int> map;
ll res = 0;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
set.insert(s);
map[s]++;
}
for (auto itr = set.begin(); itr != set.end(); ++itr) {
int n = map[*itr];
res += n * (n - 1) / 2;
}
cout << res << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define Rep(i, s, n) for (ll i = (ll)s; i < (ll)n; i++)
typedef long long ll;
using namespace std;
int main(void) {
int n;
cin >> n;
string s;
set<string> set;
unordered_map<string, int> map;
ll res = 0;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
set.insert(s);
map[s]++;
}
for (auto itr = set.begin(); itr != set.end(); ++itr) {
ll n = map[*itr];
res += n * (n - 1) / 2;
}
cout << res << endl;
} | [
"preprocessor.define.value.change",
"variable_declaration.type.change"
] | 746,622 | 746,621 | u154465766 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = (1 << 30) - 1;
const ll LINF = (1LL << 60) - 1;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll res = 0;
for (auto v : mp) {
res += v.second * (v.second - 1) / 2;
}
cout << res << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = (1 << 30) - 1;
const ll LINF = (1LL << 60) - 1;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll res = 0;
for (auto v : mp) {
res += (ll)v.second * (ll)(v.second - 1) / 2;
}
cout << res << endl;
} | [
"type_conversion.add"
] | 746,623 | 746,624 | u743124029 | cpp |
p02947 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;
bool Isprime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // ๅถๆฐใฏใใใใใ้คใ
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// ็ด ๆฐใงใฏใชใ
return false;
}
}
// ็ด ๆฐใงใใ
return true;
}
int main() {
// greenbin ่งฃ็ญไธญ
int n;
cin >> n;
vector<string> vec(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
vec[i] = s;
}
sort(vec.begin(), vec.end());
bool x = false;
Vec conti(0, 0); //ใ้ฃ็ถใใๅๆฐใฎ้
ๅ
for (int i = 0; i < n - 1; i++) {
if (vec[i] == vec[i + 1]) {
if (x) {
conti.back()++;
} else {
conti.emplace_back(1);
x = true;
}
}
else {
x = false;
}
}
ll ans = 0;
for (int i = 0; i < conti.size(); i++) {
ans += conti[i] * (conti[i] + 1) / 2;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;
bool Isprime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false; // ๅถๆฐใฏใใใใใ้คใ
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
// ็ด ๆฐใงใฏใชใ
return false;
}
}
// ็ด ๆฐใงใใ
return true;
}
int main() {
// greenbin ่งฃ็ญไธญ
int n;
cin >> n;
vector<string> vec(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
vec[i] = s;
}
sort(vec.begin(), vec.end());
bool x = false;
vector<ll> conti(0, 0);
//ใ้ฃ็ถใใๅๆฐใฎ้
ๅ
for (int i = 0; i < n - 1; i++) {
if (vec[i] == vec[i + 1]) {
if (x) {
conti.back()++;
} else {
conti.emplace_back(1);
x = true;
}
}
else {
x = false;
}
}
ll ans = 0;
for (int i = 0; i < conti.size(); i++) {
ans += conti[i] * (conti[i] + 1) / 2;
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 746,627 | 746,628 | u275409294 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using pp = pair<int, int>;
using ll = long long;
int main() {
int N, m = 0;
cin >> N;
vector<string> S(N);
set<string> ss;
map<string, int> M;
for (int i = 0; i < N; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
ss.insert(S[i]);
M[S[i]]++;
}
for (int i = 0; i < S.size(); i++) {
string sss = S[i];
if (ss.count(sss)) {
ss.erase(sss);
int w = M[sss];
m += w * (w - 1) / 2;
}
}
cout << m << endl;
} | #include <bits/stdc++.h>
using namespace std;
using pp = pair<int, int>;
using ll = long long;
int main() {
ll N, m = 0;
cin >> N;
vector<string> S(N);
set<string> ss;
map<string, ll> M;
for (ll i = 0; i < N; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
ss.insert(S[i]);
M[S[i]]++;
}
for (ll i = 0; i < S.size(); i++) {
string sss = S[i];
if (ss.count(sss)) {
ss.erase(sss);
ll w = M[sss];
m += w * (w - 1) / 2;
}
}
cout << m << endl;
} | [
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 746,629 | 746,630 | u927463074 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
const int MOD = 1000000007;
ll GCD(ll x, ll y) {
if (y == 0)
return x;
else
return GCD(y, x % y);
}
ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
int main() {
int n;
cin >> n;
multimap<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
auto x = m.find(s);
if (x == m.end()) {
m.insert(make_pair(s, 1));
} else {
x->second++;
}
}
ll ans = 0;
for (auto x : m) {
if (x.second == 1)
continue;
ans += x.second * (x.second - 1) / 2;
}
cout << ans;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
const int MOD = 1000000007;
ll GCD(ll x, ll y) {
if (y == 0)
return x;
else
return GCD(y, x % y);
}
ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
int main() {
int n;
cin >> n;
multimap<string, ll> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
auto x = m.find(s);
if (x == m.end()) {
m.insert(make_pair(s, 1));
} else {
x->second++;
}
}
ll ans = 0;
for (auto x : m) {
if (x.second == 1)
continue;
ans += x.second * (x.second - 1) / 2;
}
cout << ans;
}
| [] | 746,631 | 746,632 | u010415482 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x, ll y) {
if (y == 0)
return x;
else
return GCD(y, x % y);
}
const int MOD = 1000000007;
int main() {
int n;
cin >> n;
string s[n];
map<string, long double> ma;
int cnt = 0;
for (int i = 0; i < n; i++) {
string x;
cin >> x;
sort(x.begin(), x.end());
ma[x]++;
}
long double sum = 0;
for (auto e : ma) {
long double tmp = e.second * (e.second - 1) / 2;
sum += tmp;
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x, ll y) {
if (y == 0)
return x;
else
return GCD(y, x % y);
}
const int MOD = 1000000007;
int main() {
int n;
cin >> n;
string s[n];
map<string, ll> ma;
int cnt = 0;
for (int i = 0; i < n; i++) {
string x;
cin >> x;
sort(x.begin(), x.end());
ma[x]++;
}
ll sum = 0;
for (auto e : ma) {
ll tmp = e.second * (e.second - 1) / 2;
sum += tmp;
}
cout << sum << endl;
}
| [
"variable_declaration.type.narrow.change"
] | 746,633 | 746,634 | u010415482 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) {
rep(j, 10) { sort(s[i].begin(), s[i].end()); }
}
map<string, ll> cnt;
rep(i, n) { cnt[s[i]]++; }
ll count = 0;
for (auto x : cnt) {
auto k = x.first;
auto v = x.second;
if (v == 1)
continue;
count += (int)v * (int)(v - 1) / 2;
}
cout << count << endl;
}
// cout << fixed << setprecision(15) << << endl; | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) {
rep(j, 10) { sort(s[i].begin(), s[i].end()); }
}
map<string, ll> cnt;
rep(i, n) { cnt[s[i]]++; }
ll count = 0;
for (auto x : cnt) {
auto k = x.first;
auto v = x.second;
if (v == 1)
continue;
count += (ll)v * (ll)(v - 1) / 2;
}
cout << count << endl;
}
// cout << fixed << setprecision(15) << << endl; | [
"assignment.value.change",
"expression.operation.binary.change"
] | 746,635 | 746,636 | u052656528 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) {
rep(j, 10) { sort(s[i].begin(), s[i].end()); }
}
map<string, int> cnt;
rep(i, n) { cnt[s[i]]++; }
ll count = 0;
for (auto x : cnt) {
auto k = x.first;
auto v = x.second;
if (v == 1)
continue;
count += (int)v * (int)(v - 1) / 2;
}
cout << count << endl;
}
// cout << fixed << setprecision(15) << << endl; | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) {
rep(j, 10) { sort(s[i].begin(), s[i].end()); }
}
map<string, ll> cnt;
rep(i, n) { cnt[s[i]]++; }
ll count = 0;
for (auto x : cnt) {
auto k = x.first;
auto v = x.second;
if (v == 1)
continue;
count += (ll)v * (ll)(v - 1) / 2;
}
cout << count << endl;
}
// cout << fixed << setprecision(15) << << endl; | [
"assignment.value.change",
"expression.operation.binary.change"
] | 746,637 | 746,636 | u052656528 | cpp |
p02947 | #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <math.h>
#include <vector>
#define irep(i, n) for (int i = 0; i < (int)(n); i++)
#define irep2(i, a, n) for (int i = (int)(a); i <= (int)(n); i++)
#define irrep(i, n) for (int i = (int)(n - 1); i > -1; i--)
#define irrep2(i, n, a) for (int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second
using namespace std;
using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;
const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0, 0, 1, -1, 1, -1};
const int dr[8] = {0, 0, 1, -1, 1, 1, -1, -1};
template <typename T, typename U>
inline ostream &operator<<(ostream &o, pair<T, U> &p) {
return o << "{" << p.first << "," << p.second << "}";
}
template <typename T> inline istream &operator>>(istream &is, vector<T> &vec) {
for (auto &v : vec) {
is >> v;
}
return is;
}
template <typename T> inline ostream &operator<<(ostream &os, vector<T> &vec) {
for (auto &v : vec) {
os << v << ",";
}
return os;
}
template <typename T>
inline ostream &operator<<(ostream &os, vector<vector<T>> &mat) {
for (auto &row : mat) {
os << row << endl;
}
return os;
}
template <typename T> inline void chmin(T &a, T b) { a = min(a, b); }
template <typename T> inline void chmax(T &a, T b) { a = max(a, b); }
int main(void) {
int n;
cin >> n;
map<string, int> mp;
int ans = 0;
irep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (mp[s]) {
ans += mp[s];
}
mp[s]++;
}
cout << ans << endl;
return 0;
} /*atcoder*/
| #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <math.h>
#include <vector>
#define irep(i, n) for (int i = 0; i < (int)(n); i++)
#define irep2(i, a, n) for (int i = (int)(a); i <= (int)(n); i++)
#define irrep(i, n) for (int i = (int)(n - 1); i > -1; i--)
#define irrep2(i, n, a) for (int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second
using namespace std;
using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;
const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0, 0, 1, -1, 1, -1};
const int dr[8] = {0, 0, 1, -1, 1, 1, -1, -1};
template <typename T, typename U>
inline ostream &operator<<(ostream &o, pair<T, U> &p) {
return o << "{" << p.first << "," << p.second << "}";
}
template <typename T> inline istream &operator>>(istream &is, vector<T> &vec) {
for (auto &v : vec) {
is >> v;
}
return is;
}
template <typename T> inline ostream &operator<<(ostream &os, vector<T> &vec) {
for (auto &v : vec) {
os << v << ",";
}
return os;
}
template <typename T>
inline ostream &operator<<(ostream &os, vector<vector<T>> &mat) {
for (auto &row : mat) {
os << row << endl;
}
return os;
}
template <typename T> inline void chmin(T &a, T b) { a = min(a, b); }
template <typename T> inline void chmax(T &a, T b) { a = max(a, b); }
int main(void) {
int n;
cin >> n;
map<string, int> mp;
ll ans = 0;
irep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (mp[s]) {
ans += mp[s];
}
mp[s]++;
}
cout << ans << endl;
return 0;
} /*atcoder*/
| [
"variable_declaration.type.change"
] | 746,640 | 746,641 | u829260400 | cpp |
p02947 | #include <iostream>
#include <math.h>
//#include <numeric>
#include <algorithm>
#include <map>
#include <vector>
//#include <queue>
using namespace std;
#define n_max 10000
#define INF 10001000
#define rep(i, a, n) for (int i = a; i < n; i++)
#define rep2(i, a, n) for (int i = a; i <= n; i++)
#define rrep(i, a, n) for (int i = a; i > n; i--)
#define rrep2(i, a, n) for (int i = a; i >= n; i--)
#define lrep(i, a, n) for (long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
int main() {
long int ans = 0;
int N;
cin >> N;
map<string, int> A;
for (int i = 0; i < N; i++) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
A.insert(make_pair(tmp, 0));
A.at(tmp)++;
}
for (auto i = A.begin(); i != A.end(); i++) {
ans += i->second * (i->second - 1) / 2;
// cout << "key -> " << i->first << ", value -> " << i->second << endl;
}
cout << ans << endl;
return 0;
}
| #include <iostream>
#include <math.h>
//#include <numeric>
#include <algorithm>
#include <map>
#include <vector>
//#include <queue>
using namespace std;
#define n_max 10000
#define INF 10001000
#define rep(i, a, n) for (int i = a; i < n; i++)
#define rep2(i, a, n) for (int i = a; i <= n; i++)
#define rrep(i, a, n) for (int i = a; i > n; i--)
#define rrep2(i, a, n) for (int i = a; i >= n; i--)
#define lrep(i, a, n) for (long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
int main() {
long int ans = 0;
int N;
cin >> N;
map<string, long int> A;
for (int i = 0; i < N; i++) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
A.insert(make_pair(tmp, 0));
A.at(tmp)++;
}
for (auto i = A.begin(); i != A.end(); i++) {
ans += i->second * (i->second - 1) / 2;
// cout << "key -> " << i->first << ", value -> " << i->second << endl;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.widen.change"
] | 746,642 | 746,643 | u829260400 | cpp |
p02947 | #include <iostream>
#include <math.h>
//#include <numeric>
#include <algorithm>
#include <map>
#include <vector>
//#include <queue>
using namespace std;
#define n_max 10000
#define INF 10001000
#define rep(i, a, n) for (int i = a; i < n; i++)
#define rep2(i, a, n) for (int i = a; i <= n; i++)
#define rrep(i, a, n) for (int i = a; i > n; i--)
#define rrep2(i, a, n) for (int i = a; i >= n; i--)
#define lrep(i, a, n) for (long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
int main() {
int ans = 0;
int N;
cin >> N;
map<string, int> A;
for (int i = 0; i < N; i++) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
A.insert(make_pair(tmp, 0));
A.at(tmp)++;
}
for (auto i = A.begin(); i != A.end(); i++) {
ans += i->second * (i->second - 1) / 2;
// cout << "key -> " << i->first << ", value -> " << i->second << endl;
}
cout << ans << endl;
return 0;
}
| #include <iostream>
#include <math.h>
//#include <numeric>
#include <algorithm>
#include <map>
#include <vector>
//#include <queue>
using namespace std;
#define n_max 10000
#define INF 10001000
#define rep(i, a, n) for (int i = a; i < n; i++)
#define rep2(i, a, n) for (int i = a; i <= n; i++)
#define rrep(i, a, n) for (int i = a; i > n; i--)
#define rrep2(i, a, n) for (int i = a; i >= n; i--)
#define lrep(i, a, n) for (long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
int main() {
long int ans = 0;
int N;
cin >> N;
map<string, long int> A;
for (int i = 0; i < N; i++) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
A.insert(make_pair(tmp, 0));
A.at(tmp)++;
}
for (auto i = A.begin(); i != A.end(); i++) {
ans += i->second * (i->second - 1) / 2;
// cout << "key -> " << i->first << ", value -> " << i->second << endl;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.widen.change"
] | 746,644 | 746,643 | u829260400 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
//#include<set>
//#include<vector>
//#include<iomanip>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
map<string, long long> arr;
char x[11];
for (int i = 0; i < n; i++) {
cin >> x;
sort(x, x + 10);
arr[x]++;
ans += arr[x] - 1;
}
cout << ans;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
//#include<set>
//#include<vector>
//#include<iomanip>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
map<string, long long> arr;
char x[11];
for (int i = 0; i < n; i++) {
cin >> x;
sort(x, x + 10);
arr[x]++;
ans += arr[x] - 1;
}
cout << ans;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,645 | 746,646 | u200320655 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
//#include<set>
//#include<vector>
//#include<iomanip>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
map<string, int> arr;
char x[11];
for (int i = 0; i < n; i++) {
cin >> x;
sort(x, x + 10);
arr[x]++;
ans += arr[x] - 1;
}
cout << ans;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
//#include<set>
//#include<vector>
//#include<iomanip>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
map<string, long long> arr;
char x[11];
for (int i = 0; i < n; i++) {
cin >> x;
sort(x, x + 10);
arr[x]++;
ans += arr[x] - 1;
}
cout << ans;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,647 | 746,646 | u200320655 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main() {
int N;
cin >> N;
string s[N];
set<string> st;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
st.insert(s[i]);
}
map<string, int> mp;
for (string p : st)
mp[p] = 0;
rep(i, N) mp[s[i]]++;
ll ans = 0;
for (string p : st)
ans += mp[p] * (mp[p] - 1) / 2;
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main() {
int N;
cin >> N;
string s[N];
set<string> st;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
st.insert(s[i]);
}
map<string, int> mp;
for (string p : st)
mp[p] = 0;
rep(i, N) mp[s[i]]++;
ll ans = 0;
for (string p : st)
ans += (ll)mp[p] * (mp[p] - 1) / 2;
cout << ans << endl;
return 0;
}
| [
"type_conversion.add"
] | 746,648 | 746,649 | u499062271 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
map<string, int> mp;
int ans = 0;
for (int i = 0; i < n; i++) {
string foo;
cin >> foo;
sort(foo.begin(), foo.end());
ans += mp[foo];
mp[foo]++;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
map<string, long long> mp;
long long ans = 0;
for (int i = 0; i < n; i++) {
string foo;
cin >> foo;
sort(foo.begin(), foo.end());
ans += mp[foo];
mp[foo]++;
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,650 | 746,651 | u279033107 | cpp |
p02947 | #include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
using namespace std;
using std::cout;
#include <algorithm>
#include <map>
int main() {
long long n, m = 0;
cin >> n;
map<string, int> freq;
string x[n];
for (int i = 0; i < n; i++) {
cin >> x[i];
sort(x[i].begin(), x[i].end());
}
for (int i = 0; i < n; i++) {
freq[x[i]]++;
}
for (auto i = freq.begin(); i != freq.end(); i++)
m += (((i->second)) * (((i->second) - 1))) / 2;
cout << m << endl;
return 0;
} | #include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
using namespace std;
using std::cout;
#include <algorithm>
#include <map>
int main() {
long long n, m = 0;
cin >> n;
map<string, long long> freq;
string x[n];
for (int i = 0; i < n; i++) {
cin >> x[i];
sort(x[i].begin(), x[i].end());
}
for (int i = 0; i < n; i++) {
freq[x[i]]++;
}
for (auto i = freq.begin(); i != freq.end(); i++)
m += (((i->second)) * (((i->second) - 1))) / 2;
cout << m << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,652 | 746,653 | u474448122 | cpp |
p02947 | #include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
using namespace std;
using std::cout;
#include <algorithm>
#include <map>
int main() {
int n, m = 0;
cin >> n;
map<string, int> freq;
string x[n];
for (int i = 0; i < n; i++) {
cin >> x[i];
sort(x[i].begin(), x[i].end());
}
for (int i = 0; i < n; i++) {
freq[x[i]]++;
}
for (auto i = freq.begin(); i != freq.end(); i++)
m += (((i->second)) * (((i->second) - 1))) / 2;
cout << m << endl;
return 0;
} | #include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
using namespace std;
using std::cout;
#include <algorithm>
#include <map>
int main() {
long long n, m = 0;
cin >> n;
map<string, long long> freq;
string x[n];
for (int i = 0; i < n; i++) {
cin >> x[i];
sort(x[i].begin(), x[i].end());
}
for (int i = 0; i < n; i++) {
freq[x[i]]++;
}
for (auto i = freq.begin(); i != freq.end(); i++)
m += (((i->second)) * (((i->second) - 1))) / 2;
cout << m << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,655 | 746,653 | u474448122 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define UNIQUE(v) \
v.erase(unique(v.begin(), v.end()), v.end()) // sortใใฆใใไฝฟใ
#define INF 2147483647
#define LLINF 9223372036854775807LL
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define UNIQUE(v) \
v.erase(unique(v.begin(), v.end()), v.end()) // sortใใฆใใไฝฟใ
#define INF 2147483647
#define LLINF 9223372036854775807LL
int main() {
int n;
cin >> n;
map<string, ll> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
}
| [] | 746,656 | 746,657 | u166553470 | cpp |
p02947 | // Author: howso
#include <algorithm>
#include <assert.h>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
//#define double long double
//#define int long long
//#define int unsigned long long
#define ll long long
#define ld long double
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pd pair<ld, ld>
#define str string
#define mp make_pair
#define vi vector<int>
#define vl vector<ll>
#define vd vector<ld>
#define vs vector<str>
#define vpi vector<pi>
#define vpl vector<pl>
#define vpd vector<pd>
#define si set<int>
#define FF(i, j, n) for (signed i = j; i <= n; i++)
#define DD(i, j, n) for (signed i = j; i >= n; i--)
#define F(i, j, n) for (signed i = j; i < n; i++)
#define D(i, j, n) for (signed i = j; i > n; i--)
#define mem(a, b) memset(a, b, sizeof(a))
#define ndl cout << endl
#define ull unsigned long long
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
#define sz(x) (signed)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define X first
#define Y second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define SHOWVECTOR(v) \
{ \
std::cerr << #v << "\t: "; \
for (const auto &xxx : v) { \
std::cerr << xxx << " "; \
} \
std::cerr << "\n"; \
}
#define SHOWVECTOR2(v) \
{ \
std::cerr << #v << "\t:\n"; \
for (const auto &xxx : v) { \
for (const auto &yyy : xxx) { \
std::cerr << yyy << " "; \
} \
std::cerr << "\n"; \
} \
}
#define SHOWQUEUE(a) \
{ \
auto tmp(a); \
std::cerr << #a << "\t: "; \
while (!tmp.empty()) { \
std::cerr << tmp.front() << " "; \
tmp.pop(); \
} \
std::cerr << "\n"; \
}
#define SHOWSTACK(a) \
{ \
auto tmp(a); \
std::cerr << #a << "\t: "; \
while (!tmp.empty()) { \
std::cerr << tmp.top() << " "; \
tmp.pop(); \
} \
std::cerr << "\n"; \
}
// math
const int mod = 1e9 + 7;
ll powmod(ll a, ll b) {
ll res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
}
return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int pct(int x) { return __builtin_popcount(x); }
int bit(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int cdiv(int a, int b) {
return a / b + !(a < 0 || a % b == 0);
} // division of a by b rounded up, assumes b > 0
void DBG() { cerr << "]" << endl; }
template <class H, class... T> void DBG(H h, T... t) {
cerr << to_string(h);
if (sizeof...(t))
cerr << ", ";
DBG(t...);
}
#ifdef LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#define HERE cout << "=====GOTHERE=====" << endl
#else
#define dbg(...) 42
#define HERE 42
#endif
/* ============== END OF HEADER ============== */
const int maxn = 1e5 * 3 + 20;
int n, _, q, k;
void solve() {
map<str, int> cnt;
cin >> n;
FF(i, 1, n) {
str t;
cin >> t;
sort(all(t));
cnt[t]++;
}
int res = 0;
for (auto p : cnt) {
res += (p.Y * (p.Y - 1) / 2);
}
cout << res << endl;
}
signed main() {
// clock_t t1 = clock();
IOS solve();
// cout << "THE ALGORITHM TOOK: " << (clock() - t1) * 1.0 / CLOCKS_PER_SEC *
// 1000 << "ms"<< endl;
return 0;
} | // Author: howso
#include <algorithm>
#include <assert.h>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
//#define double long double
#define int long long
//#define int unsigned long long
#define ll long long
#define ld long double
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pd pair<ld, ld>
#define str string
#define mp make_pair
#define vi vector<int>
#define vl vector<ll>
#define vd vector<ld>
#define vs vector<str>
#define vpi vector<pi>
#define vpl vector<pl>
#define vpd vector<pd>
#define si set<int>
#define FF(i, j, n) for (signed i = j; i <= n; i++)
#define DD(i, j, n) for (signed i = j; i >= n; i--)
#define F(i, j, n) for (signed i = j; i < n; i++)
#define D(i, j, n) for (signed i = j; i > n; i--)
#define mem(a, b) memset(a, b, sizeof(a))
#define ndl cout << endl
#define ull unsigned long long
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
#define sz(x) (signed)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define X first
#define Y second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define SHOWVECTOR(v) \
{ \
std::cerr << #v << "\t: "; \
for (const auto &xxx : v) { \
std::cerr << xxx << " "; \
} \
std::cerr << "\n"; \
}
#define SHOWVECTOR2(v) \
{ \
std::cerr << #v << "\t:\n"; \
for (const auto &xxx : v) { \
for (const auto &yyy : xxx) { \
std::cerr << yyy << " "; \
} \
std::cerr << "\n"; \
} \
}
#define SHOWQUEUE(a) \
{ \
auto tmp(a); \
std::cerr << #a << "\t: "; \
while (!tmp.empty()) { \
std::cerr << tmp.front() << " "; \
tmp.pop(); \
} \
std::cerr << "\n"; \
}
#define SHOWSTACK(a) \
{ \
auto tmp(a); \
std::cerr << #a << "\t: "; \
while (!tmp.empty()) { \
std::cerr << tmp.top() << " "; \
tmp.pop(); \
} \
std::cerr << "\n"; \
}
// math
const int mod = 1e9 + 7;
ll powmod(ll a, ll b) {
ll res = 1;
a %= mod;
assert(b >= 0);
for (; b; b >>= 1) {
if (b & 1)
res = res * a % mod;
a = a * a % mod;
}
return res;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int pct(int x) { return __builtin_popcount(x); }
int bit(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int cdiv(int a, int b) {
return a / b + !(a < 0 || a % b == 0);
} // division of a by b rounded up, assumes b > 0
void DBG() { cerr << "]" << endl; }
template <class H, class... T> void DBG(H h, T... t) {
cerr << to_string(h);
if (sizeof...(t))
cerr << ", ";
DBG(t...);
}
#ifdef LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#define HERE cout << "=====GOTHERE=====" << endl
#else
#define dbg(...) 42
#define HERE 42
#endif
/* ============== END OF HEADER ============== */
const int maxn = 1e5 * 3 + 20;
int n, _, q, k;
void solve() {
map<str, int> cnt;
cin >> n;
FF(i, 1, n) {
str t;
cin >> t;
sort(all(t));
cnt[t]++;
}
int res = 0;
for (auto p : cnt) {
res += (p.Y * (p.Y - 1) / 2);
}
cout << res << endl;
}
signed main() {
// clock_t t1 = clock();
IOS solve();
// cout << "THE ALGORITHM TOOK: " << (clock() - t1) * 1.0 / CLOCKS_PER_SEC *
// 1000 << "ms"<< endl;
return 0;
} | [] | 746,658 | 746,659 | u652423305 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> S(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S.at(i) = s;
}
sort(S.begin(), S.end());
int cnt = 1, ans = 0;
for (int i = 1; i < n; i++) {
if (S.at(i) == S.at(i - 1)) {
cnt++;
if (i == n - 1) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
}
} else {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> S(n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S.at(i) = s;
}
sort(S.begin(), S.end());
long cnt = 1, ans = 0;
for (int i = 1; i < n; i++) {
if (S.at(i) == S.at(i - 1)) {
cnt++;
if (i == n - 1) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
}
} else {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 746,662 | 746,663 | u367958900 | cpp |
p02947 | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(), v.end()
#define len(x) (ll)(x).length()
#define maxs(x, y) x = max(x, y)
#define mins(x, y) x = min(x, y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a, ll b) {
if (a % b == 0) {
return b;
} else {
return (gcd(b, a % b));
}
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
const int INF = 1e9;
const ll MX = 1e18;
const int MOD = INF + 7;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const double PI = acos(-1);
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
ans += (x.second) * (x.second - 1) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(), v.end()
#define len(x) (ll)(x).length()
#define maxs(x, y) x = max(x, y)
#define mins(x, y) x = min(x, y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a, ll b) {
if (a % b == 0) {
return b;
} else {
return (gcd(b, a % b));
}
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
const int INF = 1e9;
const ll MX = 1e18;
const int MOD = INF + 7;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const double PI = acos(-1);
int main() {
ll n;
cin >> n;
map<string, ll> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
ans += (x.second) * (x.second - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.change"
] | 746,664 | 746,665 | u818755983 | cpp |
p02947 | #include <bits/stdc++.h>
#include <cassert>
#include <numeric>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod = 1e9 + 7;
const int INF = 1001001001;
const int inf = 100000;
// const ll inf=1e9+7;
// const ll ful=1e18;
using namespace std;
// namespace mp = boost::multiprecision;
int main() {
int n;
cin >> n;
vector<string> a(n);
map<string, int> p{};
for (int i = 0; i < n; i++) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
p[a[i]] += 1;
}
int ans = 0;
for (const auto &[key, value] : p) {
for (int j = 1; j <= value - 1; ++j) {
ans += j;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#include <cassert>
#include <numeric>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod = 1e9 + 7;
const int INF = 1001001001;
const int inf = 100000;
// const ll inf=1e9+7;
// const ll ful=1e18;
using namespace std;
// namespace mp = boost::multiprecision;
int main() {
int n;
cin >> n;
vector<string> a(n);
map<string, int> p{};
for (int i = 0; i < n; i++) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
p[a[i]] += 1;
}
ll ans = 0;
for (const auto &[key, value] : p) {
for (int j = 1; j < value; j++) {
ans += j;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 746,666 | 746,667 | u363550661 | cpp |
p02947 | #include <bits/stdc++.h>
#include <cassert>
#include <numeric>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod = 1e9 + 7;
const int INF = 1001001001;
const int inf = 100000;
// const ll inf=1e9+7;
// const ll ful=1e18;
using namespace std;
// namespace mp = boost::multiprecision;
int main() {
int n;
cin >> n;
vector<string> a(n);
map<string, int> p{};
for (int i = 0; i < n; i++) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
p[a[i]] += 1;
}
int ans = 0;
for (const auto &[key, value] : p) {
for (int j = 1; j < value; ++j) {
ans += j;
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
#include <cassert>
#include <numeric>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod = 1e9 + 7;
const int INF = 1001001001;
const int inf = 100000;
// const ll inf=1e9+7;
// const ll ful=1e18;
using namespace std;
// namespace mp = boost::multiprecision;
int main() {
int n;
cin >> n;
vector<string> a(n);
map<string, int> p{};
for (int i = 0; i < n; i++) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
p[a[i]] += 1;
}
ll ans = 0;
for (const auto &[key, value] : p) {
for (int j = 1; j < value; j++) {
ans += j;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 746,668 | 746,667 | u363550661 | cpp |
p02947 | #include <bits/stdc++.h>
#include <cassert>
#include <numeric>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod = 1e9 + 7;
const int INF = 1001001001;
const int inf = 100000;
// const ll inf=1e9+7;
// const ll ful=1e18;
using namespace std;
// namespace mp = boost::multiprecision;
int main() {
int n;
cin >> n;
vector<string> a(n);
map<string, int> p{};
for (int i = 0; i < n; i++) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
p[a[i]] += 1;
}
int ans = 0;
for (const auto &[key, value] : p) {
for (int j = 1; j < value; j++) {
ans += j;
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
#include <cassert>
#include <numeric>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long int
#define CON 100010
const long long mod = 1e9 + 7;
const int INF = 1001001001;
const int inf = 100000;
// const ll inf=1e9+7;
// const ll ful=1e18;
using namespace std;
// namespace mp = boost::multiprecision;
int main() {
int n;
cin >> n;
vector<string> a(n);
map<string, int> p{};
for (int i = 0; i < n; i++) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
p[a[i]] += 1;
}
ll ans = 0;
for (const auto &[key, value] : p) {
for (int j = 1; j < value; j++) {
ans += j;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 746,669 | 746,667 | u363550661 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int combination(int n, int r) {
if (r == 0 || r == n)
return 1;
else if (r == 1)
return n;
return (combination(n - 1, r - 1) + combination(n - 1, r));
}
int main() {
int n;
cin >> n;
map<string, int> moji;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
moji[s]++;
}
long long ans = 0;
for (auto x : moji) {
int p = x.second;
if (p == 1)
continue;
ans += combination(p, 2);
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
long long combination(int n, int r) {
if (r == 0 || r == n)
return 1;
else if (r == 1)
return n;
return (combination(n - 1, r - 1) + combination(n - 1, r));
}
int main() {
int n;
cin >> n;
map<string, int> moji;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
moji[s]++;
}
long long ans = 0;
for (auto x : moji) {
int p = x.second;
if (p == 1)
continue;
ans += combination(p, 2);
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,670 | 746,671 | u550374978 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(100000);
map<string, int> mp;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (mp.count(s[i])) {
ans += mp[s[i]];
mp[s[i]]++;
} else {
mp[s[i]] = 1;
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(100000);
map<string, int> mp;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (mp.count(s[i])) {
ans += mp[s[i]];
mp[s[i]]++;
} else {
mp[s[i]] = 1;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,674 | 746,675 | u277318398 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> mp;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (mp.count(s[i])) {
ans += mp[s[i]];
mp[s[i]]++;
} else {
mp[s[i]] = 1;
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(100000);
map<string, int> mp;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (mp.count(s[i])) {
ans += mp[s[i]];
mp[s[i]]++;
} else {
mp[s[i]] = 1;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,676 | 746,675 | u277318398 | cpp |
p02947 | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
map<string, int> mp;
string s;
int n;
cin >> n;
rep(i, n) {
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto &a : mp) {
int num = a.second;
ans += num * (num - 1) / 2;
}
cout << ans;
} | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
map<string, int> mp;
string s;
int n;
cin >> n;
rep(i, n) {
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto &a : mp) {
ll num = a.second;
ans += num * (num - 1) / 2;
}
cout << ans;
} | [
"variable_declaration.type.change"
] | 746,679 | 746,680 | u151236434 | cpp |
p02947 | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
map<string, int> mp;
string s;
int n;
cin >> n;
rep(i, n) {
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto &a : mp) {
int num = a.second;
ans += (num * (num - 1)) / 2;
}
cout << ans;
} | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
map<string, int> mp;
string s;
int n;
cin >> n;
rep(i, n) {
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto &a : mp) {
ll num = a.second;
ans += num * (num - 1) / 2;
}
cout << ans;
} | [
"variable_declaration.type.change"
] | 746,681 | 746,680 | u151236434 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s;
for (int i = 0; i < n; i++) {
string _s;
cin >> _s;
sort(_s.begin(), _s.end());
s.push_back(_s);
}
sort(s.begin(), s.end());
// for (auto c: s) cout << c << endl;
int b = 0;
int e = b + 1;
long long ans = 0;
int cnt = 1;
while (1) {
if (s[b] != s[e]) {
b = e;
e = b + 1;
ans += cnt * (cnt - 1) / 2;
cnt = 1;
if (e >= n) {
break;
}
} else {
cnt += 1;
e += 1;
if (e >= n) {
ans += cnt * (cnt - 1) / 2;
break;
}
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s;
for (int i = 0; i < n; i++) {
string _s;
cin >> _s;
sort(_s.begin(), _s.end());
s.push_back(_s);
}
sort(s.begin(), s.end());
// for (auto c: s) cout << c << endl;
int b = 0;
int e = b + 1;
long long ans = 0;
long long cnt = 1;
while (1) {
if (s[b] != s[e]) {
b = e;
e = b + 1;
ans += cnt * (cnt - 1) / 2;
cnt = 1;
if (e >= n) {
break;
}
} else {
cnt += 1;
e += 1;
// cout << cnt << endl;
if (e >= n) {
ans += cnt * (cnt - 1) / 2;
break;
}
}
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,682 | 746,683 | u619557935 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
template <typename T, typename Q>
istream &operator>>(istream &is, pair<T, Q> &p) {
return is >> p.first >> p.second;
}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
for (auto &x : v)
is >> x;
return is;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<string> a(n);
cin >> a;
map<string, int> m;
for (int i = 0; i < n; i++) {
sort(a[i].begin(), a[i].end());
m[a[i]]++;
}
long long ans = 0;
for (auto p : m) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << '\n';
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
template <typename T, typename Q>
istream &operator>>(istream &is, pair<T, Q> &p) {
return is >> p.first >> p.second;
}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
for (auto &x : v)
is >> x;
return is;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<string> a(n);
cin >> a;
map<string, int> m;
for (int i = 0; i < n; i++) {
sort(a[i].begin(), a[i].end());
m[a[i]]++;
}
long long ans = 0;
for (auto p : m) {
ans += p.second * (long long)(p.second - 1) / 2;
}
cout << ans << '\n';
}
| [
"type_conversion.add"
] | 746,684 | 746,685 | u070211042 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; ++i) {
string str;
cin >> str;
sort(str.begin(), str.end());
m[str]++;
}
long long ans = 0;
for (pair<string, int> e : m)
ans += ((e.second * (e.second - 1)) / 2);
cout << ans;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, long long> m;
for (int i = 0; i < n; ++i) {
string str;
cin >> str;
sort(str.begin(), str.end());
m[str]++;
}
long long ans = 0;
for (pair<string, long long> e : m)
ans += ((e.second * (e.second - 1)) / 2);
cout << ans;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,686 | 746,687 | u574392068 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, ans = 0;
;
cin >> N;
vector<string> S(N + 1);
unordered_map<string, int> UM;
for (int i = 1; i <= N; ++i)
cin >> S[i];
for (int i = 1; i <= N; ++i) {
sort(S[i].begin(), S[i].end());
++UM[S[i]];
}
for (auto itr = UM.begin(); itr != UM.end(); ++itr) {
ans += itr->second * (itr->second - 1) / 2;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, ans = 0;
;
cin >> N;
vector<string> S(N + 1);
unordered_map<string, long long> UM;
for (int i = 1; i <= N; ++i)
cin >> S[i];
for (int i = 1; i <= N; ++i) {
sort(S[i].begin(), S[i].end());
++UM[S[i]];
}
for (auto itr = UM.begin(); itr != UM.end(); ++itr) {
ans += itr->second * (itr->second - 1.) / 2.;
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,690 | 746,691 | u402717316 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;
int main() {
int N;
cin >> N;
map<string, int> mp;
int ans = 0;
for (int i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
mp[S]++;
ans += mp[S] - 1;
}
cout << ans << endl;
}
| #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;
int main() {
int N;
cin >> N;
map<string, int> mp;
ll ans = 0;
for (int i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
mp[S]++;
ans += mp[S] - 1;
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 746,692 | 746,693 | u475843109 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
const ll mod = 1000000007;
int main() {
int n;
cin >> n;
string s;
map<string, int> mp;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
int c = x.second;
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
const ll mod = 1000000007;
int main() {
int n;
cin >> n;
string s;
map<string, ll> mp;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
ll c = x.second;
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 746,694 | 746,695 | u747602774 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end() // ๆ้ ใฝใผใ
#define rall(v) (v).rbegin(), (v).rend() // ้้ ใฝใผใ
#define FastIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
typedef long long ll;
typedef long long int lli;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
int main() {
int n;
cin >> n;
map<string, int> m;
ll ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
for (auto mm = m.begin(); mm != m.end(); mm++) {
ans += (mm->second * (mm->second - 1)) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end() // ๆ้ ใฝใผใ
#define rall(v) (v).rbegin(), (v).rend() // ้้ ใฝใผใ
#define FastIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
typedef long long ll;
typedef long long int lli;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
int main() {
int n;
cin >> n;
map<string, ll> m;
ll ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
for (auto mm = m.begin(); mm != m.end(); mm++) {
ans += (mm->second * (mm->second - 1)) / 2;
}
cout << ans << endl;
}
| [] | 746,696 | 746,697 | u084949493 | cpp |
p02947 | #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;
int main() {
ll n, cnt = 0;
string s;
map<string, ll> mp;
cin >> n;
vector<int> ana(n), memo(n + 1, 0);
rep(i, n) {
cin >> s;
sort(all(s));
memo[i + 1] = memo[i] + ll(i);
mp[s]++;
}
for (auto m : mp)
cnt += memo[m.second];
cout << cnt << endl;
return 0;
}
| #include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;
int main() {
ll n, cnt = 0;
string s;
map<string, ll> mp;
cin >> n;
vector<ll> ana(n), memo(n + 1, 0);
rep(i, n) {
cin >> s;
sort(all(s));
memo[i + 1] = memo[i] + ll(i);
mp[s]++;
}
for (auto m : mp)
cnt += memo[m.second];
cout << cnt << endl;
return 0;
}
| [] | 746,698 | 746,699 | u730499268 | cpp |
p02947 | #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip> // fixed, setprecision
#include <iostream> // cout, endl, cin
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
int main() {
int64_t N, t = 0;
cin >> N;
string s;
map<string, int> cnt{};
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
cnt[s]++;
}
for (auto &[str, c] : cnt) {
t += c * (c - 1) / 2;
}
cout << t << endl;
}
| #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip> // fixed, setprecision
#include <iostream> // cout, endl, cin
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
int main() {
int64_t N, t = 0;
cin >> N;
string s;
map<string, int64_t> cnt{};
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
cnt[s]++;
}
for (auto &[str, c] : cnt) {
t += c * (c - 1) / 2;
}
cout << t << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 746,700 | 746,701 | u262646906 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
string s;
multiset<string> ms;
for (int i = 0; i < N; ++i) {
cin >> s;
sort(s.begin(), s.end());
ms.insert(s);
}
int cnt = 0, c = 0;
for (auto itr = ms.begin(); itr != ms.end();) {
c = ms.count(*itr);
cnt += (c - 1) * c / 2;
for (int j = 0; j < c; ++j)
++itr;
}
cout << cnt << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
string s;
multiset<string> ms;
for (int i = 0; i < N; ++i) {
cin >> s;
sort(s.begin(), s.end());
ms.insert(s);
}
ll cnt = 0, c = 0;
for (auto itr = ms.begin(); itr != ms.end();) {
c = ms.count(*itr);
cnt += (c - 1) * c / 2;
for (int j = 0; j < c; ++j)
++itr;
}
cout << cnt << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 746,702 | 746,703 | u768347697 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.