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 8
values |
|---|---|---|---|---|---|---|---|
p02946
|
#include <iostream>
using namespace std;
int main(void) {
int k, x;
cin >> k >> x;
for (int i = x - 2; i < x + 3; i++) {
cout << i << " ";
}
return 0;
}
|
#include <iostream>
using namespace std;
int main(void) {
int k, x;
cin >> k >> x;
for (int i = x - (k - 1); i < x + k; i++) {
cout << i << " ";
}
return 0;
}
|
[
"control_flow.loop.for.initializer.change",
"expression.operation.binary.change",
"identifier.replace.add",
"literal.replace.remove",
"control_flow.loop.for.condition.change"
] | 745,926
| 745,927
|
u876653122
|
cpp
|
p02946
|
#include <algorithm>
#include <array>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD ((ll)1000000007)
int main(int argc, char const *argv[]) {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
int K, X;
cin >> K >> X;
int start;
for (size_t i = max(-1000000, X - K + 1); i < min(X + K - 1, 1000000); i++) {
cout << i << " ";
}
cout << X + K - 1 << endl;
return 0;
}
|
#include <algorithm>
#include <array>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD ((ll)1000000007)
int main(int argc, char const *argv[]) {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
int K, X;
cin >> K >> X;
int start;
for (int i = max(-1000000, X - K + 1); i < min(X + K - 1, 1000000); i++) {
cout << i << " ";
}
cout << X + K - 1 << endl;
return 0;
}
|
[
"control_flow.loop.for.initializer.change",
"variable_declaration.type.primitive.change"
] | 745,928
| 745,929
|
u162948713
|
cpp
|
p02946
|
#include <iostream>
using namespace std;
int main() {
int K, X;
cin >> K >> X;
int max, min;
max = K + X - 1;
min = X - K + 1;
int p, i;
if (max == min) {
cout << 1;
} else {
for (i = 0; i < 2 * K - 1; i++) {
p = min + i;
cout << p << " ";
}
}
cout << endl;
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
int K, X;
cin >> K >> X;
int max, min;
max = K + X - 1;
min = X - K + 1;
int p, i;
if (max == min) {
cout << X;
} else {
for (i = 0; i < 2 * K - 1; i++) {
p = min + i;
cout << p << " ";
}
}
cout << endl;
return 0;
}
|
[
"identifier.replace.add",
"literal.replace.remove",
"io.output.change"
] | 745,935
| 745,936
|
u466992080
|
cpp
|
p02947
|
// Problem : C - Green Bin
// Contest : AtCoder - AtCoder Beginner Contest 137
// URL : https://atcoder.jp/contests/abc137/tasks/abc137_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
#define l00p(i, a, b) for (int i = a; i < (b); i++)
#define loop(i, a) for (int i = 0; i < (a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
template <class T> bool ckmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template <class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ld pii = 3.14159265359;
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; // check the limits, dummy
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<string> v(n);
unordered_map<string, int> map;
int ans = 0;
loop(i, n) {
cin >> v[i];
sort(all(v[i]));
ans += map[v[i]];
map[v[i]]++;
}
cout << ans;
}
// read the question correctly (ll vs int)
// template by bqi343
|
// Problem : C - Green Bin
// Contest : AtCoder - AtCoder Beginner Contest 137
// URL : https://atcoder.jp/contests/abc137/tasks/abc137_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
#define l00p(i, a, b) for (int i = a; i < (b); i++)
#define loop(i, a) for (int i = 0; i < (a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
template <class T> bool ckmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template <class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ld pii = 3.14159265359;
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; // check the limits, dummy
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<string> v(n);
unordered_map<string, int> map;
ll ans = 0;
loop(i, n) {
cin >> v[i];
sort(all(v[i]));
ans += map[v[i]];
map[v[i]]++;
}
cout << ans;
}
// read the question correctly (ll vs int)
// template by bqi343
|
[
"variable_declaration.type.change"
] | 745,937
| 745,938
|
u197541395
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
void solve() {
int n;
cin >> n;
unordered_map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto &itr : m) {
int t = itr.second;
ans += (t * (t - 1)) / 2;
}
cout << ans << endl;
}
int main() {
solve();
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
void solve() {
int n;
cin >> n;
unordered_map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto &itr : m) {
ll t = itr.second;
ans += (t * (t - 1)) / 2;
}
cout << ans << endl;
}
int main() {
solve();
return 0;
}
|
[
"variable_declaration.type.change"
] | 745,941
| 745,942
|
u280175105
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
void solve() {
int n;
cin >> n;
unordered_map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
int ans = 0;
for (auto &itr : m) {
int t = itr.second;
ans += (t * (t - 1)) / 2;
}
cout << ans << endl;
}
int main() {
solve();
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
void solve() {
int n;
cin >> n;
unordered_map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto &itr : m) {
ll t = itr.second;
ans += (t * (t - 1)) / 2;
}
cout << ans << endl;
}
int main() {
solve();
return 0;
}
|
[
"variable_declaration.type.change"
] | 745,943
| 745,942
|
u280175105
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, long long> s;
long long ans = 0;
for (int i = 0; i < n; i++) {
string t;
cin >> t;
sort(t.begin(), t.end());
if (s.count(t))
s[t] += 1;
else
s[t] = 1;
}
for (auto p : s) {
int x = p.second;
ans += x * (x - 1) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, long long> s;
long long ans = 0;
for (int i = 0; i < n; i++) {
string t;
cin >> t;
sort(t.begin(), t.end());
if (s.count(t))
s[t] += 1;
else
s[t] = 1;
}
for (auto p : s) {
long long x = p.second;
ans += x * (x - 1) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 745,948
| 745,949
|
u948698924
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, int> s;
long long ans = 0;
for (int i = 0; i < n; i++) {
string t;
cin >> t;
sort(t.begin(), t.end());
if (s.count(t))
s[t] += 1;
else
s[t] = 1;
}
for (auto p : s) {
int x = p.second;
ans += x * (x - 1) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, long long> s;
long long ans = 0;
for (int i = 0; i < n; i++) {
string t;
cin >> t;
sort(t.begin(), t.end());
if (s.count(t))
s[t] += 1;
else
s[t] = 1;
}
for (auto p : s) {
long long x = p.second;
ans += x * (x - 1) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 745,950
| 745,949
|
u948698924
|
cpp
|
p02947
|
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF 1000000100
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s] += 1;
}
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF 1000000100
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int N;
cin >> N;
map<string, int> mp;
// ll ans=0;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
// ans += mp[s];
mp[s] += 1;
}
ll ans = 0;
for (auto p : mp) {
ans += (ll)p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 745,953
| 745,954
|
u991650542
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
int main() {
using namespace std;
int n, cnt = 0;
cin >> n;
std::string si;
map<std::string, int> m;
for (int i = 0; i < n; i++) {
cin >> si;
// cout << "x";
sort(si.begin(), si.end());
// cout << "y";
if (m.count(si))
cnt += m[si];
m[si]++;
}
cout << cnt;
}
|
#include <algorithm>
#include <iostream>
#include <map>
int main() {
using namespace std;
long long n, cnt = 0;
cin >> n;
std::string si;
map<std::string, long long> m;
for (long long i = 0; i < n; i++) {
cin >> si;
sort(si.begin(), si.end());
if (m.count(si))
cnt += m[si];
m[si]++;
}
cout << cnt;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"control_flow.loop.for.initializer.change"
] | 745,957
| 745,958
|
u826103718
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
unordered_map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
unordered_map<string, long long> 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) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
solve();
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 745,964
| 745,965
|
u507114778
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
long long K = 0;
map<string, int> mp;
cin >> N;
vector<string> v(N);
for (int X = 0; X < N; X++) {
cin >> v[X];
sort(v[X].begin(), v[X].end());
mp[v[X]]++;
}
for (auto p : mp) {
auto V = p.second;
K += V * (V - 1) / 2;
}
cout << K << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
long long K = 0;
map<string, long long> mp;
cin >> N;
vector<string> v(N);
for (int X = 0; X < N; X++) {
cin >> v[X];
sort(v[X].begin(), v[X].end());
mp[v[X]]++;
}
for (auto p : mp) {
auto V = p.second;
K += V * (V - 1) / 2;
}
cout << K << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 745,966
| 745,967
|
u740002394
|
cpp
|
p02947
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
rep(i, N) sort(s[i].begin(), s[i].end());
map<string, int> mp;
rep(i, N) mp[s[i]]++;
ll ans = 0;
auto begin = mp.begin(), end = mp.end();
for (auto i = begin; i != end; i++)
ans += (i->second) * (i->second - 1) / 2;
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
rep(i, N) sort(s[i].begin(), s[i].end());
map<string, ll> mp;
rep(i, N) mp[s[i]]++;
ll ans = 0;
auto begin = mp.begin(), end = mp.end();
for (auto i = begin; i != end; i++)
ans += (i->second) * (i->second - 1) / 2;
cout << ans << endl;
return 0;
}
|
[] | 745,968
| 745,969
|
u530957410
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define ll long long
#define pq priority_queue
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
map<string, int> anag;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (anag.find(s) != anag.end()) {
anag[s]++;
} else {
anag[s] = 1;
}
}
ll no_pairs = 0;
for (map<string, int>::iterator it = anag.begin(); it != anag.end(); it++) {
no_pairs += (it->second) * ((it->second) - 1) / 2;
}
cout << no_pairs;
}
|
#include <bits/stdc++.h>
#define int long long
#define pq priority_queue
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
map<string, int> anag;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (anag.find(s) != anag.end()) {
anag[s]++;
} else {
anag[s] = 1;
}
}
int no_pairs = 0;
for (map<string, int>::iterator it = anag.begin(); it != anag.end(); it++) {
no_pairs += (it->second) * ((it->second) - 1) / 2;
}
cout << no_pairs;
}
|
[
"identifier.change",
"function.return_type.change",
"variable_declaration.type.change"
] | 745,970
| 745,971
|
u323819429
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
#define SORT(s) sort((s).begin(), (s).end())
#define SORTD(s) sort((s).rbegin(), (s).rend())
ll choose(ll a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) SORT(s[i]);
SORT(s);
vector<int> cnt(n, 1);
int sum = 0;
int j = 0;
rep(i, n - 1) {
if (s[i] == s[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum << endl;
}
|
//全然分からなかったから見返すとき用
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
#define SORT(s) sort((s).begin(), (s).end())
#define SORTD(s) sort((s).rbegin(), (s).rend())
ll choose(ll a) { // aC2
return (a - 1) * a / 2; //組み合わせを求める式
// 3つ同じなら3-1*3/2で4組になるので
}
int main() {
ll n; // 32 bit 整数型に収まらない可能性がある
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) SORT(s[i]); // sortで辞書順並び替えできる
SORT(s);
vector<ll> cnt(n, 1);
ll sum = 0; //最後の答えのやつ
ll j = 0; //
rep(i, n - 1) {
if (s[i] == s[i + 1])
cnt[j]++; //一致した数
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]); //一致した数から組み合わせ数を求める
cout << sum << endl;
}
|
[
"variable_declaration.type.change"
] | 745,974
| 745,975
|
u096030913
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
#define SORT(s) sort((s).begin(), (s).end())
#define SORTD(s) sort((s).rbegin(), (s).rend())
ll choose(ll a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) SORT(s[i]);
SORT(s);
vector<int> cnt(n, 1);
int sum = 0;
int j = 0;
rep(i, n - 1) {
if (s[i] == s[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
#define SORT(s) sort((s).begin(), (s).end())
#define SORTD(s) sort((s).rbegin(), (s).rend())
ll choose(ll a) { // aC2
return (a - 1) * a / 2;
}
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) SORT(s[i]);
SORT(s);
vector<ll> cnt(n, 1);
ll sum = 0;
ll j = 0;
rep(i, n - 1) {
if (s[i] == s[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum << endl;
}
|
[
"variable_declaration.type.change"
] | 745,974
| 745,976
|
u096030913
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;
int main() {
int n;
cin >> n;
map<string, int> mp;
string s;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll tmp;
ll res = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
int f = itr->second;
tmp = f * (f - 1) / 2;
res += tmp;
}
cout << res << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;
int main() {
int n;
cin >> n;
map<string, int> mp;
string s;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll tmp;
ll res = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
ll f = itr->second;
tmp = f * (f - 1) / 2;
res += tmp;
}
cout << res << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 745,979
| 745,980
|
u006167882
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;
int main() {
int n;
cin >> n;
map<string, int> mp;
string s;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll tmp;
ll res = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
int f = itr->second;
tmp = f * (f - 1) / 2;
res += tmp;
}
cout << res << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
const long long INF = 1LL << 60;
typedef long long ll;
const long long MOD = 1000000000 + 7;
int main() {
int n;
cin >> n;
map<string, int> mp;
string s;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll tmp;
ll res = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
ll f = itr->second;
tmp = f * (f - 1) / 2;
res += tmp;
}
cout << res << endl;
return 0;
}
|
[
"variable_declaration.type.narrow.change",
"variable_declaration.type.change"
] | 745,979
| 745,982
|
u006167882
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<vector<char>> S(N, vector<char>(10));
for (int i = 0; i < N; i++) {
cin >> S.at(i).at(0) >> S.at(i).at(1) >> S.at(i).at(2) >> S.at(i).at(3) >>
S.at(i).at(4) >> S.at(i).at(5) >> S.at(i).at(6) >> S.at(i).at(7) >>
S.at(i).at(8) >> S.at(i).at(9);
sort(S.at(i).begin(), S.at(i).end());
}
sort(S.begin(), S.end());
int64_t ans = 0;
int memo = 1;
for (int i = 0; i < N - 1; i++) {
if (S.at(i).at(0) == S.at(i + 1).at(0) &&
S.at(i).at(1) == S.at(i + 1).at(1) &&
S.at(i).at(2) == S.at(i + 1).at(2) &&
S.at(i).at(3) == S.at(i + 1).at(3) &&
S.at(i).at(4) == S.at(i + 1).at(4) &&
S.at(i).at(5) == S.at(i + 1).at(5) &&
S.at(i).at(6) == S.at(i + 1).at(6) &&
S.at(i).at(7) == S.at(i + 1).at(7) &&
S.at(i).at(8) == S.at(i + 1).at(8) &&
S.at(i).at(9) == S.at(i + 1).at(9)) {
memo++;
} else {
ans += (memo * (memo - 1)) / 2;
memo = 1;
}
}
ans += (memo * (memo - 1)) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<vector<char>> S(N, vector<char>(10));
for (int i = 0; i < N; i++) {
cin >> S.at(i).at(0) >> S.at(i).at(1) >> S.at(i).at(2) >> S.at(i).at(3) >>
S.at(i).at(4) >> S.at(i).at(5) >> S.at(i).at(6) >> S.at(i).at(7) >>
S.at(i).at(8) >> S.at(i).at(9);
sort(S.at(i).begin(), S.at(i).end());
}
sort(S.begin(), S.end());
int64_t ans = 0;
int64_t memo = 1;
for (int i = 0; i < N - 1; i++) {
if (S.at(i).at(0) == S.at(i + 1).at(0) &&
S.at(i).at(1) == S.at(i + 1).at(1) &&
S.at(i).at(2) == S.at(i + 1).at(2) &&
S.at(i).at(3) == S.at(i + 1).at(3) &&
S.at(i).at(4) == S.at(i + 1).at(4) &&
S.at(i).at(5) == S.at(i + 1).at(5) &&
S.at(i).at(6) == S.at(i + 1).at(6) &&
S.at(i).at(7) == S.at(i + 1).at(7) &&
S.at(i).at(8) == S.at(i + 1).at(8) &&
S.at(i).at(9) == S.at(i + 1).at(9)) {
memo++;
} else {
ans += (memo * (memo - 1)) / 2;
memo = 1;
}
}
ans += (memo * (memo - 1)) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 745,989
| 745,990
|
u453366189
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <vector>
#define ll long long
#define rep(n) for (int i = 0; i < n; ++i)
using namespace std;
int main(void) {
// Your code here!
int n;
cin >> n;
vector<string> vec(n);
rep(n) {
cin >> vec[i];
sort(vec[i].begin(), vec[i].end());
}
sort(vec.begin(), vec.end());
int count = 1, ans = 0;
for (int i = 0; i < n - 1; i++) {
if (vec[i] == vec[i + 1]) {
count++;
} else {
ans += (count * (count - 1)) / 2;
count = 1;
}
}
ans += (count * (count - 1)) / 2;
cout << ans;
}
|
#include <algorithm>
#include <iostream>
#include <vector>
#define ll long long
#define rep(n) for (int i = 0; i < n; ++i)
using namespace std;
int main(void) {
// Your code here!
int n;
cin >> n;
vector<string> vec(n);
rep(n) {
cin >> vec[i];
sort(vec[i].begin(), vec[i].end());
}
sort(vec.begin(), vec.end());
ll count = 1, ans = 0;
for (int i = 0; i < n - 1; i++) {
if (vec[i] == vec[i + 1]) {
count++;
} else {
ans += (count * (count - 1)) / 2;
count = 1;
}
}
ans += (count * (count - 1)) / 2;
cout << ans;
}
|
[
"variable_declaration.type.change"
] | 745,991
| 745,992
|
u870415620
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string tmp;
int ans = 0;
map<string, int> s;
for (int i = 0; i < n; i++) {
cin >> tmp;
sort(tmp.begin(), tmp.end());
if (s.count(tmp)) {
ans += s.at(tmp);
s.at(tmp)++;
} else
s[tmp] = 1;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string tmp;
int64_t ans = 0;
map<string, int> s;
for (int i = 0; i < n; i++) {
cin >> tmp;
sort(tmp.begin(), tmp.end());
if (s.count(tmp)) {
ans += s.at(tmp);
s.at(tmp)++;
} else
s[tmp] = 1;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 745,995
| 745,996
|
u285486772
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string, int>;
const double PI = acos(-1);
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
int x = itr->second;
ans += x * (x - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string, int>;
const double PI = acos(-1);
int main() {
ll n;
cin >> n;
map<string, ll> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
ll x = itr->second;
ans += x * (x - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 745,997
| 745,998
|
u425086757
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int N;
cin >> N;
string S;
map<string, int> M;
int ans = 0;
rep(i, N) {
cin >> S;
sort(S.begin(), S.end());
if (M.count(S))
M[S]++;
else
M[S] = 0;
ans += M[S];
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int N;
cin >> N;
string S;
map<string, int> M;
ll ans = 0;
rep(i, N) {
cin >> S;
sort(S.begin(), S.end());
if (M.count(S))
M[S]++;
else
M[S] = 0;
ans += M[S];
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 745,999
| 746,000
|
u078435079
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
int main() {
int n;
const int max_n = 1e5;
string s[max_n + 1];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
// for(int i = 0; i < n; i++) cout << s[i] << endl;
int now = 0;
long long ans = 0;
for (int i = 1; i < n; i++) {
if (s[i] != s[i - 1]) {
ans += (i - now) * (i - now - 1) / 2;
now = i;
// cout << now << endl;
}
if (i == n - 1) {
ans += (i + 1 - now) * (i + 1 - now - 1) / 2;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
int main() {
int n;
const int max_n = 1e5;
string s[max_n + 1];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
// for(int i = 0; i < n; i++) cout << s[i] << endl;
long long now = 0;
long long ans = 0;
for (long long i = 1; i < n; i++) {
if (s[i] != s[i - 1]) {
ans += (i - now) * (i - now - 1) / 2;
now = i;
// cout << now << endl;
}
if (i == n - 1) {
ans += (i + 1 - now) * (i + 1 - now - 1) / 2;
}
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"control_flow.loop.for.initializer.change"
] | 746,001
| 746,002
|
u906832993
|
cpp
|
p02947
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;
int choose(ll a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> ss(n);
rep(i, n) cin >> ss[i];
rep(i, n) sort(ss[i].begin(), ss[i].end());
sort(ss.begin(), ss.end());
vector<ll> cnt(n, 1);
ll sum = 0;
int j = 0;
rep(i, n - 1) {
if (ss[i] == ss[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum;
}
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;
ll choose(ll a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> ss(n);
rep(i, n) cin >> ss[i];
rep(i, n) sort(ss[i].begin(), ss[i].end());
sort(ss.begin(), ss.end());
vector<ll> cnt(n, 1);
ll sum = 0;
int j = 0;
rep(i, n - 1) {
if (ss[i] == ss[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum;
}
|
[] | 746,005
| 746,006
|
u510989601
|
cpp
|
p02947
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;
int choose(int a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> ss(n);
rep(i, n) cin >> ss[i];
rep(i, n) sort(ss[i].begin(), ss[i].end());
sort(ss.begin(), ss.end());
vector<ll> cnt(n, 1);
ll sum = 0;
int j = 0;
rep(i, n - 1) {
if (ss[i] == ss[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum;
}
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;
ll choose(ll a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> ss(n);
rep(i, n) cin >> ss[i];
rep(i, n) sort(ss[i].begin(), ss[i].end());
sort(ss.begin(), ss.end());
vector<ll> cnt(n, 1);
ll sum = 0;
int j = 0;
rep(i, n - 1) {
if (ss[i] == ss[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum;
}
|
[] | 746,007
| 746,006
|
u510989601
|
cpp
|
p02947
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;
int choose(int a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> ss(n);
rep(i, n) cin >> ss[i];
rep(i, n) sort(ss[i].begin(), ss[i].end());
sort(ss.begin(), ss.end());
vector<int> cnt(n, 1);
ll sum = 0;
int j = 0;
rep(i, n - 1) {
if (ss[i] == ss[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum;
}
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;
ll choose(ll a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> ss(n);
rep(i, n) cin >> ss[i];
rep(i, n) sort(ss[i].begin(), ss[i].end());
sort(ss.begin(), ss.end());
vector<ll> cnt(n, 1);
ll sum = 0;
int j = 0;
rep(i, n - 1) {
if (ss[i] == ss[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum;
}
|
[] | 746,008
| 746,006
|
u510989601
|
cpp
|
p02947
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;
int choose(int a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> ss(n);
rep(i, n) cin >> ss[i];
rep(i, n) sort(ss[i].begin(), ss[i].end());
sort(ss.begin(), ss.end());
vector<int> cnt(n, 1);
int sum = 0;
int j = 0;
rep(i, n - 1) {
if (ss[i] == ss[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum;
}
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll Max = 10 + 1e12;
int N = 5 + 1e5;
ll choose(ll a) { // aC2
return (a - 1) * a / 2;
}
int main() {
int n;
cin >> n;
vector<string> ss(n);
rep(i, n) cin >> ss[i];
rep(i, n) sort(ss[i].begin(), ss[i].end());
sort(ss.begin(), ss.end());
vector<ll> cnt(n, 1);
ll sum = 0;
int j = 0;
rep(i, n - 1) {
if (ss[i] == ss[i + 1])
cnt[j]++;
else
j++;
}
j++;
rep(i, j) sum += choose(cnt[i]);
cout << sum;
}
|
[
"variable_declaration.type.change"
] | 746,009
| 746,006
|
u510989601
|
cpp
|
p02947
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
int choose(int i) { return i * (i - 1) / 2; }
int main() {
int n;
cin >> n;
vector<string> ss(n);
map<string, ll> mp;
rep(i, n) {
cin >> ss[i];
sort(ss[i].begin(), ss[i].end());
mp[ss[i]]++;
}
ll cnt = 0;
rep(i, n) {
cnt += choose(mp[ss[i]]);
mp[ss[i]] = 1;
}
cout << cnt;
}
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll choose(ll i) { return i * (i - 1) / 2; }
int main() {
int n;
cin >> n;
vector<string> ss(n);
map<string, ll> mp;
rep(i, n) {
cin >> ss[i];
sort(ss[i].begin(), ss[i].end());
mp[ss[i]]++;
}
ll cnt = 0;
rep(i, n) {
cnt += choose(mp[ss[i]]);
mp[ss[i]] = 1;
}
cout << cnt;
}
|
[] | 746,010
| 746,011
|
u510989601
|
cpp
|
p02947
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
int choose(int i) { return i * (i - 1) / 2; }
int main() {
int n;
cin >> n;
vector<string> ss(n);
map<string, int> mp;
rep(i, n) {
cin >> ss[i];
sort(ss[i].begin(), ss[i].end());
mp[ss[i]]++;
}
ll cnt = 0;
rep(i, n) {
cnt += choose(mp[ss[i]]);
mp[ss[i]] = 1;
}
cout << cnt;
}
|
#include <algorithm>
#include <ciso646>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
ll choose(ll i) { return i * (i - 1) / 2; }
int main() {
int n;
cin >> n;
vector<string> ss(n);
map<string, ll> mp;
rep(i, n) {
cin >> ss[i];
sort(ss[i].begin(), ss[i].end());
mp[ss[i]]++;
}
ll cnt = 0;
rep(i, n) {
cnt += choose(mp[ss[i]]);
mp[ss[i]] = 1;
}
cout << cnt;
}
|
[] | 746,012
| 746,011
|
u510989601
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto x : mp) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
ans += (ll)x.second * (x.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,013
| 746,014
|
u547099897
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main() {
int n;
cin >> n;
vector<string> ss(n);
for (int i = 0; i < n; i++)
cin >> ss[i];
map<string, int> m;
for (int i = 0; i < n; i++) {
auto s = ss[i];
sort(s.begin(), s.end());
if (m.count(s) == 0)
m[s] = 0;
m[s]++;
}
ll ans(0);
for (auto ele : m) {
ans += ele.second * (ele.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main() {
int n;
cin >> n;
vector<string> ss(n);
for (int i = 0; i < n; i++)
cin >> ss[i];
map<string, ll> m;
for (int i = 0; i < n; i++) {
auto s = ss[i];
sort(s.begin(), s.end());
if (m.count(s) == 0)
m[s] = 0;
m[s]++;
}
ll ans(0);
for (auto ele : m) {
ans += ele.second * (ele.second - 1) / 2;
}
cout << ans << endl;
}
|
[] | 746,017
| 746,018
|
u619273584
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u> bool chmax(t &a, u b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class t, class u> bool chmin(t &a, u b) {
if (b < a) {
a = b;
return true;
}
return false;
}
signed main() {
int n;
cin >> n;
map<string, int> msi;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
msi[s]++;
}
ll ans = 0;
for (auto &i : msi) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u> bool chmax(t &a, u b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class t, class u> bool chmin(t &a, u b) {
if (b < a) {
a = b;
return true;
}
return false;
}
signed main() {
int n;
cin >> n;
map<string, ll> msi;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
msi[s]++;
}
ll ans = 0;
for (auto &i : msi) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,019
| 746,020
|
u319279308
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
int main() {
int n;
cin >> n;
unordered_map<string, int> um;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
um[s]++;
}
ll ans = 0;
for (pair<string, int> p : um) {
int cnt = p.second;
if (cnt >= 2) {
ans += (cnt * (cnt - 1)) / 2;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
int main() {
int n;
cin >> n;
unordered_map<string, int> um;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
um[s]++;
}
ll ans = 0;
for (pair<string, int> p : um) {
int cnt = p.second;
if (cnt >= 2) {
ans += ((ll)cnt * (cnt - 1)) / 2;
}
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 746,028
| 746,029
|
u225642513
|
cpp
|
p02947
|
/*Function Template*/
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for (long long int i = 0; i < (n); i++)
int Len(int n) {
int s = 0;
while (n != 0)
s++, n /= 10;
return s;
}
int Sint(int n) {
int m = 0, s = 0, a = n;
while (a != 0)
s++, a /= 10;
for (int i = s - 1; i >= 0; i--)
m += n / ((int)pow(10, i)) - (n / ((int)pow(10, i + 1))) * 10;
return m;
}
int Svec(vector<int> v) {
int n = 0;
for (int i = 0; i < v.size(); i++)
n += v[i];
return n;
}
int GCD(int a, int b) {
int r, tmp;
/*自然数 a > b を確認・入替*/
if (a < b) {
tmp = a, a = b, b = tmp;
}
/*ユークリッドの互除法*/
r = a % b;
while (r != 0) {
a = b, b = r, r = a % b;
}
return b;
}
int LCM(int a, int b) {
int c = a, d = b, r, tmp;
/*自然数 a > b を確認・入替*/
if (a < b) {
tmp = a, a = b, b = tmp;
}
/*ユークリッドの互除法*/
r = a % b;
while (r != 0) {
a = b, b = r, r = a % b;
}
return c / b * d;
}
int Factorial(int n) {
int m = 1;
while (n >= 1)
m *= n, n--;
return m;
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
long long int n, ans = 0;
cin >> n;
vector<string> v(n);
map<string, int> mp;
rep(i, n) {
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
rep(i, n) { mp[v[i]]++; }
for (auto c : mp) {
ans += (c.second - 1) * (c.second) / 2;
}
cout << ans << endl;
}
|
/*Function Template*/
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for (long long int i = 0; i < (n); i++)
int Len(int n) {
int s = 0;
while (n != 0)
s++, n /= 10;
return s;
}
int Sint(int n) {
int m = 0, s = 0, a = n;
while (a != 0)
s++, a /= 10;
for (int i = s - 1; i >= 0; i--)
m += n / ((int)pow(10, i)) - (n / ((int)pow(10, i + 1))) * 10;
return m;
}
int Svec(vector<int> v) {
int n = 0;
for (int i = 0; i < v.size(); i++)
n += v[i];
return n;
}
int GCD(int a, int b) {
int r, tmp;
/*自然数 a > b を確認・入替*/
if (a < b) {
tmp = a, a = b, b = tmp;
}
/*ユークリッドの互除法*/
r = a % b;
while (r != 0) {
a = b, b = r, r = a % b;
}
return b;
}
int LCM(int a, int b) {
int c = a, d = b, r, tmp;
/*自然数 a > b を確認・入替*/
if (a < b) {
tmp = a, a = b, b = tmp;
}
/*ユークリッドの互除法*/
r = a % b;
while (r != 0) {
a = b, b = r, r = a % b;
}
return c / b * d;
}
int Factorial(int n) {
int m = 1;
while (n >= 1)
m *= n, n--;
return m;
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
long long int n, ans = 0;
cin >> n;
vector<string> v(n);
map<string, long long int> mp;
rep(i, n) {
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
rep(i, n) { mp[v[i]]++; }
for (auto c : mp) {
ans += (c.second - 1) * (c.second) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 746,030
| 746,031
|
u264265458
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, i;
long long Sum = 0;
string s;
map<string, int> S;
cin >> N;
for (i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
S[s]++;
}
for (auto p : S) {
Sum += p.second * (p.second - 1) / 2;
}
cout << Sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, i;
long long Sum = 0;
string s;
map<string, long long> S;
cin >> N;
for (i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
S[s]++;
}
for (auto p : S) {
Sum += p.second * (p.second - 1) / 2;
}
cout << Sum << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,036
| 746,037
|
u319965179
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, i, Sum = 0;
string s;
map<string, int> S;
cin >> N;
for (i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
S[s]++;
}
for (auto p : S) {
Sum += p.second * (p.second - 1) / 2;
}
cout << Sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, i;
long long Sum = 0;
string s;
map<string, long long> S;
cin >> N;
for (i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
S[s]++;
}
for (auto p : S) {
Sum += p.second * (p.second - 1) / 2;
}
cout << Sum << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,038
| 746,037
|
u319965179
|
cpp
|
p02947
|
/*
URL_HERE
*/
/*
*/
#ifdef _WIN32
#pragma warning(disable : 4996)
#endif
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
using namespace std;
FILE *_fin = stdin;
FILE *_fout = stdout;
#define PI 3.141592653589793238462643383279502884197169399375105820974
#define ten5p1 100001
#define ten6p1 1000001
#define ten8p1 100000001
#define ten9p1 1000000001
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define rep(var, n) for (int var = 0; var < n; ++var)
#define repi(n) rep(i, n)
#define repj(n) rep(j, n)
#define repi1(n) for (int i = 1; i < n; ++i)
#define repj1(n) for (int j = 1; j < n; ++j)
int _min(int a, int b) { return a <= b ? a : b; }
int _min(ll a, ll b) { return a <= b ? a : b; }
int _max(int a, int b) { return a >= b ? a : b; }
int _max(ll a, ll b) { return a >= b ? a : b; }
void zero(int *data, int n) { memset(data, 0, sizeof(int) * n); }
void zero(ll *data, int n) { memset(data, 0, sizeof(ll) * n); }
void zero(char *data, int n) { memset(data, 0, sizeof(char) * n); }
char readc() {
char var;
fscanf(_fin, "%c", &var);
return var;
}
int readi() {
int var;
fscanf(_fin, "%d", &var);
return var;
}
ll readll() {
ll var;
fscanf(_fin, "%lld", &var);
return var;
}
void repread(int *data, int n) { repi(n) data[i] = readi(); }
void repread(ll *data, int n) { repi(n) data[i] = readll(); }
int reads(char *str, int maxsize) {
for (;;) {
if (fgets(str, maxsize, _fin) == NULL)
break;
if (str[0] != '\n' && str[0] != '\r')
break;
}
int slen = strlen(str);
if (slen == 0)
return 0;
if (str[slen - 1] == '\n' || str[slen - 1] == '\r')
str[--slen] = 0;
return slen;
}
#define writec(var) fprintf(_fout, "%c", var)
#define writecsp(var) fprintf(_fout, "%c ", var)
#define writecln(var) fprintf(_fout, "%c\n", var)
#define writei(var) fprintf(_fout, "%d", var)
#define writeisp(var) fprintf(_fout, "%d ", var)
#define writellsp(var) fprintf(_fout, "%lld ", var)
#define writeiln(var) fprintf(_fout, "%d\n", var)
#define writellln(var) fprintf(_fout, "%lld\n", var)
#define writeulln(var) fprintf(_fout, "%llu\n", var)
#define writefln(var) fprintf(_fout, "%f\n", var)
#define writes(str) fprintf(_fout, "%s", str)
#define writesp() fprintf(_fout, " ")
#define writeln() fprintf(_fout, "\n")
#define RUN_LOCAL(testfilename) \
{ \
_fin = fopen(testfilename, "r"); \
if (_fin == NULL) \
_fin = stdin; \
}
#define swap(type, a, b) \
{ \
type t = a; \
a = b; \
b = t; \
}
#define sort(data, n) std::sort(data, data + n)
//#define mod(a,b) b==0 ? 0 : a==0 ? 0 :(a>0 ? a%b : b + a % b) //what the hell
//is this...
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
void reverse(char *data, int n) {
int k = n >> 1;
repi(k) {
char tmp = data[i];
data[i] = data[n - i - 1];
data[n - i - 1] = tmp;
}
}
void reverse(int *data, int n) {
int k = n >> 1;
repi(k) {
int tmp = data[i];
data[i] = data[n - i - 1];
data[n - i - 1] = tmp;
}
}
#define _Vec(type, name) \
struct name { \
type *data; \
int size; \
int n; \
}; \
void init(name *t, int size) { \
t->data = (type *)malloc(sizeof(type) * size); \
t->size = size; \
t->n = 0; \
} \
void resize(name *t) { \
int ns = t->size * 1.2f; \
t->data = (type *)realloc(t->data, sizeof(type) * ns); \
t->size = ns; \
} \
void add(name *t, type val) { \
if (t->n >= t->size) \
resize(t); \
int k = t->n; \
t->data[k] = val; \
t->n = k + 1; \
} \
void free(name *t) { free(t->data); }
_Vec(int, Veci) _Vec(long long, Vecll) _Vec(char *, Vecs)
#define _ispal(type, name) \
int name(type *a, type *b, int n) { \
repi(n) { \
if (a[i] != b[n - i - 1]) { \
return 0; \
} \
} \
return 1; \
}
_ispal(int, ispali) _ispal(char, ispalc)
#define _Pair(type, name) \
struct name { \
type x, y; \
}; \
int cmp_##name(const void *_a, const void *_b) { \
name *a = (name *)_a; \
name *b = (name *)_b; \
if (a->x == b->x) { \
if (a->y < b->y) \
return -1; \
else \
return 1; \
} \
if (a->x < b->x) \
return -1; \
else \
return 1; \
} \
void sort_##name(name *d, int n) { qsort(d, n, sizeof(name), cmp_##name); }
_Pair(int, Pairi)
int cmp_Str(const void *_a, const void *_b) {
char *a = *((char **)_a);
char *b = *((char **)_b);
return strcmp(a, b);
}
void sort_Str(char **str, int n) { qsort(str, n, sizeof(char *), cmp_Str); }
ll expmod(ll x, ll n, ll m) {
ll ans = 1;
for (; n;) {
if (n & 1)
ans = (ans * x) % m;
x = (x * x) % m;
n >>= 1;
}
return ans;
}
ll combmod(ll n, ll k, ll m) {
ll ret = 1;
ll div = 1;
for (ll i = 0; i < k; ++i) {
ret = (ret * (n - i) % m) % m;
div = (div * (i + 1)) % m;
}
div = expmod(div, m - 2, m) % m;
return (ret * div) % m;
}
//------------------------------------------
//------------
int main() {
RUN_LOCAL("xxb05in.txt");
int n = readi();
static char *s[2 * ten5p1];
static char db[12 * 2 * ten5p1];
repi(n) {
s[i] = &db[i * 12];
reads(s[i], 11);
}
repi(n) sort(s[i], 10);
sort_Str(s, n);
char *tmp = s[0];
int count = 1;
ll sum = 0;
repi1(n) {
if (strcmp(s[i], tmp) == 0) {
count++;
} else {
sum += count * (count - 1) / 2;
count = 1;
tmp = s[i];
}
}
sum += count * (count - 1) / 2;
writellln(sum);
return 0;
}
|
/*
URL_HERE
*/
/*
*/
#ifdef _WIN32
#pragma warning(disable : 4996)
#endif
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
using namespace std;
FILE *_fin = stdin;
FILE *_fout = stdout;
#define PI 3.141592653589793238462643383279502884197169399375105820974
#define ten5p1 100001
#define ten6p1 1000001
#define ten8p1 100000001
#define ten9p1 1000000001
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define rep(var, n) for (int var = 0; var < n; ++var)
#define repi(n) rep(i, n)
#define repj(n) rep(j, n)
#define repi1(n) for (int i = 1; i < n; ++i)
#define repj1(n) for (int j = 1; j < n; ++j)
int _min(int a, int b) { return a <= b ? a : b; }
int _min(ll a, ll b) { return a <= b ? a : b; }
int _max(int a, int b) { return a >= b ? a : b; }
int _max(ll a, ll b) { return a >= b ? a : b; }
void zero(int *data, int n) { memset(data, 0, sizeof(int) * n); }
void zero(ll *data, int n) { memset(data, 0, sizeof(ll) * n); }
void zero(char *data, int n) { memset(data, 0, sizeof(char) * n); }
char readc() {
char var;
fscanf(_fin, "%c", &var);
return var;
}
int readi() {
int var;
fscanf(_fin, "%d", &var);
return var;
}
ll readll() {
ll var;
fscanf(_fin, "%lld", &var);
return var;
}
void repread(int *data, int n) { repi(n) data[i] = readi(); }
void repread(ll *data, int n) { repi(n) data[i] = readll(); }
int reads(char *str, int maxsize) {
for (;;) {
if (fgets(str, maxsize, _fin) == NULL)
break;
if (str[0] != '\n' && str[0] != '\r')
break;
}
int slen = strlen(str);
if (slen == 0)
return 0;
if (str[slen - 1] == '\n' || str[slen - 1] == '\r')
str[--slen] = 0;
return slen;
}
#define writec(var) fprintf(_fout, "%c", var)
#define writecsp(var) fprintf(_fout, "%c ", var)
#define writecln(var) fprintf(_fout, "%c\n", var)
#define writei(var) fprintf(_fout, "%d", var)
#define writeisp(var) fprintf(_fout, "%d ", var)
#define writellsp(var) fprintf(_fout, "%lld ", var)
#define writeiln(var) fprintf(_fout, "%d\n", var)
#define writellln(var) fprintf(_fout, "%lld\n", var)
#define writeulln(var) fprintf(_fout, "%llu\n", var)
#define writefln(var) fprintf(_fout, "%f\n", var)
#define writes(str) fprintf(_fout, "%s", str)
#define writesp() fprintf(_fout, " ")
#define writeln() fprintf(_fout, "\n")
#define RUN_LOCAL(testfilename) \
{ \
_fin = fopen(testfilename, "r"); \
if (_fin == NULL) \
_fin = stdin; \
}
#define swap(type, a, b) \
{ \
type t = a; \
a = b; \
b = t; \
}
#define sort(data, n) std::sort(data, data + n)
//#define mod(a,b) b==0 ? 0 : a==0 ? 0 :(a>0 ? a%b : b + a % b) //what the hell
//is this...
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
void reverse(char *data, int n) {
int k = n >> 1;
repi(k) {
char tmp = data[i];
data[i] = data[n - i - 1];
data[n - i - 1] = tmp;
}
}
void reverse(int *data, int n) {
int k = n >> 1;
repi(k) {
int tmp = data[i];
data[i] = data[n - i - 1];
data[n - i - 1] = tmp;
}
}
#define _Vec(type, name) \
struct name { \
type *data; \
int size; \
int n; \
}; \
void init(name *t, int size) { \
t->data = (type *)malloc(sizeof(type) * size); \
t->size = size; \
t->n = 0; \
} \
void resize(name *t) { \
int ns = t->size * 1.2f; \
t->data = (type *)realloc(t->data, sizeof(type) * ns); \
t->size = ns; \
} \
void add(name *t, type val) { \
if (t->n >= t->size) \
resize(t); \
int k = t->n; \
t->data[k] = val; \
t->n = k + 1; \
} \
void free(name *t) { free(t->data); }
_Vec(int, Veci) _Vec(long long, Vecll) _Vec(char *, Vecs)
#define _ispal(type, name) \
int name(type *a, type *b, int n) { \
repi(n) { \
if (a[i] != b[n - i - 1]) { \
return 0; \
} \
} \
return 1; \
}
_ispal(int, ispali) _ispal(char, ispalc)
#define _Pair(type, name) \
struct name { \
type x, y; \
}; \
int cmp_##name(const void *_a, const void *_b) { \
name *a = (name *)_a; \
name *b = (name *)_b; \
if (a->x == b->x) { \
if (a->y < b->y) \
return -1; \
else \
return 1; \
} \
if (a->x < b->x) \
return -1; \
else \
return 1; \
} \
void sort_##name(name *d, int n) { qsort(d, n, sizeof(name), cmp_##name); }
_Pair(int, Pairi)
int cmp_Str(const void *_a, const void *_b) {
char *a = *((char **)_a);
char *b = *((char **)_b);
return strcmp(a, b);
}
void sort_Str(char **str, int n) { qsort(str, n, sizeof(char *), cmp_Str); }
ll expmod(ll x, ll n, ll m) {
ll ans = 1;
for (; n;) {
if (n & 1)
ans = (ans * x) % m;
x = (x * x) % m;
n >>= 1;
}
return ans;
}
ll combmod(ll n, ll k, ll m) {
ll ret = 1;
ll div = 1;
for (ll i = 0; i < k; ++i) {
ret = (ret * (n - i) % m) % m;
div = (div * (i + 1)) % m;
}
div = expmod(div, m - 2, m) % m;
return (ret * div) % m;
}
//------------------------------------------
//------------
int main() {
RUN_LOCAL("b11in.txt");
int n = readi();
static char *s[2 * ten5p1];
static char db[12 * 2 * ten5p1];
repi(n) {
s[i] = &db[i * 12];
reads(s[i], 11);
}
repi(n) sort(s[i], 10);
sort_Str(s, n);
char *tmp = s[0];
ll count = 1;
ll sum = 0;
repi1(n) {
if (strcmp(s[i], tmp) == 0) {
count++;
} else {
sum += count * (count - 1) / 2;
count = 1;
tmp = s[i];
}
}
sum += count * (count - 1) / 2;
writellln(sum);
return 0;
}
|
[
"literal.string.change",
"call.arguments.change",
"variable_declaration.type.change"
] | 746,043
| 746,044
|
u950002813
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using P = pair<long long, long long>;
int main() {
long long N;
cin >> N;
map<string, long long> mp;
long long ans;
rep(i, N) {
string temp;
cin >> temp;
sort(temp.begin(), temp.end());
if (!mp[temp]) {
mp[temp] = 1;
} else {
ans += mp[temp];
mp[temp] = mp[temp] + 1;
}
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <stdio.h>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using P = pair<long long, long long>;
int main() {
long long N;
cin >> N;
map<string, long long> mp;
long long ans = 0;
rep(i, N) {
string temp;
cin >> temp;
sort(temp.begin(), temp.end());
if (!mp[temp]) {
mp[temp] = 1;
} else {
ans += mp[temp];
mp[temp] = mp[temp] + 1;
}
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.value.change"
] | 746,048
| 746,049
|
u605168157
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(), x.end()
#define rep(i, j, n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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;
}
// name[i][j]-> vvl name(i,vl(j))
// map<int,int>mp
//余りを切り上げる => (a + b - 1) / b
signed main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, 0, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto c : mp) {
ans += c.second * (c.second - 1) / 2;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(), x.end()
#define rep(i, j, n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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;
}
// name[i][j]-> vvl name(i,vl(j))
// map<int,int>mp
//余りを切り上げる => (a + b - 1) / b
signed main() {
ll n;
cin >> n;
map<string, ll> mp;
rep(i, 0, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto c : mp) {
ans += c.second * (c.second - 1) / 2;
}
cout << ans;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,050
| 746,051
|
u164181205
|
cpp
|
p02947
|
// 6/30 解き直し
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
map<string, int> mp;
rep(i, n) {
sort(s[i].begin(), s[i].end());
mp[s[i]]++;
}
ll res = 0;
for (auto p : mp) {
res += p.second * (p.second - 1) / 2;
}
cout << res << endl;
}
|
// 6/30 解き直し
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
map<string, ll> mp;
rep(i, n) {
sort(s[i].begin(), s[i].end());
mp[s[i]]++;
}
ll res = 0;
for (auto p : mp) {
res += (p.second * (p.second - 1) / 2);
}
cout << res << endl;
}
|
[] | 746,054
| 746,055
|
u581094488
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a) a.begin(), a.end()
//#define for(i, K, N) for(int i = K; i < N; i++)
#define ll long long int
using namespace std;
int main() {
ll N, Ans = 0;
cin >> N;
map<string, int> MAP;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(ALL(s));
MAP[s]++;
}
for (auto x : MAP) {
Ans += (x.second * (x.second - 1)) / 2;
}
cout << Ans;
}
|
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a) a.begin(), a.end()
//#define for(i, K, N) for(int i = K; i < N; i++)
#define ll long long int
using namespace std;
int main() {
ll N, Ans = 0;
cin >> N;
map<string, ll> MAP;
for (ll i = 0; i < N; i++) {
string s;
cin >> s;
sort(ALL(s));
MAP[s]++;
}
for (auto x : MAP) {
Ans += (x.second * (x.second - 1)) / 2;
}
cout << Ans;
}
|
[
"control_flow.loop.for.initializer.change",
"variable_declaration.type.change"
] | 746,056
| 746,057
|
u551500493
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) { //階乗
if (i == 0)
return 1;
return (factorial(i - 1)) * i;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string S;
cin >> S;
sort(S.begin(), S.end());
s[i] = S;
}
sort(s.begin(), s.end());
int count;
int j;
ll ans = 0;
rep(i, n) {
count = 1;
j = i + 1;
while (s[i] == s[j]) {
count++;
j++;
}
ans += count * (count - 1) / 2;
i = j - 1;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) { //階乗
if (i == 0)
return 1;
return (factorial(i - 1)) * i;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string S;
cin >> S;
sort(S.begin(), S.end());
s[i] = S;
}
sort(s.begin(), s.end());
ll count;
int j;
ll ans = 0;
rep(i, n) {
count = 1;
j = i + 1;
while (s[i] == s[j]) {
count++;
j++;
}
ans += count * (count - 1) / 2;
i = j - 1;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,058
| 746,059
|
u608773191
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) { //階乗
if (i == 0)
return 1;
return (factorial(i - 1)) * i;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string S;
cin >> S;
sort(S.begin(), S.end());
s[i] = S;
}
sort(s.begin(), s.end());
int count;
int j;
ll ans = 0;
rep(i, n) {
count = 0;
j = i;
while (s[i] == s[j]) {
count++;
j++;
}
ans += count * (count - 1) / 2;
i = j - 1;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) { //階乗
if (i == 0)
return 1;
return (factorial(i - 1)) * i;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string S;
cin >> S;
sort(S.begin(), S.end());
s[i] = S;
}
sort(s.begin(), s.end());
ll count;
int j;
ll ans = 0;
rep(i, n) {
count = 1;
j = i + 1;
while (s[i] == s[j]) {
count++;
j++;
}
ans += count * (count - 1) / 2;
i = j - 1;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change",
"literal.number.change",
"assignment.value.change",
"assignment.change"
] | 746,060
| 746,059
|
u608773191
|
cpp
|
p02947
|
#include "bits/stdc++.h"
using namespace std;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)
typedef long long ll;
int main() {
int N;
cin >> N;
vector<string> S(N);
Rep(i, N) {
string s;
cin >> s;
Sort(s);
S[i] = s;
}
Sort(S);
int cnt = 0, ans = 0;
string now = "";
Rep(i, N) {
if (now == "") {
now = S[i];
cnt++;
continue;
}
if (S[i] == now) {
cnt++;
} else {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
now = S[i];
}
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
return 0;
}
|
#include "bits/stdc++.h"
using namespace std;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)
typedef long long ll;
int main() {
int N;
cin >> N;
vector<string> S(N);
Rep(i, N) {
string s;
cin >> s;
Sort(s);
S[i] = s;
}
Sort(S);
ll cnt = 0, ans = 0;
string now = "";
Rep(i, N) {
if (now == "") {
now = S[i];
cnt++;
continue;
}
if (S[i] == now) {
cnt++;
} else {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
now = S[i];
}
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,063
| 746,064
|
u906839513
|
cpp
|
p02947
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; (i) < ((int)(n)); ++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define test(a) \
cout << "line:" << __LINE__ << "[" << (#a) << ": " << (a) << "]" << endl
const int INF = 1e9 + 7;
const ll INFL = 9 * 1e18;
// const int dx[4] = { 1, 0, -1, 0 };
// const int dy[4] = { 0, 1, 0, -1 };
const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
ll inline digit(ll num) {
int tmp = 0;
while (num) {
tmp++;
num /= 10;
}
return tmp;
} // 桁数
template <typename T> inline void print(T &&x) {
cout << x << endl;
} // 改行付き出力
template <typename T> inline T SUM(vector<T> vec) {
return accumulate(all(vec), (T)0);
} // vectorの中身を全部足す
template <typename T> inline T digitSum(T num) {
T sum = 0;
while (num) {
sum += num % 10;
num /= 10;
}
return sum;
} // 各桁の和
template <typename T> inline T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
} // 最大公約数
template <typename T> inline T lcm(T a, T b) {
T g = gcd(a, b);
return a / g * b;
} // 最小公倍数
template <typename T> inline T power(T a, T b) {
T tmp = 1;
rep(i, b) { tmp *= a; }
return tmp;
} // 累乗
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;
}
int ctoi(char c) { return c - '0'; }
// TODO: write
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
ll ans = 0;
for (auto &&one : m) {
int cnt = one.se;
ans += (cnt * (cnt - 1)) / 2;
}
print(ans);
return 0;
}
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; (i) < ((int)(n)); ++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define test(a) \
cout << "line:" << __LINE__ << "[" << (#a) << ": " << (a) << "]" << endl
const int INF = 1e9 + 7;
const ll INFL = 9 * 1e18;
// const int dx[4] = { 1, 0, -1, 0 };
// const int dy[4] = { 0, 1, 0, -1 };
const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
ll inline digit(ll num) {
int tmp = 0;
while (num) {
tmp++;
num /= 10;
}
return tmp;
} // 桁数
template <typename T> inline void print(T &&x) {
cout << x << endl;
} // 改行付き出力
template <typename T> inline T SUM(vector<T> vec) {
return accumulate(all(vec), (T)0);
} // vectorの中身を全部足す
template <typename T> inline T digitSum(T num) {
T sum = 0;
while (num) {
sum += num % 10;
num /= 10;
}
return sum;
} // 各桁の和
template <typename T> inline T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
} // 最大公約数
template <typename T> inline T lcm(T a, T b) {
T g = gcd(a, b);
return a / g * b;
} // 最小公倍数
template <typename T> inline T power(T a, T b) {
T tmp = 1;
rep(i, b) { tmp *= a; }
return tmp;
} // 累乗
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;
}
int ctoi(char c) { return c - '0'; }
// TODO: write
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
ll ans = 0;
for (auto &&one : m) {
ll cnt = one.se;
ans += (cnt * (cnt - 1)) / 2;
}
print(ans);
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,065
| 746,066
|
u184572586
|
cpp
|
p02947
|
#include <algorithm> // sort
#include <iostream>
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(), (x).end()
#define print(x) cout << x << endl
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec), 0)
const ll INF = 1e9 + 7;
// 各桁の和
template <typename T> T digit(T num) {
T sum = 0;
while (num) {
sum += num % 10;
num /= 10;
}
return sum;
}
template <typename T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) {
T g = gcd(a, b);
return a / g * b;
}
template <typename T> T power(T a, T b) {
T tmp = 1;
rep(i, b) { tmp *= a; }
return tmp;
}
ll bikkuri(ll n) {
if (n == 2)
return 1;
ll tmp = 3;
for (ll i = 4; i <= n; ++i) {
tmp *= i;
}
return tmp;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, ll> m;
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
}
sort(all(s));
for (auto S : s) {
m[S]++;
}
ll ans = 0;
for (auto x : m) {
ll tmp = x.se;
ans += bikkuri(tmp);
}
print(ans);
return 0;
}
|
#include <algorithm> // sort
#include <iostream>
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(), (x).end()
#define print(x) cout << x << endl
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec), 0)
const ll INF = 1e9 + 7;
// 各桁の和
template <typename T> T digit(T num) {
T sum = 0;
while (num) {
sum += num % 10;
num /= 10;
}
return sum;
}
template <typename T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) {
T g = gcd(a, b);
return a / g * b;
}
template <typename T> T power(T a, T b) {
T tmp = 1;
rep(i, b) { tmp *= a; }
return tmp;
}
ll bikkuri(ll n) {
if (n == 2)
return 1;
ll tmp = 3;
for (ll i = 4; i <= n; ++i) {
tmp *= i;
}
return tmp;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, ll> m;
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
}
sort(all(s));
for (auto S : s) {
m[S]++;
}
ll ans = 0;
for (auto x : m) {
ll tmp = x.se;
ans += tmp * (tmp - 1) / 2;
}
print(ans);
return 0;
}
|
[
"assignment.value.change",
"assignment.change"
] | 746,067
| 746,068
|
u184572586
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;
// container util
// -----------------------------------------------------------------------------
#define ALL(c) (c).begin(), (c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(), (c).end())
// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
// debug
// -----------------------------------------------------------------------------
#define DUMP(x) cerr << #x << " = " << (x) << endl
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
ll N;
cin >> N;
map<string, ll> m;
int ans = 0;
REP(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += m[s];
m[s]++;
}
cout << ans << "\n";
}
|
#include <bits/stdc++.h>
using namespace std;
// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;
// container util
// -----------------------------------------------------------------------------
#define ALL(c) (c).begin(), (c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(), (c).end())
// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
// debug
// -----------------------------------------------------------------------------
#define DUMP(x) cerr << #x << " = " << (x) << endl
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
ll N;
cin >> N;
map<string, ll> m;
ll ans = 0;
REP(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += m[s];
m[s]++;
}
cout << ans << "\n";
}
|
[
"variable_declaration.type.change"
] | 746,071
| 746,072
|
u811321379
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;
// container util
// -----------------------------------------------------------------------------
#define ALL(c) (c).begin(), (c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(), (c).end())
// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
// debug
// -----------------------------------------------------------------------------
#define DUMP(x) cerr << #x << " = " << (x) << endl
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
int N;
cin >> N;
map<string, int> m;
int ans = 0;
REP(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += m[s];
m[s]++;
}
cout << ans << "\n";
}
|
#include <bits/stdc++.h>
using namespace std;
// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;
// container util
// -----------------------------------------------------------------------------
#define ALL(c) (c).begin(), (c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(), (c).end())
// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
// debug
// -----------------------------------------------------------------------------
#define DUMP(x) cerr << #x << " = " << (x) << endl
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
ll N;
cin >> N;
map<string, ll> m;
ll ans = 0;
REP(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += m[s];
m[s]++;
}
cout << ans << "\n";
}
|
[
"variable_declaration.type.change"
] | 746,073
| 746,072
|
u811321379
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;
// container util
// -----------------------------------------------------------------------------
#define ALL(c) (c).begin(), (c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(), (c).end())
// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
// debug
// -----------------------------------------------------------------------------
#define DUMP(x) cerr << #x << " = " << (x) << endl
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
int N;
cin >> N;
map<string, int> m;
int ans = 0;
REP(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (auto x : m) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << "\n";
}
|
#include <bits/stdc++.h>
using namespace std;
// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;
// container util
// -----------------------------------------------------------------------------
#define ALL(c) (c).begin(), (c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(), (c).end())
// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
// debug
// -----------------------------------------------------------------------------
#define DUMP(x) cerr << #x << " = " << (x) << endl
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
ll N;
cin >> N;
map<string, ll> m;
ll ans = 0;
REP(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (auto x : m) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << "\n";
}
|
[
"variable_declaration.type.change"
] | 746,074
| 746,075
|
u811321379
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 2e9;
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll ans = 0;
int cnt = 1;
rep(i, n - 1) {
if (s[i] == s[i + 1])
cnt++;
else {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
}
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 2e9;
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll ans = 0;
ll cnt = 1;
rep(i, n - 1) {
if (s[i] == s[i + 1])
cnt++;
else {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
}
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,076
| 746,077
|
u816145694
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 2e9;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> x;
int ans = 0;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
x[s[i]]++;
ans += (x[s[i]] - 1);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 2e9;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, ll> x;
ll ans = 0;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
x[s[i]]++;
ans += (x[s[i]] - 1);
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,078
| 746,079
|
u816145694
|
cpp
|
p02947
|
#include <bits/stdc++.h>
//#define <- プログラムの文字列を置換する
// typedef <- 新しい型に名前を付けるためのキーワード
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;
template <class TYPE> struct edge {
TYPE to, cost;
edge(TYPE t, TYPE c) {
to = t;
cost = c;
}
};
int main() {
int N;
cin >> N;
map<string, int> m;
for (int i = 0; i < N; i++) {
string a;
cin >> a;
sort(a.begin(), a.end());
m[a]++;
}
ll ans = 0;
auto ite = m.begin();
for (; ite != m.end(); ite++) {
ans += ite->second * (ite->second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
//#define <- プログラムの文字列を置換する
// typedef <- 新しい型に名前を付けるためのキーワード
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;
template <class TYPE> struct edge {
TYPE to, cost;
edge(TYPE t, TYPE c) {
to = t;
cost = c;
}
};
int main() {
int N;
cin >> N;
map<string, ll> m;
for (int i = 0; i < N; i++) {
string a;
cin >> a;
sort(a.begin(), a.end());
m[a]++;
}
ll ans = 0;
auto ite = m.begin();
for (; ite != m.end(); ite++) {
ans += ite->second * (ite->second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,080
| 746,081
|
u705561278
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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++)
using namespace std;
int main() {
int N;
cin >> N;
string S[N];
rep(i, N) { cin >> S[i]; }
rep(i, N) { sort(S[i].begin(), S[i].end()); }
long long ans = 0;
unordered_map<string, long long> X(N);
rep(i, N) { X[S[i]]++; }
for (auto x : X) {
int n = x.second;
ans += (n * (n - 1) / 2);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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++)
using namespace std;
int main() {
int N;
cin >> N;
string S[N];
rep(i, N) { cin >> S[i]; }
rep(i, N) { sort(S[i].begin(), S[i].end()); }
long long ans = 0;
unordered_map<string, long long> X;
rep(i, N) { X[S[i]]++; }
for (auto x : X) {
long long n = x.second;
ans += (n * (n - 1) / 2);
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,082
| 746,083
|
u805392425
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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++)
using namespace std;
int main() {
int N;
cin >> N;
string S[N];
rep(i, N) { cin >> S[i]; }
rep(i, N) { sort(S[i].begin(), S[i].end()); }
long long ans = 0;
unordered_map<string, long long> X(N);
rep(i, N) { X[S[i]]++; }
for (auto x : X) {
int n = x.second;
ans += (n * (n - 1) / 2);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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++)
using namespace std;
int main() {
int N;
cin >> N;
string S[N];
rep(i, N) { cin >> S[i]; }
rep(i, N) { sort(S[i].begin(), S[i].end()); }
long long ans = 0;
unordered_map<string, long long> X(N);
rep(i, N) { X[S[i]]++; }
for (auto x : X) {
long long n = x.second;
ans += (n * (n - 1) / 2);
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,082
| 746,084
|
u805392425
|
cpp
|
p02947
|
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int nCr(int n, int r) {
int num = 1;
for (int i = 1; i <= r; i++) {
num = num * (n - i + 1) / i;
}
return num;
}
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++)
cin >> S[i];
for (string &s : S)
sort(all(s));
map<string, int> M;
for (string s : S)
M[s]++;
ll sum = 0;
for (auto p : M) {
if (p.se == 1)
continue;
sum += nCr(p.se, 2);
}
cout << sum << endl;
}
|
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll nCr(int n, int r) {
ll num = 1;
for (int i = 1; i <= r; i++) {
num = num * (n - i + 1) / i;
}
return num;
}
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++)
cin >> S[i];
for (string &s : S)
sort(all(s));
map<string, int> M;
for (string s : S)
M[s]++;
ll sum = 0;
for (auto p : M) {
if (p.se == 1)
continue;
sum += nCr(p.se, 2);
}
cout << sum << endl;
}
|
[
"variable_declaration.type.change"
] | 746,085
| 746,086
|
u229582356
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
long long ans = 0;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto &it : mp) {
ans += (long long)(it.second * (it.second - 1) / 2);
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
long long ans = 0;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto &it : mp) {
ans += (long long)it.second * (it.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,089
| 746,090
|
u058720266
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
long long ans = 0;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto &it : mp) {
ans += it.second * (it.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
long long ans = 0;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto &it : mp) {
ans += (long long)it.second * (it.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 746,091
| 746,090
|
u058720266
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ll combi(int x) {
if (x < 2)
return 0;
else {
return x * (x - 1) / 2;
}
}
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string y;
cin >> y;
sort(y.begin(), y.end());
mp[y]++;
}
ll sum = 0;
for (auto it = mp.begin(); it != mp.end(); ++it) {
sum += combi(it->second);
}
cout << sum << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ll combi(int x) {
if (x < 2)
return 0;
else {
return (ll)x * (x - 1) / 2;
}
}
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string y;
cin >> y;
sort(y.begin(), y.end());
mp[y]++;
}
ll sum = 0;
for (auto it = mp.begin(); it != mp.end(); ++it) {
sum += combi(it->second);
}
cout << sum << endl;
return 0;
}
|
[
"type_conversion.add"
] | 746,092
| 746,093
|
u058720266
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007; // 998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
map<map<char, int>, int> m;
while (n--) {
string s;
cin >> s;
map<char, int> mp;
for (auto &&j : s) {
mp[j]++;
}
m[mp]++;
}
int ans = 0;
for (auto &&i : m) {
ans += (i.second * (i.second - 1)) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007; // 998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
map<map<char, ll>, ll> m;
while (n--) {
string s;
cin >> s;
map<char, ll> mp;
for (auto &&j : s) {
mp[j]++;
}
m[mp]++;
}
ll ans = 0;
for (auto &&i : m) {
ans += (i.second * (i.second - 1)) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,094
| 746,095
|
u528388170
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
long long nCr(const long long n, long long r) {
if (n == 0) {
return 0;
}
if (r == 0) {
return 1;
}
if (r == 1) {
return n;
}
if (n == r) {
return 1;
}
if (r > n / 2) {
r = n / 2;
}
long long result = 1;
for (long long i = 1; i <= r; i++) {
result *= (n - i + 1) / i;
}
return (result);
}
int main() {
//
long long num;
string str;
long long kekka = 0;
map<string, long long> m;
cin >> num;
for (long long i = 0; i < num; i++) {
cin >> str;
sort(str.begin(), str.end());
m[str]++;
}
for (auto itr : m) {
if (itr.second < 2)
continue;
long long tmp = itr.second;
kekka += tmp * (tmp + 1) / 2;
}
cout << kekka;
}
|
#include <bits/stdc++.h>
using namespace std;
long long nCr(const long long n, long long r) {
if (n == 0) {
return 0;
}
if (r == 0) {
return 1;
}
if (r == 1) {
return n;
}
if (n == r) {
return 1;
}
if (r > n / 2) {
r = n / 2;
}
long long result = 1;
for (long long i = 1; i <= r; i++) {
result *= (n - i + 1) / i;
}
return (result);
}
int main() {
//
long long num;
string str;
long long kekka = 0;
map<string, long long> m;
cin >> num;
for (long long i = 0; i < num; i++) {
cin >> str;
sort(str.begin(), str.end());
m[str]++;
}
for (auto itr : m) {
if (itr.second < 2)
continue;
long long tmp = itr.second - 1;
kekka += tmp * (tmp + 1) / 2;
}
cout << kekka;
}
|
[
"assignment.change"
] | 746,096
| 746,097
|
u367131219
|
cpp
|
p02947
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip> // fixed, setprecision
#include <iostream> // cout, endl, cin
#include <map> // map
#include <math.h> // double sqrt
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
string zisho(string a) {
sort(a.begin(), a.end());
return a;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) s[i] = zisho(s[i]);
map<string, int> xx;
int count = 0;
rep(i, n) {
if (xx.count(s[i])) {
xx.at(s[i])++;
count += xx.at(s[i]) - 1;
} else
xx[s[i]] = 1;
}
cout << count;
return 0;
}
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip> // fixed, setprecision
#include <iostream> // cout, endl, cin
#include <map> // map
#include <math.h> // double sqrt
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
string zisho(string a) {
sort(a.begin(), a.end());
return a;
}
int main() {
long long n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) s[i] = zisho(s[i]);
map<string, int> xx;
long long count = 0;
rep(i, n) {
if (xx.count(s[i])) {
xx.at(s[i])++;
count += xx.at(s[i]) - 1;
} else
xx[s[i]] = 1;
}
cout << count;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,098
| 746,099
|
u100459591
|
cpp
|
p02947
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip> // fixed, setprecision
#include <iostream> // cout, endl, cin
#include <map> // map
#include <math.h> // double sqrt
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
string zisho(string a) {
sort(a.begin(), a.end());
return a;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) s[i] = zisho(s[i]);
map<string, int> xx;
int count = 0;
rep(i, n) {
if (xx.count(s[i])) {
xx.at(s[i])++;
count += xx.at(s[i]) - 1;
continue;
} else
xx[s[i]] = 1;
}
cout << count;
return 0;
}
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip> // fixed, setprecision
#include <iostream> // cout, endl, cin
#include <map> // map
#include <math.h> // double sqrt
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
string zisho(string a) {
sort(a.begin(), a.end());
return a;
}
int main() {
long long n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) s[i] = zisho(s[i]);
map<string, int> xx;
long long count = 0;
rep(i, n) {
if (xx.count(s[i])) {
xx.at(s[i])++;
count += xx.at(s[i]) - 1;
} else
xx[s[i]] = 1;
}
cout << count;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,100
| 746,099
|
u100459591
|
cpp
|
p02947
|
#include "bits/stdc++.h"
using namespace std;
// 47
typedef long long ll;
int main() {
int n;
cin >> n;
// vector<string> v(n);
map<string, int> m;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
// sort(v.begin(),v.end());
// int ans = 0;
// map<string,int> m;
// for (int i = 0; i < n; ++i) {
// m[v[i]]++;
//}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); ++it) {
if (it->second > 1) {
ans += 1LL * ((it->second * (it->second - 1)) / 2);
}
}
cout << ans;
}
|
#include "bits/stdc++.h"
using namespace std;
// 47
typedef long long ll;
int main() {
int n;
cin >> n;
// vector<string> v(n);
map<string, int> m;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
// sort(v.begin(),v.end());
// int ans = 0;
// map<string,int> m;
// for (int i = 0; i < n; ++i) {
// m[v[i]]++;
//}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); ++it) {
if (it->second > 1) {
ans += 1LL * ((it->second * 1LL * (it->second - 1)) / 2);
}
}
cout << ans;
}
|
[
"assignment.change"
] | 746,104
| 746,105
|
u403668916
|
cpp
|
p02947
|
#include "bits/stdc++.h"
using namespace std;
// 47
typedef long long ll;
int main() {
int n;
cin >> n;
// vector<string> v(n);
map<string, int> m;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
// sort(v.begin(),v.end());
// int ans = 0;
// map<string,int> m;
// for (int i = 0; i < n; ++i) {
// m[v[i]]++;
//}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); ++it) {
if (it->second > 1) {
ans += 1LL * (it->second * (it->second - 1)) / 2;
}
}
cout << ans;
}
|
#include "bits/stdc++.h"
using namespace std;
// 47
typedef long long ll;
int main() {
int n;
cin >> n;
// vector<string> v(n);
map<string, int> m;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
// sort(v.begin(),v.end());
// int ans = 0;
// map<string,int> m;
// for (int i = 0; i < n; ++i) {
// m[v[i]]++;
//}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); ++it) {
if (it->second > 1) {
ans += 1LL * ((it->second * 1LL * (it->second - 1)) / 2);
}
}
cout << ans;
}
|
[
"assignment.change"
] | 746,106
| 746,105
|
u403668916
|
cpp
|
p02947
|
#include "bits/stdc++.h"
using namespace std;
// 47
typedef long long ll;
int main() {
int n;
cin >> n;
// vector<string> v(n);
map<string, int> m;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
// sort(v.begin(),v.end());
// int ans = 0;
// map<string,int> m;
// for (int i = 0; i < n; ++i) {
// m[v[i]]++;
//}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); ++it) {
if (it->second > 1) {
ans += 1LL * (it->second * (it->second - 1)) / 2;
}
}
cout << ans;
}
|
#include "bits/stdc++.h"
using namespace std;
// 47
typedef long long ll;
int main() {
int n;
cin >> n;
// vector<string> v(n);
map<string, ll> m;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
// sort(v.begin(),v.end());
// int ans = 0;
// map<string,int> m;
// for (int i = 0; i < n; ++i) {
// m[v[i]]++;
//}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); ++it) {
if (it->second > 1) {
ans += 1LL * ((it->second * (it->second - 1)) / 2);
}
}
cout << ans;
}
|
[] | 746,106
| 746,107
|
u403668916
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int n;
long long ans;
char s2[10];
string s[123456], h;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < 10; j++)
cin >> s2[j];
sort(s2, s2 + 10);
s[i] = {s2[0], s2[1], s2[2], s2[3], s2[4],
s2[5], s2[6], s2[7], s2[8], s2[9]};
}
sort(s, s + n);
h = s[0];
int count = 1;
for (int i = 1; i < n; i++) {
if (h == s[i])
count++;
else {
ans += (count * (count - 1)) / 2;
h = s[i];
count = 1;
}
}
ans += (count * (count - 1)) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n;
long long ans;
char s2[10];
string s[123456], h;
signed main() {
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < 10; j++)
cin >> s2[j];
sort(s2, s2 + 10);
s[i] = {s2[0], s2[1], s2[2], s2[3], s2[4],
s2[5], s2[6], s2[7], s2[8], s2[9]};
}
sort(s, s + n);
h = s[0];
int count = 1;
for (int i = 1; i < n; i++) {
if (h == s[i])
count++;
else {
ans += (count * (count - 1)) / 2;
h = s[i];
count = 1;
}
}
ans += (count * (count - 1)) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,108
| 746,109
|
u943070796
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int inf = 100100;
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]++;
}
ll cnt = 0;
for (auto x : m) {
auto value = x.second;
if (value != 0) {
cnt += value * (value - 1) / 2;
}
}
cout << cnt << endl;
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int inf = 100100;
int main() {
ll n;
cin >> n;
map<string, ll> m;
for (ll i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll cnt = 0;
for (auto x : m) {
auto value = x.second;
if (value != 0) {
cnt += value * (value - 1) / 2;
}
}
cout << cnt << endl;
return (0);
}
|
[
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 746,110
| 746,111
|
u282807996
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#include <iomanip>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> pppp(int64_t x) {
vector<pair<int64_t, int64_t>> p;
for (int64_t i = 2; i * i <= x; i++) {
int cnt = 0;
if (x % i == 0) {
while (x % i == 0) {
cnt++;
x /= i;
}
p.push_back(make_pair(i, cnt));
}
}
if (x != 1) {
p.push_back(make_pair(x, 1));
}
return p;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, int> k;
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
k[s[i]]++;
}
int64_t sum = 0;
for (auto a : k) {
int c = a.second;
sum += (c * (c - 1) / 2);
}
cout << sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#include <iomanip>
#include <math.h>
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = 1001001001;
vector<pair<int64_t, int64_t>> pppp(int64_t x) {
vector<pair<int64_t, int64_t>> p;
for (int64_t i = 2; i * i <= x; i++) {
int cnt = 0;
if (x % i == 0) {
while (x % i == 0) {
cnt++;
x /= i;
}
p.push_back(make_pair(i, cnt));
}
}
if (x != 1) {
p.push_back(make_pair(x, 1));
}
return p;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, int> k;
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
k[s[i]]++;
}
int64_t sum = 0;
for (auto a : k) {
int64_t c = a.second;
sum += (c * (c - 1) / 2);
}
cout << sum << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,112
| 746,113
|
u209457657
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
long long nc2(long long a) { return a * (a - 1) / 2; }
int main() {
long long n;
cin >> n;
vector<string> arr(n);
map<string, long long> mp;
for (long long i = 0; i < n; i++) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
mp[arr[i]]++;
}
int ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
ans = ans + nc2(it->second);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
long long nc2(long long a) { return a * (a - 1) / 2; }
int main() {
long long n;
cin >> n;
vector<string> arr(n);
map<string, long long> mp;
for (long long i = 0; i < n; i++) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
mp[arr[i]]++;
}
long long ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
ans = ans + nc2(it->second);
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,121
| 746,122
|
u814501862
|
cpp
|
p02947
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath> //sqrt pow
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // dequef
#include <iostream> // cout, endl, cin
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> cnt;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
ll ans = 0;
for (auto a : cnt) {
ans += a.second * (a.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath> //sqrt pow
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // dequef
#include <iostream> // cout, endl, cin
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
#define rep(i, n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
map<string, ll> cnt;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
ll ans = 0;
for (auto a : cnt) {
ans += a.second * (a.second - 1) / 2;
}
cout << ans << endl;
}
|
[] | 746,123
| 746,124
|
u396266329
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int, int> P;
const int INF = 1001001001;
int main() {
int n;
cin >> n;
map<string, int> mp;
int ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto p : mp) {
ans += (ll)p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int, int> P;
const int INF = 1001001001;
int main() {
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 p : mp) {
ans += (ll)p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,125
| 746,126
|
u186506670
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#include <cctype>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int, int>
int main() {
int N;
cin >> N;
string s;
map<string, int> cnt;
rep(i, N) {
cin >> s;
sort(all(s));
cnt[s]++;
}
ll retval = 0;
for (auto p : cnt) {
retval += p.second * (p.second - 1) / 2;
}
cout << retval << endl;
// cout << fixed << setprecision(10);
return 0;
}
|
#include <bits/stdc++.h>
#include <cctype>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int, int>
int main() {
int N;
cin >> N;
string s;
map<string, ll> cnt;
rep(i, N) {
cin >> s;
sort(all(s));
cnt[s]++;
}
ll retval = 0;
for (auto p : cnt) {
retval += p.second * (p.second - 1) / 2;
}
cout << retval << endl;
// cout << fixed << setprecision(10);
return 0;
}
|
[] | 746,127
| 746,128
|
u474180590
|
cpp
|
p02947
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> mp;
int count = 0;
rep(i, n) {
if (mp[s[i]] > 0) {
count += mp[s[i]];
}
mp[s[i]]++;
}
cout << count << endl;
}
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, ll> mp;
ll count = 0;
rep(i, n) {
if (mp[s[i]] > 0) {
count += mp[s[i]];
}
mp[s[i]]++;
}
cout << count << endl;
}
|
[
"variable_declaration.type.change"
] | 746,129
| 746,130
|
u789673498
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
ll res = 0;
map<string, int> table;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
auto it = table.find(s);
if (it != table.end()) {
it->second++;
} else {
table[s] = 1;
}
}
for (auto it = table.begin(); it != table.end(); it++) {
res += it->second * (it->second - 1) / 2;
}
cout << res << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
ll res = 0;
map<string, ll> table;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
auto it = table.find(s);
if (it != table.end()) {
it->second++;
} else {
table[s] = 1;
}
}
for (auto it = table.begin(); it != table.end(); it++) {
res += it->second * (it->second - 1) / 2;
}
cout << res << endl;
return 0;
}
|
[] | 746,131
| 746,132
|
u423665486
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
/*
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
//************** StrAnge.R *********************
#define ll long long int
#define ull unsigned long long
#define ld long double
#define lll __int128
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define pii pair<int, int>
#define piii pair<int, pair<int, int>>
#define pll pair<ll, ll>
#define vii vector<pii>
#define sz(v) ((int)(v).size())
#define all(s) s.begin(), s.end()
#define allr(s) s.rbegin(), s.rend()
#define unq(c) (sort(all(c)), c.resize(distance(c.begin(), unique(all(c)))))
#define get_pos(c, x) (lower_bound(all(c), x) - c.begin())
#define MS0(v) memset((v), 0, sizeof((v)))
#define MS1(v) memset((v), -1, sizeof((v)))
#define LEN(v) strlen(v)
#define MP make_pair
#define pb push_back
#define pob pop_back
#define ff first
#define ss second
#define sc scanf
#define pf printf
#define endl "\n"
#define TEST_CASE \
int ___T; \
cin >> ___T; \
for (int cs = 1; cs <= ___T; cs++)
#define PRINT_CASE printf("Case %d: ", cs)
#define vpf(v) \
for (int i = 0; i < v.size(); i++) { \
cout << v[i]; \
if (i != v.size() - 1) \
cout << " "; \
else \
cout << "\n"; \
}
#define vsc(v) \
for (int i = 0; i < v.size(); i++) \
cin >> v[i];
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORS(i, s) for (int i = 0; s[i]; i++)
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define fileio \
freopen("in.txt", "r", stdin); \
freopen("out.txt", "w", stdout)
#define intlim 2147483648
#define infinity (1LL << 50)
#define intmx INT_MAX
#define PI 3.14159265358979323846264338327950L // acos(-1.0)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * ((b) / gcd(a, b)))
int on_bit(int N, int pos) { return N = N | (1 << pos); }
int off_bit(int N, int pos) { return N = N & ~(1 << pos); }
bool check_bit(ll N, int pos) { return (bool)(N & (1 << pos)); }
#define start_clock clock_t tStart = clock()
#define end_clock \
printf("\n>>Runtime: %.10fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC)
template <class T> inline bool read(T &x) {
int c = getchar();
int sgn = 1;
while (~c && c < '0' || c > '9') {
if (c == '-')
sgn = -1;
c = getchar();
}
for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar())
x = x * 10 + c - '0';
x *= sgn;
return ~c;
}
//******************* my code starts here **********************************
int main() {
int n;
cin >> n;
map<string, int> mp;
int cnt = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
cnt += mp[s];
mp[s]++;
}
cout << cnt << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
/*
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
//************** StrAnge.R *********************
#define ll long long int
#define ull unsigned long long
#define ld long double
#define lll __int128
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define pii pair<int, int>
#define piii pair<int, pair<int, int>>
#define pll pair<ll, ll>
#define vii vector<pii>
#define sz(v) ((int)(v).size())
#define all(s) s.begin(), s.end()
#define allr(s) s.rbegin(), s.rend()
#define unq(c) (sort(all(c)), c.resize(distance(c.begin(), unique(all(c)))))
#define get_pos(c, x) (lower_bound(all(c), x) - c.begin())
#define MS0(v) memset((v), 0, sizeof((v)))
#define MS1(v) memset((v), -1, sizeof((v)))
#define LEN(v) strlen(v)
#define MP make_pair
#define pb push_back
#define pob pop_back
#define ff first
#define ss second
#define sc scanf
#define pf printf
#define endl "\n"
#define TEST_CASE \
int ___T; \
cin >> ___T; \
for (int cs = 1; cs <= ___T; cs++)
#define PRINT_CASE printf("Case %d: ", cs)
#define vpf(v) \
for (int i = 0; i < v.size(); i++) { \
cout << v[i]; \
if (i != v.size() - 1) \
cout << " "; \
else \
cout << "\n"; \
}
#define vsc(v) \
for (int i = 0; i < v.size(); i++) \
cin >> v[i];
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORS(i, s) for (int i = 0; s[i]; i++)
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define fileio \
freopen("in.txt", "r", stdin); \
freopen("out.txt", "w", stdout)
#define intlim 2147483648
#define infinity (1LL << 50)
#define intmx INT_MAX
#define PI 3.14159265358979323846264338327950L // acos(-1.0)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * ((b) / gcd(a, b)))
int on_bit(int N, int pos) { return N = N | (1 << pos); }
int off_bit(int N, int pos) { return N = N & ~(1 << pos); }
bool check_bit(ll N, int pos) { return (bool)(N & (1 << pos)); }
#define start_clock clock_t tStart = clock()
#define end_clock \
printf("\n>>Runtime: %.10fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC)
template <class T> inline bool read(T &x) {
int c = getchar();
int sgn = 1;
while (~c && c < '0' || c > '9') {
if (c == '-')
sgn = -1;
c = getchar();
}
for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar())
x = x * 10 + c - '0';
x *= sgn;
return ~c;
}
//******************* my code starts here **********************************
int main() {
int n;
cin >> n;
map<string, int> mp;
ll cnt = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
cnt += mp[s];
mp[s]++;
}
cout << cnt << "\n";
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,133
| 746,134
|
u655790107
|
cpp
|
p02947
|
#include <algorithm>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
unordered_map<string, long long int> Map(N);
vector<string> S(N, "");
for (int i = 0; i < N; ++i)
cin >> S[i];
int cnt = 0;
for (int i = 0; i < N; ++i) {
sort(S[i].begin(), S[i].end());
Map[S[i]]++;
cnt += Map[S[i]] - 1;
}
cout << cnt << endl;
}
|
#include <algorithm>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
unordered_map<string, long long int> Map(N);
vector<string> S(N, "");
for (int i = 0; i < N; ++i)
cin >> S[i];
long long int cnt = 0;
for (int i = 0; i < N; ++i) {
sort(S[i].begin(), S[i].end());
Map[S[i]]++;
cnt += Map[S[i]] - 1;
}
cout << cnt << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 746,139
| 746,140
|
u358765098
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pint = pair<int, int>;
using vec = vector<int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pint = pair<int, int>;
using vec = vector<int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 746,141
| 746,142
|
u825601908
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
map<string, int> m{};
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m.count(s) == 0) {
m.insert(make_pair(s, 1));
} else {
m[s] = m[s] + 1;
}
}
long long res = 0;
for (auto i = m.begin(); i != m.end(); ++i) {
if (i->second > 1) {
// cout << i->second << " "<<i->second<< endl;
res += (i->second) * (i->second - 1) / 2;
}
}
cout << res;
}
|
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
map<string, long long> m{};
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m.count(s) == 0) {
m.insert(make_pair(s, 1));
} else {
m[s] = m[s] + 1;
}
}
long long res = 0;
for (auto i = m.begin(); i != m.end(); ++i) {
if (i->second > 1) {
// cout << i->second << " "<<i->second<< endl;
res += (i->second) * (i->second - 1) / 2;
}
}
cout << res;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,143
| 746,144
|
u891945807
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
map<string, int> m{};
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m.count(s) == 0) {
m.insert(make_pair(s, 1));
} else {
m[s] = m[s] + 1;
}
}
int res = 0;
for (auto i = m.begin(); i != m.end(); ++i) {
if (i->second > 1) {
// cout << i->second << " "<<i->second<< endl;
res += (i->second) * (i->second - 1) / 2;
}
}
cout << res;
}
|
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
map<string, long long> m{};
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m.count(s) == 0) {
m.insert(make_pair(s, 1));
} else {
m[s] = m[s] + 1;
}
}
long long res = 0;
for (auto i = m.begin(); i != m.end(); ++i) {
if (i->second > 1) {
// cout << i->second << " "<<i->second<< endl;
res += (i->second) * (i->second - 1) / 2;
}
}
cout << res;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,145
| 746,144
|
u891945807
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
void fnInput(vector<string> &rvsStr) {
int nStrSiz;
cin >> nStrSiz;
rvsStr.resize(nStrSiz);
for (string &rsStr : rvsStr)
cin >> rsStr;
}
int64_t fnAnagramCnt(const vector<string> &cnrvsStr) {
vector<string> vsSortStr(cnrvsStr);
for (int i = 0; i < vsSortStr.size(); i++)
sort(begin(vsSortStr[i]), end(vsSortStr[i]));
int nAnagramCnt = 0;
map<string, int> mpSortStr;
for (int i = 0; i < vsSortStr.size(); i++)
if (mpSortStr[vsSortStr[i]] == 0)
mpSortStr[vsSortStr[i]]++;
else {
nAnagramCnt += mpSortStr[vsSortStr[i]];
mpSortStr[vsSortStr[i]]++;
}
return nAnagramCnt;
}
int main() {
vector<string> vsStr;
fnInput(vsStr);
cout << fnAnagramCnt(vsStr) << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void fnInput(vector<string> &rvsStr) {
int nStrSiz;
cin >> nStrSiz;
rvsStr.resize(nStrSiz);
for (string &rsStr : rvsStr)
cin >> rsStr;
}
int64_t fnAnagramCnt(const vector<string> &cnrvsStr) {
vector<string> vsSortStr(cnrvsStr);
for (int i = 0; i < vsSortStr.size(); i++)
sort(begin(vsSortStr[i]), end(vsSortStr[i]));
int64_t nAnagramCnt = 0;
map<string, int> mpSortStr;
for (int i = 0; i < vsSortStr.size(); i++)
if (mpSortStr[vsSortStr[i]] == 0)
mpSortStr[vsSortStr[i]]++;
else {
nAnagramCnt += mpSortStr[vsSortStr[i]];
mpSortStr[vsSortStr[i]]++;
}
return nAnagramCnt;
}
int main() {
vector<string> vsStr;
fnInput(vsStr);
cout << fnAnagramCnt(vsStr) << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,146
| 746,147
|
u439912527
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
int main(int argc, char *argv[]) {
int n;
std::cin >> n;
std::map<std::string, int> m;
for (int i = 0; i < n; ++i) {
std::string t;
std::cin >> t;
std::sort(t.begin(), t.end());
++m[t];
}
long sum = 0;
for (auto i : m) {
int c = i.second;
sum += c * (c - 1) / 2;
}
std::cout << sum << std::endl;
}
|
#include <algorithm>
#include <iostream>
#include <map>
int main(int argc, char *argv[]) {
int n;
std::cin >> n;
std::map<std::string, int> m;
for (int i = 0; i < n; ++i) {
std::string t;
std::cin >> t;
std::sort(t.begin(), t.end());
++m[t];
}
long sum = 0;
for (auto i : m) {
long c = i.second;
sum += c * (c - 1) / 2;
}
std::cout << sum << std::endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,148
| 746,149
|
u089888152
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
int main(int argc, char *argv[]) {
int n;
std::cin >> n;
std::map<std::string, int> m;
for (int i = 0; i < n; ++i) {
std::string t;
std::cin >> t;
std::sort(t.begin(), t.end());
++m[t];
}
int sum = 0;
for (auto i : m) {
int c = i.second;
sum += c * (c - 1) / 2;
}
std::cout << sum << std::endl;
}
|
#include <algorithm>
#include <iostream>
#include <map>
int main(int argc, char *argv[]) {
int n;
std::cin >> n;
std::map<std::string, int> m;
for (int i = 0; i < n; ++i) {
std::string t;
std::cin >> t;
std::sort(t.begin(), t.end());
++m[t];
}
long sum = 0;
for (auto i : m) {
long c = i.second;
sum += c * (c - 1) / 2;
}
std::cout << sum << std::endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,150
| 746,149
|
u089888152
|
cpp
|
p02947
|
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend() // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define all(x) (x).begin(), (x).end()
//略記
#define pb emplace_back // vectorヘの挿入
#define mp make_pair // pairのコンストラクタ
#define F first // pairの一つ目の要素
#define S second // pairの二つ目の要素
#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)
#define perm(c) \
sort(all(c)); \
for (bool c##p = 1; c##p; \
c##p = next_permutation(all(c))) //順列 123 132 213 231 312 321
#define BIT(n) (1LL << (n))
#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif
//入力高速化
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
}
} iosetup;
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;
}
signed main() {
int N;
cin >> N;
map<string, int> m;
rep(i, N) {
string S;
cin >> S;
sort(all(S));
m[S]++;
}
int ans = 0;
for (auto a : m) {
int count = a.second;
ans += (a.second) * (a.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend() // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define all(x) (x).begin(), (x).end()
//略記
#define pb emplace_back // vectorヘの挿入
#define mp make_pair // pairのコンストラクタ
#define F first // pairの一つ目の要素
#define S second // pairの二つ目の要素
#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)
#define perm(c) \
sort(all(c)); \
for (bool c##p = 1; c##p; \
c##p = next_permutation(all(c))) //順列 123 132 213 231 312 321
#define BIT(n) (1LL << (n))
#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif
//入力高速化
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
}
} iosetup;
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;
}
signed main() {
int N;
cin >> N;
map<string, ll> m;
rep(i, N) {
string S;
cin >> S;
sort(all(S));
m[S]++;
}
ll ans = 0;
for (auto a : m) {
int count = a.second;
ans += (a.second) * (a.second - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,151
| 746,152
|
u322110493
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++)
cin >> s[i];
for (int i = 0; i < N; i++) {
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll ans = 0;
int streak = 1;
for (int i = 1; i < N; i++) {
if (s[i - 1] == s[i]) {
streak++;
} else {
ans += (streak * (streak - 1)) / 2;
streak = 1;
}
}
ans += (streak * (streak - 1)) / 2;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++)
cin >> s[i];
for (int i = 0; i < N; i++) {
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll ans = 0;
ll streak = 1;
for (int i = 1; i < N; i++) {
if (s[i - 1] == s[i]) {
streak++;
} else {
ans += (streak * (streak - 1)) / 2;
streak = 1;
}
}
ans += (streak * (streak - 1)) / 2;
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,155
| 746,156
|
u083494782
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
int main() {
int n;
cin >> n;
string s[n];
map<string, int> num;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
num[s[i]]++;
}
ll ans = 0;
for (auto i : num) {
if (i.second == 1)
continue;
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
int main() {
int n;
cin >> n;
string s[n];
map<string, ll> num;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
num[s[i]]++;
}
ll ans = 0;
for (auto i : num) {
if (i.second == 1)
continue;
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,157
| 746,158
|
u938028169
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> a;
vector<char> tmp(10);
for (int i = 0; i < N; i++) {
string str;
cin >> str;
for (int j = 0; j < 10; j++) {
tmp[j] = str[j];
}
sort(tmp.begin(), tmp.end());
for (int j = 0; j < 10; j++) {
str[j] = tmp[j];
}
a[str]++;
}
long long int output = 0;
for (auto num : a) {
output += num.second * (num.second - 1) / 2;
}
cout << output << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, long long int> a;
vector<char> tmp(10);
for (int i = 0; i < N; i++) {
string str;
cin >> str;
for (int j = 0; j < 10; j++) {
tmp[j] = str[j];
}
sort(tmp.begin(), tmp.end());
for (int j = 0; j < 10; j++) {
str[j] = tmp[j];
}
a[str]++;
}
long long int output = 0;
for (auto num : a) {
output += num.second * (num.second - 1) / 2;
}
cout << output << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,159
| 746,160
|
u412408615
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> a;
vector<char> tmp(10);
for (int i = 0; i < N; i++) {
string str;
cin >> str;
for (int j = 0; j < 10; j++) {
tmp[j] = str[j];
}
sort(tmp.begin(), tmp.end());
for (int j = 0; j < 10; j++) {
str[j] = tmp[j];
}
a[str]++;
}
int output = 0;
for (auto num : a) {
output += num.second * (num.second - 1) / 2;
}
cout << output << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, long long int> a;
vector<char> tmp(10);
for (int i = 0; i < N; i++) {
string str;
cin >> str;
for (int j = 0; j < 10; j++) {
tmp[j] = str[j];
}
sort(tmp.begin(), tmp.end());
for (int j = 0; j < 10; j++) {
str[j] = tmp[j];
}
a[str]++;
}
long long int output = 0;
for (auto num : a) {
output += num.second * (num.second - 1) / 2;
}
cout << output << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,161
| 746,160
|
u412408615
|
cpp
|
p02947
|
#include <algorithm>
#include <cctype>
#include <cmath>
#include <ctype.h>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#define PI 3.141592653
#define rep(i, a, n) for (int i = a; i < (int)n; ++i)
#define SZ(x) ((int)(x).size()) // size() unsigned -> int
#define DescSort(a) sort(a.begin(), a.end(), std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
int main() {
int n, ans = 0;
cin >> n;
map<string, int> mp;
rep(i, 0, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += mp[s];
mp[s]++;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <cctype>
#include <cmath>
#include <ctype.h>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#define PI 3.141592653
#define rep(i, a, n) for (int i = a; i < (int)n; ++i)
#define SZ(x) ((int)(x).size()) // size() unsigned -> int
#define DescSort(a) sort(a.begin(), a.end(), std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
int main() {
int n;
ll ans = 0;
cin >> n;
map<string, int> mp;
rep(i, 0, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += mp[s];
mp[s]++;
}
cout << ans << endl;
return 0;
}
|
[] | 746,162
| 746,163
|
u817523595
|
cpp
|
p02947
|
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
ll n;
ll ans = 0;
cin >> n;
vector<string> s(n);
map<string, int> m;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]] += 1;
}
rep(i, n) {
if (m[s[i]] >= 2) {
ans += m[s[i]] * (m[s[i]] - 1) / 2;
m[s[i]] = 1;
}
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
ll n;
ll ans = 0;
cin >> n;
vector<string> s(n);
map<string, ll> m;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]] += 1;
}
rep(i, n) {
if (m[s[i]] >= 2) {
ans += m[s[i]] * (m[s[i]] - 1) / 2;
m[s[i]] = 1;
}
}
cout << ans << endl;
return 0;
}
|
[] | 746,164
| 746,165
|
u358388458
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string target;
vector<string> targets;
for (int i = 0; i < n; ++i) {
cin >> target;
sort(target.begin(), target.end());
targets.push_back(target);
}
sort(targets.begin(), targets.end());
long long sum_count = 0;
int count = 1;
for (int i = 1; i <= n; ++i) {
if (i == n) {
sum_count += count * (count - 1) / 2;
break;
}
if (targets[i] == targets[i - 1]) {
++count;
continue;
}
sum_count += count * (count - 1) / 2;
count = 1;
}
cout << sum_count << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string target;
vector<string> targets;
for (int i = 0; i < n; ++i) {
cin >> target;
sort(target.begin(), target.end());
targets.push_back(target);
}
// TODO: map使ってやってみる。
sort(targets.begin(), targets.end());
long long sum_count = 0;
long long count = 1;
for (int i = 1; i <= n; ++i) {
if (i == n) {
sum_count += count * (count - 1) / 2;
break;
}
if (targets[i] == targets[i - 1]) {
++count;
continue;
}
sum_count += count * (count - 1) / 2;
count = 1;
}
cout << sum_count << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,166
| 746,167
|
u358245944
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N;
cin >> N;
vector<int> data(26);
vector<string> data2;
vector<int> data3;
rep(i, N) {
string S;
cin >> S;
sort(S.begin(), S.end());
data2.push_back(S);
}
sort(data2.begin(), data2.end());
data2.push_back(" ");
int count = 0;
for (int i = 0; i < N; i++) {
if (data2.at(i) == data2.at(i + 1)) {
count++;
} else {
data3.push_back(count);
count = 0;
}
}
int64_t ans = 0;
for (int x : data3) {
ans += x * (x + 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N;
cin >> N;
vector<int> data(26);
vector<string> data2;
vector<int> data3;
rep(i, N) {
string S;
cin >> S;
sort(S.begin(), S.end());
data2.push_back(S);
}
sort(data2.begin(), data2.end());
data2.push_back(" ");
int64_t count = 0;
for (int i = 0; i < N; i++) {
if (data2.at(i) == data2.at(i + 1)) {
count++;
} else {
data3.push_back(count);
count = 0;
}
}
int64_t ans = 0;
for (int64_t x : data3) {
ans += x * (x + 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,168
| 746,169
|
u666490638
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int n;
cin >> n;
unordered_map<string, int> frq;
int ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += frq[s]++;
}
cout << ans << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int n;
cin >> n;
unordered_map<string, int> frq;
long long ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += frq[s]++;
}
cout << ans << "\n";
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,173
| 746,174
|
u845907943
|
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.at(i);
sort(a.at(i).begin(), a.at(i).end());
}
sort(a.begin(), a.end());
int cnt = 0, count = 0;
string copy = a.at(0);
for (int i = 0; i < n; i++) {
if (a.at(i) == copy) {
count++;
} else {
cnt += (count * (count - 1)) / 2;
count = 1;
copy = a.at(i);
}
}
cnt += (count * (count - 1)) / 2;
cout << cnt << endl;
return 0;
}
|
#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.at(i);
sort(a.at(i).begin(), a.at(i).end());
}
sort(a.begin(), a.end());
long long cnt = 0, count = 0;
string copy = a.at(0);
for (int i = 0; i < n; i++) {
if (a.at(i) == copy) {
count++;
} else {
cnt += (count * (count - 1)) / 2;
count = 1;
copy = a.at(i);
}
}
cnt += (count * (count - 1)) / 2;
cout << cnt << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,175
| 746,176
|
u191114518
|
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.at(i);
sort(a.at(i).begin(), a.at(i).end());
}
sort(a.begin(), a.end());
int cnt = 0, count = 0;
string copy = a.at(0);
for (int i = 0; i < n; i++) {
if (a.at(i) == copy) {
count++;
} else {
cnt += count * (count - 1) / 2;
count = 1;
copy = a.at(i);
}
}
cnt += count * (count - 1) / 2;
cout << cnt << endl;
return 0;
}
|
#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.at(i);
sort(a.at(i).begin(), a.at(i).end());
}
sort(a.begin(), a.end());
long long cnt = 0, count = 0;
string copy = a.at(0);
for (int i = 0; i < n; i++) {
if (a.at(i) == copy) {
count++;
} else {
cnt += (count * (count - 1)) / 2;
count = 1;
copy = a.at(i);
}
}
cnt += (count * (count - 1)) / 2;
cout << cnt << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,177
| 746,176
|
u191114518
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
unordered_map<string, int> mp;
int ans = 0;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += mp[s];
mp[s]++;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
unordered_map<string, int> mp;
ll ans = 0;
for (int i = 0; i < N; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += mp[s];
mp[s]++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,178
| 746,179
|
u433685759
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>
typedef long long ll;
int n;
string s;
unordered_set<string> SET;
unordered_map<string, int> byk;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s;
sort(s.begin(), s.end());
SET.insert(s);
byk[s]++;
}
int ans = 0;
for (string isi : SET) {
ans += (byk[isi] * (byk[isi] - 1)) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>
typedef long long ll;
int n;
string s;
unordered_set<string> SET;
unordered_map<string, ll> byk;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s;
sort(s.begin(), s.end());
SET.insert(s);
byk[s]++;
}
ll ans = 0;
for (string isi : SET) {
ans += (byk[isi] * (byk[isi] - 1)) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,180
| 746,181
|
u230350277
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s.at(i);
rep(i, n) sort(s.at(i).begin(), s.at(i).end());
sort(s.begin(), s.end());
int cnt = 1;
int ans = 0;
rep(i, n - 1) {
if (s.at(i) == s.at(i + 1)) {
cnt++;
} else {
ans += (cnt * (cnt - 1)) / 2;
cnt = 1;
}
}
ans += (cnt * (cnt - 1)) / 2;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s.at(i);
rep(i, n) sort(s.at(i).begin(), s.at(i).end());
sort(s.begin(), s.end());
ll cnt = 1;
ll ans = 0;
rep(i, n - 1) {
if (s.at(i) == s.at(i + 1)) {
cnt++;
} else {
ans += (cnt * (cnt - 1)) / 2;
cnt = 1;
}
}
ans += (cnt * (cnt - 1)) / 2;
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,184
| 746,185
|
u442855610
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long res = 0;
string pre = s[0];
for (int i = 0; i < n; i++) {
int j = i + 1;
long long tmp = 1;
while (pre == s[j] && j < n) {
j++;
tmp++;
}
res += tmp * (tmp - 1) / 2;
if (j == n)
break;
pre = s[j];
i += j - 1;
}
cout << res << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long res = 0;
string pre = s[0];
for (int i = 0; i < n;) {
int j = i + 1;
long long tmp = 1;
while (pre == s[j] && j < n) {
j++;
tmp++;
}
res += tmp * (tmp - 1) / 2;
if (j == n)
break;
pre = s[j];
i = j;
}
cout << res << endl;
return 0;
}
|
[
"control_flow.loop.for.update.change",
"assignment.value.change",
"expression.operation.binary.remove"
] | 746,186
| 746,187
|
u315542000
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll countNum(ll val) { return (val - 1) * val / 2; }
int main() {
int n;
cin >> n;
string str;
map<string, ll> _mp;
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
_mp[str] += 1;
}
map<string, ll>::iterator it = _mp.begin();
int ans = 0;
for (; it != _mp.end(); it++) {
if (it->second >= 2) {
ans += countNum(it->second);
}
}
cout << ans << endl;
}
// cat act tac dog god
|
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll countNum(ll val) { return (val - 1) * val / 2; }
int main() {
int n;
cin >> n;
string str;
map<string, ll> _mp;
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
_mp[str] += 1;
}
map<string, ll>::iterator it = _mp.begin();
ll ans = 0;
for (; it != _mp.end(); it++) {
if (it->second >= 2) {
ans += countNum(it->second);
}
}
cout << ans << endl;
}
// cat act tac dog god
|
[
"variable_declaration.type.change"
] | 746,194
| 746,195
|
u914684060
|
cpp
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.