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++)
typedef long long ll;
using namespace std;
int INF = 1001001001;
int combination(int x, int y) {
if (x < y)
return 0;
int a = 1;
int b = 1;
rep(i, y) {
a *= i + 1;
b *= x - i;
}
return b / a;
}
int main() {
int n;
cin >> n;
vector<string> s(n + 1);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end() - 1);
int ans = 0, count = 1;
string tmp = "nyo";
s[n] = "nyo";
rep(i, n + 1) {
if (tmp == s[i]) {
count++;
} else {
tmp = s[i];
ans += combination(count, 2);
count = 1;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int INF = 1001001001;
ll combination(int x, int y) {
if (x < y)
return 0;
ll a = 1;
ll b = 1;
rep(i, y) {
a *= i + 1;
b *= x - i;
}
return b / a;
}
int main() {
int n;
cin >> n;
vector<string> s(n + 1);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end() - 1);
ll ans = 0, count = 1;
string tmp = "nyo";
s[n] = "nyo";
rep(i, n + 1) {
if (tmp == s[i]) {
count++;
} else {
tmp = s[i];
ans += combination(count, 2);
count = 1;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 747,756 | 747,755 | u405620865 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int N;
cin >> N;
map<string, int> all;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
all[s]++;
}
ll total = 0;
for (auto const &p : all) {
int val = p.second;
total += val * (val - 1) / 2;
}
cout << total << "\n";
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int N;
cin >> N;
map<string, int> all;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
all[s]++;
}
ll total = 0;
for (auto const &p : all) {
ll val = p.second;
total += val * (val - 1) / 2;
}
cout << total << "\n";
} | [
"variable_declaration.type.change"
] | 747,757 | 747,758 | u148425972 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define MAX_N 10000000
#define ll int64_t
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
using namespace std;
int main() {
int n, count = 0, ren = 0;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
}
sort(all(s));
rep(i, n - 1) {
if (s[i] == s[i + 1]) {
count++;
count += ren;
ren++;
} else
ren = 0;
}
cout << count << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define MAX_N 10000000
#define ll int64_t
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
using namespace std;
int main() {
ll n, count = 0, ren = 0;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
}
sort(all(s));
rep(i, n - 1) {
if (s[i] == s[i + 1]) {
count++;
count += ren;
ren++;
} else
ren = 0;
}
cout << count << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 747,761 | 747,762 | u532401120 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string s;
char cha[11];
vector<string> str(n);
for (int i = 0; i < n; i++) {
cin >> s;
for (int j = 0; j < 11; j++) {
cha[j] = s[j];
}
sort(cha, cha + 10);
s = cha;
str[i] = s;
}
sort(str.begin(), str.end());
int cnt = 0;
long long int ans = 0;
for (int i = 0; i < n - 1; i++) {
if (str[i] == str[i + 1]) {
cnt++;
} else {
ans = ans + cnt * (cnt + 1) / 2;
cnt = 0;
}
}
ans = ans + cnt * (cnt + 1) / 2;
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string s;
char cha[11];
vector<string> str(n);
for (int i = 0; i < n; i++) {
cin >> s;
for (int j = 0; j < 11; j++) {
cha[j] = s[j];
}
sort(cha, cha + 10);
s = cha;
str[i] = s;
}
sort(str.begin(), str.end());
long long int cnt = 0;
long long int ans = 0;
for (int i = 0; i < n - 1; i++) {
if (str[i] == str[i + 1]) {
cnt++;
} else {
ans = ans + cnt * (cnt + 1) / 2;
cnt = 0;
}
}
ans = ans + cnt * (cnt + 1) / 2;
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 747,763 | 747,764 | u992779443 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 2e9
typedef long long ll;
int main() {
int n;
cin >> n;
vector<string> s(n);
REP(i, n) {
cin >> s[i];
sort(ALL(s[i]));
}
sort(ALL(s));
s.push_back(" ");
int v = 0, t = 0;
REP(i, n) {
t++;
if (s[i] != s[i + 1]) {
v += t * (t - 1) / 2;
t = 0;
}
}
cout << v << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 2e9
typedef long long ll;
int main() {
int n;
cin >> n;
vector<string> s(n);
REP(i, n) {
cin >> s[i];
sort(ALL(s[i]));
}
sort(ALL(s));
s.push_back(" ");
ll v = 0, t = 0;
REP(i, n) {
t++;
if (s[i] != s[i + 1]) {
v += t * (t - 1) / 2;
t = 0;
}
}
cout << v << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 747,769 | 747,770 | u291873788 | cpp |
p02947 | #include <algorithm>
#include <assert.h>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
//#include <functional>
int main() {
int32_t N;
std::cin >> N;
// naiive approach
// reorder N strings O(NlogN * 10)
// check every combination nC2 = N^2
// to avoid N^2, hash_map can be used.
std::unordered_map<std::string, int32_t> s2cnt_um;
std::string s;
int32_t res = 0;
for (int32_t i = 0; i < N; i++) {
std::cin >> s;
std::sort(s.begin(), s.end());
// std::cout << "sorted string: " << s << std::endl;
if (s2cnt_um[s] != 0) {
res += s2cnt_um[s];
}
s2cnt_um[s] += 1;
}
std::cout << res;
return 0;
}
| #include <algorithm>
#include <assert.h>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
//#include <functional>
int main() {
int32_t N;
std::cin >> N;
// naiive approach
// reorder N strings O(NlogN * 10)
// check every combination nC2 = N^2
// to avoid N^2, hash_map can be used.
std::unordered_map<std::string, int64_t> s2cnt_um;
std::string s;
int64_t res = 0;
for (int32_t i = 0; i < N; i++) {
std::cin >> s;
std::sort(s.begin(), s.end());
// std::cout << "sorted string: " << s << std::endl;
if (s2cnt_um[s] != 0) {
res += s2cnt_um[s];
}
s2cnt_um[s] += 1;
}
std::cout << res;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 747,771 | 747,772 | u775900747 | cpp |
p02947 | #pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define for1(i, n) for (int i = 1; i <= n; ++i)
#define for0(i, n) for (int i = 0; i < n; ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define next qwerty1
#define left qwerty2
#define right qwerty3
#define y1 qwerty4
#define y0 qwerty5
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main() {
ios::sync_with_stdio(false);
cout.tie(nullptr);
cin.tie(nullptr);
int n;
cin >> n;
map<string, ll> cnt;
int ans = 0;
for0(i, n) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
for (auto &el : cnt) {
ans += el.second * 1LL * (el.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | #pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define for1(i, n) for (int i = 1; i <= n; ++i)
#define for0(i, n) for (int i = 0; i < n; ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define next qwerty1
#define left qwerty2
#define right qwerty3
#define y1 qwerty4
#define y0 qwerty5
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main() {
ios::sync_with_stdio(false);
cout.tie(nullptr);
cin.tie(nullptr);
int n;
cin >> n;
map<string, ll> cnt;
ll ans = 0;
for0(i, n) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
for (auto &el : cnt) {
ans += el.second * 1LL * (el.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 747,773 | 747,774 | u190848148 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using S = set<long long>;
using D = deque<long long>;
using L = vector<long long>;
using M = map<int, long long>;
using A = vector<vector<long long>>;
using Q = priority_queue<long long>;
using U =
unordered_map<int, long long>; // mapとの違いはkeyの順番を保持していない
#define sorted(vector) sort(vector.begin(), vector.end()) // O(nlongn)
#define vmin(vector) *min_element(vector.begin(), vector.end()) // O(N)
#define vmax(vector) *max_element(vector.begin(), vector.end()) // O(N)
#define vsum(vector) accumulate(vector.begin(), vector.end(), 0) // O(N)
#define vcount(vector, a) count(vector.begin(), vector.end(), a) // O(N)
#define bisect_left(vector, a) \
(lower_bound(vector.begin(), vector.end(), a) - vector.begin())
#define bisect_right(vector, a) \
(upper_bound(vector.begin(), vector.end(), a) - vector.begin())
#define vfind(vector, a) \
find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
//存在確認はmap!!!!!!!!!!!!!
//__gcd(a,b)はコンパイラがGCC時のみ
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
A a;
string s;
L l;
unordered_map<string, long long> u;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sorted(s);
u[s] += 1;
ans += u[s];
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using S = set<long long>;
using D = deque<long long>;
using L = vector<long long>;
using M = map<int, long long>;
using A = vector<vector<long long>>;
using Q = priority_queue<long long>;
using U =
unordered_map<int, long long>; // mapとの違いはkeyの順番を保持していない
#define sorted(vector) sort(vector.begin(), vector.end()) // O(nlongn)
#define vmin(vector) *min_element(vector.begin(), vector.end()) // O(N)
#define vmax(vector) *max_element(vector.begin(), vector.end()) // O(N)
#define vsum(vector) accumulate(vector.begin(), vector.end(), 0) // O(N)
#define vcount(vector, a) count(vector.begin(), vector.end(), a) // O(N)
#define bisect_left(vector, a) \
(lower_bound(vector.begin(), vector.end(), a) - vector.begin())
#define bisect_right(vector, a) \
(upper_bound(vector.begin(), vector.end(), a) - vector.begin())
#define vfind(vector, a) \
find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
//存在確認はmap!!!!!!!!!!!!!
//__gcd(a,b)はコンパイラがGCC時のみ
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
A a;
string s;
L l;
unordered_map<string, long long> u;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sorted(s);
u[s] += 1;
ans += u[s] - 1;
}
cout << ans << endl;
}
| [
"assignment.change"
] | 747,777 | 747,778 | u367130284 | cpp |
p02947 | #pragma GCC optimize(3)
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
string s;
int n;
map<string, int> m;
long long ans, tmp;
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (register int i = 1; i <= n; i++) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (register map<string, int>::iterator iter = m.begin(); iter != m.end();
iter++) {
tmp = iter->second;
ans += (tmp * (tmp - 1)) >> 1;
}
printf("%d", ans);
} | #pragma GCC optimize(3)
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
string s;
int n;
map<string, int> m;
long long ans, tmp;
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (register int i = 1; i <= n; i++) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (register map<string, int>::iterator iter = m.begin(); iter != m.end();
iter++) {
tmp = iter->second;
ans += (tmp * (tmp - 1)) >> 1;
}
printf("%lld", ans);
} | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 747,779 | 747,780 | u131977721 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
int main() {
int N, ans = 0;
cin >> N;
map<string, ll> s;
for (int i = 0; i < N; i++) {
string ss;
cin >> ss;
sort(ss.begin(), ss.end());
ans += s[ss]++;
}
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
int main() {
int N;
long long ans = 0;
cin >> N;
map<string, ll> s;
for (int i = 0; i < N; i++) {
string ss;
cin >> ss;
sort(ss.begin(), ss.end());
ans += s[ss]++;
}
cout << ans << endl;
} | [
"variable_declaration.type.widen.change"
] | 747,781 | 747,782 | u001858868 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(int argc, char const *argv[]) {
int n;
cin >> n;
map<string, int> ma;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ma[s]++;
}
ll ans = 0;
for (auto u : ma) {
ans += u.second * (u.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main(int argc, char const *argv[]) {
int n;
cin >> n;
map<string, ll> ma;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ma[s]++;
}
ll ans = 0;
for (auto u : ma) {
ans += u.second * (u.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [] | 747,785 | 747,786 | u029876051 | cpp |
p02947 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int, int>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
// int 2×10の9乗
// vector<vector<int>> a(n, vector<int>(m));
// rep(i,n) rep(j,m) cin >> a[i][j];
// cout << fixed << setprecision(10);
// int gcd(int x, int y){
// if(y==0) return x;
// return gcd(y, x%y);
//}
// sort小さい順(昇順)
// g++ code.cpp ./a.out
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (pair<string, int> p : m) {
int v = p.second;
ans += v * (v - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int, int>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
// int 2×10の9乗
// vector<vector<int>> a(n, vector<int>(m));
// rep(i,n) rep(j,m) cin >> a[i][j];
// cout << fixed << setprecision(10);
// int gcd(int x, int y){
// if(y==0) return x;
// return gcd(y, x%y);
//}
// sort小さい順(昇順)
// g++ code.cpp ./a.out
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (pair<string, int> p : m) {
ll v = p.second;
ans += v * (v - 1) / 2;
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 747,787 | 747,788 | u510383220 | cpp |
p02947 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int, int>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
// int 2×10の9乗
// vector<vector<int>> a(n, vector<int>(m));
// rep(i,n) rep(j,m) cin >> a[i][j];
// cout << fixed << setprecision(10);
// int gcd(int x, int y){
// if(y==0) return x;
// return gcd(y, x%y);
//}
// sort小さい順(昇順)
// g++ code.cpp ./a.out
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
int ans = 0;
for (pair<string, int> p : m) {
int v = p.second;
ans += v * (v - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int, int>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
// int 2×10の9乗
// vector<vector<int>> a(n, vector<int>(m));
// rep(i,n) rep(j,m) cin >> a[i][j];
// cout << fixed << setprecision(10);
// int gcd(int x, int y){
// if(y==0) return x;
// return gcd(y, x%y);
//}
// sort小さい順(昇順)
// g++ code.cpp ./a.out
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (pair<string, int> p : m) {
ll v = p.second;
ans += v * (v - 1) / 2;
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 747,789 | 747,788 | u510383220 | cpp |
p02947 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int, int>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
// int 2×10の9乗
// vector<vector<int>> a(n, vector<int>(m));
// rep(i,n) rep(j,m) cin >> a[i][j];
// cout << fixed << setprecision(10);
// int gcd(int x, int y){
// if(y==0) return x;
// return gcd(y, x%y);
//}
// sort小さい順(昇順)
// g++ code.cpp ./a.out
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (pair<string, int> p : m) {
int v = p.second;
ans += v * (v - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int, int>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
// int 2×10の9乗
// vector<vector<int>> a(n, vector<int>(m));
// rep(i,n) rep(j,m) cin >> a[i][j];
// cout << fixed << setprecision(10);
// int gcd(int x, int y){
// if(y==0) return x;
// return gcd(y, x%y);
//}
// sort小さい順(昇順)
// g++ code.cpp ./a.out
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (pair<string, int> p : m) {
int v = p.second;
ans += (ll)v * (v - 1) / 2;
}
cout << ans << endl;
}
| [
"type_conversion.add"
] | 747,787 | 747,790 | u510383220 | cpp |
p02947 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int, int>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
// int 2×10の9乗
// vector<vector<int>> a(n, vector<int>(m));
// rep(i,n) rep(j,m) cin >> a[i][j];
// cout << fixed << setprecision(10);
// int gcd(int x, int y){
// if(y==0) return x;
// return gcd(y, x%y);
//}
// sort小さい順(昇順)
// g++ code.cpp ./a.out
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
int ans = 0;
for (pair<string, int> p : m) {
int v = p.second;
ans += v * (v - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define ll long long
#define pii pair<int, int>
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
const int INF = 1001001001;
// int 2×10の9乗
// vector<vector<int>> a(n, vector<int>(m));
// rep(i,n) rep(j,m) cin >> a[i][j];
// cout << fixed << setprecision(10);
// int gcd(int x, int y){
// if(y==0) return x;
// return gcd(y, x%y);
//}
// sort小さい順(昇順)
// g++ code.cpp ./a.out
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (pair<string, int> p : m) {
int v = p.second;
ans += (ll)v * (v - 1) / 2;
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 747,789 | 747,790 | u510383220 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define all(x) x.begin(), x.end()
#define VI vector<int>
#define VS vector<string>
#define ll long long
#define INF 2e9
#define fir first
#define sec second
using namespace std;
void Main() {
int n;
cin >> n;
map<string, int> S;
int ans = 0;
rep(i, 0, n) {
string k;
cin >> k;
sort(all(k));
if (S.count(k) == 0) {
S[k] = 0;
} else {
S[k]++;
ans += S[k];
}
}
cout << ans << endl;
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15) << endl;
Main();
return 0;
} | #include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define all(x) x.begin(), x.end()
#define VI vector<int>
#define VS vector<string>
#define ll long long
#define INF 2e9
#define fir first
#define sec second
using namespace std;
void Main() {
int n;
cin >> n;
map<string, int> S;
ll ans = 0;
rep(i, 0, n) {
string k;
cin >> k;
sort(all(k));
if (S.count(k) == 0) {
S[k] = 0;
} else {
S[k]++;
ans += S[k];
}
}
cout << ans << endl;
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15) << endl;
Main();
return 0;
} | [
"variable_declaration.type.change"
] | 747,791 | 747,792 | u075520262 | 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 <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#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
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define MOD 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS \
cin.tie(0); \
ios::sync_with_stdio(false)
#define M_P make_pair
#define PU_B push_back
#define PU_F push_front
#define PO_B pop_back
#define PO_F pop_front
#define U_B upper_bound
#define L_B lower_bound
#define B_S binary_search
#define PR_Q priority_queue
#define FIR first
#define SEC second
#if __cplusplus < 201103L
#define stoi(argument_string) atoi((argument_string).c_str())
#define stoll(argument_string) atoll((argument_string).c_str())
#endif
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP_R(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define FOR(i, m, n) for (int i = ((int)(m)); i < (int)(n); ++i)
#define FOR_R(i, m, n) for (int i = ((int)(m)-1); i >= (int)(n); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SIZ(x) ((int)(x).size())
#define CIN(x) cin >> (x)
#define CIN2(x, y) cin >> (x) >> (y)
#define CIN3(x, y, z) cin >> (x) >> (y) >> (z)
#define CIN4(x, y, z, w) cin >> (x) >> (y) >> (z) >> (w)
#define CIN5(x, y, z, w, u) cin >> (x) >> (y) >> (z) >> (w) >> (u)
#define SCAND(x) scanf("%d", &(x))
#define SCAND2(x, y) scanf("%d%d", &(x), &(y))
#define SCAND3(x, y, z) scanf("%d%d%d", &(x), &(y), &(z))
#define SCAND4(x, y, z, w) scanf("%d%d%d%d", &(x), &(y), &(z), &(w))
#define SCAND5(x, y, z, w, u) scanf("%d%d%d%d%d", &(x), &(y), &(z), &(w), &(u))
#define SCANLLD(x) scanf("%lld", &(x))
#define SCANLLD2(x, y) scanf("%lld%lld", &(x), &(y))
#define SCANLLD3(x, y, z) scanf("%lld%lld%lld", &(x), &(y), &(z))
#define SCANLLD4(x, y, z, w) scanf("%lld%lld%lld%lld", &(x), &(y), &(z), &(w))
#define SCANLLD5(x, y, z, w, u) \
scanf("%lld%lld%lld%lld%lld", &(x), &(y), &(z), &(w), &(u))
#define I64DSCAN(x) scanf("%I64d", &(x))
#define I64DSCAN2(x, y) scanf("%I64d%I64d", &(x), &(y))
#define I64DSCAN3(x, y, z) scanf("%I64d%I64d%I64d", &(x), &(y), &(z))
#define I64DSCAN4(x, y, z, w) \
scanf("%I64d%I64d%I64d%I64d", &(x), &(y), &(z), &(w))
#define I64DSCAN5(x, y, z, w, u) \
scanf("%I64d%I64d%I64d%I64d%I64d", &(x), &(y), &(z), &(w), &(u))
#define PRINTD(x) printf("%d\n", (x))
#define PRINTLLD(x) printf("%lld\n", (x))
#define PRINTI64D(x) printf("%I64d\n", (x))
#define DEBUG(argument) cerr << (#argument) << " : " << (argument) << "\n"
typedef long long int lli;
using namespace std;
bool compare_by_2nd(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int ctoi(char c) {
if (c >= '0' and c <= '9') {
return (int)(c - '0');
}
return -1;
}
int alphabet_pos(char c) {
if (c >= 'a' and c <= 'z') {
return (int)(c - 'a');
}
return -1;
}
int alphabet_pos_capital(char c) {
if (c >= 'A' and c <= 'Z') {
return (int)(c - 'A');
}
return -1;
}
vector<string> split(string str, char ch) {
int first = 0;
int last = str.find_first_of(ch);
if (last == string::npos) {
last = SIZ(str);
}
vector<string> result;
while (first < SIZ(str)) {
string Ssubstr(str, first, last - first);
result.push_back(Ssubstr);
first = last + 1;
last = str.find_first_of(ch, first);
if (last == string::npos) {
last = SIZ(str);
}
}
return result;
}
int gcd(int a, int b) // assuming a,b >= 1
{
if (a < b) {
swap(a, b);
}
if (a == 0) {
return b;
}
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
long long gcd(long long a, long long b) // assuming a,b >= 1
{
if (a < b) {
swap(a, b);
}
if (a == 0LL) {
return b;
}
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
return a * b / gcd(a, b);
}
long long lcm(long long a, long long b) // assuming a,b >= 1
{
return a * b / gcd(a, b);
}
long long pow_fast(long long x, long long n_power, long long modulus) {
if (n_power == 0) {
return 1;
}
if (n_power % 2 == 0) {
return pow_fast(x * x % modulus, n_power / 2, modulus);
}
return x * pow_fast(x, n_power - 1, modulus) % modulus;
}
struct CombinationTable {
vector<vector<long long>> val;
CombinationTable(int size)
: val(size + 1, vector<long long>(size + 1)) // constructor
{
for (int i = 0; i <= size; ++i) // note that 0 <= i <= size
{
for (int j = 0; j <= i; ++j) {
if (j == 0 or j == i) {
val[i][j] = 1LL;
} else {
val[i][j] = val[i - 1][j - 1] + val[i - 1][j];
}
}
}
}
};
void print_vector(vector<int> &h) {
int L = h.size();
for (int i = 0; i < L; ++i) {
printf("%d", h[i]);
if (i != L - 1) {
printf(" ");
} else {
printf("\n");
}
}
}
void print_vector(vector<long long> &h) {
int L = h.size();
for (int i = 0; i < L; ++i) {
printf("%lld", h[i]);
if (i != L - 1) {
printf(" ");
} else {
printf("\n");
}
}
}
void print_matrix2D(vector<vector<int>> &h) {
int Ly = h.size();
int Lx = h[0].size();
for (int i = 0; i < Ly; ++i) {
for (int j = 0; j < Lx; ++j) {
printf("%d", h[i][j]);
if (j != Lx - 1) {
printf(" ");
} else {
printf("\n");
}
}
}
}
void print_matrix2D(vector<vector<long long>> &h) {
int Ly = h.size();
int Lx = h[0].size();
for (int i = 0; i < Ly; ++i) {
for (int j = 0; j < Lx; ++j) {
printf("%lld", h[i][j]);
if (j != Lx - 1) {
printf(" ");
} else {
printf("\n");
}
}
}
}
void print_matrix2D(vector<string> &h) {
int Ly = h.size();
int Lx = h[0].size();
for (int i = 0; i < Ly; ++i) {
for (int j = 0; j < Lx; ++j) {
printf("%c", h[i][j]);
}
printf("\n");
}
}
void print_binary(int val, int num_digit = 31, bool verbose = false) {
for (int k = num_digit - 1; k >= 0; --k) {
if (verbose) {
printf("%d", (val >> k) & 1);
} else {
cerr << ((val >> k) & 1);
}
}
if (verbose) {
printf("\n");
} else {
cerr << "\n";
}
}
void print_binary(long long val, int num_digit = 63, bool verbose = false) {
for (int k = num_digit - 1; k >= 0; --k) {
if (verbose) {
printf("%lld", ((val >> k) & 1));
} else {
cerr << ((val >> k) & 1);
}
}
if (verbose) {
printf("\n");
} else {
cerr << "\n";
}
}
struct UnionFind // size-based
{
vector<int> parent, treesize;
UnionFind(int size)
: parent(size), treesize(size, 1) // constructor
{
for (int i = 0; i < size; ++i) {
parent[i] = i;
}
}
int root(int x) {
if (parent[x] == x) {
return x;
}
return parent[x] = root(parent[x]);
}
void unite(int x, int y) {
x = root(x);
y = root(y);
if (x == y) {
return;
}
if (treesize[x] < treesize[y]) {
parent[x] = y;
treesize[y] += treesize[x];
} else {
parent[y] = x;
treesize[x] += treesize[y];
}
}
bool sametree(int x, int y) { return root(x) == root(y); }
int gettreesize(int x) { return treesize[root(x)]; }
};
template <typename Type_value>
struct SegmentTree // Range Minimum Query (RMQ)
{
private:
int n;
vector<Type_value> node;
Type_value identity_element_segmenttree;
public:
SegmentTree(vector<Type_value> v,
Type_value identity_element_st) // constructor
{
int sz = v.size();
identity_element_segmenttree = identity_element_st;
n = 1;
while (n < sz) {
n <<= 1;
}
node.resize(2 * n - 1, identity_element_segmenttree);
for (int i = 0; i < sz; ++i) {
node[i + n - 1] = v[i];
}
for (int i = n - 2; i >= 0; --i) {
node[i] = min(node[2 * i + 1], node[2 * i + 2]);
}
}
void update(int x, Type_value val) {
x += (n - 1);
node[x] = val;
while (x > 0) {
x = (x - 1) / 2;
node[x] = min(node[2 * x + 1], node[2 * x + 2]);
}
}
Type_value getmin(int a, int b, int k = 0, int l = 0,
int r = -1) // getting minimum value in [a,b)
{
// k : index of the referred node
// [l,r) : range covered by the k-th node
if (r < 0) {
r = n;
}
if (r <= a or b <= l) {
return identity_element_segmenttree;
}
if (a <= l and r <= b) {
return node[k];
}
Type_value vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
Type_value vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
return min(vl, vr);
}
};
template <typename Type_value>
struct BinaryIndexedTree // Range Sum Query (RSQ), 0-indexed
{
private:
int size_;
vector<Type_value> data;
public:
BinaryIndexedTree(int sz, Type_value identity_element_binaryindexedtree =
0.0) // constructor
{
size_ = sz;
data.resize(sz + 1, identity_element_binaryindexedtree);
}
Type_value sum(int i) // sum within [0,i)
{
if (i <= 0) {
return (Type_value)0.0;
}
if (i > size_) {
i = size_;
}
Type_value sm = 0.0;
while (i > 0) {
sm += data[i];
i -= i & -i;
}
return sm;
}
void add(int i, Type_value x) {
if (i < 0 or i >= size_) {
return;
}
++i;
while (i <= size_) {
data[i] += x;
i += i & -i;
}
}
};
struct RollingHash {
/*
10 primes near 1e9(for other mod(s)):
{
1000000007,
1000000009,
1000000021,
1000000033,
1000000087,
1000000093,
1000000097,
1000000103,
1000000123,
1000000181
}
10 primes near 1e5(for other base(s)):
{100003,
100019,
100043,
100049,
100057,
100069,
100103,
100109,
100129,
100151}
*/
private:
vector<unsigned long long> hash;
vector<unsigned long long> base_pow;
unsigned long long base, modulus;
const unsigned long long MODULUS_DEFAULT = (1ULL << 61) - 1;
const unsigned long long MASK30 = (1ULL << 30) - 1;
const unsigned long long MASK31 = (1ULL << 31) - 1;
const unsigned long long BASE_MIN = 1e7;
unsigned long long Modulus_2pow61m1(unsigned long long val) {
val = (val & MODULUS_DEFAULT) + (val >> 61);
if (MODULUS_DEFAULT < val) {
val -= MODULUS_DEFAULT;
}
return val;
}
unsigned long long Multiple_2pow61m1(unsigned long long a,
unsigned long long b) {
unsigned long long au = a >> 31;
unsigned long long ad = a & MASK31;
unsigned long long bu = b >> 31;
unsigned long long bd = b & MASK31;
unsigned long long mid = ad * bu + au * bd;
unsigned long long midu = mid >> 30;
unsigned long long midd = mid & MASK30;
return Modulus_2pow61m1(((au * bu) << 1) + midu + (midd << 31) + ad * bd);
}
void initialize(string &S) {
int N = S.size();
vector<int> s(N);
for (int i = 0; i < N; ++i) {
s[i] = S[i];
}
initialize(s);
}
void initialize(vector<int> &S) {
hash.resize(S.size() + 1);
base_pow.resize(S.size() + 1);
hash[0] = 0;
base_pow[0] = 1;
if (modulus == MODULUS_DEFAULT) {
for (int i = 1; i <= S.size(); ++i) {
hash[i] =
Modulus_2pow61m1(Multiple_2pow61m1(hash[i - 1], base) + S[i - 1]);
base_pow[i] = Multiple_2pow61m1(base_pow[i - 1], base);
}
} else {
for (int i = 1; i <= S.size(); ++i) {
hash[i] = (hash[i - 1] * base + S[i - 1]) % modulus;
base_pow[i] = (base_pow[i - 1] * base) % modulus;
}
}
}
public:
RollingHash(string S = "", unsigned long long base_ = 0,
unsigned long long modulus_ = 0) {
if (0 < modulus_) {
modulus = modulus_;
} else {
modulus = MODULUS_DEFAULT;
}
if (0 < base_) {
base = base_;
} else {
mt19937_64 mt64(static_cast<unsigned int>(time(nullptr)));
uniform_int_distribution<unsigned long long> rand_uniform(
BASE_MIN, modulus - BASE_MIN);
base = rand_uniform(mt64);
}
if (S.size() > 0) {
initialize(S);
}
}
// 0-indexed, [a, b)
unsigned long long between(int a, int b) {
if (modulus == MODULUS_DEFAULT) {
return Modulus_2pow61m1(modulus + hash[b] -
Multiple_2pow61m1(hash[a], base_pow[b - a]));
}
return (modulus + hash[b] - (hash[a] * base_pow[b - a]) % modulus) %
modulus;
}
};
/*------------------ the end of the template -----------------------*/
signed main() {
IOS; /* making cin faster */
int N;
CIN(N);
vector<string> S(N);
REP(i, N) {
CIN(S[i]);
sort(ALL(S[i]));
}
sort(ALL(S));
int i = 0;
lli ans = 0LL;
while (i < N) {
lli cnt = 0LL;
string temp = S[i];
while (i < N and S[i] == temp) {
++i;
++cnt;
}
ans += cnt * (cnt - 1LL) / 2LL;
}
CIN(ans);
}
| #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 <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#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
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define MOD 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS \
cin.tie(0); \
ios::sync_with_stdio(false)
#define M_P make_pair
#define PU_B push_back
#define PU_F push_front
#define PO_B pop_back
#define PO_F pop_front
#define U_B upper_bound
#define L_B lower_bound
#define B_S binary_search
#define PR_Q priority_queue
#define FIR first
#define SEC second
#if __cplusplus < 201103L
#define stoi(argument_string) atoi((argument_string).c_str())
#define stoll(argument_string) atoll((argument_string).c_str())
#endif
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP_R(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define FOR(i, m, n) for (int i = ((int)(m)); i < (int)(n); ++i)
#define FOR_R(i, m, n) for (int i = ((int)(m)-1); i >= (int)(n); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SIZ(x) ((int)(x).size())
#define CIN(x) cin >> (x)
#define CIN2(x, y) cin >> (x) >> (y)
#define CIN3(x, y, z) cin >> (x) >> (y) >> (z)
#define CIN4(x, y, z, w) cin >> (x) >> (y) >> (z) >> (w)
#define CIN5(x, y, z, w, u) cin >> (x) >> (y) >> (z) >> (w) >> (u)
#define SCAND(x) scanf("%d", &(x))
#define SCAND2(x, y) scanf("%d%d", &(x), &(y))
#define SCAND3(x, y, z) scanf("%d%d%d", &(x), &(y), &(z))
#define SCAND4(x, y, z, w) scanf("%d%d%d%d", &(x), &(y), &(z), &(w))
#define SCAND5(x, y, z, w, u) scanf("%d%d%d%d%d", &(x), &(y), &(z), &(w), &(u))
#define SCANLLD(x) scanf("%lld", &(x))
#define SCANLLD2(x, y) scanf("%lld%lld", &(x), &(y))
#define SCANLLD3(x, y, z) scanf("%lld%lld%lld", &(x), &(y), &(z))
#define SCANLLD4(x, y, z, w) scanf("%lld%lld%lld%lld", &(x), &(y), &(z), &(w))
#define SCANLLD5(x, y, z, w, u) \
scanf("%lld%lld%lld%lld%lld", &(x), &(y), &(z), &(w), &(u))
#define I64DSCAN(x) scanf("%I64d", &(x))
#define I64DSCAN2(x, y) scanf("%I64d%I64d", &(x), &(y))
#define I64DSCAN3(x, y, z) scanf("%I64d%I64d%I64d", &(x), &(y), &(z))
#define I64DSCAN4(x, y, z, w) \
scanf("%I64d%I64d%I64d%I64d", &(x), &(y), &(z), &(w))
#define I64DSCAN5(x, y, z, w, u) \
scanf("%I64d%I64d%I64d%I64d%I64d", &(x), &(y), &(z), &(w), &(u))
#define PRINTD(x) printf("%d\n", (x))
#define PRINTLLD(x) printf("%lld\n", (x))
#define PRINTI64D(x) printf("%I64d\n", (x))
#define DEBUG(argument) cerr << (#argument) << " : " << (argument) << "\n"
typedef long long int lli;
using namespace std;
bool compare_by_2nd(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int ctoi(char c) {
if (c >= '0' and c <= '9') {
return (int)(c - '0');
}
return -1;
}
int alphabet_pos(char c) {
if (c >= 'a' and c <= 'z') {
return (int)(c - 'a');
}
return -1;
}
int alphabet_pos_capital(char c) {
if (c >= 'A' and c <= 'Z') {
return (int)(c - 'A');
}
return -1;
}
vector<string> split(string str, char ch) {
int first = 0;
int last = str.find_first_of(ch);
if (last == string::npos) {
last = SIZ(str);
}
vector<string> result;
while (first < SIZ(str)) {
string Ssubstr(str, first, last - first);
result.push_back(Ssubstr);
first = last + 1;
last = str.find_first_of(ch, first);
if (last == string::npos) {
last = SIZ(str);
}
}
return result;
}
int gcd(int a, int b) // assuming a,b >= 1
{
if (a < b) {
swap(a, b);
}
if (a == 0) {
return b;
}
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
long long gcd(long long a, long long b) // assuming a,b >= 1
{
if (a < b) {
swap(a, b);
}
if (a == 0LL) {
return b;
}
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
return a * b / gcd(a, b);
}
long long lcm(long long a, long long b) // assuming a,b >= 1
{
return a * b / gcd(a, b);
}
long long pow_fast(long long x, long long n_power, long long modulus) {
if (n_power == 0) {
return 1;
}
if (n_power % 2 == 0) {
return pow_fast(x * x % modulus, n_power / 2, modulus);
}
return x * pow_fast(x, n_power - 1, modulus) % modulus;
}
struct CombinationTable {
vector<vector<long long>> val;
CombinationTable(int size)
: val(size + 1, vector<long long>(size + 1)) // constructor
{
for (int i = 0; i <= size; ++i) // note that 0 <= i <= size
{
for (int j = 0; j <= i; ++j) {
if (j == 0 or j == i) {
val[i][j] = 1LL;
} else {
val[i][j] = val[i - 1][j - 1] + val[i - 1][j];
}
}
}
}
};
void print_vector(vector<int> &h) {
int L = h.size();
for (int i = 0; i < L; ++i) {
printf("%d", h[i]);
if (i != L - 1) {
printf(" ");
} else {
printf("\n");
}
}
}
void print_vector(vector<long long> &h) {
int L = h.size();
for (int i = 0; i < L; ++i) {
printf("%lld", h[i]);
if (i != L - 1) {
printf(" ");
} else {
printf("\n");
}
}
}
void print_matrix2D(vector<vector<int>> &h) {
int Ly = h.size();
int Lx = h[0].size();
for (int i = 0; i < Ly; ++i) {
for (int j = 0; j < Lx; ++j) {
printf("%d", h[i][j]);
if (j != Lx - 1) {
printf(" ");
} else {
printf("\n");
}
}
}
}
void print_matrix2D(vector<vector<long long>> &h) {
int Ly = h.size();
int Lx = h[0].size();
for (int i = 0; i < Ly; ++i) {
for (int j = 0; j < Lx; ++j) {
printf("%lld", h[i][j]);
if (j != Lx - 1) {
printf(" ");
} else {
printf("\n");
}
}
}
}
void print_matrix2D(vector<string> &h) {
int Ly = h.size();
int Lx = h[0].size();
for (int i = 0; i < Ly; ++i) {
for (int j = 0; j < Lx; ++j) {
printf("%c", h[i][j]);
}
printf("\n");
}
}
void print_binary(int val, int num_digit = 31, bool verbose = false) {
for (int k = num_digit - 1; k >= 0; --k) {
if (verbose) {
printf("%d", (val >> k) & 1);
} else {
cerr << ((val >> k) & 1);
}
}
if (verbose) {
printf("\n");
} else {
cerr << "\n";
}
}
void print_binary(long long val, int num_digit = 63, bool verbose = false) {
for (int k = num_digit - 1; k >= 0; --k) {
if (verbose) {
printf("%lld", ((val >> k) & 1));
} else {
cerr << ((val >> k) & 1);
}
}
if (verbose) {
printf("\n");
} else {
cerr << "\n";
}
}
struct UnionFind // size-based
{
vector<int> parent, treesize;
UnionFind(int size)
: parent(size), treesize(size, 1) // constructor
{
for (int i = 0; i < size; ++i) {
parent[i] = i;
}
}
int root(int x) {
if (parent[x] == x) {
return x;
}
return parent[x] = root(parent[x]);
}
void unite(int x, int y) {
x = root(x);
y = root(y);
if (x == y) {
return;
}
if (treesize[x] < treesize[y]) {
parent[x] = y;
treesize[y] += treesize[x];
} else {
parent[y] = x;
treesize[x] += treesize[y];
}
}
bool sametree(int x, int y) { return root(x) == root(y); }
int gettreesize(int x) { return treesize[root(x)]; }
};
template <typename Type_value>
struct SegmentTree // Range Minimum Query (RMQ)
{
private:
int n;
vector<Type_value> node;
Type_value identity_element_segmenttree;
public:
SegmentTree(vector<Type_value> v,
Type_value identity_element_st) // constructor
{
int sz = v.size();
identity_element_segmenttree = identity_element_st;
n = 1;
while (n < sz) {
n <<= 1;
}
node.resize(2 * n - 1, identity_element_segmenttree);
for (int i = 0; i < sz; ++i) {
node[i + n - 1] = v[i];
}
for (int i = n - 2; i >= 0; --i) {
node[i] = min(node[2 * i + 1], node[2 * i + 2]);
}
}
void update(int x, Type_value val) {
x += (n - 1);
node[x] = val;
while (x > 0) {
x = (x - 1) / 2;
node[x] = min(node[2 * x + 1], node[2 * x + 2]);
}
}
Type_value getmin(int a, int b, int k = 0, int l = 0,
int r = -1) // getting minimum value in [a,b)
{
// k : index of the referred node
// [l,r) : range covered by the k-th node
if (r < 0) {
r = n;
}
if (r <= a or b <= l) {
return identity_element_segmenttree;
}
if (a <= l and r <= b) {
return node[k];
}
Type_value vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
Type_value vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
return min(vl, vr);
}
};
template <typename Type_value>
struct BinaryIndexedTree // Range Sum Query (RSQ), 0-indexed
{
private:
int size_;
vector<Type_value> data;
public:
BinaryIndexedTree(int sz, Type_value identity_element_binaryindexedtree =
0.0) // constructor
{
size_ = sz;
data.resize(sz + 1, identity_element_binaryindexedtree);
}
Type_value sum(int i) // sum within [0,i)
{
if (i <= 0) {
return (Type_value)0.0;
}
if (i > size_) {
i = size_;
}
Type_value sm = 0.0;
while (i > 0) {
sm += data[i];
i -= i & -i;
}
return sm;
}
void add(int i, Type_value x) {
if (i < 0 or i >= size_) {
return;
}
++i;
while (i <= size_) {
data[i] += x;
i += i & -i;
}
}
};
struct RollingHash {
/*
10 primes near 1e9(for other mod(s)):
{
1000000007,
1000000009,
1000000021,
1000000033,
1000000087,
1000000093,
1000000097,
1000000103,
1000000123,
1000000181
}
10 primes near 1e5(for other base(s)):
{100003,
100019,
100043,
100049,
100057,
100069,
100103,
100109,
100129,
100151}
*/
private:
vector<unsigned long long> hash;
vector<unsigned long long> base_pow;
unsigned long long base, modulus;
const unsigned long long MODULUS_DEFAULT = (1ULL << 61) - 1;
const unsigned long long MASK30 = (1ULL << 30) - 1;
const unsigned long long MASK31 = (1ULL << 31) - 1;
const unsigned long long BASE_MIN = 1e7;
unsigned long long Modulus_2pow61m1(unsigned long long val) {
val = (val & MODULUS_DEFAULT) + (val >> 61);
if (MODULUS_DEFAULT < val) {
val -= MODULUS_DEFAULT;
}
return val;
}
unsigned long long Multiple_2pow61m1(unsigned long long a,
unsigned long long b) {
unsigned long long au = a >> 31;
unsigned long long ad = a & MASK31;
unsigned long long bu = b >> 31;
unsigned long long bd = b & MASK31;
unsigned long long mid = ad * bu + au * bd;
unsigned long long midu = mid >> 30;
unsigned long long midd = mid & MASK30;
return Modulus_2pow61m1(((au * bu) << 1) + midu + (midd << 31) + ad * bd);
}
void initialize(string &S) {
int N = S.size();
vector<int> s(N);
for (int i = 0; i < N; ++i) {
s[i] = S[i];
}
initialize(s);
}
void initialize(vector<int> &S) {
hash.resize(S.size() + 1);
base_pow.resize(S.size() + 1);
hash[0] = 0;
base_pow[0] = 1;
if (modulus == MODULUS_DEFAULT) {
for (int i = 1; i <= S.size(); ++i) {
hash[i] =
Modulus_2pow61m1(Multiple_2pow61m1(hash[i - 1], base) + S[i - 1]);
base_pow[i] = Multiple_2pow61m1(base_pow[i - 1], base);
}
} else {
for (int i = 1; i <= S.size(); ++i) {
hash[i] = (hash[i - 1] * base + S[i - 1]) % modulus;
base_pow[i] = (base_pow[i - 1] * base) % modulus;
}
}
}
public:
RollingHash(string S = "", unsigned long long base_ = 0,
unsigned long long modulus_ = 0) {
if (0 < modulus_) {
modulus = modulus_;
} else {
modulus = MODULUS_DEFAULT;
}
if (0 < base_) {
base = base_;
} else {
mt19937_64 mt64(static_cast<unsigned int>(time(nullptr)));
uniform_int_distribution<unsigned long long> rand_uniform(
BASE_MIN, modulus - BASE_MIN);
base = rand_uniform(mt64);
}
if (S.size() > 0) {
initialize(S);
}
}
// 0-indexed, [a, b)
unsigned long long between(int a, int b) {
if (modulus == MODULUS_DEFAULT) {
return Modulus_2pow61m1(modulus + hash[b] -
Multiple_2pow61m1(hash[a], base_pow[b - a]));
}
return (modulus + hash[b] - (hash[a] * base_pow[b - a]) % modulus) %
modulus;
}
};
/*------------------ the end of the template -----------------------*/
signed main() {
IOS; /* making cin faster */
int N;
CIN(N);
vector<string> S(N);
REP(i, N) {
CIN(S[i]);
sort(ALL(S[i]));
}
sort(ALL(S));
int i = 0;
lli ans = 0LL;
while (i < N) {
lli cnt = 0LL;
string temp = S[i];
while (i < N and S[i] == temp) {
++i;
++cnt;
}
ans += cnt * (cnt - 1LL) / 2LL;
}
cout << ans << endl;
}
| [
"io.output.change"
] | 747,793 | 747,794 | u900727536 | cpp |
p02947 | #include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
const long long mod = 1e9 + 7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<double> VI; // VI a(n);
typedef vector<string> VS;
typedef vector<VS> VSS;
typedef vector<VI> VVI; // VVI a(n,vector<int>(m)) n * m
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll; // ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main() {
ll c = 0, d = 0, k = 0, n, m, h, w, p, q, min, max, ans;
string s, s1, s2;
map<string, int> mp;
cin >> n;
rep(i, n) {
cin >> s;
sort(ALL(s));
auto itr = mp.find(s);
if (itr != mp.end()) {
ans += itr->second;
mp[s]++;
} else {
mp[s] = 1;
}
}
cout << ans << endl;
return 0;
}
| #include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
const long long mod = 1e9 + 7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<double> VI; // VI a(n);
typedef vector<string> VS;
typedef vector<VS> VSS;
typedef vector<VI> VVI; // VVI a(n,vector<int>(m)) n * m
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll; // ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main() {
ll c = 0, d = 0, k = 0, n, m, h, w, p, q, min, max, ans = 0;
string s, s1, s2;
map<string, int> mp;
cin >> n;
rep(i, n) {
cin >> s;
sort(ALL(s));
auto itr = mp.find(s);
if (itr != mp.end()) {
ans += itr->second;
mp[s]++;
} else {
mp[s] = 1;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.value.change"
] | 747,795 | 747,796 | u718774863 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
int k, x;
string s;
map<string, int> mp;
cin >> k;
while (k--) {
cin >> s;
sort(s.begin(), s.end());
mp[s] += 1;
}
ll ans = 0;
for (auto it : mp) {
ans += (it.second) * (it.second - 1) / 2;
}
cout << ans << '\n';
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
int k, x;
string s;
map<string, ll> mp;
cin >> k;
while (k--) {
cin >> s;
sort(s.begin(), s.end());
mp[s] += 1;
}
ll ans = 0;
for (auto it : mp) {
ans += (it.second) * (it.second - 1) / 2;
}
cout << ans << '\n';
return 0;
} | [] | 747,798 | 747,799 | u038410216 | cpp |
p02947 | #include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 0; i <= n; i++)
#define repr(i, n) for (int i = n; i > 0; i--)
#define REPR(i, n) for (int i = n; i >= 0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9 + 7;
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;
}
using namespace std;
int N;
string s;
map<string, int> m;
// x個の中から二つを選ぶ方法
int comb(int x) { return x * (x - 1) / 2; }
int main() {
cin >> N;
ll ans = 0;
rep(i, N) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (const auto &x : m) {
ans += comb(x.second);
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 0; i <= n; i++)
#define repr(i, n) for (int i = n; i > 0; i--)
#define REPR(i, n) for (int i = n; i >= 0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9 + 7;
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;
}
using namespace std;
int N;
string s;
map<string, ll> m;
// x個の中から二つを選ぶ方法
ll comb(ll x) { return x * (x - 1) / 2; }
int main() {
cin >> N;
ll ans = 0;
rep(i, N) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (const auto &x : m) {
ans += comb(x.second);
}
cout << ans << endl;
}
| [] | 747,800 | 747,801 | u864667985 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> MAP;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
MAP[s]++;
}
long long ans = 0;
for (auto p : MAP) {
int a = p.second;
ans += a * (a - 1) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, long long> MAP;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
MAP[s]++;
}
long long ans = 0;
for (auto p : MAP) {
long long a = p.second;
ans += a * (a - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,808 | 747,809 | u688422725 | 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 SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) \
fprintf(stderr, "%s - %d (%s) = ", __PRETTY_FUNCTION__, __LINE__, \
#__VA_ARGS__); \
_do(__VA_ARGS__);
template <typename T> void _do(T &&x) { cerr << x << endl; }
template <typename T, typename... S> void _do(T &&x, S &&...y) {
cerr << x << ", ";
_do(y...);
}
#else
#define IOS() \
ios_base::sync_with_stdio(0); \
cin.tie(0);
#define endl '\n'
#define debug(...)
#endif
const int MAXN = 1000006;
const ll MOD = 1000000007;
vector<string> sa;
/*********************GoodLuck***********************/
int main() {
IOS();
ll ans = 0;
int n;
cin >> n;
REP(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
sa.emplace_back(s);
}
sort(sa.begin(), sa.end());
int cnt = 1;
REP1(i, SZ(sa)) {
if (i == SZ(sa) || sa[i] != sa[i - 1]) {
debug(cnt);
ans += cnt * (cnt - 1) / 2;
cnt = 0;
}
cnt++;
}
cout << ans << endl;
return 0;
}
| #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 SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) \
fprintf(stderr, "%s - %d (%s) = ", __PRETTY_FUNCTION__, __LINE__, \
#__VA_ARGS__); \
_do(__VA_ARGS__);
template <typename T> void _do(T &&x) { cerr << x << endl; }
template <typename T, typename... S> void _do(T &&x, S &&...y) {
cerr << x << ", ";
_do(y...);
}
#else
#define IOS() \
ios_base::sync_with_stdio(0); \
cin.tie(0);
#define endl '\n'
#define debug(...)
#endif
const int MAXN = 1000006;
const ll MOD = 1000000007;
vector<string> sa;
/*********************GoodLuck***********************/
int main() {
IOS();
ll ans = 0;
int n;
cin >> n;
REP(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
sa.emplace_back(s);
}
sort(sa.begin(), sa.end());
int cnt = 1;
REP1(i, SZ(sa)) {
if (i == SZ(sa) || sa[i] != sa[i - 1]) {
debug(cnt);
ans += cnt * ll(cnt - 1) / 2;
cnt = 0;
}
cnt++;
}
cout << ans << endl;
return 0;
}
| [
"call.add"
] | 747,810 | 747,811 | u825429292 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
int calc(int n) {}
int main() {
int N;
std::unordered_map<std::string, int> ss;
std::cin >> N;
for (int i = 0; i < N; ++i) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
ss[s] += 1;
}
long count = 0L;
for (auto i = ss.begin(); i != ss.end(); ++i) {
int occur = (*i).second;
count += occur * (occur - 1) / 2;
}
std::cout << count << std::endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
int calc(int n) {}
int main() {
int N;
std::unordered_map<std::string, int> ss;
std::cin >> N;
for (int i = 0; i < N; ++i) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
ss[s] += 1;
}
long count = 0L;
for (auto i = ss.begin(); i != ss.end(); ++i) {
long occur = (*i).second;
count += occur * (occur - 1) / 2;
}
std::cout << count << std::endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 747,812 | 747,813 | u321149875 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
int calc(int n) {}
int main() {
int N;
std::unordered_map<std::string, int> ss;
std::cin >> N;
for (int i = 0; i < N; ++i) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
ss[s] += 1;
}
int count = 0;
for (auto i = ss.begin(); i != ss.end(); ++i) {
int occur = (*i).second;
count += occur * (occur - 1) / 2;
}
std::cout << count << std::endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
int calc(int n) {}
int main() {
int N;
std::unordered_map<std::string, int> ss;
std::cin >> N;
for (int i = 0; i < N; ++i) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
ss[s] += 1;
}
long count = 0L;
for (auto i = ss.begin(); i != ss.end(); ++i) {
long occur = (*i).second;
count += occur * (occur - 1) / 2;
}
std::cout << count << std::endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"literal.number.type.widen.change"
] | 747,814 | 747,813 | u321149875 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
int n;
cin >> n;
string s;
unordered_map<string, int> map;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
map[s]++;
}
long int ans = 0;
for (auto it = map.begin(); it != map.end(); it++) {
if (it->second > 1) {
ans += it->second * (it->second - 1) / 2;
}
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
int n;
cin >> n;
string s;
unordered_map<string, int> map;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
map[s]++;
}
long int ans = 0;
for (auto it = map.begin(); it != map.end(); it++) {
if (it->second > 1) {
ans += (long int)it->second * (it->second - 1) / 2;
}
}
cout << ans << endl;
return 0;
}
| [
"type_conversion.add"
] | 747,815 | 747,816 | u493846037 | cpp |
p02947 | #include <bits/stdc++.h>
// # define INF 1e9
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]++;
}
int ans = 0;
for (auto x : m) {
int v = x.second;
ans += (v - 1) * v / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
// # define INF 1e9
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 x : m) {
long long v = x.second;
ans += (v - 1) * v / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,823 | 747,824 | u116002573 | cpp |
p02947 | #include <bits/stdc++.h>
#define INF 1e9
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]++;
}
int ans = 0;
auto begin = m.begin(), end = m.end();
for (auto iter = begin; iter != end; iter++) {
string s = iter->first;
ans += m[s] * (m[s] - 1) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define INF 1e9
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;
auto begin = m.begin(), end = m.end();
for (auto iter = begin; iter != end; iter++) {
string s = iter->first;
ans += m[s] * (m[s] - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,825 | 747,826 | u116002573 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
bool ard(string a, string b) {
int c = 0;
for (int i = 0; i < a.length(); i++) {
int f = b.find(a[i]);
if (f != string::npos) {
c++;
b.erase(f, 1);
}
}
return (c == 10);
}
int main() {
int n;
cin >> n;
vector<string> v;
for (int i = 0; i < n; i++) {
string t;
cin >> t;
sort(t.begin(), t.end());
v.push_back(t);
}
sort(v.begin(), v.end());
int ans = 0;
int fn = 1;
for (int i = 1; i < v.size(); i++) {
if (v[i] == v[i - 1]) {
ans += fn;
fn++;
} else
fn = 1;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
bool ard(string a, string b) {
int c = 0;
for (int i = 0; i < a.length(); i++) {
int f = b.find(a[i]);
if (f != string::npos) {
c++;
b.erase(f, 1);
}
}
return (c == 10);
}
int main() {
int n;
cin >> n;
vector<string> v;
for (int i = 0; i < n; i++) {
string t;
cin >> t;
sort(t.begin(), t.end());
v.push_back(t);
}
sort(v.begin(), v.end());
long long ans = 0;
int fn = 1;
for (int i = 1; i < v.size(); i++) {
if (v[i] == v[i - 1]) {
ans += fn;
fn++;
} else
fn = 1;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,827 | 747,828 | u129611452 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++)
cin >> s.at(i);
for (int i = 0; i < N; i++)
sort(s.at(i).begin(), s.at(i).end());
sort(s.begin(), s.end());
int ans = 0;
map<string, int> list;
for (int i = 0; i < N; i++) {
if (list.find(s.at(i)) == list.end()) {
list.insert(make_pair(s.at(i), 1));
} else {
ans += list.at(s.at(i));
list.at(s.at(i))++;
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++)
cin >> s.at(i);
for (int i = 0; i < N; i++)
sort(s.at(i).begin(), s.at(i).end());
sort(s.begin(), s.end());
int64_t ans = 0;
map<string, int> list;
for (int i = 0; i < N; i++) {
if (list.find(s.at(i)) == list.end()) {
list.insert(make_pair(s.at(i), 1));
} else {
ans += list.at(s.at(i));
list.at(s.at(i))++;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 747,832 | 747,833 | u152315108 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
mp[s.at(i)]++;
}
long long cnt = 0;
for (auto s : mp) {
cnt += s.second * (s.second - 1) / 2;
}
cout << cnt << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
mp[s.at(i)]++;
}
long long cnt = 0;
for (auto s : mp) {
cnt += (long long)s.second * (s.second - 1) / 2;
}
cout << cnt << endl;
return 0;
}
| [
"type_conversion.add"
] | 747,834 | 747,835 | u215743476 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
int main(int argc, char const *argv[]) {
int d = 1000000;
map<string, int> arl;
int ans = 0;
cin >> d;
for (int i = 0; i < d; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
arl[S]++;
ans += arl[S] - 1;
}
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
int main(int argc, char const *argv[]) {
int d = 1000000;
map<string, int> arl;
long long ans = 0;
cin >> d;
for (int i = 0; i < d; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
arl[S]++;
ans += arl[S] - 1;
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,836 | 747,837 | u498467508 | cpp |
p02947 | #include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int main() {
double n, cnt = 0, num = 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());
string tmp = s[0];
for (int i = 1; i < n; i++) {
if (tmp == s[i]) {
num++;
} else if (1 <= num) {
cnt += num * (num + 1) / 2;
num = 0;
tmp = s[i];
} else {
tmp = s[i];
num = 0;
}
if (i == n - 1 and 1 <= num) {
cnt += num * (num + 1) / 2;
}
}
cout << cnt << endl;
return 0;
}
| #include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int main() {
long long n, cnt = 0, num = 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());
string tmp = s[0];
for (int i = 1; i < n; i++) {
if (tmp == s[i]) {
num++;
} else if (1 <= num) {
cnt += num * (num + 1) / 2;
num = 0;
tmp = s[i];
} else {
tmp = s[i];
num = 0;
}
if (i == n - 1 and 1 <= num) {
cnt += num * (num + 1) / 2;
}
}
cout << cnt << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,838 | 747,839 | u816935184 | cpp |
p02947 | #include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> data; //文字列→個数
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (data.count(s))
data.at(s)++;
else
data[s] = 1;
}
long long sum = 0;
for (pair<string, int> p : data) {
int d = p.second;
sum += d * (d - 1) / 2;
}
cout << sum << endl;
return 0;
} | #include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> data; //文字列→個数
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (data.count(s))
data.at(s)++;
else
data[s] = 1;
}
long long sum = 0;
for (pair<string, int> p : data) {
long long d = p.second;
sum += d * (d - 1) / 2;
}
cout << sum << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,840 | 747,841 | u938841444 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(void) {
int N;
int cnt = 0;
cin >> N;
vector<string> s(N);
unordered_map<string, int> table;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (table.find(s[i]) == table.end()) {
table.emplace(s[i], 0);
} else {
table[s[i]]++;
cnt += table[s[i]];
}
}
cout << cnt << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(void) {
long N;
long cnt = 0;
cin >> N;
vector<string> s(N);
unordered_map<string, long> table;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (table.find(s[i]) == table.end()) {
table.emplace(s[i], 0);
} else {
table[s[i]]++;
cnt += table[s[i]];
}
}
cout << cnt << endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 747,844 | 747,845 | u145179061 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
long long g = GCD(a, b);
return a / g * b;
}
int main() {
int N;
cin >> N;
map<string, int> ma;
rep(i, 0, N) {
string s;
cin >> s;
//ここで受け取った文字列sを辞書順最小にソートする
sort(s.begin(), s.end());
ma[s]++;
}
long long count = 0;
for (auto a : ma) {
count += a.second * (a.second - 1) / 2;
}
cout << count << endl;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
long long GCD(long long a, long long b) {
if (b == 0)
return a;
else
return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
long long g = GCD(a, b);
return a / g * b;
}
int main() {
int N;
cin >> N;
map<string, long long> ma;
rep(i, 0, N) {
string s;
cin >> s;
//ここで受け取った文字列sを辞書順最小にソートする
sort(s.begin(), s.end());
ma[s]++;
}
long long count = 0;
for (auto a : ma) {
count += a.second * (a.second - 1) / 2;
}
cout << count << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,846 | 747,847 | u183971632 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
int main() {
int n, ans = 0;
std::unordered_map<std::string, int> string_map;
std::cin >> n;
std::string s;
for (int i = 0; i < n; i++) {
std::cin >> s;
std::sort(s.begin(), s.end());
if (string_map.find(s) == string_map.end())
string_map[s] = 0;
else
string_map[s] += 1;
}
for (auto &i : string_map) {
long x = i.second;
ans += x * (x + 1) / 2;
}
std::cout << ans << std::endl;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
int main() {
int n;
long ans = 0;
std::unordered_map<std::string, int> string_map;
std::cin >> n;
std::string s;
for (int i = 0; i < n; i++) {
std::cin >> s;
std::sort(s.begin(), s.end());
if (string_map.find(s) == string_map.end())
string_map[s] = 0;
else
string_map[s] += 1;
}
for (auto &i : string_map) {
long x = i.second;
ans += x * (x + 1) / 2;
}
std::cout << ans << std::endl;
} | [
"variable_declaration.type.widen.change"
] | 747,853 | 747,854 | u911828387 | cpp |
p02947 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
#define MIN(a, b) (a) > (b) ? (b) : (a)
using namespace std;
int main() {
int N;
cin >> N;
long ans = 0;
unordered_map<string, int> S;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (S.find(s) == S.end()) {
S[s] = 0;
} else {
S[s]++;
}
}
for (auto &i : S) {
int f = i.second;
ans += f * (f + 1) / 2;
}
cout << ans;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
#define MIN(a, b) (a) > (b) ? (b) : (a)
using namespace std;
int main() {
int N;
cin >> N;
long ans = 0;
unordered_map<string, int> S;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (S.find(s) == S.end()) {
S[s] = 0;
} else {
S[s]++;
}
}
for (auto &i : S) {
long f = i.second;
ans += f * (f + 1) / 2;
}
cout << ans;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 747,855 | 747,856 | u598273654 | cpp |
p02947 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using ll = long long int;
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> A;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
A[s]++;
}
ll ans = 0;
for (auto a : A) {
ans += (a.second * (a.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using ll = long long int;
using namespace std;
int main() {
int N;
cin >> N;
map<string, ll> A;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
A[s]++;
}
ll ans = 0;
for (auto a : A) {
ans += (a.second * (a.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | [] | 747,857 | 747,858 | u569272329 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main(void) {
int n;
cin >> n;
typedef long long ll;
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) { // auto&で型推測を自動化し、mpの存在するpを全て列挙してくれる
int s =
p.second; // 2番目の値を持ってくる つまり、string int
// のint成分を持ってくるということ p.firstはstring持ってくる
ans *= (ll)s * (s - 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;
int main(void) {
int n;
cin >> n;
typedef long long ll;
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) { // auto&で型推測を自動化し、mpの存在するpを全て列挙してくれる
int s =
p.second; // 2番目の値を持ってくる つまり、string int
// のint成分を持ってくるということ p.firstはstring持ってくる
ans += (ll)s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"expression.operator.change"
] | 747,859 | 747,860 | u905170328 | cpp |
p02947 | #include <bits/stdc++.h>
#define ll long long
#define maxn (1000 + 10)
#define mod 10000003
#define lnode node * 2, start, mid
#define rnode node * 2 + 1, mid + 1, end
using namespace std;
map<string, int> m;
string s[100010];
long long num = 0;
int main() {
ios::sync_with_stdio(false);
#define int ll
int n;
char t[100];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
sort(t, t + strlen(t));
s[i] = t;
m[t] += 1;
}
for (int i = 0; i < n; i++) {
if (m[s[i]] != 0) {
num += (m[s[i]] * (m[s[i]] - 1)) / 2;
m[s[i]] = 0;
}
}
cout << num;
return 0;
} | #include <bits/stdc++.h>
#define ll long long
#define maxn (1000 + 10)
#define mod 10000003
#define lnode node * 2, start, mid
#define rnode node * 2 + 1, mid + 1, end
using namespace std;
map<string, long long> m;
string s[100010];
long long num = 0;
int main() {
ios::sync_with_stdio(false);
#define int ll
int n;
char t[100];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
sort(t, t + strlen(t));
s[i] = t;
m[t] += 1;
}
for (int i = 0; i < n; i++) {
if (m[s[i]] != 0) {
num += (m[s[i]] * (m[s[i]] - 1)) / 2;
m[s[i]] = 0;
}
}
cout << num;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,861 | 747,862 | u455823625 | cpp |
p02947 | #include <bits/stdc++.h>
#define ll long long
#define maxn (1000 + 10)
#define mod 10000003
#define lnode node * 2, start, mid
#define rnode node * 2 + 1, mid + 1, end
using namespace std;
map<string, int> m;
string s[100010];
int num = 0;
int main() {
ios::sync_with_stdio(false);
#define int ll
int n;
char t[100];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
sort(t, t + strlen(t));
s[i] = t;
m[t] += 1;
}
for (int i = 0; i < n; i++) {
if (m[s[i]] != 0) {
num += (m[s[i]] * (m[s[i]] - 1)) / 2;
m[s[i]] = 0;
}
}
cout << num;
return 0;
} | #include <bits/stdc++.h>
#define ll long long
#define maxn (1000 + 10)
#define mod 10000003
#define lnode node * 2, start, mid
#define rnode node * 2 + 1, mid + 1, end
using namespace std;
map<string, long long> m;
string s[100010];
long long num = 0;
int main() {
ios::sync_with_stdio(false);
#define int ll
int n;
char t[100];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
sort(t, t + strlen(t));
s[i] = t;
m[t] += 1;
}
for (int i = 0; i < n; i++) {
if (m[s[i]] != 0) {
num += (m[s[i]] * (m[s[i]] - 1)) / 2;
m[s[i]] = 0;
}
}
cout << num;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,863 | 747,862 | u455823625 | cpp |
p02947 | #include <bits/stdc++.h>
#define ll long long
#define maxn (1000 + 10)
#define mod 10000003
#define lnode node * 2, start, mid
#define rnode node * 2 + 1, mid + 1, end
using namespace std;
map<string, int> m;
string s[100001];
int num = 0;
int main() {
ios::sync_with_stdio(false);
#define int ll
int n;
char t[11];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
sort(t, t + strlen(t));
s[i] = t;
m[t] += 1;
}
for (int i = 0; i < n; i++) {
if (m[s[i]] != 0) {
num += (m[s[i]] * (m[s[i]] - 1)) / 2;
m[s[i]] = 0;
}
}
cout << num;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define maxn (1000 + 10)
#define mod 10000003
#define lnode node * 2, start, mid
#define rnode node * 2 + 1, mid + 1, end
using namespace std;
map<string, long long> m;
string s[100010];
long long num = 0;
int main() {
ios::sync_with_stdio(false);
#define int ll
int n;
char t[100];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
sort(t, t + strlen(t));
s[i] = t;
m[t] += 1;
}
for (int i = 0; i < n; i++) {
if (m[s[i]] != 0) {
num += (m[s[i]] * (m[s[i]] - 1)) / 2;
m[s[i]] = 0;
}
}
cout << num;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 747,864 | 747,862 | u455823625 | 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[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> mp;
for (int i = 0; i < n; i++) {
if (mp.find(s[i]) != mp.end()) {
mp[s[i]]++;
} else {
mp[s[i]] = 1;
}
}
long long ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
ans += (itr->second * (itr->second - 1)) / 2;
}
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++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, long long> mp;
for (int i = 0; i < n; i++) {
if (mp.find(s[i]) != mp.end()) {
mp[s[i]]++;
} else {
mp[s[i]] = 1;
}
}
long long ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
ans += (itr->second * (itr->second - 1)) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,865 | 747,866 | u526708273 | cpp |
p02947 | #include <bits/stdc++.h>
#include <map>
using namespace std;
// typedef long long long long;
int main() {
long long n = 3;
cin >> n;
// map<string, long long> m;
// long n = 3;
// map<string, long long> m = {{"acornistnt", 1}, {"peanutbomb", 2}
// ,{"constraint", 3}};
map<string, long long> m;
// vector<string> ss = {"acornistnt", "peanutbomb","constraint"};
// for(long long i=0; i<n; i++){
// string s = ss.at(i);
// sort(s.begin(), s.end());
// m.insert(make_pair(s, i));
// }
for (long long i = 0; i < n; i++) {
string s;
// cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
long long ans = 0;
for (auto p : m) {
long long x = p.second;
// cout << "x = " << x <<endl;
ans += x * (x - 1) / 2;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
#include <map>
using namespace std;
// typedef long long long long;
int main() {
long long n = 3;
cin >> n;
// map<string, long long> m;
// long n = 3;
// map<string, long long> m = {{"acornistnt", 1}, {"peanutbomb", 2}
// ,{"constraint", 3}};
map<string, long long> m;
// vector<string> ss = {"acornistnt", "peanutbomb","constraint"};
// for(long long i=0; i<n; i++){
// string s = ss.at(i);
// sort(s.begin(), s.end());
// m.insert(make_pair(s, i));
// }
for (long long i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
long long ans = 0;
for (auto p : m) {
long long x = p.second;
// cout << "x = " << x <<endl;
ans += x * (x - 1) / 2;
}
cout << ans << endl;
return 0;
} | [] | 747,867 | 747,868 | u891807037 | cpp |
p02947 | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N + 1);
for (int i = 0; i < N; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
}
long long ans = 0;
S[N] = ("zzzzzzzzzzz");
sort(S.begin(), S.end());
int count = 0;
for (int i = 0; i < N; i++) {
// cout<<S[i]<<endl;
if (S[i] == S[i + 1]) {
count++;
} else {
ans += count * (count + 1) / 2;
count = 0;
}
}
cout << ans << endl;
return 0;
} | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N + 1);
for (int i = 0; i < N; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
}
long long ans = 0;
S[N] = ("zzzzzzzzzzz");
sort(S.begin(), S.end());
long long count = 0;
for (int i = 0; i < N; i++) {
// cout<<S[i]<<endl;
if (S[i] == S[i + 1]) {
count++;
} else {
ans += count * (count + 1) / 2;
count = 0;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,871 | 747,870 | u184929210 | cpp |
p02947 | #include <bits/stdc++.h>
#define SEKAI_NO_OWARI return 0;
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
void solve() {
int n;
cin >> n;
vector<string> s(n);
unordered_map<string, int> um(n);
rep(i, n) cin >> s[i];
int res = 0;
for (int i = 0; i < n; i++) {
sort(s[i].begin(), s[i].end());
um[s[i]] += 1;
res += um[s[i]] - 1;
}
cout << res << endl;
}
int main(void) {
solve();
SEKAI_NO_OWARI
} | #include <bits/stdc++.h>
#define SEKAI_NO_OWARI return 0;
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
void solve() {
int n;
cin >> n;
vector<string> s(n);
unordered_map<string, long long> um(n);
rep(i, n) cin >> s[i];
long long res = 0;
for (int i = 0; i < n; i++) {
sort(s[i].begin(), s[i].end());
um[s[i]] += 1;
res += um[s[i]] - 1;
}
cout << res << endl;
}
int main(void) {
solve();
SEKAI_NO_OWARI
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,874 | 747,875 | u863957421 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, int> m;
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]]++;
}
long long ans = 0;
for (auto &&i : m) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, int> m;
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]]++;
}
long long ans = 0;
for (auto &&i : m) {
ans += (long long)i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"type_conversion.add"
] | 747,876 | 747,877 | u528523331 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
// Macros
#define f(i, a, b) for (int i = a; i < b; i++)
#define f_(i, a, b) for (int i = a; i >= b; i++)
#define F first
#define S second
#define PB push_back
#define endl '\n'
// Debuging
#define deb(x) cout << #x << " " << x << '\n'
// Shortcuts
typedef long long ll;
typedef pair<int, string> pi;
typedef vector<string> vi;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
/* code */
int n;
cin >> n;
unordered_map<string, int> mp;
f(i, 0, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &it : mp) {
int s = it.S;
ans += s * (s - 1) / 2; // nCr (Combination) in particular of r=2
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
// Macros
#define f(i, a, b) for (int i = a; i < b; i++)
#define f_(i, a, b) for (int i = a; i >= b; i++)
#define F first
#define S second
#define PB push_back
#define endl '\n'
// Debuging
#define deb(x) cout << #x << " " << x << '\n'
// Shortcuts
typedef long long ll;
typedef pair<int, string> pi;
typedef vector<string> vi;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
/* code */
int n;
cin >> n;
unordered_map<string, int> mp;
f(i, 0, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &it : mp) {
int s = it.S;
ans +=
(ll)s * (s - 1) / 2; // nCr (Combination formula) in particular of r=2
}
cout << ans << endl;
} | [
"type_conversion.add"
] | 747,878 | 747,879 | u359384375 | cpp |
p02947 | #include <bits/stdc++.h>
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 i = p.second;
ans += i * (i - 1) / 2;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
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 i = p.second;
ans += (long long)i * (i - 1) / 2;
}
cout << ans << endl;
}
| [
"type_conversion.add"
] | 747,880 | 747,881 | u806149832 | cpp |
p02947 | #include <bits/stdc++.h>
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 i = p.second;
ans += i * (i - 1) / 2;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
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 i = p.second;
ans += (long long)i * (i - 1) / 2;
}
cout << ans << endl;
}
| [
"type_conversion.add"
] | 747,882 | 747,881 | u806149832 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
long int comb(int);
int main(void) {
int n;
cin >> n;
vector<string> sv(n);
for (int i = 0; i < n; i++)
cin >> sv.at(i);
unordered_map<string, int> hash;
for (auto s : sv) {
sort(s.begin(), s.end());
if (hash[s] == 0) {
hash[s]++;
} else {
hash[s] += 1;
}
}
long int cnt = 0;
for (auto i = hash.begin(); i != hash.end(); i++) {
cnt += comb(i->second);
}
cout << cnt << endl;
return 0;
}
long int comb(int x) { return x * (x - 1) / 2; } | #include <bits/stdc++.h>
using namespace std;
long int comb(long int);
int main(void) {
int n;
cin >> n;
vector<string> sv(n);
for (int i = 0; i < n; i++)
cin >> sv.at(i);
unordered_map<string, int> hash;
for (auto s : sv) {
sort(s.begin(), s.end());
if (hash[s] == 0) {
hash[s]++;
} else {
hash[s] += 1;
}
}
long int cnt = 0;
for (auto i = hash.begin(); i != hash.end(); i++) {
cnt += comb(i->second);
}
cout << cnt << endl;
return 0;
}
long int comb(long int x) { return x * (x - 1) / 2; } | [
"variable_declaration.type.widen.change"
] | 747,883 | 747,884 | u720447689 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int comb(int);
int main(void) {
int n;
cin >> n;
vector<string> sv(n);
for (int i = 0; i < n; i++)
cin >> sv.at(i);
unordered_map<string, int> hash;
for (auto s : sv) {
sort(s.begin(), s.end());
if (hash[s] == 0) {
hash[s]++;
} else {
hash[s] += 1;
}
}
int cnt = 0;
for (auto i = hash.begin(); i != hash.end(); i++) {
cnt += comb(i->second);
}
cout << cnt << endl;
return 0;
}
int comb(int x) { return x * (x - 1) / 2; } | #include <bits/stdc++.h>
using namespace std;
long int comb(long int);
int main(void) {
int n;
cin >> n;
vector<string> sv(n);
for (int i = 0; i < n; i++)
cin >> sv.at(i);
unordered_map<string, int> hash;
for (auto s : sv) {
sort(s.begin(), s.end());
if (hash[s] == 0) {
hash[s]++;
} else {
hash[s] += 1;
}
}
long int cnt = 0;
for (auto i = hash.begin(); i != hash.end(); i++) {
cnt += comb(i->second);
}
cout << cnt << endl;
return 0;
}
long int comb(long int x) { return x * (x - 1) / 2; } | [
"variable_declaration.type.widen.change"
] | 747,885 | 747,884 | u720447689 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, ans = 0;
cin >> n;
string s[n];
priority_queue<char> que;
priority_queue<string> que2;
for (i = 0; i < n; i++) {
cin >> s[i];
for (j = 0; j < 10; j++) {
que.push(s[i][j]);
}
for (j = 0; j < 10; j++) {
s[i][j] = que.top();
que.pop();
}
}
for (i = 0; i < n; i++) {
que2.push(s[i]);
}
for (i = 0; i < n; i++) {
s[i] = que2.top();
que2.pop();
}
j = 0;
for (i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
j++;
if (i == n - 1 || s[i + 1] != s[i]) {
ans += j * (j + 1) / 2;
j = 0;
}
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, i, j, ans = 0;
cin >> n;
string s[n];
priority_queue<char> que;
priority_queue<string> que2;
for (i = 0; i < n; i++) {
cin >> s[i];
for (j = 0; j < 10; j++) {
que.push(s[i][j]);
}
for (j = 0; j < 10; j++) {
s[i][j] = que.top();
que.pop();
}
}
for (i = 0; i < n; i++) {
que2.push(s[i]);
}
for (i = 0; i < n; i++) {
s[i] = que2.top();
que2.pop();
}
j = 0;
for (i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
j++;
if (i == n - 1 || s[i + 1] != s[i]) {
ans += j * (j + 1) / 2;
j = 0;
}
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,892 | 747,893 | u122874387 | cpp |
p02947 | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
vector<string> sorted;
int N;
cin >> N;
for (int i = 0; i < N; i++) {
vector<char> temp;
for (int j = 0; j < 10; j++) {
char c;
cin >> c;
temp.push_back(c);
}
sort(temp.begin(), temp.end());
string s = "";
for (int j = 0; j < 10; j++) {
s += temp[j];
}
sorted.push_back(s);
}
sort(sorted.begin(), sorted.end());
ll res = 0;
int streak = 1;
for (int i = 1; i < N; i++) {
if (sorted[i] == sorted[i - 1])
streak++;
else {
res += ((streak - 1) * streak) / 2;
streak = 1;
}
}
res += ((streak - 1) * streak) / 2;
cout << res;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
vector<string> sorted;
int N;
cin >> N;
for (int i = 0; i < N; i++) {
vector<char> temp;
for (int j = 0; j < 10; j++) {
char c;
cin >> c;
temp.push_back(c);
}
sort(temp.begin(), temp.end());
string s = "";
for (int j = 0; j < 10; j++) {
s += temp[j];
}
sorted.push_back(s);
}
sort(sorted.begin(), sorted.end());
ll res = 0;
ll streak = 1;
for (int i = 1; i < N; i++) {
if (sorted[i] == sorted[i - 1])
streak++;
else {
res += ((streak - 1) * streak) / 2;
streak = 1;
}
}
res += ((streak - 1) * streak) / 2;
cout << res;
return 0;
}
| [
"variable_declaration.type.change"
] | 747,894 | 747,895 | u466568754 | cpp |
p02947 | #include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) \
cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" \
<< endl;
#define dump(v) \
cerr << #v ":[ "; \
for (auto macro_vi : v) { \
cerr << macro_vi << " "; \
} \
cerr << "]" << endl;
#define ddump(v) \
cerr << #v ":" << endl; \
for (auto macro_row : v) { \
cerr << "["; \
for (auto macro__vi : macro_row) { \
cerr << macro__vi << " "; \
} \
cerr << "]" << endl; \
}
#define damp(m) \
for (auto macro_pair : m) { \
cerr << macro_pair.first << ":" << macro_pair.second << endl; \
}
#define dpair(p) \
cerr << #p ":" \
<< "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll sum = 0;
for (auto p : mp) {
int k = p.second;
sum += k * (k - 1) / 2;
}
cout << sum << endl;
return 0;
} | #include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) \
cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" \
<< endl;
#define dump(v) \
cerr << #v ":[ "; \
for (auto macro_vi : v) { \
cerr << macro_vi << " "; \
} \
cerr << "]" << endl;
#define ddump(v) \
cerr << #v ":" << endl; \
for (auto macro_row : v) { \
cerr << "["; \
for (auto macro__vi : macro_row) { \
cerr << macro__vi << " "; \
} \
cerr << "]" << endl; \
}
#define damp(m) \
for (auto macro_pair : m) { \
cerr << macro_pair.first << ":" << macro_pair.second << endl; \
}
#define dpair(p) \
cerr << #p ":" \
<< "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll sum = 0;
for (auto p : mp) {
int k = p.second;
sum += 1LL * k * (k - 1) / 2;
}
cout << sum << endl;
return 0;
} | [
"assignment.change"
] | 747,896 | 747,897 | u784072785 | cpp |
p02947 | #include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) \
cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" \
<< endl;
#define dump(v) \
cerr << #v ":[ "; \
for (auto macro_vi : v) { \
cerr << macro_vi << " "; \
} \
cerr << "]" << endl;
#define ddump(v) \
cerr << #v ":" << endl; \
for (auto macro_row : v) { \
cerr << "["; \
for (auto macro__vi : macro_row) { \
cerr << macro__vi << " "; \
} \
cerr << "]" << endl; \
}
#define damp(m) \
for (auto macro_pair : m) { \
cerr << macro_pair.first << ":" << macro_pair.second << endl; \
}
#define dpair(p) \
cerr << #p ":" \
<< "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
mp[tmp] += 1;
}
damp(mp) ll ans = 0LL;
for (auto p : mp) {
ans += (p.second - 1) * (p.second) / 2;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) \
cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" \
<< endl;
#define dump(v) \
cerr << #v ":[ "; \
for (auto macro_vi : v) { \
cerr << macro_vi << " "; \
} \
cerr << "]" << endl;
#define ddump(v) \
cerr << #v ":" << endl; \
for (auto macro_row : v) { \
cerr << "["; \
for (auto macro__vi : macro_row) { \
cerr << macro__vi << " "; \
} \
cerr << "]" << endl; \
}
#define damp(m) \
for (auto macro_pair : m) { \
cerr << macro_pair.first << ":" << macro_pair.second << endl; \
}
#define dpair(p) \
cerr << #p ":" \
<< "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, ll> mp;
rep(i, n) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
mp[tmp] += 1;
}
damp(mp) ll ans = 0LL;
for (auto p : mp) {
ans += (p.second - 1) * (p.second) / 2;
}
cout << ans << endl;
return 0;
} | [] | 747,898 | 747,899 | u784072785 | cpp |
p02947 | #include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) \
cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" \
<< endl;
#define dump(v) \
cerr << #v ":[ "; \
for (auto macro_vi : v) { \
cerr << macro_vi << " "; \
} \
cerr << "]" << endl;
#define ddump(v) \
cerr << #v ":" << endl; \
for (auto macro_row : v) { \
cerr << "["; \
for (auto macro__vi : macro_row) { \
cerr << macro__vi << " "; \
} \
cerr << "]" << endl; \
}
#define damp(m) \
for (auto macro_pair : m) { \
cerr << macro_pair.first << ":" << macro_pair.second << endl; \
}
#define dpair(p) \
cerr << #p ":" \
<< "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
mp[tmp] += 1;
}
damp(mp) ll ans = 0LL;
for (auto p : mp) {
ans += (p.second - 1) * (p.second) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) \
cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" \
<< endl;
#define dump(v) \
cerr << #v ":[ "; \
for (auto macro_vi : v) { \
cerr << macro_vi << " "; \
} \
cerr << "]" << endl;
#define ddump(v) \
cerr << #v ":" << endl; \
for (auto macro_row : v) { \
cerr << "["; \
for (auto macro__vi : macro_row) { \
cerr << macro__vi << " "; \
} \
cerr << "]" << endl; \
}
#define damp(m) \
for (auto macro_pair : m) { \
cerr << macro_pair.first << ":" << macro_pair.second << endl; \
}
#define dpair(p) \
cerr << #p ":" \
<< "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, ll> mp;
rep(i, n) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
mp[tmp] += 1;
}
damp(mp) ll ans = 0LL;
for (auto p : mp) {
ans += (p.second - 1) * (p.second) / 2;
}
cout << ans << endl;
return 0;
} | [] | 747,901 | 747,899 | u784072785 | cpp |
p02947 | #include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) \
cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" \
<< endl;
#define dump(v) \
cerr << #v ":[ "; \
for (auto macro_vi : v) { \
cerr << macro_vi << " "; \
} \
cerr << "]" << endl;
#define ddump(v) \
cerr << #v ":" << endl; \
for (auto macro_row : v) { \
cerr << "["; \
for (auto macro__vi : macro_row) { \
cerr << macro__vi << " "; \
} \
cerr << "]" << endl; \
}
#define damp(m) \
for (auto macro_pair : m) { \
cerr << macro_pair.first << ":" << macro_pair.second << endl; \
}
#define dpair(p) \
cerr << #p ":" \
<< "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
mp[tmp] += 1;
}
damp(mp) ll ans = 0LL;
for (auto p : mp) {
ans += (p.second - 1) * (p.second) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) \
cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" \
<< endl;
#define dump(v) \
cerr << #v ":[ "; \
for (auto macro_vi : v) { \
cerr << macro_vi << " "; \
} \
cerr << "]" << endl;
#define ddump(v) \
cerr << #v ":" << endl; \
for (auto macro_row : v) { \
cerr << "["; \
for (auto macro__vi : macro_row) { \
cerr << macro__vi << " "; \
} \
cerr << "]" << endl; \
}
#define damp(m) \
for (auto macro_pair : m) { \
cerr << macro_pair.first << ":" << macro_pair.second << endl; \
}
#define dpair(p) \
cerr << #p ":" \
<< "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
mp[tmp] += 1;
}
damp(mp) ll ans = 0LL;
for (auto p : mp) {
ans += (p.second - 1LL) * (p.second) / 2;
}
cout << ans << endl;
return 0;
} | [
"literal.number.type.widen.change"
] | 747,901 | 747,903 | u784072785 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template <typename T> void swap(T *t1, T *t2) {
T *tmp = t1;
t1 = t2;
t2 = tmp;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, cnt = 0;
string tmp;
vector<char> s;
map<string, int> m;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> tmp;
for (int j = 0; j < 10; j++) {
s.push_back(tmp.at(j));
}
sort(s.begin(), s.end());
string buf = "";
for (int i = 0; i < 10; i++) {
buf += s[i];
}
if (m.find(buf) == m.end()) {
m.insert(make_pair(buf, 0));
} else {
cnt += m.at(buf) + 1;
m.at(buf)++;
}
s.clear();
}
cout << cnt << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template <typename T> void swap(T *t1, T *t2) {
T *tmp = t1;
t1 = t2;
t2 = tmp;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
long cnt = 0;
string tmp;
vector<char> s;
map<string, int> m;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> tmp;
for (int j = 0; j < 10; j++) {
s.push_back(tmp.at(j));
}
sort(s.begin(), s.end());
string buf = "";
for (int i = 0; i < 10; i++) {
buf += s[i];
}
if (m.find(buf) == m.end()) {
m.insert(make_pair(buf, 0));
} else {
cnt += m.at(buf) + 1;
m.at(buf)++;
}
s.clear();
}
cout << cnt << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 747,909 | 747,910 | u026620445 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#define ll long long
using namespace std;
int main() {
ll N;
cin >> N;
string str[N];
ll i;
for (i = 0; i < N; i++) {
cin >> str[i];
sort(str[i].begin(), str[i].end());
}
sort(str, str + N);
ll tmp = 1;
ll ans = 0;
for (i = 1; i < N; i++) {
if (str[i - 1] == str[i]) {
ans += tmp;
tmp++;
} else
tmp = 1;
}
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#define ll long long
using namespace std;
int main() {
ll N;
cin >> N;
string str[N];
ll i;
for (i = 0; i < N; i++) {
cin >> str[i];
sort(str[i].begin(), str[i].end());
}
sort(str, str + N);
ll tmp = 1;
ll ans = 0;
for (i = 1; i < N; i++) {
if (str[i - 1] == str[i]) {
ans += tmp;
tmp++;
} else
tmp = 1;
}
cout << ans;
return 0;
} | [] | 747,915 | 747,916 | u770161743 | cpp |
p02947 | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
unsigned nChoosek(unsigned n, unsigned k) {
if (k > n)
return 0;
if (k * 2 > n)
k = n - k;
if (k == 0)
return 1;
int result = n;
for (int i = 2; i <= k; ++i) {
result *= (n - i + 1);
result /= i;
}
return result;
}
int main() {
int n;
ll sum = 0;
cin >> n;
string s;
map<string, ll> m;
int res = 0;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
res += m[s];
m[s]++;
}
for (const auto &kv : m) {
sum += nChoosek(kv.second, 2);
}
// cout << sum;
cout << res;
return 0;
}
| #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
unsigned nChoosek(unsigned n, unsigned k) {
if (k > n)
return 0;
if (k * 2 > n)
k = n - k;
if (k == 0)
return 1;
int result = n;
for (int i = 2; i <= k; ++i) {
result *= (n - i + 1);
result /= i;
}
return result;
}
int main() {
int n;
ll sum = 0;
cin >> n;
string s;
map<string, ll> m;
ll res = 0;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
res += m[s];
m[s]++;
}
for (const auto &kv : m) {
sum += nChoosek(kv.second, 2);
}
// cout << sum;
cout << res;
return 0;
}
| [
"variable_declaration.type.change"
] | 747,917 | 747,918 | u391340825 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
string tmp;
map<string, int> mp;
int cnt = 0;
for (int i = 0; i < n; i++) {
cin >> tmp;
sort(tmp.begin(), tmp.end());
cnt += mp[tmp];
mp[tmp]++;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
string tmp;
map<string, int> mp;
long long cnt = 0;
for (int i = 0; i < n; i++) {
cin >> tmp;
sort(tmp.begin(), tmp.end());
cnt += mp[tmp];
mp[tmp]++;
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,919 | 747,920 | u760628894 | cpp |
p02947 | #include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
long int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
vector<char> c(10);
for (int j = 0; j < 10; j++) {
cin >> c[j];
}
sort(c.begin(), c.end());
string hoge(c.begin(), c.end());
s[i] = hoge;
}
sort(s.begin(), s.end());
long int num = 0;
int i = 0;
while (i < n) {
int a = 1;
for (int j = i + 1; j < n; j++) {
if (s[i] != s[j]) {
break;
}
a++;
}
num += a * (a - 1) / 2;
i += a;
}
cout << num << endl;
return 0;
} | #include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
long int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
vector<char> c(10);
for (int j = 0; j < 10; j++) {
cin >> c[j];
}
sort(c.begin(), c.end());
string hoge(c.begin(), c.end());
s[i] = hoge;
}
sort(s.begin(), s.end());
long int num = 0;
int i = 0;
while (i < n) {
long int a = 1;
for (int j = i + 1; j < n; j++) {
if (s[i] != s[j]) {
break;
}
a++;
}
num += a * (a - 1) / 2;
i += a;
}
cout << num << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 747,921 | 747,922 | u987591601 | cpp |
p02947 | #include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
vector<char> c(10);
for (int j = 0; j < 10; j++) {
cin >> c[j];
}
sort(c.begin(), c.end());
string hoge(c.begin(), c.end());
s[i] = hoge;
}
sort(s.begin(), s.end());
long int num = 0;
int i = 0;
while (i < n) {
int a = 1;
for (int j = i + 1; j < n; j++) {
if (s[i] != s[j]) {
break;
}
a++;
}
num += a * (a - 1) / 2;
i += a;
}
cout << num << endl;
return 0;
} | #include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
long int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
vector<char> c(10);
for (int j = 0; j < 10; j++) {
cin >> c[j];
}
sort(c.begin(), c.end());
string hoge(c.begin(), c.end());
s[i] = hoge;
}
sort(s.begin(), s.end());
long int num = 0;
int i = 0;
while (i < n) {
long int a = 1;
for (int j = i + 1; j < n; j++) {
if (s[i] != s[j]) {
break;
}
a++;
}
num += a * (a - 1) / 2;
i += a;
}
cout << num << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 747,923 | 747,922 | u987591601 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 999999999;
int binominalCoeff(int n, int k) {
int res = 1;
if (k > n - k)
k = n - k;
for (int i = 0; i < k; ++i) {
res *= (n - i);
res /= (i + 1);
}
return res;
}
int main() {
int N;
cin >> N;
map<string, int> s;
for (int i = 0; i < N; ++i) {
string st;
cin >> st;
sort(st.begin(), st.end());
s[st]++;
}
ll rtn = 0;
for (auto &it : s) {
// cout << it.first << " " << it.second << endl;
if (it.second >= 2) {
rtn += (ll)binominalCoeff(it.second, 2);
}
}
cout << rtn << endl;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 999999999;
ll binominalCoeff(ll n, ll k) {
ll res = 1;
if (k > n - k)
k = n - k;
for (ll i = 0; i < k; ++i) {
res *= (n - i);
res /= (i + 1);
}
return res;
}
int main() {
int N;
cin >> N;
map<string, int> s;
for (int i = 0; i < N; ++i) {
string st;
cin >> st;
sort(st.begin(), st.end());
s[st]++;
}
ll rtn = 0;
for (auto &it : s) {
// cout << it.first << " " << it.second << endl;
if (it.second >= 2) {
rtn += (ll)binominalCoeff(it.second, 2);
}
}
cout << rtn << endl;
} | [
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 747,924 | 747,925 | u239023686 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;
int main() {
#ifdef MYLOCAL
ifstream in("input.txt");
cin.rdbuf(in.rdbuf());
#endif
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());
ll ans = 0;
for (int i = 0; i < N;) {
int j = i + 1;
for (; j < N; ++j) {
if (s[i] != s[j])
break;
}
ans += (j - i) * (j - i - 1) / 2;
i = j;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;
int main() {
#ifdef MYLOCAL
ifstream in("input.txt");
cin.rdbuf(in.rdbuf());
#endif
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());
ll ans = 0;
for (ll i = 0; i < N;) {
ll j = i + 1;
for (; j < N; ++j) {
if (s[i] != s[j])
break;
}
ans += (j - i) * (j - i - 1) / 2LL;
i = j;
}
cout << ans << endl;
return 0;
}
| [
"control_flow.loop.for.initializer.change",
"variable_declaration.type.change",
"literal.number.type.widen.change"
] | 747,926 | 747,927 | u335667012 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, b) FOR(i, 0, b)
#define RFOR(i, a, b) for (int i = a - 1; i >= b; i--)
#define RREP(i, a) RFOR(i, a, 0)
#define REPALL(i, x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i, x) for (int i = x.size() - 1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x, num) count(ALL(x), num)
#define MEMSET(x, val) memset(x, val, sizeof(x))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
void YES(bool flag) { cout << (flag ? "YES" : "NO") << endl; }
void Yes(bool flag) { cout << (flag ? "Yes" : "No") << endl; }
void yes(bool flag) { cout << (flag ? "yes" : "no") << endl; }
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
map<string, int> mp;
int main() {
int n;
cin >> n;
REP(i, n) {
string s;
cin >> s;
SORT(s);
mp[s]++;
}
ll ans = 0ll;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
int n = itr->scd;
// cout<<itr->fst<<" "<<itr->scd<<endl;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, b) FOR(i, 0, b)
#define RFOR(i, a, b) for (int i = a - 1; i >= b; i--)
#define RREP(i, a) RFOR(i, a, 0)
#define REPALL(i, x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i, x) for (int i = x.size() - 1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x, num) count(ALL(x), num)
#define MEMSET(x, val) memset(x, val, sizeof(x))
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
void YES(bool flag) { cout << (flag ? "YES" : "NO") << endl; }
void Yes(bool flag) { cout << (flag ? "Yes" : "No") << endl; }
void yes(bool flag) { cout << (flag ? "yes" : "no") << endl; }
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
map<string, int> mp;
int main() {
int n;
cin >> n;
REP(i, n) {
string s;
cin >> s;
SORT(s);
mp[s]++;
}
ll ans = 0ll;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
int n = itr->scd;
// cout<<itr->fst<<" "<<itr->scd<<endl;
ans += n * (n - 1ll) / 2;
}
cout << ans << endl;
return 0;
}
| [] | 747,933 | 747,934 | u007637377 | cpp |
p02947 | #include <algorithm>
#include <fstream>
#include <iostream>
#include <queue>
#include <stack>
#include <stdio.h>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define input_code \
ifstream in("input.txt"); \
cin.rdbuf(in.rdbuf())
using namespace std;
static const int MAX = 100001;
int n;
int alpha[MAX][30];
priority_queue<pair<int, vector<int>>> q;
int main(int argc, const char *argv[]) {
// [erase]
//
cin >> n;
rep(i, MAX) {
rep(j, 30) { alpha[i][j] = 0; }
}
rep(i, n) {
string tmp;
cin >> tmp;
int sum = 0;
vector<int> tmp2;
rep(j, tmp.length()) { tmp2.push_back(tmp[j] - '0'); }
sort(tmp2.begin(), tmp2.end());
rep(j, tmp.length()) {
rep(itr, j + 1) { sum += tmp2[itr] - '0'; }
}
pair<int, vector<int>> f = make_pair(sum, tmp2);
q.push(f);
}
pair<int, vector<int>> bef_f;
int res = 0;
int continue_ = 1;
while (!q.empty()) {
pair<int, vector<int>> f = q.top();
q.pop();
vector<int> cmp1 = f.second;
vector<int> cmp2 = bef_f.second;
if (f == bef_f) {
res += continue_;
continue_++;
} else
continue_ = 1;
bef_f = f;
}
cout << res << endl;
return 0;
}
| #include <algorithm>
#include <fstream>
#include <iostream>
#include <queue>
#include <stack>
#include <stdio.h>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define input_code \
ifstream in("input.txt"); \
cin.rdbuf(in.rdbuf())
using namespace std;
static const int MAX = 100001;
int n;
int alpha[MAX][30];
priority_queue<pair<int, vector<int>>> q;
int main(int argc, const char *argv[]) {
// [erase]
//
cin >> n;
rep(i, MAX) {
rep(j, 30) { alpha[i][j] = 0; }
}
rep(i, n) {
string tmp;
cin >> tmp;
int sum = 0;
vector<int> tmp2;
rep(j, tmp.length()) { tmp2.push_back(tmp[j] - '0'); }
sort(tmp2.begin(), tmp2.end());
rep(j, tmp.length()) {
rep(itr, j + 1) { sum += tmp2[itr] - '0'; }
}
pair<int, vector<int>> f = make_pair(sum, tmp2);
q.push(f);
}
pair<int, vector<int>> bef_f;
long long res = 0;
int continue_ = 1;
while (!q.empty()) {
pair<int, vector<int>> f = q.top();
q.pop();
vector<int> cmp1 = f.second;
vector<int> cmp2 = bef_f.second;
if (f == bef_f) {
res += continue_;
continue_++;
} else
continue_ = 1;
bef_f = f;
}
cout << res << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,937 | 747,938 | u895382169 | cpp |
p02947 | /*
このコード、と~おれ!
Be accepted!
∧_∧
(。・ω・。)つ━☆・*。
⊂ ノ ・゜+.
しーJ °。+ *´¨)
.· ´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·'* ☆
*/
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <random>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
#pragma GCC optimize("Ofast")
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define reprm(i, n) for (int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a) //少数出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2) //等差数列の和、初項,末項,項数
using ll = long long;
const int INF = 2147483647;
const int MINF = -2147483648;
const ll LINF = ll(9223372036854775807);
const ll MOD = 1000000007;
const double PI = acos(-1);
//マクロとかここまで
using namespace std;
int ggd(int number1, int number2) { // ggcを求める
int m = number1;
int n = number2;
if (number2 > number1) {
m = number2;
n = number1;
}
while (m != n) {
int temp = n;
n = m - n;
m = temp;
}
return m;
}
int lcm(int number1, int number2) { // lcmを求める
return number1 * number2 / ggd(number1, number2);
}
bool is_prime(int64_t x) { //素数判定
for (int64_t i = 2; i * i <= x; i++) {
if (x % i == 0)
return false;
}
return true;
}
ll nearPow2(ll n) // x以上の2のべき乗を返す
{
// nが0以下の時は0とする。
if (n <= 0)
return 0;
// (n & (n - 1)) == 0 の時は、nが2の冪乗であるため、そのままnを返す。
if ((n & (n - 1)) == 0)
return ll(n);
// bitシフトを用いて、2の冪乗を求める。
ll ret = 1;
while (n > 0) {
ret <<= 1;
n >>= 1;
}
return ret;
}
map<int64_t, int> prime_factor(int64_t n) { //素因数分解
map<int64_t, int> ret;
for (int64_t i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
template <int mod> struct ModInt {
int x;
ModInt() : x(0) {}
ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
ModInt &operator+=(const ModInt &p) {
if ((x += p.x) >= mod)
x -= mod;
return *this;
}
ModInt &operator-=(const ModInt &p) {
if ((x += mod - p.x) >= mod)
x -= mod;
return *this;
}
ModInt &operator*=(const ModInt &p) {
x = (int)(1LL * x * p.x % mod);
return *this;
}
ModInt &operator/=(const ModInt &p) {
*this *= p.inverse();
return *this;
}
ModInt operator-() const { return ModInt(-x); }
ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
bool operator==(const ModInt &p) const { return x == p.x; }
bool operator!=(const ModInt &p) const { return x != p.x; }
ModInt inverse() const {
int a = x, b = mod, u = 1, v = 0, t;
while (b > 0) {
t = a / b;
swap(a -= t * b, b);
swap(u -= t * v, v);
}
return ModInt(u);
}
ModInt pow(int64_t n) const {
ModInt ret(1), mul(x);
while (n > 0) {
if (n & 1)
ret *= mul;
mul *= mul;
n >>= 1;
}
return ret;
}
friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
friend istream &operator>>(istream &is, ModInt &a) {
int64_t t;
is >> t;
a = ModInt<mod>(t);
return (is);
}
static int get_mod() { return mod; }
};
using modint = ModInt<MOD>; // MOD=10億7
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// aCbを1000000007で割った余りを求める
ll aCb(ll a, ll b) {
ll ans = 1;
for (ll i = 0; i < b; i++) {
ans *= a - i;
ans %= MOD;
}
for (ll i = 1; i <= b; i++) {
ans *= modinv(i, MOD);
ans %= MOD;
}
return ans;
}
/*-----------------------------------------ここまでライブラリとか-----------------------------------------*/
int main() {
int n;
ll ans = 0;
char s[100];
scanf("%d", &n);
unordered_map<string, int> a;
rep(i, n) {
scanf("%s", s);
sort(s, s + 10);
++a[s];
if (a[s] > 1)
ans += a[s] - 1;
}
printf("%d\n", ans);
return 0;
}
| /*
このコード、と~おれ!
Be accepted!
∧_∧
(。・ω・。)つ━☆・*。
⊂ ノ ・゜+.
しーJ °。+ *´¨)
.· ´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·'* ☆
*/
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <random>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
#pragma GCC optimize("Ofast")
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define reprm(i, n) for (int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a) //少数出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2) //等差数列の和、初項,末項,項数
using ll = long long;
const int INF = 2147483647;
const int MINF = -2147483648;
const ll LINF = ll(9223372036854775807);
const ll MOD = 1000000007;
const double PI = acos(-1);
//マクロとかここまで
using namespace std;
int ggd(int number1, int number2) { // ggcを求める
int m = number1;
int n = number2;
if (number2 > number1) {
m = number2;
n = number1;
}
while (m != n) {
int temp = n;
n = m - n;
m = temp;
}
return m;
}
int lcm(int number1, int number2) { // lcmを求める
return number1 * number2 / ggd(number1, number2);
}
bool is_prime(int64_t x) { //素数判定
for (int64_t i = 2; i * i <= x; i++) {
if (x % i == 0)
return false;
}
return true;
}
ll nearPow2(ll n) // x以上の2のべき乗を返す
{
// nが0以下の時は0とする。
if (n <= 0)
return 0;
// (n & (n - 1)) == 0 の時は、nが2の冪乗であるため、そのままnを返す。
if ((n & (n - 1)) == 0)
return ll(n);
// bitシフトを用いて、2の冪乗を求める。
ll ret = 1;
while (n > 0) {
ret <<= 1;
n >>= 1;
}
return ret;
}
map<int64_t, int> prime_factor(int64_t n) { //素因数分解
map<int64_t, int> ret;
for (int64_t i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1)
ret[n] = 1;
return ret;
}
template <int mod> struct ModInt {
int x;
ModInt() : x(0) {}
ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
ModInt &operator+=(const ModInt &p) {
if ((x += p.x) >= mod)
x -= mod;
return *this;
}
ModInt &operator-=(const ModInt &p) {
if ((x += mod - p.x) >= mod)
x -= mod;
return *this;
}
ModInt &operator*=(const ModInt &p) {
x = (int)(1LL * x * p.x % mod);
return *this;
}
ModInt &operator/=(const ModInt &p) {
*this *= p.inverse();
return *this;
}
ModInt operator-() const { return ModInt(-x); }
ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
bool operator==(const ModInt &p) const { return x == p.x; }
bool operator!=(const ModInt &p) const { return x != p.x; }
ModInt inverse() const {
int a = x, b = mod, u = 1, v = 0, t;
while (b > 0) {
t = a / b;
swap(a -= t * b, b);
swap(u -= t * v, v);
}
return ModInt(u);
}
ModInt pow(int64_t n) const {
ModInt ret(1), mul(x);
while (n > 0) {
if (n & 1)
ret *= mul;
mul *= mul;
n >>= 1;
}
return ret;
}
friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
friend istream &operator>>(istream &is, ModInt &a) {
int64_t t;
is >> t;
a = ModInt<mod>(t);
return (is);
}
static int get_mod() { return mod; }
};
using modint = ModInt<MOD>; // MOD=10億7
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
// aCbを1000000007で割った余りを求める
ll aCb(ll a, ll b) {
ll ans = 1;
for (ll i = 0; i < b; i++) {
ans *= a - i;
ans %= MOD;
}
for (ll i = 1; i <= b; i++) {
ans *= modinv(i, MOD);
ans %= MOD;
}
return ans;
}
/*-----------------------------------------ここまでライブラリとか-----------------------------------------*/
int main() {
int n;
ll ans = 0;
char s[100];
scanf("%d", &n);
unordered_map<string, ll> a;
rep(i, n) {
scanf("%s", s);
sort(s, s + 10);
++a[s];
if (a[s] > 1)
ans += a[s] - 1;
}
printf("%lld\n", ans);
return 0;
}
| [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 747,939 | 747,940 | u917972976 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t 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]++;
}
int64_t ans = 0;
for (auto p : mp) {
int64_t s = p.second;
ans = s * (s - 1) / 2;
}
cout << ans;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t 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]++;
}
int64_t ans = 0;
for (auto p : mp) {
int64_t s = p.second;
ans += s * (s - 1) / 2;
}
cout << ans;
} | [
"assignment.value.change"
] | 747,941 | 747,942 | u009870106 | cpp |
p02947 | #include <algorithm>
#include <cstdio>
#include <map>
#include <string>
using namespace std;
int N;
char t[12];
long long ans;
string ts;
map<string, int> s;
int main() {
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%s", t);
ts = string(t);
sort(ts.begin(), ts.end());
s[ts]++;
}
for (auto x : s) {
ans += x.second * (x.second - 1) / 2;
}
printf("%ld", ans);
} | #include <algorithm>
#include <cstdio>
#include <map>
#include <string>
using namespace std;
int N;
char t[12];
long long ans;
string ts;
map<string, long long> s;
int main() {
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%s", t);
ts = string(t);
sort(ts.begin(), ts.end());
s[ts]++;
}
for (auto x : s) {
ans += x.second * (x.second - 1) / 2;
}
printf("%ld", ans);
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,943 | 747,944 | u923285281 | cpp |
p02947 | #include <algorithm>
#include <fstream>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(), (a).end()
#define INF (1 << 29)
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;
}
string S;
int N, ans;
map<string, int> m;
int main() {
cin >> N;
rep(i, N) {
cin >> S;
sort(S.begin(), S.end());
ans += m[S]++;
}
out(ans);
}
| #include <algorithm>
#include <fstream>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(), (a).end()
#define INF (1 << 29)
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;
}
string S;
ll N, ans = 0;
map<string, int> m;
int main() {
cin >> N;
rep(i, N) {
cin >> S;
sort(S.begin(), S.end());
ans += m[S]++;
}
out(ans);
}
| [
"variable_declaration.type.change",
"variable_declaration.value.change"
] | 747,950 | 747,951 | u190907730 | cpp |
p02947 | /*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prayer
*/
// g++ -std=c++11 a.cpp
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
#define loop(i, a, b) for (long long i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define FOR(i, a) for (auto i : a)
#define pb push_back
#define all(in) in.begin(), in.end()
#define shosu(x) fixed << setprecision(x)
#define show1d(v) \
{ \
rep(_, v.size()) cout << " " << v[_]; \
cout << endl; \
}
#define show2d(v) \
{ rep(__, v.size()) show1d(v[__]); }
using namespace std;
// kaewasuretyuui
typedef long long ll;
// #define int ll
typedef int Def;
typedef pair<Def, Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def, pii> pip;
typedef vector<pip> vip;
#define mt make_tuple
typedef tuple<int, int, int, int> tp;
typedef vector<tp> vt;
template <typename A, typename B> bool cmin(A &a, const B &b) {
return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9 + 10;
#define yes cout << "Yes\n"
#define no cout << "No\n"
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
for (T &in : v)
is >> in;
return is;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
map<string, int> ma;
int w = 0;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
w += ma[s];
ma[s]++;
}
cout << w << endl;
}
| /*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
prayer
*/
// g++ -std=c++11 a.cpp
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
#define loop(i, a, b) for (long long i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define FOR(i, a) for (auto i : a)
#define pb push_back
#define all(in) in.begin(), in.end()
#define shosu(x) fixed << setprecision(x)
#define show1d(v) \
{ \
rep(_, v.size()) cout << " " << v[_]; \
cout << endl; \
}
#define show2d(v) \
{ rep(__, v.size()) show1d(v[__]); }
using namespace std;
// kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def, Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def, pii> pip;
typedef vector<pip> vip;
#define mt make_tuple
typedef tuple<int, int, int, int> tp;
typedef vector<tp> vt;
template <typename A, typename B> bool cmin(A &a, const B &b) {
return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9 + 10;
#define yes cout << "Yes\n"
#define no cout << "No\n"
template <typename T> istream &operator>>(istream &is, vector<T> &v) {
for (T &in : v)
is >> in;
return is;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
map<string, int> ma;
int w = 0;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
w += ma[s];
ma[s]++;
}
cout << w << endl;
}
| [] | 747,956 | 747,957 | u010004797 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> arr;
for (int i = 0; i < n; i++) {
string a;
cin >> a;
sort(a.begin(), a.end());
arr.push_back(a);
}
sort(arr.begin(), arr.end());
int cnt = 0;
int value = 0;
for (int i = 0; i < arr.size(); i++) {
if (i + 1 < arr.size() && arr[i] == arr[i + 1])
cnt++;
else {
value = value + (cnt * (cnt - 1)) / 2;
cnt = 0;
}
}
value = value + (cnt * (cnt + 1)) / 2;
cout << value << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> arr;
for (int i = 0; i < n; i++) {
string a;
cin >> a;
sort(a.begin(), a.end());
arr.push_back(a);
}
sort(arr.begin(), arr.end());
long long cnt = 0;
long long value = 0;
for (int i = 0; i < arr.size(); i++) {
if (i + 1 < arr.size() && arr[i] == arr[i + 1])
cnt++;
else {
value = value + (cnt * (cnt + 1)) / 2;
cnt = 0;
}
}
value = value + (cnt * (cnt + 1)) / 2;
cout << value << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 747,958 | 747,959 | u201678045 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> arr;
for (int i = 0; i < n; i++) {
string a;
cin >> a;
sort(a.begin(), a.end());
arr.push_back(a);
}
sort(arr.begin(), arr.end());
int cnt = 0;
int value = 0;
for (int i = 0; i < arr.size(); i++) {
if (i + 1 < arr.size() && arr[i] == arr[i + 1])
cnt++;
else {
value = value + (cnt * (cnt + 1)) / 2;
cnt = 0;
}
}
value = value + (cnt * (cnt + 1)) / 2;
cout << value << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> arr;
for (int i = 0; i < n; i++) {
string a;
cin >> a;
sort(a.begin(), a.end());
arr.push_back(a);
}
sort(arr.begin(), arr.end());
long long cnt = 0;
long long value = 0;
for (int i = 0; i < arr.size(); i++) {
if (i + 1 < arr.size() && arr[i] == arr[i + 1])
cnt++;
else {
value = value + (cnt * (cnt + 1)) / 2;
cnt = 0;
}
}
value = value + (cnt * (cnt + 1)) / 2;
cout << value << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,960 | 747,959 | u201678045 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
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;
}
using namespace std;
#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
int main() {
// abc137c
int n;
cin >> n;
map<string, int> s;
ll ans = 0;
for (int i = 0; i < n; i++) {
string x;
cin >> x;
sort(x.begin(), x.end());
s[x]++;
}
for (auto &p : s) {
int a = p.second;
ans += a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
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;
}
using namespace std;
#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
int main() {
// abc137c
int n;
cin >> n;
unordered_map<string, int> s;
ll ans = 0;
for (int i = 0; i < n; i++) {
string x;
cin >> x;
sort(x.begin(), x.end());
s[x]++;
}
for (auto &p : s) {
int a = p.second;
ans += (ll)a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 747,967 | 747,968 | u170650966 | 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[i];
sort(s[i].begin(), s[i].end());
}
long long ans = 0;
sort(s.begin(), s.end());
int count = 1;
vector<int> n;
for (int i = 0; i < N - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
count++;
if (i == N - 2) {
n.push_back(count);
}
} else {
n.push_back(count);
count = 1;
}
}
for (int c : n) {
if (c != 1) {
ans += c * (c - 1) / 2;
}
}
cout << ans << 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[i];
sort(s[i].begin(), s[i].end());
}
long long ans = 0;
sort(s.begin(), s.end());
long long count = 1;
vector<int> n;
for (int i = 0; i < N - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
count++;
if (i == N - 2) {
n.push_back(count);
}
} else {
n.push_back(count);
count = 1;
}
}
for (long long c : n) {
if (c != 1) {
ans += c * (c - 1) / 2;
}
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,971 | 747,972 | u654055742 | 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[i];
sort(s[i].begin(), s[i].end());
}
int ans = 0;
sort(s.begin(), s.end());
int count = 1;
vector<int> n;
for (int i = 0; i < N - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
count++;
if (i == N - 2) {
n.push_back(count);
}
} else {
n.push_back(count);
count = 1;
}
}
for (int c : n) {
if (c != 1) {
ans += c * (c - 1) / 2;
}
}
cout << ans << 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[i];
sort(s[i].begin(), s[i].end());
}
long long ans = 0;
sort(s.begin(), s.end());
long long count = 1;
vector<int> n;
for (int i = 0; i < N - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
count++;
if (i == N - 2) {
n.push_back(count);
}
} else {
n.push_back(count);
count = 1;
}
}
for (long long c : n) {
if (c != 1) {
ans += c * (c - 1) / 2;
}
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,973 | 747,972 | u654055742 | cpp |
p02947 | #include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
map<string, int> mp;
ll ans = 0;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto const &x : mp) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
map<string, ll> mp;
ll ans = 0;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto const &x : mp) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | [] | 747,974 | 747,975 | u199371251 | cpp |
p02947 | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int binomialCoeff(int n, int k) {
int C[k + 1];
memset(C, 0, sizeof(C));
C[0] = 1; // nC0 is 1
for (int i = 1; i <= n; i++) {
// Compute next row of pascal triangle using
// the previous row
for (int j = min(i, k); j > 0; j--)
C[j] = C[j] + C[j - 1];
}
return C[k];
}
int main() {
ll int n;
cin >> n;
map<string, int> mp1;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp1[s]++;
}
ll int cnt = 0;
for (auto it = mp1.begin(); it != mp1.end(); it++) {
if (it->second > 1)
cnt += binomialCoeff(it->second, 2);
}
cout << cnt;
} | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll int binomialCoeff(ll int n, ll int k) {
ll int C[k + 1];
memset(C, 0, sizeof(C));
C[0] = 1; // nC0 is 1
for (ll int i = 1; i <= n; i++) {
for (ll int j = min(i, k); j > 0; j--)
C[j] = C[j] + C[j - 1];
}
return C[k];
}
int main() {
ll int n;
cin >> n;
map<string, int> mp1;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp1[s]++;
}
ll int cnt = 0;
for (auto it = mp1.begin(); it != mp1.end(); it++) {
if (it->second > 1)
cnt += binomialCoeff(it->second, 2);
}
cout << cnt;
} | [
"function.parameters.parameter.add"
] | 747,976 | 747,977 | u603457443 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
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); } //最小公倍数
uintmax_t combination(unsigned int n, unsigned int r) {
if (r * 2 > n)
r = n - r;
uintmax_t dividend = 1;
uintmax_t divisor = 1;
for (unsigned int i = 1; i <= r; ++i) {
dividend *= (n - i + 1);
divisor *= i;
}
return dividend / divisor;
}
int main() {
int n;
cin >> n;
vector<string> v;
string s;
map<string, int> m;
rep(i, n) {
cin >> s;
v.push_back(s);
}
rep(i, n) { sort(v[i].begin(), v[i].end()); }
rep(i, n) {
if (m.count(v[i]) == 1) {
m[v[i]]++;
} else {
m[v[i]] = 1;
}
}
int result = 0;
for (auto itr = m.begin(); itr != m.end(); ++itr) {
if (itr->second >= 2)
result += combination(itr->second, 2);
}
cout << result << endl;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
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); } //最小公倍数
uintmax_t combination(unsigned int n, unsigned int r) {
if (r * 2 > n)
r = n - r;
uintmax_t dividend = 1;
uintmax_t divisor = 1;
for (unsigned int i = 1; i <= r; ++i) {
dividend *= (n - i + 1);
divisor *= i;
}
return dividend / divisor;
}
int main() {
int n;
cin >> n;
vector<string> v;
string s;
map<string, int> m;
rep(i, n) {
cin >> s;
v.push_back(s);
}
rep(i, n) { sort(v[i].begin(), v[i].end()); }
rep(i, n) {
if (m.count(v[i]) == 1) {
m[v[i]]++;
} else {
m[v[i]] = 1;
}
}
ll result = 0;
for (auto itr = m.begin(); itr != m.end(); ++itr) {
if (itr->second >= 2)
result += combination(itr->second, 2);
}
cout << result << endl;
} | [
"variable_declaration.type.change"
] | 747,980 | 747,981 | u110681742 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
#define long long int
signed main() {
int n;
cin >> n;
string a[n];
map<string, int> ma;
for (int i = 0; i < n; ++i) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
}
int tot = 0;
for (int i = 0; i < n; ++i) {
tot += ma[a[i]];
++ma[a[i]];
}
cout << tot << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
#define int long long
signed main() {
int n;
cin >> n;
string a[n];
map<string, int> ma;
for (int i = 0; i < n; ++i) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
}
int tot = 0;
for (int i = 0; i < n; ++i) {
tot += ma[a[i]];
++ma[a[i]];
}
cout << tot << endl;
return 0;
} | [] | 747,996 | 747,997 | u146240825 | cpp |
p02947 | #include <bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long int ll;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
auto itr = mp.find(str);
if (itr == mp.end())
mp.insert(make_pair(str, 1));
else
mp[str]++;
}
ll sum = 0;
for (auto &e : mp) {
if (e.second == 0)
continue;
sum += e.second * (e.second - 1) / 2;
}
cout << sum << endl;
return 0;
}
| #include <bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long int ll;
int main() {
int n;
cin >> n;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
auto itr = mp.find(str);
if (itr == mp.end())
mp.insert(make_pair(str, 1));
else
mp[str]++;
}
ll sum = 0;
for (auto &e : mp) {
if (e.second == 0)
continue;
sum += e.second * (e.second - 1) / 2;
}
cout << sum << endl;
return 0;
}
| [] | 747,998 | 747,999 | u175426149 | cpp |
p02947 | #include <bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long int ll;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
mp[str]++;
}
ll sum = 0;
for (auto &e : mp) {
sum += e.second * (e.second - 1) / 2;
}
cout << sum << endl;
return 0;
}
| #include <bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long int ll;
int main() {
int n;
cin >> n;
map<string, uint64_t> mp;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
mp[str]++;
}
ll sum = 0;
for (auto &e : mp) {
sum += e.second * (e.second - 1) / 2;
}
cout << sum << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 748,000 | 748,001 | u175426149 | 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[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int ans = 0;
int i = 0;
for (int j = 1; j < n; ++j) {
if (s[i] == s[j]) {
ans += (j - i);
} else {
i = j;
}
}
cout << ans << 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[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
long long int ans = 0;
int i = 0;
for (int j = 1; j < n; ++j) {
if (s[i] == s[j]) {
ans += (j - i);
} else {
i = j;
}
}
cout << ans << endl;
}
| [
"variable_declaration.type.widen.change"
] | 748,002 | 748,003 | u567252408 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
}
sort(a.begin(), a.end());
vector<int> cut;
for (int i = 0; i < (n - 1); ++i) {
if (a[i] != a[i + 1]) {
cut.push_back(i);
}
}
cut.push_back(n - 1);
int len = cut.size();
long long int ans = 0;
int q = cut[0] + 1;
ans += (q * (q - 1) / 2);
for (int j = 0; j < (len - 1); ++j) {
int q = cut[j + 1] - cut[j];
ans += (q * (q - 1) / 2);
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
}
sort(a.begin(), a.end());
vector<int> cut;
for (int i = 0; i < (n - 1); ++i) {
if (a[i] != a[i + 1]) {
cut.push_back(i);
}
}
cut.push_back(n - 1);
int len = cut.size();
long long int ans = 0;
long long int q = cut[0] + 1;
ans += (q * (q - 1) / 2);
for (int j = 0; j < (len - 1); ++j) {
long long int q = cut[j + 1] - cut[j];
ans += (q * (q - 1) / 2);
}
cout << ans << endl;
}
| [
"variable_declaration.type.widen.change"
] | 748,004 | 748,005 | u567252408 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
int n;
cin >> n;
map<string, int> m;
long long ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s] += 1;
}
for (auto it = m.begin(); it != m.end(); it++) {
ans += it->second * (it->second - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
int n;
cin >> n;
map<string, long long> m;
long long ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s] += 1;
}
for (auto it = m.begin(); it != m.end(); it++) {
ans += it->second * (it->second - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,006 | 748,007 | u527293637 | cpp |
p02947 | #define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> cnt;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
++cnt[s];
}
long long ans = 0;
for (const auto &p : cnt)
ans += p.second * (p.second - 1) / 2;
cout << ans << endl;
return 0;
}
| #define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> cnt;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
++cnt[s];
}
long long ans = 0;
for (const auto &p : cnt)
ans += p.second * (p.second - 1LL) / 2;
cout << ans << endl;
return 0;
}
| [
"literal.number.type.widen.change"
] | 748,008 | 748,009 | u917944707 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPE(i, n) FOR(i, 0, n)
typedef long long ll;
typedef pair<ll, ll> P;
int main() {
int N;
cin >> N;
map<string, ll> mp;
REP(i, N) {
string st;
cin >> st;
sort(ALL(st));
mp[st]++;
}
int ans = 0;
for (auto x : mp) {
if (1 < x.second) {
ans += x.second * (x.second - 1) / 2;
}
}
cout << ans;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPE(i, n) FOR(i, 0, n)
typedef long long ll;
typedef pair<ll, ll> P;
int main() {
int N;
cin >> N;
map<string, ll> mp;
REP(i, N) {
string st;
cin >> st;
sort(ALL(st));
mp[st]++;
}
ll ans = 0;
for (auto x : mp) {
if (1 < x.second) {
ans += x.second * (x.second - 1) / 2;
}
}
cout << ans;
return 0;
} | [
"variable_declaration.type.change"
] | 748,013 | 748,014 | u476383383 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int n;
long long ans, num;
string s[100010];
char c[20];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
cin >> s[i];
for (int j = 0; j < 10; ++j)
c[j] = s[i][j];
sort(c, c + 10);
for (int j = 0; j < 10; ++j)
s[i][j] = c[j];
}
sort(s + 1, s + n + 1);
for (int i = 2; i <= n; ++i) {
if (s[i] == s[i - 1])
++num;
else {
ans += num * (num + 1) / 2;
num = 0;
}
}
ans += num * (num + 1) / 2;
printf("%d", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int n;
long long ans, num;
string s[100010];
char c[20];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
cin >> s[i];
for (int j = 0; j < 10; ++j)
c[j] = s[i][j];
sort(c, c + 10);
for (int j = 0; j < 10; ++j)
s[i][j] = c[j];
}
sort(s + 1, s + n + 1);
// for(int i=1;i<=n;++i) cout<<s[i]<<endl;
for (int i = 2; i <= n; ++i) {
if (s[i] == s[i - 1])
++num;
else {
ans += num * (num + 1) / 2;
num = 0;
}
}
ans += num * (num + 1) / 2;
printf("%lld", ans);
return 0;
} | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 748,015 | 748,016 | u573810484 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string a[n];
for (int i = 0; i < n; i++) {
string temp;
cin >> temp;
int c[10];
for (int k = 0; k < 10; k++) {
c[k] = (int)temp.at(k);
}
sort(c, c + 10);
string s = "";
for (int k = 0; k < 10; k++) {
s = s + (char)c[k];
}
a[i] = s;
}
sort(a, a + n);
int sum = 0;
int x = 1;
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
x++;
} else {
sum = sum + (((x - 1) * x) / 2);
x = 1;
}
}
if (x > 1) {
sum = sum + (((x - 1) * x) / 2);
}
cout << sum;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string a[n];
for (int i = 0; i < n; i++) {
string temp;
cin >> temp;
int c[10];
for (int k = 0; k < 10; k++) {
c[k] = (int)temp.at(k);
}
sort(c, c + 10);
string s = "";
for (int k = 0; k < 10; k++) {
s = s + (char)c[k];
}
a[i] = s;
}
sort(a, a + n);
long sum = 0;
long x = 1;
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
x++;
} else {
sum = sum + (((x - 1) * x) / 2);
x = 1;
}
}
if (x > 1) {
sum = sum + (((x - 1) * x) / 2);
}
cout << sum;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 748,019 | 748,020 | u090223455 | cpp |
p02947 | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; 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;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
string replaceAll(string &replacedStr, string from, string to) {
unsigned int pos = replacedStr.find(from);
int toLen = to.length();
if (from.empty()) {
return replacedStr;
}
while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
replacedStr.replace(pos, from.length(), to);
pos += toLen;
}
return replacedStr;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
struct Edge {
int to; // 辺の行き先
int weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;
vector<bool> seen;
vector<ll> step;
void dfs(const Graph &G, int v, ll now) {
seen[v] = true; // v を訪問済にする
step[v] = now;
// v から行ける各頂点 next_v について
for (auto next_v : G[v]) {
if (seen[next_v] && (now + 1 >= step[next_v]))
continue; // next_v が探索済だったらスルー
dfs(G, next_v, now + 1); // 再帰的に探索
}
}
std::vector<int> enum_div(int n) // nの約数を列挙
{
std::vector<int> ret;
for (int i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
void Ssort(int no, char *month[]) {
int i, j;
char *temp;
for (i = 0; i < no; i++) {
for (j = i + 1; j < no; j++) {
if (strcmp((month[i]), (month[j])) > 0) {
temp = *(month + i);
*(month + i) = *(month + j);
*(month + j) = temp;
}
}
}
}
int main() {
ll N;
ll ans = 0;
cin >> N;
map<string, ll> mp;
FOR(i, 0, N - 1) {
string tp;
sort(tp.begin(), tp.end());
mp[tp]++;
}
for (auto p : mp) {
long long c = p.second;
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; 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;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
string replaceAll(string &replacedStr, string from, string to) {
unsigned int pos = replacedStr.find(from);
int toLen = to.length();
if (from.empty()) {
return replacedStr;
}
while ((pos = replacedStr.find(from, pos)) != std::string::npos) {
replacedStr.replace(pos, from.length(), to);
pos += toLen;
}
return replacedStr;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
struct Edge {
int to; // 辺の行き先
int weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;
vector<bool> seen;
vector<ll> step;
void dfs(const Graph &G, int v, ll now) {
seen[v] = true; // v を訪問済にする
step[v] = now;
// v から行ける各頂点 next_v について
for (auto next_v : G[v]) {
if (seen[next_v] && (now + 1 >= step[next_v]))
continue; // next_v が探索済だったらスルー
dfs(G, next_v, now + 1); // 再帰的に探索
}
}
std::vector<int> enum_div(int n) // nの約数を列挙
{
std::vector<int> ret;
for (int i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
void Ssort(int no, char *month[]) {
int i, j;
char *temp;
for (i = 0; i < no; i++) {
for (j = i + 1; j < no; j++) {
if (strcmp((month[i]), (month[j])) > 0) {
temp = *(month + i);
*(month + i) = *(month + j);
*(month + j) = temp;
}
}
}
}
int main() {
ll N;
ll ans = 0;
cin >> N;
map<string, ll> mp;
FOR(i, 0, N - 1) {
string tp;
cin >> tp;
sort(tp.begin(), tp.end());
mp[tp]++;
}
for (auto p : mp) {
long long c = p.second;
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
} | [] | 748,031 | 748,032 | u043443359 | cpp |
p02947 | #include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORR(i, a, b) for (int i = a; i >= b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;
template <typename T> void chmin(T &a, T b) {
if (a > b)
a = b;
}
template <typename T> void chmax(T &a, T b) {
if (a < b)
a = b;
}
int in() {
int x;
scanf("%d", &x);
return x;
}
ll lin() {
ll x;
scanf("%lld", &x);
return x;
}
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> str2count;
for (string x : s)
str2count[x]++;
int ans = 0;
for (pair<string, int> p : str2count) {
int c = p.second;
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORR(i, a, b) for (int i = a; i >= b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;
template <typename T> void chmin(T &a, T b) {
if (a > b)
a = b;
}
template <typename T> void chmax(T &a, T b) {
if (a < b)
a = b;
}
int in() {
int x;
scanf("%d", &x);
return x;
}
ll lin() {
ll x;
scanf("%lld", &x);
return x;
}
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> str2count;
for (string x : s)
str2count[x]++;
long long ans = 0;
for (pair<string, int> p : str2count) {
long long c = p.second;
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,033 | 748,034 | u016572066 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ll long long
int main() {
int n;
cin >> n;
string s;
map<string, int> d;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
++d[s];
}
ll ans = 0;
for (auto p : d) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ll long long
int main() {
int n;
cin >> n;
string s;
map<string, int> d;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
++d[s];
}
ll ans = 0;
for (auto p : d) {
ans += (ll)p.second * (p.second - 1) / 2;
}
cout << ans << endl;
} | [
"type_conversion.add"
] | 748,035 | 748,036 | u887207211 | cpp |
p02947 | #pragma GCC optimize "03"
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
signed main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
IOS;
int n;
cin >> n;
map<string, int> m;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
int ans = 0;
for (auto i : m)
ans += i.se * (i.se - 1) / 2;
cout << ans;
return 0;
} | #pragma GCC optimize "03"
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
signed main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
IOS;
int n;
cin >> n;
map<string, int> m;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
int ans = 0;
for (auto i : m)
ans += i.se * (i.se - 1) / 2;
cout << ans;
return 0;
} | [
"identifier.change"
] | 748,044 | 748,045 | u995439034 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8
using namespace std;
typedef pair<int, int> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }
int N;
map<string, int> nums;
int main(int argc, char **argv) {
cin >> N;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (nums.find(s) == nums.end())
nums[s] = 1;
else
nums[s]++;
}
llong res = 0;
for (map<string, int>::iterator it = nums.begin(); it != nums.end(); ++it) {
res += it->second * (it->second - 1) / 2;
}
cout << res << endl;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8
using namespace std;
typedef pair<int, int> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }
int N;
map<string, llong> nums;
int main(int argc, char **argv) {
cin >> N;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (nums.find(s) == nums.end()) {
nums[s] = 1;
} else {
nums[s]++;
}
}
llong res = 0;
for (map<string, llong>::iterator it = nums.begin(); it != nums.end(); ++it) {
res += it->second * (it->second - 1) / 2;
}
cout << res << endl;
} | [
"control_flow.loop.for.initializer.change"
] | 748,046 | 748,047 | u777137418 | cpp |
p02947 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
int main() {
int n;
ll cnt = 0;
cin >> n;
string s;
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s;
sort(ALL(s));
mp[s]++;
}
for (auto p : mp) {
cnt += p.second * (p.second - 1) / 2;
}
cout << cnt << endl;
return 0;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
int main() {
int n;
ll cnt = 0;
cin >> n;
string s;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
cin >> s;
sort(ALL(s));
mp[s]++;
}
for (auto p : mp) {
cnt += p.second * (p.second - 1) / 2;
}
cout << cnt << endl;
return 0;
} | [] | 748,048 | 748,049 | u538125576 | cpp |
p02947 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
int main() {
int n, cnt = 0;
cin >> n;
string s;
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s;
sort(ALL(s));
mp[s]++;
}
for (auto p : mp) {
cnt += p.second * (p.second - 1) / 2;
}
cout << cnt << endl;
return 0;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
int main() {
int n;
ll cnt = 0;
cin >> n;
string s;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
cin >> s;
sort(ALL(s));
mp[s]++;
}
for (auto p : mp) {
cnt += p.second * (p.second - 1) / 2;
}
cout << cnt << endl;
return 0;
} | [] | 748,050 | 748,049 | u538125576 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#define roop(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main(void) {
int n, m, count = 0;
map<string, int> mp;
cin >> n;
m = n;
while (m--) {
string x;
cin >> x;
sort(x.begin(), x.end());
mp[x]++;
}
long long int sum = 0;
for (auto i : mp) {
sum += (i.second * (i.second - 1)) / 2;
}
cout << sum << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#define roop(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main(void) {
int n, m, count = 0;
map<string, long> mp;
cin >> n;
m = n;
while (m--) {
string x;
cin >> x;
sort(x.begin(), x.end());
mp[x]++;
}
long long int sum = 0;
for (auto i : mp) {
sum += (i.second * (i.second - 1)) / 2;
}
cout << sum << endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 748,062 | 748,063 | u749089333 | 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]++;
}
ll sum = 0;
for (auto it : mp) {
sum += (it.second) * (it.second - 1) / 2;
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, long> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll sum = 0;
for (auto it : mp) {
sum += (it.second) * (it.second - 1) / 2;
}
cout << sum << endl;
}
| [
"variable_declaration.type.change",
"variable_declaration.type.primitive.change"
] | 748,064 | 748,065 | u374190629 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.