Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
9 values
p02947
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #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 show(x) \ for (auto i : x) { \ cout << i << " "; \ } #define showm(m) \ for (auto i : m) { \ cout << m.x << " "; \ } typedef long long ll; typedef pair<int, int> P; int main() { int N; cin >> N; vector<string> s; rep(i, N) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); s.push_back(tmp); } // show(s); sort(s.begin(), s.end()); // show(s); ll ans = 0; int tmp_cnt = 0; rep(i, N - 1) { if (s[i] == s[i + 1]) { tmp_cnt++; } else { ans += tmp_cnt * (tmp_cnt + 1) / 2; tmp_cnt = 0; } // cout << tmp_cnt << endl; } ans += tmp_cnt * (tmp_cnt + 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #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 show(x) \ for (auto i : x) { \ cout << i << " "; \ } #define showm(m) \ for (auto i : m) { \ cout << m.x << " "; \ } typedef long long ll; typedef pair<int, int> P; int main() { int N; cin >> N; vector<string> s; rep(i, N) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); s.push_back(tmp); } // show(s); sort(s.begin(), s.end()); // show(s); ll ans = 0; ll tmp_cnt = 0; rep(i, N - 1) { if (s[i] == s[i + 1]) { tmp_cnt++; } else { ans += tmp_cnt * (tmp_cnt + 1) / 2; tmp_cnt = 0; } // cout << tmp_cnt << endl; } ans += tmp_cnt * (tmp_cnt + 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,222
747,223
u317715099
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); long long ans = 0; int suc = 1; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); for (int i = 0; i < n - 1; i++) { if (s[i] == s[i + 1]) { suc++; } else { ans += suc * (suc - 1) / 2; suc = 1; } } if (s[n - 2] == s[n - 1]) { ans += suc * (suc - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); long long ans = 0; long long suc = 1; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); for (int i = 0; i < n - 1; i++) { if (s[i] == s[i + 1]) { suc++; } else { ans += suc * (suc - 1) / 2; suc = 1; } } if (s[n - 2] == s[n - 1]) { ans += suc * (suc - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,226
747,227
u057810841
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; typedef long long llong; int main() { llong N; cin >> N; map<string, int> m; for (int i = 0; i < N; ++i) { string s; cin >> s; sort(s.begin(), s.end()); if (m.find(s) != m.end()) { ++m[s]; } else m[s] = 1; } int cnt = 0; for (auto it = m.begin(); it != m.end(); ++it) { int n = it->second; if (n > 1) { // nC2の計算 cnt += n * (n - 1) / 2; } } cout << cnt << endl; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; typedef long long llong; int main() { llong N; cin >> N; map<string, llong> m; for (llong i = 0; i < N; ++i) { string s; cin >> s; sort(s.begin(), s.end()); if (m.find(s) != m.end()) { ++m[s]; } else m[s] = 1; } llong cnt = 0; for (auto it = m.begin(); it != m.end(); ++it) { llong n = it->second; if (n > 1) { // nC2の計算 cnt += (n * (n - 1) / 2); } } cout << cnt << endl; }
[ "control_flow.loop.for.initializer.change", "variable_declaration.type.change" ]
747,231
747,232
u684435505
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(x) (x).begin(), (x).end() #define rrng(x) (x).rbegin(), (x).rend() #define limit(x, l, r) max(l, min(x, r)) #define lims(x, l, r) (x = max(l, min(x, r))) #define isin(x, l, r) ((l) <= (x) && (x) < (r)) #define show(x) cout << #x << " = " << (x) << endl #define show2(x, y) \ cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl #define show3(x, y, z) \ cout << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z \ << " = " << (z) << endl #define showv(v) \ rep(i, v.size()) printf("%d%c", v[i], i == v.size() - 1 ? '\n' : ' ') #define showv2(v) rep(j, v.size()) showv(v[j]) #define showt(t, n) rep(i, n) printf("%d%c", t[i], i == n - 1 ? '\n' : ' ') #define showt2(t, r, c) rep(j, r) showt(t[j], c) #define showvp(p) rep(i, p.size()) printf("%d %d\n", p[i].first, p[i].second); #define printv(v) rep(i, v.size()) printf("%d\n", v[i]) #define printt(t, n) rep(i, n) printf("%d\n", t[i]) #define incl(v, x) find(rng(v), x) != v.end() #define incls(s, c) s.find(c) != string::npos #define fi first #define se second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define bit(n, k) ((n >> k) & 1) // nのk bit目 #define bn(x) ((1 << x) - 1) #define dup(x, y) (((x) + (y)-1) / (y)) #define newline puts("") #define uni(x) x.erase(unique(rng(x)), x.end()) #define SP << " " << #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vs = vector<string>; using P = pair<int, int>; using T = tuple<int, int, int>; using vp = vector<P>; using vt = vector<T>; const int mod = 1000000007; const double EPS = 1e-9; const int INF = (1 << 30) - 1; const ll INFLL = (1LL << 62) - 1; #define dame \ { \ puts("No"); \ return 0; \ } #define yn \ { puts("Yes"); } \ else { \ puts("No"); \ } inline int in() { int x; scanf("%d", &x); return x; } template <typename T> inline ll suma(const v(T) & a) { ll res(0); for (auto &&x : a) res += x; return res; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { int n; cin >> n; vector<string> s(n); map<string, int> mp; rep(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); mp[s[i]]++; } ll ans = 0; for (auto p : mp) { ans += p.se * (p.se - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = (0); i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(x) (x).begin(), (x).end() #define rrng(x) (x).rbegin(), (x).rend() #define limit(x, l, r) max(l, min(x, r)) #define lims(x, l, r) (x = max(l, min(x, r))) #define isin(x, l, r) ((l) <= (x) && (x) < (r)) #define show(x) cout << #x << " = " << (x) << endl #define show2(x, y) \ cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl #define show3(x, y, z) \ cout << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z \ << " = " << (z) << endl #define showv(v) \ rep(i, v.size()) printf("%d%c", v[i], i == v.size() - 1 ? '\n' : ' ') #define showv2(v) rep(j, v.size()) showv(v[j]) #define showt(t, n) rep(i, n) printf("%d%c", t[i], i == n - 1 ? '\n' : ' ') #define showt2(t, r, c) rep(j, r) showt(t[j], c) #define showvp(p) rep(i, p.size()) printf("%d %d\n", p[i].first, p[i].second); #define printv(v) rep(i, v.size()) printf("%d\n", v[i]) #define printt(t, n) rep(i, n) printf("%d\n", t[i]) #define incl(v, x) find(rng(v), x) != v.end() #define incls(s, c) s.find(c) != string::npos #define fi first #define se second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define bit(n, k) ((n >> k) & 1) // nのk bit目 #define bn(x) ((1 << x) - 1) #define dup(x, y) (((x) + (y)-1) / (y)) #define newline puts("") #define uni(x) x.erase(unique(rng(x)), x.end()) #define SP << " " << #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vs = vector<string>; using P = pair<int, int>; using T = tuple<int, int, int>; using vp = vector<P>; using vt = vector<T>; const int mod = 1000000007; const double EPS = 1e-9; const int INF = (1 << 30) - 1; const ll INFLL = (1LL << 62) - 1; #define dame \ { \ puts("No"); \ return 0; \ } #define yn \ { puts("Yes"); } \ else { \ puts("No"); \ } inline int in() { int x; scanf("%d", &x); return x; } template <typename T> inline ll suma(const v(T) & a) { ll res(0); for (auto &&x : a) res += x; return res; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int main() { int n; cin >> n; vector<string> s(n); map<string, int> mp; rep(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); mp[s[i]]++; } ll ans = 0; for (auto p : mp) { ans += (ll)p.se * (p.se - 1) / 2; } cout << ans << endl; return 0; }
[ "type_conversion.add" ]
747,233
747,234
u850516963
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define DEBUG(x) cout << #x << " = " << (x) << endl; #define SORT(x) sort(ALL(x)); #define RSORT(x) sort(RALL(x)); #define SUM(x) accumulate(ALL(x), 0); using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using pii = pair<int, int>; using tiii = tuple<int, int, int>; const int inf = 1 << 30; const ll mod = 1000000007; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; // cout << fixed << setprecision(10); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { int n; cin >> n; map<string, int> mp; rep(i, n) { string s; cin >> s; SORT(s); 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> #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define DEBUG(x) cout << #x << " = " << (x) << endl; #define SORT(x) sort(ALL(x)); #define RSORT(x) sort(RALL(x)); #define SUM(x) accumulate(ALL(x), 0); using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using pii = pair<int, int>; using tiii = tuple<int, int, int>; const int inf = 1 << 30; const ll mod = 1000000007; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; // cout << fixed << setprecision(10); ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { int n; cin >> n; unordered_map<string, int> mp; rep(i, n) { string s; cin >> s; SORT(s); mp[s]++; } ll ans = 0; for (auto &p : mp) { int s = p.second; ans += (ll)s * (s - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
747,235
747,236
u850516963
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < (int)b; i++) #define rep(i, n) REP(i, 0, n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) \ { std::cout << #a << " = " << a << "\n"; } template <class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template <class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } template <class T, class V> istream &operator>>(istream &ist, pair<T, V> &p) { return ist >> p.first >> p.second; } template <class T> ostream &operator<<(ostream &ost, pair<T, T> &p) { return ost << p.first << ", " << p.second; } template <class T> istream &operator>>(istream &ist, vector<T> &vs) { for (auto &e : vs) ist >> e; return ist; } typedef long long ll; int const inf = INT_MAX / 2; 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 &e : mp) { ans += e.second * (e.second - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < (int)b; i++) #define rep(i, n) REP(i, 0, n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) \ { std::cout << #a << " = " << a << "\n"; } template <class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template <class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } template <class T, class V> istream &operator>>(istream &ist, pair<T, V> &p) { return ist >> p.first >> p.second; } template <class T> ostream &operator<<(ostream &ost, pair<T, T> &p) { return ost << p.first << ", " << p.second; } template <class T> istream &operator>>(istream &ist, vector<T> &vs) { for (auto &e : vs) ist >> e; return ist; } typedef long long ll; int const inf = INT_MAX / 2; 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 &e : mp) { ans += (ll)e.second * (e.second - 1) / 2; } cout << ans << endl; }
[ "type_conversion.add" ]
747,237
747,238
u809665051
cpp
p02947
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; const int MOD = 1000000007; const int MAX = 510000; long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[n - k] * finv[k] % MOD) % MOD; } int main() { COMinit(); 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()); long long count = 0; long long sum = 0; for (int i = 0; i < N - 1; i++) { // cout << count << endl; if (S[i] == S[i + 1]) { count++; sum += count; } else { count = 0; } } sum += count; cout << sum << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; const int MOD = 1000000007; const int MAX = 510000; long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[n - k] * finv[k] % MOD) % MOD; } int main() { COMinit(); 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()); long long count = 0; long long sum = 0; for (int i = 0; i < N - 1; i++) { // cout << count << endl; if (S[i] == S[i + 1]) { count++; sum += count; } else { count = 0; } } cout << sum << endl; return 0; }
[]
747,239
747,240
u005906204
cpp
p02947
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N, i, cont = 0, res = 0; string s; vector<string> v; cin >> N; for (i = 0; i < N; i++) { cin >> s; // sortString(s); sort(s.begin(), s.end()); // cout<<s<<endl; v.push_back(s); } sort(v.begin(), v.end()); for (int i = 0; i < v.size(); i++) { cont++; // cout<<v[i]<<endl; if (v[i] != v[i + 1]) { if (cont > 1) { res = res + (cont - 1) * cont / 2; } cont = 0; } } cout << res << endl; return 0; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { long long int N, i, cont = 0, res = 0; string s; vector<string> v; cin >> N; for (i = 0; i < N; i++) { cin >> s; // sortString(s); sort(s.begin(), s.end()); // cout<<s<<endl; v.push_back(s); } sort(v.begin(), v.end()); for (long long int i = 0; i < v.size(); i++) { cont++; // cout<<v[i]<<endl; if (v[i] != v[i + 1]) { if (cont > 1) { res = res + (cont - 1) * cont / 2; } cont = 0; } } cout << res << endl; return 0; }
[ "control_flow.loop.for.initializer.change" ]
747,241
747,242
u623599984
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pad pair<double, double> #define pb push_back #define mp make_pair #define VIN(v) \ for (int64_t i = 0; i < (v).size(); i++) { \ cin >> (v).at(i); \ } typedef vector<bool> bvec; typedef vector<int> ivec; typedef vector<long long> lvec; typedef vector<double> dvec; typedef vector<pa> pvec; typedef vector<vector<bool>> bmat; typedef vector<vector<int>> imat; typedef vector<string> svec; typedef vector<vector<string>> smat; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; ll sum = 0; cin >> n; svec s; map<string, int> hmap; for (int i = 0; i < n; i++) { string x; cin >> x; sort(x.begin(), x.end()); if (hmap.count(x)) hmap[x]++; else hmap[x] = 1; } for (auto &x : hmap) sum += x.second * (x.second - 1) / 2; cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pad pair<double, double> #define pb push_back #define mp make_pair #define VIN(v) \ for (int64_t i = 0; i < (v).size(); i++) { \ cin >> (v).at(i); \ } typedef vector<bool> bvec; typedef vector<int> ivec; typedef vector<long long> lvec; typedef vector<double> dvec; typedef vector<pa> pvec; typedef vector<vector<bool>> bmat; typedef vector<vector<int>> imat; typedef vector<string> svec; typedef vector<vector<string>> smat; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; ll sum = 0; cin >> n; svec s; map<string, ll> hmap; for (ll i = 0; i < n; i++) { string x; cin >> x; sort(x.begin(), x.end()); if (hmap.count(x)) hmap[x]++; else hmap[x] = 1; } for (auto &x : hmap) sum += x.second * (x.second - 1) / 2; cout << sum << endl; }
[ "variable_declaration.type.change", "control_flow.loop.for.initializer.change" ]
747,244
747,245
u842917248
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pad pair<double, double> #define pb push_back #define mp make_pair #define VIN(v) \ for (int64_t i = 0; i < (v).size(); i++) { \ cin >> (v).at(i); \ } typedef vector<bool> bvec; typedef vector<int> ivec; typedef vector<long long> lvec; typedef vector<double> dvec; typedef vector<pa> pvec; typedef vector<vector<bool>> bmat; typedef vector<vector<int>> imat; typedef vector<string> svec; typedef vector<vector<string>> smat; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, sum = 0; cin >> n; svec s; map<string, int> hmap; for (int i = 0; i < n; i++) { string x; cin >> x; sort(x.begin(), x.end()); if (hmap.count(x)) hmap[x]++; else hmap[x] = 1; } for (auto &x : hmap) sum += x.second * (x.second - 1) / 2; cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pa pair<int, int> #define pal pair<long long, long long> #define pad pair<double, double> #define pb push_back #define mp make_pair #define VIN(v) \ for (int64_t i = 0; i < (v).size(); i++) { \ cin >> (v).at(i); \ } typedef vector<bool> bvec; typedef vector<int> ivec; typedef vector<long long> lvec; typedef vector<double> dvec; typedef vector<pa> pvec; typedef vector<vector<bool>> bmat; typedef vector<vector<int>> imat; typedef vector<string> svec; typedef vector<vector<string>> smat; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; ll sum = 0; cin >> n; svec s; map<string, ll> hmap; for (ll i = 0; i < n; i++) { string x; cin >> x; sort(x.begin(), x.end()); if (hmap.count(x)) hmap[x]++; else hmap[x] = 1; } for (auto &x : hmap) sum += x.second * (x.second - 1) / 2; cout << sum << endl; }
[ "variable_declaration.type.change", "control_flow.loop.for.initializer.change" ]
747,246
747,245
u842917248
cpp
p02947
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { long n; cin >> n; unsigned long ans = 0; map<string, unsigned long> mp; string str; for (long i = 0; i < n; i++) { cin >> str; sort(str.begin(), str.end()); if (mp[str]) ans += mp[str]; mp[str]++; } printf("%ul\n", ans); return 0; }
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { long n; cin >> n; unsigned long ans = 0; map<string, unsigned long> mp; string str; for (long i = 0; i < n; i++) { cin >> str; sort(str.begin(), str.end()); if (mp[str]) ans += mp[str]; mp[str]++; } printf("%lu\n", ans); return 0; }
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
747,249
747,250
u407630908
cpp
p02947
#include <bits/stdc++.h> #define llint long long int using namespace std; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s[i]; for (int j = 9; j >= 0; j--) { for (int k = 0; k < j; k++) { if (s[i][k] > s[i][k + 1]) { char t = s[i][k]; s[i][k] = s[i][k + 1]; s[i][k + 1] = t; } } } } sort(s.begin(), s.end()); int count = 1; llint ans = 0; string t = s[0]; for (int i = 1; i < N; i++) { if (s[i] == t) { count++; } else { ans += (llint)count * (count - 1) / 2; count = 1; t = s[i]; } } ans += count * (count - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> #define llint long long int using namespace std; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s[i]; for (int j = 9; j >= 0; j--) { for (int k = 0; k < j; k++) { if (s[i][k] > s[i][k + 1]) { char t = s[i][k]; s[i][k] = s[i][k + 1]; s[i][k + 1] = t; } } } } sort(s.begin(), s.end()); int count = 1; llint ans = 0; string t = s[0]; for (int i = 1; i < N; i++) { if (s[i] == t) { count++; } else { ans += (llint)count * (count - 1) / 2; count = 1; t = s[i]; } } ans += (llint)count * (count - 1) / 2; cout << ans << endl; }
[ "type_conversion.add" ]
747,252
747,253
u845608451
cpp
p02947
#include <bits/stdc++.h> #define llint long long int using namespace std; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s[i]; for (int j = 9; j >= 0; j--) { for (int k = 0; k < j; k++) { if (s[i][k] > s[i][k + 1]) { char t = s[i][k]; s[i][k] = s[i][k + 1]; s[i][k + 1] = t; } } } } sort(s.begin(), s.end()); int count = 1; llint ans = 0; string t = s[0]; for (int i = 1; i < N; i++) { if (s[i] == t) { count++; } else { ans += count * (count - 1) / 2; count = 1; t = s[i]; } } ans += count * (count - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> #define llint long long int using namespace std; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s[i]; for (int j = 9; j >= 0; j--) { for (int k = 0; k < j; k++) { if (s[i][k] > s[i][k + 1]) { char t = s[i][k]; s[i][k] = s[i][k + 1]; s[i][k + 1] = t; } } } } sort(s.begin(), s.end()); int count = 1; llint ans = 0; string t = s[0]; for (int i = 1; i < N; i++) { if (s[i] == t) { count++; } else { ans += (llint)count * (count - 1) / 2; count = 1; t = s[i]; } } ans += (llint)count * (count - 1) / 2; cout << ans << endl; }
[ "type_conversion.add" ]
747,254
747,253
u845608451
cpp
p02947
#include <bits/stdc++.h> #include <math.h> using namespace std; long ex(int n) { return n * (n - 1) / 2; } int main() { int N; cin >> N; vector<string> data(N); for (int i = 0; i < N; i++) { cin >> data.at(i); } for (int i = 0; i < N; i++) { sort(data.at(i).begin(), data.at(i).end()); } sort(data.begin(), data.end()); long a = 0; int j = 0; string b = data.at(0); vector<int> c(N); for (int i = 0; i < N; i++) { if (b == data.at(i)) { c.at(j)++; } else { c.at(j + 1) = 1; b = data.at(i); j++; } } for (int i = 0; i < N; i++) { a += ex(c.at(i)); } cout << a << endl; }
#include <bits/stdc++.h> #include <math.h> using namespace std; long ex(long n) { return n * (n - 1) / 2; } int main() { int N; cin >> N; vector<string> data(N); for (int i = 0; i < N; i++) { cin >> data.at(i); } for (int i = 0; i < N; i++) { sort(data.at(i).begin(), data.at(i).end()); } sort(data.begin(), data.end()); long a = 0; int j = 0; string b = data.at(0); vector<int> c(N); for (int i = 0; i < N; i++) { if (b == data.at(i)) { c.at(j)++; } else { c.at(j + 1) = 1; b = data.at(i); j++; } } for (int i = 0; i < N; i++) { a += ex(c.at(i)); } cout << a << endl; }
[ "variable_declaration.type.primitive.change" ]
747,257
747,258
u387371565
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef tuple<char, char, char, char, char, char, char, char, char, char> T; int main() { int N; cin >> N; T t[N]; for (int i = 0; i < N; i++) { vector<char> s; for (int j = 0; j < 10; j++) { char c; cin >> c; s.push_back(c); } sort(s.begin(), s.end()); t[i] = T(s.at(0), s.at(1), s.at(2), s.at(3), s.at(4), s.at(5), s.at(6), s.at(7), s.at(8), s.at(9)); } priority_queue<T> que; for (int i = 0; i < N; i++) { que.push(t[i]); } vector<int> leng; int l = 0; for (int i = 0; i < N - 1; i++) { T q = que.top(); que.pop(); T r = que.top(); if (q != r) { leng.push_back(i + 1 - l); l = i + 1; } } leng.push_back(N - l); ll ans = 0; for (int i = 0; i < leng.size(); i++) { ans = ans + leng[i] * (leng[i] - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef tuple<char, char, char, char, char, char, char, char, char, char> T; int main() { int N; cin >> N; T t[N]; for (int i = 0; i < N; i++) { vector<char> s; for (int j = 0; j < 10; j++) { char c; cin >> c; s.push_back(c); } sort(s.begin(), s.end()); t[i] = T(s.at(0), s.at(1), s.at(2), s.at(3), s.at(4), s.at(5), s.at(6), s.at(7), s.at(8), s.at(9)); } priority_queue<T> que; for (int i = 0; i < N; i++) { que.push(t[i]); } vector<ll> leng; ll l = 0; for (ll i = 0; i < N - 1; i++) { T q = que.top(); que.pop(); T r = que.top(); if (q != r) { leng.push_back(i + 1 - l); l = i + 1; } } leng.push_back(N - l); ll ans = 0; for (int i = 0; i < leng.size(); i++) { ans = ans + leng[i] * (leng[i] - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.change", "control_flow.loop.for.initializer.change" ]
747,261
747,262
u559578080
cpp
p02947
#include <bits/stdc++.h> #define all(A) begin(A), end(A) #define rall(A) rbegin(A), rend(A) #define sz(A) int(A.size()) #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; ll total = 0; map<string, int> m; set<string> s; for (ll i = 1; i <= n; i++) { string palabra; cin >> palabra; sort(palabra.begin(), palabra.end()); m[palabra]++; s.insert(palabra); } for (auto it = s.begin(); it != s.end(); ++it) { total += (m[*it]) * (m[*it] - 1) / 2; } cout << total; return (0); }
#include <bits/stdc++.h> #define all(A) begin(A), end(A) #define rall(A) rbegin(A), rend(A) #define sz(A) int(A.size()) #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; ll total = 0; map<string, ll> m; set<string> s; for (ll i = 1; i <= n; i++) { string palabra; cin >> palabra; sort(palabra.begin(), palabra.end()); m[palabra]++; s.insert(palabra); } for (auto it = s.begin(); it != s.end(); ++it) { total += (m[*it]) * (m[*it] - 1) / 2; } cout << total; return (0); }
[]
747,263
747,264
u957932627
cpp
p02947
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; int main() { int n, tmp = 0, s = 0; cin >> n; vector<string> v(n), t(n, ""); rep(i, n) cin >> v[i]; vector<vector<char>> r(n, vector<char>(10)); rep(i, n) { rep(j, 10) r[i][j] = v[i][j]; } rep(i, n) sort(r[i].begin(), r[i].end()); rep(i, n) { rep(j, 10) t[i] += r[i][j]; } sort(t.begin(), t.end()); rep(i, n - 1) { if (t[i] == t[i + 1]) { ++tmp; s += tmp; } else tmp = 0; } cout << s << endl; return 0; }
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; int main() { int64_t n, tmp = 0, s = 0; cin >> n; vector<string> v(n), t(n, ""); rep(i, n) cin >> v[i]; vector<vector<char>> r(n, vector<char>(10)); rep(i, n) { rep(j, 10) r[i][j] = v[i][j]; } rep(i, n) sort(r[i].begin(), r[i].end()); rep(i, n) { rep(j, 10) t[i] += r[i][j]; } sort(t.begin(), t.end()); rep(i, n - 1) { if (t[i] == t[i + 1]) { ++tmp; s += tmp; } else tmp = 0; } cout << s << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
747,265
747,266
u757584836
cpp
p02947
#include <bits/stdc++.h> int main() { int n; std::cin >> n; auto sorted_strings = std::unordered_map<std::string, int>(); for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; std::sort(s.begin(), s.end()); ++sorted_strings[s]; } uint64_t answer = 0; for (const auto x : sorted_strings) { const int y = x.second; answer += y * (y - 1) / 2; } std::cout << answer << std::endl; return 0; }
#include <bits/stdc++.h> int main() { int n; std::cin >> n; auto sorted_strings = std::unordered_map<std::string, uint64_t>(); for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; std::sort(s.begin(), s.end()); ++sorted_strings[s]; } uint64_t answer = 0; for (const auto x : sorted_strings) { const auto y = x.second; answer += y * (y - 1) / 2; } std::cout << answer << std::endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
747,267
747,268
u414568024
cpp
p02947
#include <bits/stdc++.h> using namespace std; using lint = long long int; using ulint = unsigned long long int; using pint = pair<int, int>; using plint = pair<lint, lint>; struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1LL << (n)) #define FOR(i, begin, end) \ for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) \ for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; } template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) { os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; } template <typename T> ostream &operator<<(ostream &os, const set<T> &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template <typename T> ostream &operator<<(ostream &os, const multiset<T> &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa) { os << "(" << pa.first << "," << pa.second << ")"; return os; } template <typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp) { os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; } template <typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp) { os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; } template <typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); } template <typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); } template <typename T> bool mjjj(T &m, const T q) { if (m < q) { m = q; return true; } else return false; } template <typename T> bool mmin(T &m, const T q) { if (m > q) { m = q; return true; } else return false; } template <typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); } template <typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); } #define dbg(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl; /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; // find_by_order(), order_of_key() template<typename TK> using pbds_set = tree<TK, null_type, less<TK>, rb_tree_tag, tree_order_statistics_node_update>; template<typename TK, typename TV> using pbds_map = tree<TK, TV, less<TK>, rb_tree_tag, tree_order_statistics_node_update>; */ template <typename T> struct edge { int src, to; T cost; // edge(int to) : src(-1),to(to),cost(-1){} edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(const int &x) { to = x; return *this; } operator int() const { return to; } }; template <typename T> using Edges = vector<edge<T>>; template <typename T> using WeightedGraph = vector<Edges<T>>; using UnWeightedGraph = vector<vector<lint>>; template <typename T> using Matrix = vector<vector<T>>; #define INF 1e+9 #define MAX_V 100000 // <最短距離, 頂点の番号> using P = pair<lint, lint>; lint V; vector<edge<lint>> G[MAX_V]; lint d[MAX_V]; // void dijkstra(lint s) { // priority_queue<P, vector<P>, greater<P> > que; // fill(d, d+V, INF); // d[s] = 0; // que.push(P(0, s)); // while (!que.empty()) { // P p = que.top(); // que.pop(); // lint v = p.second; // if (d[v] < p.first) continue; // for (lint i=0; i<G[v].size(); ++i) { // edge<lint> e = G[v][i]; // if (d[e.to] > d[v] + e.cost) { // d[e.to] = d[v] + e.cost; // que.push(P(d[e.to], e.to)); // } // } // } // } const lint mod = 1000000007; struct mint { lint x; // typedef long long lint; mint(lint x = 0) : x((x % mod + mod) % mod) {} mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(lint t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } }; map<lint, lint> prime_factor(lint n) { map<lint, lint> ret; for (lint i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } lint MAX = 1000000000; vector<lint> co; bool dfs(lint from, lint to, lint par = -1) { if (from == to) { return true; } for (edge<lint> v : G[from]) { if (v.to == par) continue; if (dfs(v.to, to, from)) { co.push_back(v.cost); return true; } } return false; } lint digit(lint a, lint b) { lint ad = 1, bd = 1; while (a > 9) { ad++; a /= 10; } while (b > 9) { bd++; b /= 10; } return max(ad, bd); } int main() { int n; cin >> n; map<string, int> m; REP(i, n) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } lint ans = 0; for (auto it : m) { ans += it.second * (it.second - 1) / 2; } cout << ans; } lint gcd(lint a, lint b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } lint lcm(lint a, lint b) { return a * b / gcd(a, b); }
#include <bits/stdc++.h> using namespace std; using lint = long long int; using ulint = unsigned long long int; using pint = pair<int, int>; using plint = pair<lint, lint>; struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1LL << (n)) #define FOR(i, begin, end) \ for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) \ for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; } template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) { os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; } template <typename T> ostream &operator<<(ostream &os, const set<T> &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template <typename T> ostream &operator<<(ostream &os, const multiset<T> &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) { os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa) { os << "(" << pa.first << "," << pa.second << ")"; return os; } template <typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp) { os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; } template <typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp) { os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; } template <typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); } template <typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); } template <typename T> bool mjjj(T &m, const T q) { if (m < q) { m = q; return true; } else return false; } template <typename T> bool mmin(T &m, const T q) { if (m > q) { m = q; return true; } else return false; } template <typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); } template <typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); } #define dbg(x) \ cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl; /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; // find_by_order(), order_of_key() template<typename TK> using pbds_set = tree<TK, null_type, less<TK>, rb_tree_tag, tree_order_statistics_node_update>; template<typename TK, typename TV> using pbds_map = tree<TK, TV, less<TK>, rb_tree_tag, tree_order_statistics_node_update>; */ template <typename T> struct edge { int src, to; T cost; // edge(int to) : src(-1),to(to),cost(-1){} edge(int to, T cost) : src(-1), to(to), cost(cost) {} edge(int src, int to, T cost) : src(src), to(to), cost(cost) {} edge &operator=(const int &x) { to = x; return *this; } operator int() const { return to; } }; template <typename T> using Edges = vector<edge<T>>; template <typename T> using WeightedGraph = vector<Edges<T>>; using UnWeightedGraph = vector<vector<lint>>; template <typename T> using Matrix = vector<vector<T>>; #define INF 1e+9 #define MAX_V 100000 // <最短距離, 頂点の番号> using P = pair<lint, lint>; lint V; vector<edge<lint>> G[MAX_V]; lint d[MAX_V]; // void dijkstra(lint s) { // priority_queue<P, vector<P>, greater<P> > que; // fill(d, d+V, INF); // d[s] = 0; // que.push(P(0, s)); // while (!que.empty()) { // P p = que.top(); // que.pop(); // lint v = p.second; // if (d[v] < p.first) continue; // for (lint i=0; i<G[v].size(); ++i) { // edge<lint> e = G[v][i]; // if (d[e.to] > d[v] + e.cost) { // d[e.to] = d[v] + e.cost; // que.push(P(d[e.to], e.to)); // } // } // } // } const lint mod = 1000000007; struct mint { lint x; // typedef long long lint; mint(lint x = 0) : x((x % mod + mod) % mod) {} mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(lint t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } }; map<lint, lint> prime_factor(lint n) { map<lint, lint> ret; for (lint i = 2; i * i <= n; i++) { while (n % i == 0) { ret[i]++; n /= i; } } if (n != 1) ret[n] = 1; return ret; } lint MAX = 1000000000; vector<lint> co; bool dfs(lint from, lint to, lint par = -1) { if (from == to) { return true; } for (edge<lint> v : G[from]) { if (v.to == par) continue; if (dfs(v.to, to, from)) { co.push_back(v.cost); return true; } } return false; } lint digit(lint a, lint b) { lint ad = 1, bd = 1; while (a > 9) { ad++; a /= 10; } while (b > 9) { bd++; b /= 10; } return max(ad, bd); } int main() { lint n; cin >> n; map<string, lint> m; REP(i, n) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } lint ans = 0; for (auto it : m) { ans += it.second * (it.second - 1) / 2; } cout << ans; } lint gcd(lint a, lint b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } lint lcm(lint a, lint b) { return a * b / gcd(a, b); }
[ "variable_declaration.type.change" ]
747,269
747,270
u647592933
cpp
p02947
#include <bits/stdc++.h> #define maxn (int)(2e5) #define i64 long long #define all(x) x.begin(), x.end() using namespace std; unordered_map<string, int> MP; void init() { MP.clear(); } int main() { // your code goes here int n, k; string s; while (scanf("%d", &n) == 1) { getchar(); init(); for (int i = 0; i < n; i++) { cin >> s; sort(all(s)); MP[s]++; } i64 ans = 0; for (auto p : MP) { int cnt = p.second; ans += cnt * (cnt - 1) / 2LL; } printf("%lld\n", ans); } return 0; }
#include <bits/stdc++.h> #define maxn (int)(2e5) #define i64 long long #define all(x) x.begin(), x.end() using namespace std; unordered_map<string, int> MP; void init() { MP.clear(); } int main() { // your code goes here int n, k; string s; while (scanf("%d", &n) == 1) { getchar(); init(); for (int i = 0; i < n; i++) { cin >> s; sort(all(s)); MP[s]++; } i64 ans = 0; for (auto p : MP) { i64 cnt = p.second; ans += cnt * (cnt - 1) / 2LL; } printf("%lld\n", ans); } return 0; }
[ "variable_declaration.type.change" ]
747,271
747,272
u717687462
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { int n; cin >> n; map<string, int> mp; for (int i = 1; i <= (n); ++i) { 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> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { int n; cin >> n; map<string, int> mp; for (int i = 1; i <= (n); ++i) { 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" ]
747,277
747,278
u139255323
cpp
p02947
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n, count = 0; string s; cin >> n; map<string, int> m; while (n--) { cin >> s; sort(s.begin(), s.end()); m[s]++; } for (auto x : m) { if (x.second >= 2) { count += (x.second * (x.second - 1)) / 2; } } cout << count << endl; // your code goes here return 0; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n, count = 0; string s; cin >> n; map<string, ll> m; while (n--) { cin >> s; sort(s.begin(), s.end()); m[s]++; } for (auto x : m) { if (x.second >= 2) { count += (x.second * (x.second - 1)) / 2; } } cout << count << endl; // your code goes here return 0; }
[]
747,279
747,280
u738804491
cpp
p02947
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> using namespace std; int main(void) { long N; cin >> N; map<string, int> m; for (int i = 0; i < N; i++) { string s; cin >> s; char *c = new char[10]; s.copy(c, 10); sort(c, c + 10); s = string(c); // cout << s << endl; auto itr = m.find(s); if (itr != m.end()) { m[s] += 1; } else { m[s] = 1; } } long cnt = 0; for (auto i = m.begin(); i != m.end(); ++i) { int x = i->second; if (x > 1) { cnt += x * (x - 1) / 2; } } cout << cnt << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> using namespace std; int main(void) { long N; cin >> N; map<string, int> m; for (int i = 0; i < N; i++) { string s; cin >> s; char *c = new char[10]; s.copy(c, 10); sort(c, c + 10); s = string(c); // cout << s << endl; auto itr = m.find(s); if (itr != m.end()) { m[s] += 1; } else { m[s] = 1; } } long cnt = 0; for (auto i = m.begin(); i != m.end(); ++i) { long x = i->second; if (x > 1) { cnt += x * (x - 1) / 2; } } cout << cnt << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
747,281
747,282
u710789518
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5 + 100; const int mod = 3e5; char s[N][20]; int hashTable[mod], cnt[mod]; void init() { for (int i = 0; i < mod; i++) { hashTable[i] = -1; cnt[i] = 0; } return; } int Hash(char *x) { int c, base = 5381, ha = 0; while (c = *x++) { ha = (ha * base + c) % mod; } return ha; } bool compare(char *s1, char *s2) { while (*s1) { if (*s1 != *s2) return 0; s1++, s2++; } return 1; } int getID(int t, int id) { while (hashTable[t] != -1) { if (compare(s[hashTable[t]], s[id])) return t; t++; if (t == mod) t = 0; } return t; } int main() { int n; while (~scanf("%d", &n)) { init(); for (int i = 0; i < n; i++) { scanf("%s", s[i]); sort(s[i], s[i] + 10); int t = Hash(s[i]); int id = getID(t, i); cnt[id]++; hashTable[id] = i; } ll ans = 0; for (int i = 0; i < mod; i++) ans += (ll)(cnt[i] * (cnt[i] - 1)) / 2; printf("%lld\n", ans); } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5 + 100; const int mod = 3e5; char s[N][20]; int hashTable[mod]; ll cnt[mod]; void init() { for (int i = 0; i < mod; i++) { hashTable[i] = -1; cnt[i] = 0; } return; } int Hash(char *x) { int c, base = 5381, ha = 0; while (c = *x++) { ha = (ha * base + c) % mod; } return ha; } bool compare(char *s1, char *s2) { while (*s1) { if (*s1 != *s2) return 0; s1++, s2++; } return 1; } int getID(int t, int id) { while (hashTable[t] != -1) { if (compare(s[hashTable[t]], s[id])) return t; t++; if (t == mod) t = 0; } return t; } int main() { int n; while (~scanf("%d", &n)) { init(); for (int i = 0; i < n; i++) { scanf("%s", s[i]); sort(s[i], s[i] + 10); int t = Hash(s[i]); int id = getID(t, i); cnt[id]++; hashTable[id] = i; } ll ans = 0; for (int i = 0; i < mod; i++) ans += (cnt[i] * (cnt[i] - 1)) / 2; printf("%lld\n", ans); } return 0; }
[ "call.remove" ]
747,283
747,284
u013103635
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 6; const int mod = 1e5 + 3; char s[N][20]; int hashTable[N], cnt[N]; void init() { for (int i = 0; i < mod; i++) { hashTable[i] = -1; cnt[i] = 0; } return; } int Hash(char *t) { int ha = 5381; int c; while (c = *t++) { ha = ((ha << 5) % mod + ha + c) % mod; } return ha % mod; } bool compare(char *s1, char *s2) { while (*s1) { if (*s1 != *s2) return 0; s1++, s2++; } return 1; } int getID(int t, int id) { while (hashTable[t] != -1) { if (compare(s[hashTable[t]], s[id])) return t; t++; if (t == N) t = 0; } return t; } int main() { int n; while (~scanf("%d", &n)) { init(); for (int i = 0; i < n; i++) { scanf("%s", s[i]); sort(s[i], s[i] + 10); int t = Hash(s[i]); int id = getID(t, i); cnt[id]++; hashTable[id] = i; } ll ans = 0; for (int i = 0; i < N; i++) ans += (ll)(cnt[i] * (cnt[i] - 1)) / 2; printf("%lld\n", ans); } return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 6; const int mod = 1e5 + 3; char s[N][20]; int hashTable[N]; ll cnt[N]; void init() { for (int i = 0; i < mod; i++) { hashTable[i] = -1; cnt[i] = 0; } return; } int Hash(char *t) { int ha = 5381; int c; while (c = *t++) { ha = ((ha << 5) % mod + ha + c) % mod; } return ha % mod; } bool compare(char *s1, char *s2) { while (*s1) { if (*s1 != *s2) return 0; s1++, s2++; } return 1; } int getID(int t, int id) { while (hashTable[t] != -1) { if (compare(s[hashTable[t]], s[id])) return t; t++; if (t == N) t = 0; } return t; } int main() { int n; while (~scanf("%d", &n)) { init(); for (int i = 0; i < n; i++) { scanf("%s", s[i]); sort(s[i], s[i] + 10); int t = Hash(s[i]); int id = getID(t, i); cnt[id]++; hashTable[id] = i; } ll ans = 0; for (int i = 0; i < N; i++) ans += (ll)(cnt[i] * (cnt[i] - 1)) / 2; printf("%lld\n", ans); } return 0; }
[]
747,285
747,286
u013103635
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); long long int ans = 0; string t; t = s.at(0); int count = 1; for (int i = 1; i < N; i++) { if (s.at(i) == t) { count++; } else { if (count == 1) { t = s.at(i); } else { ans += count * (count - 1) / 2; count = 1; t = s.at(i); } } } cout << ans + count * (count - 1) / 2 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); long long int ans = 0; string t; t = s.at(0); long long int count = 1; for (int i = 1; i < N; i++) { if (s.at(i) == t) { count++; } else { if (count == 1) { t = s.at(i); } else { ans += count * (count - 1) / 2; count = 1; t = s.at(i); } } } cout << ans + count * (count - 1) / 2 << endl; }
[ "variable_declaration.type.widen.change" ]
747,291
747,292
u406337986
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int n; cin >> n; map<string, int> mp; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } int ans = 0; for (auto &p : mp) { int cnt = p.second; ans += cnt * (cnt - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int main() { int n; cin >> n; 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 cnt = p.second; ans += (ll)cnt * (cnt - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
747,293
747,294
u430209651
cpp
p02947
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using Graph = vector<vector<ll>>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++) #define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--) const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1}; const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1}; const ll MOD = 1000000007; const ll INF = 1000000000000000000L; #ifdef __DEBUG /** * For DEBUG * https://github.com/ta7uw/cpp-pyprint */ #include "cpp-pyprint/pyprint.h" #endif void Main() { int N; cin >> N; vector<string> S(N); rep(i, N) cin >> S[i]; ll ans = 0; map<string, int> counter; rep(i, N) { string s = S[i]; sort(s.begin(), s.end()); counter[s]++; } for (auto &p : counter) { if (p.second > 1) { ans += (p.second - 1) * p.second / 2; } } cout << ans << '\n'; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); Main(); return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using Graph = vector<vector<ll>>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++) #define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--) const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1}; const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1}; const ll MOD = 1000000007; const ll INF = 1000000000000000000L; #ifdef __DEBUG /** * For DEBUG * https://github.com/ta7uw/cpp-pyprint */ #include "cpp-pyprint/pyprint.h" #endif void Main() { int N; cin >> N; vector<string> S(N); rep(i, N) cin >> S[i]; ll ans = 0; map<string, ll> counter; rep(i, N) { string s = S[i]; sort(s.begin(), s.end()); counter[s]++; } for (auto &p : counter) { if (p.second > 1) { ans += (p.second - 1) * p.second / 2; } } cout << ans << '\n'; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); Main(); return 0; }
[]
747,295
747,296
u427344224
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, m, n) for (int i = m; i < (n); i++) #define rrep(i, n, m) for (int i = n; i >= (m); i--) using Graph = vector<vector<int>>; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; const ll MOD = 1000000007; #ifdef __DEBUG #include "cpp-pyprint/pyprint.h" #endif void Main() { int N; cin >> N; vector<string> S(N); rep(i, N) cin >> S[i]; unordered_map<string, int> dic; for (int i = 0; i < N; ++i) { string s = S[i]; sort(s.begin(), s.end()); dic[s] += 1; } ll ans = 0; for (auto p : dic) { if (p.second > 1) { ans += (p.second * (p.second - 1)) / 2; } } cout << ans << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); Main(); }
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, m, n) for (int i = m; i < (n); i++) #define rrep(i, n, m) for (int i = n; i >= (m); i--) using Graph = vector<vector<int>>; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; const ll MOD = 1000000007; #ifdef __DEBUG #include "cpp-pyprint/pyprint.h" #endif void Main() { int N; cin >> N; vector<string> S(N); rep(i, N) cin >> S[i]; unordered_map<string, ll> dic; for (int i = 0; i < N; ++i) { string s = S[i]; sort(s.begin(), s.end()); dic[s] += 1; } ll ans = 0; for (auto p : dic) { if (p.second > 1) { ans += (p.second * (p.second - 1)) / 2; } } cout << ans << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); Main(); }
[]
747,297
747,298
u427344224
cpp
p02947
#include <algorithm> #include <iostream> #include <string> using namespace std; #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { int N; ll ans = 0; cin >> N; map<string, int> nums; rep(i, N) { string s; cin >> s; sort(s.begin(), s.end()); nums[s]++; } for (auto p : nums) { int a = p.second; ans += (ll)(a * (a - 1) / 2); } cout << ans << endl; }
#include <algorithm> #include <iostream> #include <string> using namespace std; #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { int N; ll ans = 0; cin >> N; map<string, int> nums; rep(i, N) { string s; cin >> s; sort(s.begin(), s.end()); nums[s]++; } for (auto p : nums) { int a = p.second; ans += (ll)a * (a - 1) / 2; } cout << ans << endl; }
[ "call.arguments.change" ]
747,301
747,302
u841131859
cpp
p02947
#include <algorithm> #include <iostream> #include <string> using namespace std; #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { int N; ll ans = 0; cin >> N; map<string, int> nums; rep(i, N) { string s; cin >> s; sort(s.begin(), s.end()); nums[s]++; } for (auto p : nums) { int a = p.second; ans += (ll)(a * (a - 1)) / 2; } cout << ans << endl; }
#include <algorithm> #include <iostream> #include <string> using namespace std; #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; int main() { int N; ll ans = 0; cin >> N; map<string, int> nums; rep(i, N) { string s; cin >> s; sort(s.begin(), s.end()); nums[s]++; } for (auto p : nums) { int a = p.second; ans += (ll)a * (a - 1) / 2; } cout << ans << endl; }
[ "call.arguments.change" ]
747,303
747,302
u841131859
cpp
p02947
#include "bits/stdc++.h" using namespace std; void Main() { int n; cin >> n; unordered_map<string, int> cnt; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); cnt[s]++; } long long ans = 0; for (auto it : cnt) { int tmp = it.second; ans += tmp * (tmp - 1) / 2; } cout << ans << endl; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); Main(); return 0; }
#include "bits/stdc++.h" using namespace std; void Main() { int n; cin >> n; unordered_map<string, long long> cnt; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); cnt[s]++; } long long ans = 0; for (auto it : cnt) { long long tmp = it.second; ans += tmp * (tmp - 1) / 2; } cout << ans << endl; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); Main(); return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,304
747,305
u931698099
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rep(i, n) repi(i, 0, n) #define all(x) (x).begin(), (x).end() inline void Main() { // code int n; map<string, int> count; cin >> n; rep(i, n) { string s; cin >> s; sort(all(s)); count[s]++; } long long r = 0; for (const auto &value : count) { if (value.second) { r += (value.second - 1) * value.second / 2; } } cout << r << endl; } int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(20); Main(); return 0; }
#include <bits/stdc++.h> using namespace std; #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rep(i, n) repi(i, 0, n) #define all(x) (x).begin(), (x).end() inline void Main() { // code long long n; map<string, long long> count; cin >> n; rep(i, n) { string s; cin >> s; sort(all(s)); count[s]++; } long long r = 0; for (const auto &value : count) { if (value.second) { r += (value.second - 1) * value.second / 2; } } cout << r << endl; } int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(20); Main(); return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,312
747,313
u979605701
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rep(i, n) repi(i, 0, n) #define all(x) (x).begin(), (x).end() inline void Main() { // code int n; map<string, int> count; cin >> n; rep(i, n) { string s; cin >> s; sort(all(s)); count[s]++; } int r = 0; for (const auto &value : count) { if (value.second) { r += (value.second - 1) * value.second / 2; } } cout << r << endl; } int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(20); Main(); return 0; }
#include <bits/stdc++.h> using namespace std; #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rep(i, n) repi(i, 0, n) #define all(x) (x).begin(), (x).end() inline void Main() { // code long long n; map<string, long long> count; cin >> n; rep(i, n) { string s; cin >> s; sort(all(s)); count[s]++; } long long r = 0; for (const auto &value : count) { if (value.second) { r += (value.second - 1) * value.second / 2; } } cout << r << endl; } int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(20); Main(); return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,314
747,313
u979605701
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> words(n); string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); words.at(i) = s; } sort(words.begin(), words.end()); int cont = 1; long long ans = 0; for (int i = 1; i < n; i++) { if (words.at(i) == words.at(i - 1)) { cont++; } else { ans += cont * (cont - 1) / 2; cont = 1; } } ans += cont * (cont - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> words(n); string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); words.at(i) = s; } sort(words.begin(), words.end()); long long cont = 1; long long ans = 0; for (int i = 1; i < n; i++) { if (words.at(i) == words.at(i - 1)) { cont++; } else { ans += cont * (cont - 1) / 2; cont = 1; } } ans += cont * (cont - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,319
747,320
u771662691
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long ll; int main() { int n; cin >> n; ll ans = 0; unordered_map<string, int> m; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } for (auto &p : m) { int b = p.second; ans += b * (b - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) typedef long long ll; int main() { int n; cin >> n; ll ans = 0; unordered_map<string, int> m; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } for (auto &p : m) { int b = p.second; ans += (ll)b * (b - 1) / 2; } cout << ans << endl; }
[ "type_conversion.add" ]
747,323
747,324
u981304949
cpp
p02947
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { int n; cin >> n; int res = 0; unordered_map<string, int> anagrams; for (int i = 0; i < n; i++) { string temp; cin >> temp; sort(temp.begin(), temp.end()); if (anagrams.find(temp) == anagrams.end()) anagrams[temp] = 0; else anagrams[temp]++; res += anagrams[temp]; } cout << res; }
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { int n; cin >> n; long long res = 0; unordered_map<string, long long> anagrams; for (int i = 0; i < n; i++) { string temp; cin >> temp; sort(temp.begin(), temp.end()); if (anagrams.find(temp) == anagrams.end()) anagrams[temp] = 0; else anagrams[temp]++; res += anagrams[temp]; } cout << res; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,329
747,330
u904019018
cpp
p02947
#include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <vector> using namespace std; typedef long long ll; #define forn(i, n) for (int i = 0; i < int(n); ++i) #define pb push_back #define vi vector<int> #define pll pair<ll, ll> #define pvii pair<vi, int> #define vb vector<bool> #define vvi vector<vi> #define vpll vector<pll> #define vll vector<ll> #define vvll vector<vll> #define sz(x) (int)x.size() #define ff first #define ss second void solve() {} int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ll n; cin >> n; string s; map<string, int> ennui; forn(i, n) { cin >> s; sort(s.begin(), s.end()); ennui[s]++; } int ans = 0; for (auto i : ennui) { for (int j = 1; j <= i.ss - 1; ++j) { ans += j; } } cout << ans; return 0; }
#include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <vector> using namespace std; typedef long long ll; #define forn(i, n) for (int i = 0; i < int(n); ++i) #define pb push_back #define vi vector<int> #define pll pair<ll, ll> #define pvii pair<vi, int> #define vb vector<bool> #define vvi vector<vi> #define vpll vector<pll> #define vll vector<ll> #define vvll vector<vll> #define sz(x) (int)x.size() #define ff first #define ss second void solve() {} int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ll n; cin >> n; string s; map<string, int> ennui; forn(i, n) { cin >> s; sort(s.begin(), s.end()); ennui[s]++; } ll ans = 0; for (auto i : ennui) { for (int j = 1; j <= i.ss - 1; ++j) { ans += j; } } cout << ans; return 0; }
[ "variable_declaration.type.change" ]
747,331
747,332
u629521741
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { using ll = long long; int N; cin >> N; queue<string> q; map<string, int> m; for (int i = 0; i < N; i++) { string S; cin >> S; sort(S.begin(), S.end()); if (m.count(S)) m[S]++; else { m[S] = 1; q.push(S); } } ll count = 0; while (!q.empty()) { for (int i = 0; i < q.size(); i++) { string qf = q.front(); q.pop(); count += m[qf] * (m[qf] - 1) / 2; } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int main() { using ll = long long; int N; cin >> N; queue<string> q; map<string, ll> m; for (int i = 0; i < N; i++) { string S; cin >> S; sort(S.begin(), S.end()); if (m.count(S)) m[S]++; else { m[S] = 1LL; q.push(S); } } ll count = 0; while (!q.empty()) { for (int i = 0; i < q.size(); i++) { string qf = q.front(); q.pop(); count += m[qf] * (m[qf] - 1LL) / 2; } } cout << count << endl; }
[ "literal.number.type.widen.change" ]
747,333
747,334
u136342563
cpp
p02947
#include <algorithm> #include <climits> #include <cmath> #include <cstdlib> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define MOD1097 1000000007 #define ll long long #define pint pair<int, int> #define pll pair<ll, ll> #define pb push_back #define mpair make_pair #define pm(first, second) pb(mpair(first, second)) #define SPACE " " #define fpf first.first #define fps first.second #define spf second.first #define sps second.second #define all(X) (X).begin(), (X).end() #define reall(X) (X).rbegin(), (X).rend() #define divcel(a, b) (((a) + ((b)-1)) / (b)) int main() { int N; cin >> N; string S; map<string, int> mp; for (int i = 0; i < N; i++) { cin >> S; sort(all(S)); mp[S]++; } ll ans = 0; for (auto itr = mp.begin(); itr != mp.end(); itr++) { ans += itr->second * (itr->second - 1) / 2; } cout << ans << endl; return 0; }
#include <algorithm> #include <climits> #include <cmath> #include <cstdlib> #include <ctime> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define MOD1097 1000000007 #define ll long long #define pint pair<int, int> #define pll pair<ll, ll> #define pb push_back #define mpair make_pair #define pm(first, second) pb(mpair(first, second)) #define SPACE " " #define fpf first.first #define fps first.second #define spf second.first #define sps second.second #define all(X) (X).begin(), (X).end() #define reall(X) (X).rbegin(), (X).rend() #define divcel(a, b) (((a) + ((b)-1)) / (b)) int main() { int N; cin >> N; string S; map<string, ll> mp; for (int i = 0; i < N; i++) { cin >> S; sort(all(S)); mp[S]++; } ll ans = 0; for (auto itr = mp.begin(); itr != mp.end(); itr++) { ans += itr->second * (itr->second - 1) / 2; } cout << ans << endl; return 0; }
[]
747,337
747,338
u285598935
cpp
p02947
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> //#include <set> #include <unordered_map> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define max_n 100 int N; string s[100000]; int main() { cin >> N; rep(i, N) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } unordered_map<string, int> mp; // 文字列 → 整数 のハッシュ連想配列 vector<int> Check(1); int now = 0; rep(i, N) { if (mp[s[i]] == 0) { now++; Check.push_back(0); mp[s[i]] = now; } else { Check[mp[s[i]]]++; } } int ans = 0; rep(i, Check.size()) { rep(j, Check[i]) { ans += j + 1; } } cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> //#include <set> #include <unordered_map> using namespace std; #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define max_n 100 int N; string s[100000]; int main() { cin >> N; rep(i, N) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } unordered_map<string, int> mp; // 文字列 → 整数 のハッシュ連想配列 vector<int> Check(1); int now = 0; rep(i, N) { if (mp[s[i]] == 0) { now++; Check.push_back(0); mp[s[i]] = now; } else { Check[mp[s[i]]]++; } } long long ans = 0; rep(i, Check.size()) { rep(j, Check[i]) { ans += j + 1; } } cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,339
747,340
u069033429
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define FAST_IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) typedef long long ll; typedef unsigned int UINT; typedef unsigned long long ull; typedef pair<int, int> pdi; typedef pair<ll, int> pli; map<string, int> mp; int main(void) { FAST_IO; int n; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } ll ans = 0; for (auto &x : mp) { int m = x.second; if (m < 2) continue; ans += m * (m - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define FAST_IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) typedef long long ll; typedef unsigned int UINT; typedef unsigned long long ull; typedef pair<int, int> pdi; typedef pair<ll, int> pli; map<string, int> mp; int main(void) { FAST_IO; int n; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } ll ans = 0; for (auto &x : mp) { ll m = x.second; if (m < 2) continue; ans += m * (m - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
747,341
747,342
u785795721
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> st(n); for (int i = 0; i < n; i++) { cin >> st[i]; sort(st[i].begin(), st[i].end()); } // set<string> setSt; map<string, int> mapSt; for (int i = 0; i < n; i++) { if (!mapSt.empty()) { if (mapSt.find(st[i]) != mapSt.end()) { mapSt[st[i]]++; } else { mapSt.insert({st[i], 1}); } } else { mapSt.insert({st[i], 1}); } } long long int totalcount = 0; for (const auto &i : mapSt) { if (i.second > 1) { totalcount += ((i.second * (i.second - 1)) >> 1); } // cout<<i.second<<endl; } cout << totalcount << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> st(n); for (int i = 0; i < n; i++) { cin >> st[i]; sort(st[i].begin(), st[i].end()); } // set<string> setSt; map<string, long long int> mapSt; for (int i = 0; i < n; i++) { if (!mapSt.empty()) { if (mapSt.find(st[i]) != mapSt.end()) { mapSt[st[i]]++; } else { mapSt.insert({st[i], 1}); } } else { mapSt.insert({st[i], 1}); } } long long int totalcount = 0; for (const auto &i : mapSt) { if (i.second > 1) { totalcount += ((i.second * (i.second - 1)) >> 1); } // cout<<i.second<<endl; } cout << totalcount << endl; return 0; }
[ "variable_declaration.type.widen.change" ]
747,343
747,344
u901408472
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef set<int> si; typedef pair<int, int> pii; #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define per(i, a, b) for (int i = (b)-1; i >= (a); --i) #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define F first #define S second const int INF = 1000000007; const int MOD = (int)1e9 + 7; const long double PI = (acos(-1)); const long double EPS = 0.0000000001; int dy[4] = {-2, -1}; int dx[4] = {-1, -2}; int n; string s; int cnt[26]; map<string, int> record; int main(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // freopen("in.txt", "r", stdin); cin >> n; ll total = 0; rep(i, 0, n) { cin >> s; memset(cnt, 0, sizeof(cnt)); rep(j, 0, 10) { cnt[s[j] - 'a']++; } string key = ""; rep(j, 0, 26) { if (!cnt[j]) { string num = string(1, cnt[j] + '0'); if (cnt[j] == 10) { num = "10"; } char c = j + 'a'; string here = string(1, c) + num; key += here; } } if (record.find(key) != record.end()) { total += record[key]; record[key]++; } else { record[key] = 1; } } cout << total << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef set<int> si; typedef pair<int, int> pii; #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define per(i, a, b) for (int i = (b)-1; i >= (a); --i) #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define F first #define S second const int INF = 1000000007; const int MOD = (int)1e9 + 7; const long double PI = (acos(-1)); const long double EPS = 0.0000000001; int dy[4] = {-2, -1}; int dx[4] = {-1, -2}; int n; string s; int cnt[26]; map<string, ll> record; int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen("in.txt", "r", stdin); cin >> n; ll total = 0; rep(i, 0, n) { cin >> s; memset(cnt, 0, sizeof(cnt)); rep(j, 0, 10) { cnt[s[j] - 'a']++; } string key = ""; rep(j, 0, 26) { if (cnt[j]) { string num = string(1, cnt[j] + '0'); if (cnt[j] == 10) { num = "10"; } char c = j + 'a'; string here = string(1, c) + num; key += here; } } // cout << key << endl; if (record.find(key) != record.end()) { total += record[key]; record[key]++; } else { record[key] = 1; } } cout << total << endl; return 0; }
[ "call.arguments.change", "io.output.change", "expression.operation.unary.logical.remove", "control_flow.branch.if.condition.change" ]
747,345
747,346
u035566695
cpp
p02947
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <vector> using namespace std; int main(void) { int N, count = 0; long long result = 0; scanf("%d", &N); char tmp[11]; vector<string> S(N); queue<long long> q; //入力してソート--O(N) for (int i = 0; i < N; i++) { scanf("%s", tmp); S[i] = tmp; sort(S[i].begin(), S[i].end()); //ソート--O(10log10) } sort(S.begin(), S.end()); //キューに同じ組み合わせの文字列の数を追加--O(N) while (S.size() != 1) { auto itr = S.end() - 1; if (*itr == *(itr - 1)) { count++; } else { if (count != 0) { q.push(count + 1); count = 0; } else count = 0; } S.pop_back(); } if (count != 0) { q.push(count + 1); } //キューに入った組み合わせの計算--O(N) while (!q.empty()) { int num = q.front(); // numC2の計算 result += num * (num - 1) / 2; q.pop(); } cout << result << endl; return 0; }
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <vector> using namespace std; int main(void) { int N, count = 0; long long result = 0; scanf("%d", &N); char tmp[11]; vector<string> S(N); queue<long long> q; //入力してソート--O(N) for (int i = 0; i < N; i++) { scanf("%s", tmp); S[i] = tmp; sort(S[i].begin(), S[i].end()); //ソート--O(10log10) } sort(S.begin(), S.end()); //キューに同じ組み合わせの文字列の数を追加--O(N) while (S.size() != 1) { auto itr = S.end() - 1; if (*itr == *(itr - 1)) { count++; } else { if (count != 0) { q.push(count + 1); count = 0; } else count = 0; } S.pop_back(); } if (count != 0) { q.push(count + 1); } //キューに入った組み合わせの計算--O(N) while (!q.empty()) { long long num = q.front(); // numC2の計算 result += num * (num - 1) / 2; q.pop(); } cout << result << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,347
747,348
u405010758
cpp
p02947
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <vector> using namespace std; int main(void) { int N, count = 0; long long result = 0; scanf("%d", &N); char tmp[11]; vector<string> S(N); queue<int> q; //入力してソート--O(N) for (int i = 0; i < N; i++) { scanf("%s", tmp); S[i] = tmp; sort(S[i].begin(), S[i].end()); //ソート--O(10log10) } sort(S.begin(), S.end()); //キューに同じ組み合わせの文字列の数を追加--O(N) while (S.size() != 1) { auto itr = S.end() - 1; if (*itr == *(itr - 1)) { count++; } else { if (count != 0) { q.push(count + 1); count = 0; } else count = 0; } S.pop_back(); } if (count != 0) { q.push(count + 1); } //キューに入った組み合わせの計算--O(N) while (!q.empty()) { int num = q.front(); // numC2の計算 result += num * (num - 1) / 2; q.pop(); } cout << result << endl; return 0; }
#include <algorithm> #include <cstdio> #include <iostream> #include <queue> #include <vector> using namespace std; int main(void) { int N, count = 0; long long result = 0; scanf("%d", &N); char tmp[11]; vector<string> S(N); queue<long long> q; //入力してソート--O(N) for (int i = 0; i < N; i++) { scanf("%s", tmp); S[i] = tmp; sort(S[i].begin(), S[i].end()); //ソート--O(10log10) } sort(S.begin(), S.end()); //キューに同じ組み合わせの文字列の数を追加--O(N) while (S.size() != 1) { auto itr = S.end() - 1; if (*itr == *(itr - 1)) { count++; } else { if (count != 0) { q.push(count + 1); count = 0; } else count = 0; } S.pop_back(); } if (count != 0) { q.push(count + 1); } //キューに入った組み合わせの計算--O(N) while (!q.empty()) { long long num = q.front(); // numC2の計算 result += num * (num - 1) / 2; q.pop(); } cout << result << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,349
747,348
u405010758
cpp
p02947
#include <iomanip> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <numeric> #include <unordered_map> using namespace std; typedef long long ll; const long double PI = (acos(-1)); const long long MOD = 1000000007; #define rep(i, n) REP(i, 0, n) #define REP(i, x, n) for (int i = x; i < n; ++i) /////////////////////////////////////////////////// // -------------------- I/O -------------------- // /////////////////////////////////////////////////// // https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords template <typename T> void outputVec(const std::vector<T> &vec, const int precision = 0) { if (precision > 0) std::cout << std::fixed << std::setprecision(precision); for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; } std::cout << *(vec.end() - 1) << "\n"; } template <typename T> void outputVal(const T &res, const int precision = 0) { if (precision > 0) std::cout << std::fixed << std::setprecision(precision); std::cout << res << "\n"; } template <typename T> T inputVal() { T a; std::cin >> a; return a; } template <typename T> std::vector<T> inputVec(int N) { std::vector<T> vec(N); for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; } return vec; } template <typename T> void inputVec(std::vector<T> &vec) { for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; } } /////////////////////////////////////////////////// // ------------------- utils ------------------- // /////////////////////////////////////////////////// // change min/max 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; } /////////////////////////////////////////////////// // ------------------- main -------------------- // /////////////////////////////////////////////////// void Main() { //// review const int N = inputVal<int>(); std::unordered_map<std::string, int> mp; rep(i, N) { string sline = inputVal<string>(); std::sort(sline.begin(), sline.end()); auto val = mp.find(sline); if (val != mp.end()) { (*val).second += 1; //!!!! } else { mp[sline] = 1; } } ll cmb = 0; for (auto v : mp) { int nb = v.second; if (nb > 1) { cmb += nb * (nb - 1) / 2; } } outputVal(cmb); } int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout << std::fixed << std::setprecision(15); Main(); return 0; }
#include <iomanip> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <numeric> #include <unordered_map> using namespace std; typedef long long ll; const long double PI = (acos(-1)); const long long MOD = 1000000007; #define rep(i, n) REP(i, 0, n) #define REP(i, x, n) for (int i = x; i < n; ++i) /////////////////////////////////////////////////// // -------------------- I/O -------------------- // /////////////////////////////////////////////////// // https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords template <typename T> void outputVec(const std::vector<T> &vec, const int precision = 0) { if (precision > 0) std::cout << std::fixed << std::setprecision(precision); for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; } std::cout << *(vec.end() - 1) << "\n"; } template <typename T> void outputVal(const T &res, const int precision = 0) { if (precision > 0) std::cout << std::fixed << std::setprecision(precision); std::cout << res << "\n"; } template <typename T> T inputVal() { T a; std::cin >> a; return a; } template <typename T> std::vector<T> inputVec(int N) { std::vector<T> vec(N); for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; } return vec; } template <typename T> void inputVec(std::vector<T> &vec) { for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; } } /////////////////////////////////////////////////// // ------------------- utils ------------------- // /////////////////////////////////////////////////// // change min/max 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; } /////////////////////////////////////////////////// // ------------------- main -------------------- // /////////////////////////////////////////////////// void Main() { //// MY solution // const int N = inputVal<int>(); // std::vector<string> s(N); // rep(i, N) { // string sline = inputVal<string>(); // sort(sline.begin(), sline.end()); // s[i] = sline; //} // sort(s.begin(), s.end()); // ll cnt = 0; // ll cmb = 0; // REP(i, 1, N) { // if (s[i] == s[i - 1]) ++cnt; // else if (cnt == 0) continue; // else { // cmb += (cnt +1) * cnt / 2; // cnt = 0; // } //} // if (cnt != 0) { // cmb += (cnt + 1) * cnt / 2; //} // outputVal(cmb); //// review const int N = inputVal<int>(); std::unordered_map<std::string, ll> mp; rep(i, N) { string sline = inputVal<string>(); std::sort(sline.begin(), sline.end()); auto val = mp.find(sline); if (val != mp.end()) { (*val).second += 1; //!!!! } else { mp[sline] = 1; } } ll cmb = 0; for (auto v : mp) { ll nb = v.second; if (nb > 1) { cmb += nb * (nb - 1) / 2; } } outputVal(cmb); } int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout << std::fixed << std::setprecision(15); Main(); return 0; }
[ "variable_declaration.type.change" ]
747,350
747,351
u542249197
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, a, b) for (int i = a; i < b; ++i) typedef long long ll; //プロトタイプ宣言 int gcd(int, int); int main() { int n, ans = 0; cin >> n; string s; unordered_map<string, int> mp; while (n > 0) { cin >> s; sort(s.begin(), s.end()); ans += mp[s]; mp[s]++; n--; } cout << ans << endl; } //以下、ライブラリ //ユークリッドの互除法 int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, a, b) for (int i = a; i < b; ++i) typedef long long ll; //プロトタイプ宣言 int gcd(int, int); int main() { ll n, ans = 0; cin >> n; string s; map<string, ll> mp; while (n > 0) { cin >> s; sort(s.begin(), s.end()); ans += mp[s]; mp[s]++; n--; } cout << ans << endl; } //以下、ライブラリ //ユークリッドの互除法 int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
[ "variable_declaration.type.change" ]
747,352
747,353
u060965067
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, a, b) for (int i = a; i < b; ++i) typedef long long ll; //プロトタイプ宣言 int gcd(int, int); int main() { int n, ans = 0; cin >> n; string s; unordered_map<string, int> mp; while (n > 0) { cin >> s; sort(s.begin(), s.end()); ans += mp[s]; mp[s]++; n--; } cout << ans << endl; } //以下、ライブラリ //ユークリッドの互除法 int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, a, b) for (int i = a; i < b; ++i) typedef long long ll; //プロトタイプ宣言 int gcd(int, int); int main() { ll n, ans = 0; cin >> n; string s; unordered_map<string, ll> mp; while (n > 0) { cin >> s; sort(s.begin(), s.end()); ans += mp[s]; mp[s]++; n--; } cout << ans << endl; } //以下、ライブラリ //ユークリッドの互除法 int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
[ "variable_declaration.type.change" ]
747,352
747,354
u060965067
cpp
p02947
/**************************************************** * Template for coding contests * * Author : Sanjeev Sharma * * Email : thedevelopersanjeev@gmail.com * *****************************************************/ #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; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; string s; cin >> n; int ans = 0; unordered_map<string, int> mp; while (n--) { cin >> s; sort(s.begin(), s.end()); ans += mp[s]; mp[s]++; } cout << ans; return 0; }
/**************************************************** * Template for coding contests * * Author : Sanjeev Sharma * * Email : thedevelopersanjeev@gmail.com * *****************************************************/ #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; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n; string s; cin >> n; long long ans = 0; unordered_map<string, long long> mp; while (n--) { cin >> s; sort(s.begin(), s.end()); ans += mp[s]; mp[s]++; } cout << ans; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,357
747,358
u752949890
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; unordered_map<string, int> mp; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } long ans = 0; for (auto &p : mp) { ans += (p.second * (p.second - 1)) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; unordered_map<string, long> mp; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } long ans = 0; for (auto &p : mp) { ans += (p.second * (p.second - 1)) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
747,359
747,360
u033627628
cpp
p02947
#include <bits/stdc++.h> #define INF 1e18 #define PI M_PI #define ll long long #define vi vector<int> #define all(v) v.begin(), v.end() #define REP(i, n) for (int i = 0; i < n; i++) #define REPD(i, n) for (int i = n - 1; i >= 0; i--) #define print(x) cout << x << endl; #define debug(x) cout << #x << " = " << endl; using namespace std; void solve() { ll N; cin >> N; string S[N]; map<string, int> memory; REP(i, N) { string x; cin >> x; sort(all(x)); if (!memory.count(x)) memory[x] = 0; else memory[x] += 1; } ll ans = 0; for (auto item : memory) { // print(key << " : " << value); ans += (item.second + 1) * item.second / 2; } print(ans); } int main() { solve(); return 0; }
#include <bits/stdc++.h> #define INF 1e18 #define PI M_PI #define ll long long #define vi vector<int> #define all(v) v.begin(), v.end() #define REP(i, n) for (int i = 0; i < n; i++) #define REPD(i, n) for (int i = n - 1; i >= 0; i--) #define print(x) cout << x << endl; #define debug(x) cout << #x << " = " << endl; using namespace std; void solve() { ll N; cin >> N; string S[N]; map<string, ll> memory; REP(i, N) { string x; cin >> x; sort(all(x)); if (!memory.count(x)) memory[x] = 0; else memory[x] += 1; } ll ans = 0; for (auto item : memory) { // print(key << " : " << value); ans += (item.second + 1) * item.second / 2; } print(ans); } int main() { solve(); return 0; }
[]
747,361
747,362
u929199273
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; // vector<string> strs; string tmp; map<string, int> mp; int ans = 0; for (int i = 0; i < n; i++) { cin >> tmp; sort(tmp.begin(), tmp.end()); ans += mp[tmp]; mp[tmp]++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; // vector<string> strs; string tmp; map<string, int> mp; int64_t ans = 0; for (int i = 0; i < n; i++) { cin >> tmp; sort(tmp.begin(), tmp.end()); ans += mp[tmp]; mp[tmp]++; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
747,365
747,366
u091552241
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } map<string, int> m; set<string> t; for (int i = 0; i < n; i++) { m[s.at(i)]++; t.insert(s.at(i)); } int64_t ans = 0; for (string u : t) { int n = m.at(u); ans += n * (n - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } map<string, int> m; set<string> t; for (int i = 0; i < n; i++) { m[s.at(i)]++; t.insert(s.at(i)); } int64_t ans = 0; for (string u : t) { int64_t n = m.at(u); ans += n * (n - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
747,367
747,368
u482982507
cpp
p02947
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REPR(i, n) for (int i = n - 1; i >= 0; i--) #define INF 1145141919 #define LLINF 1145148101919 #define PI 3.14159265359 int dy[] = {0, 0, 1, -1}; int dx[] = {1, -1, 0, 0}; int ny, nx; typedef long long ll; using namespace std; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll m, ll n) { if ((0 == m) || (0 == n)) return 0; return ((m / gcd(m, n)) * n); } ll llpow(ll x, ll y) { ll ans = 1; REP(i, y) ans *= x; return ans; } int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; } class UnionFind { public: vector<ll> par; // 各元の親を表す配列 vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化) // Constructor UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) { for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } void init(ll sz_) { siz.assign(sz_, 1LL); // assign: 再代入 par.resize(sz_); // resize: 再確保 for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } // Member Function // Find ll root(ll x) { // 根の検索 while (par[x] != x) { x = par[x] = par[par[x]]; // x の親の親を x の親とする } return x; } // Union(Unite, Merge) bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; // merge technique(データ構造をマージするテク.小を大にくっつける) if (siz[x] < siz[y]) swap(x, y); siz[x] += siz[y]; par[y] = x; return true; } bool issame(ll x, ll y) { // 連結判定 return root(x) == root(y); } ll size(ll x) { // 素集合のサイズ return siz[root(x)]; } }; 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; } template <typename Container> bool exist_in(const Container &c, const typename Container::value_type &v) { return (c.end() != std::find(c.begin(), c.end(), v)); } vector<ll> decom; void decompositPrime(ll n) { ll a = 2; while (n >= a * a) { if (n % a == 0) { decom.push_back(a); n /= a; } else { a++; } } decom.push_back(n); } int ctoi_alpha(char c) { if (c >= 'a' && c <= 'z') { return c - 'a'; } return 0; } void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; } // std::cout << std::defaultfloat << std::setprecision(10); //////////////////////////////////////// int main() { int N; cin >> N; 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 ans = 0; for (auto fuck : mp) { ans += fuck.second * (fuck.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define REPR(i, n) for (int i = n - 1; i >= 0; i--) #define INF 1145141919 #define LLINF 1145148101919 #define PI 3.14159265359 int dy[] = {0, 0, 1, -1}; int dx[] = {1, -1, 0, 0}; int ny, nx; typedef long long ll; using namespace std; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll m, ll n) { if ((0 == m) || (0 == n)) return 0; return ((m / gcd(m, n)) * n); } ll llpow(ll x, ll y) { ll ans = 1; REP(i, y) ans *= x; return ans; } int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; } class UnionFind { public: vector<ll> par; // 各元の親を表す配列 vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化) // Constructor UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) { for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } void init(ll sz_) { siz.assign(sz_, 1LL); // assign: 再代入 par.resize(sz_); // resize: 再確保 for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身 } // Member Function // Find ll root(ll x) { // 根の検索 while (par[x] != x) { x = par[x] = par[par[x]]; // x の親の親を x の親とする } return x; } // Union(Unite, Merge) bool merge(ll x, ll y) { x = root(x); y = root(y); if (x == y) return false; // merge technique(データ構造をマージするテク.小を大にくっつける) if (siz[x] < siz[y]) swap(x, y); siz[x] += siz[y]; par[y] = x; return true; } bool issame(ll x, ll y) { // 連結判定 return root(x) == root(y); } ll size(ll x) { // 素集合のサイズ return siz[root(x)]; } }; 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; } template <typename Container> bool exist_in(const Container &c, const typename Container::value_type &v) { return (c.end() != std::find(c.begin(), c.end(), v)); } vector<ll> decom; void decompositPrime(ll n) { ll a = 2; while (n >= a * a) { if (n % a == 0) { decom.push_back(a); n /= a; } else { a++; } } decom.push_back(n); } int ctoi_alpha(char c) { if (c >= 'a' && c <= 'z') { return c - 'a'; } return 0; } void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; } // std::cout << std::defaultfloat << std::setprecision(10); //////////////////////////////////////// int main() { int N; cin >> N; 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 ans = 0; for (auto fuck : mp) { ans += 1ll * fuck.second * (fuck.second - 1) / 2; } cout << ans << endl; return 0; }
[ "assignment.change" ]
747,369
747,370
u811528179
cpp
p02947
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int N = 1e5; const int MOD = 1e9 + 7; const double PI = acos(-1); int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n; cin >> n; map<string, int> st; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); st[s]++; } long long ans = 0; for (auto x : st) ans += x.second * (x.second - 1) / 2; cout << ans; }
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int N = 1e5; const int MOD = 1e9 + 7; const double PI = acos(-1); int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n; cin >> n; map<string, int> st; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); st[s]++; } long long ans = 0; for (auto x : st) ans += 1ll * x.second * (x.second - 1) / 2; cout << ans; }
[ "assignment.change" ]
747,371
747,372
u645588943
cpp
p02947
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int N = 1e5; const int MOD = 1e9 + 7; const double PI = acos(-1); int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n; cin >> n; map<string, int> st; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); st[s]++; } int ans = 0; for (auto x : st) ans += x.second * (x.second - 1) / 2; cout << ans; }
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int N = 1e5; const int MOD = 1e9 + 7; const double PI = acos(-1); int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n; cin >> n; map<string, int> st; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); st[s]++; } long long ans = 0; for (auto x : st) ans += 1ll * x.second * (x.second - 1) / 2; cout << ans; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "assignment.change" ]
747,373
747,372
u645588943
cpp
p02947
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n = 0; cin >> n; vector<string> v(n); rep(i, n) { cin >> v[i]; sort(v[i].begin(), v[i].end()); } sort(v.begin(), v.end()); string tmpstr = v[0]; int ans = 0, tmpint = 0; for (int i = 1; i < n; i++) { if (tmpstr == v[i]) { tmpint++; } else { if (tmpint > 0) { ans += tmpint * (tmpint + 1) / 2; } tmpint = 0; tmpstr = v[i]; } } if (tmpint > 0) { ans += tmpint * (tmpint + 1) / 2; } cout << ans << endl; }
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int n = 0; cin >> n; vector<string> v(n); rep(i, n) { cin >> v[i]; sort(v[i].begin(), v[i].end()); } sort(v.begin(), v.end()); string tmpstr = v[0]; long ans = 0, tmpint = 0; for (int i = 1; i < n; i++) { if (tmpstr == v[i]) { tmpint++; } else { if (tmpint > 0) { ans += tmpint * (tmpint + 1) / 2; } tmpint = 0; tmpstr = v[i]; } } if (tmpint > 0) { ans += tmpint * (tmpint + 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
747,378
747,379
u154833883
cpp
p02947
#include <bits/stdc++.h> using namespace std; int n; string s[100010]; map<string, int> cnt; void solve() { int ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); // cout<<s[i]<<endl; ans += cnt[s[i]]; cnt[s[i]] += 1; } cout << ans << endl; } signed main() { // while(1) solve(); }
#include <bits/stdc++.h> using namespace std; int n; string s[100010]; map<string, int> cnt; void solve() { long long ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); // cout<<s[i]<<endl; ans += cnt[s[i]]; cnt[s[i]] += 1; } cout << ans << endl; } signed main() { // while(1) solve(); }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,380
747,381
u134181243
cpp
p02947
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<string> vs; long long n; string s; cin >> n; cin.ignore(); for (long long i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); vs.push_back(s); } sort(vs.begin(), vs.end()); long long sz = vs.size(); long long i, j, sum = 0; for (i = 0; i < sz;) { long long temp = 0; for (j = i; j < sz && vs[j] == vs[i]; j++) ; temp = (j - i) * (j - i - 1) / 2; i += j; //~ temp = (j-i)*(j-i-1)/2; sum += temp; } cout << sum << endl; }
#include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<string> vs; long long n; string s; cin >> n; cin.ignore(); for (long long i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); vs.push_back(s); } sort(vs.begin(), vs.end()); long long sz = vs.size(); long long i, j, sum = 0; for (i = 0; i < sz;) { long long temp = 0; for (j = i; j < sz && vs[j] == vs[i]; j++) ; temp = (j - i) * (j - i - 1) / 2; i = j; //~ temp = (j-i)*(j-i-1)/2; sum += temp; } cout << sum << endl; }
[ "assignment.value.change" ]
747,382
747,383
u116018262
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 - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) using namespace std; int main() { int n; cin >> n; long long ans = 0; string s[n]; map<string, int> m; REP(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); m[s[i]] += 1; } for (auto P : m) { ans += P.second * (P.second - 1) / 2; } cout << ans; 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 - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) using namespace std; int main() { int n; cin >> n; long long ans = 0; string s[n]; map<string, int> m; REP(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); m[s[i]] += 1; } for (auto P : m) { ans += (long long)P.second * (P.second - 1) / 2; } cout << ans; return 0; }
[ "type_conversion.add" ]
747,389
747,390
u809690311
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 - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) using namespace std; int main() { int n; cin >> n; long ans = 0; string s[n]; map<string, int> m; REP(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); m[s[i]] += 1; } for (auto P : m) { ans += P.second * (P.second - 1) / 2; } cout << ans; 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 - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) using namespace std; int main() { int n; cin >> n; long long ans = 0; string s[n]; map<string, int> m; REP(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); m[s[i]] += 1; } for (auto P : m) { ans += (long long)P.second * (P.second - 1) / 2; } cout << ans; return 0; }
[ "variable_declaration.type.widen.change" ]
747,391
747,390
u809690311
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) const int INF = 100100100; using namespace std; int main() { int N; string s; long long res = 0; cin >> N; unordered_map<string, int> map; rep(i, N) { cin >> s; sort(s.begin(), s.end()); if (map.find(s) != map.end()) { map[s]++; } else { map[s] = 1; } } for (auto itr = map.begin(); itr != map.end(); ++itr) { int num = itr->second; if (num > 1) res += num * (num - 1) / 2; } cout << res << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) const int INF = 100100100; using namespace std; int main() { int N; string s; long long res = 0; cin >> N; unordered_map<string, int> map; rep(i, N) { cin >> s; sort(s.begin(), s.end()); if (map.find(s) != map.end()) { map[s]++; } else { map[s] = 1; } } for (auto itr = map.begin(); itr != map.end(); ++itr) { long long num = itr->second; if (num > 1) res += num * (num - 1) / 2; } cout << res << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,392
747,393
u411427373
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, N) for (int i = 0; i < (int)N; i++) const ll MOD = pow(10, 9) + 7; const ll LLINF = pow(2, 61) - 1; const int INF = pow(2, 30) - 1; int main() { int N; cin >> N; map<string, int> ana; rep(i, N) { string s; cin >> s; char tmp[10]; rep(j, 10) tmp[j] = s[j]; sort(tmp, tmp + 10); string ss = ""; rep(j, 10) ss += tmp[j]; ana[ss]++; // cout << ss << endl; } ll result = 0; for (auto x : ana) result += x.second * (x.second - 1) / 2; cout << result << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, N) for (int i = 0; i < (int)N; i++) const ll MOD = pow(10, 9) + 7; const ll LLINF = pow(2, 61) - 1; const int INF = pow(2, 30) - 1; int main() { int N; cin >> N; map<string, ll> ana; rep(i, N) { string s; cin >> s; char tmp[10]; rep(j, 10) tmp[j] = s[j]; sort(tmp, tmp + 10); string ss = ""; rep(j, 10) ss += tmp[j]; ana[ss]++; // cout << ss << endl; } ll result = 0; for (auto x : ana) result += x.second * (x.second - 1) / 2; cout << result << endl; return 0; }
[]
747,394
747,395
u680707192
cpp
p02947
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #define rep(i, n) rep2(i, 0, n) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define PI acos(-1); typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<string> fs(n); int ans = 0; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); fs.at(i) = s; } sort(fs.begin(), fs.end()); int count = 1; string now = fs[0]; rep2(i, 1, n) { if (fs[i] != now) { count = 1; now = fs[i]; } else ++count; ans += count - 1; } cout << ans << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #define rep(i, n) rep2(i, 0, n) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define PI acos(-1); typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<string> fs(n); ll ans = 0; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); fs.at(i) = s; } sort(fs.begin(), fs.end()); int count = 1; string now = fs[0]; rep2(i, 1, n) { if (fs[i] != now) { count = 1; now = fs[i]; } else ++count; ans += count - 1; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,396
747,397
u661738979
cpp
p02947
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #define rep(i, n) rep2(i, 0, n) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define PI acos(-1); typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<string> fs(n); int ans = 0; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); fs.at(i) = s; } sort(fs.begin(), fs.end()); int count = 1; string now = fs[0]; rep2(i, 1, n) { if (fs[i] != now) { count = 1; now = fs[i]; } else { ++count; ans += count - 1; } } cout << ans << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #define rep(i, n) rep2(i, 0, n) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define PI acos(-1); typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<string> fs(n); ll ans = 0; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); fs.at(i) = s; } sort(fs.begin(), fs.end()); int count = 1; string now = fs[0]; rep2(i, 1, n) { if (fs[i] != now) { count = 1; now = fs[i]; } else ++count; ans += count - 1; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,398
747,397
u661738979
cpp
p02947
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #define rep(i, n) rep2(i, 0, n) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define PI acos(-1); typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<string> fs(n); int ans = 0; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); fs.at(i) = s; } sort(fs.begin(), fs.end()); int count = 1; string now = fs[0]; rep2(i, 1, n) { if (fs[i] != now) { count = 1; now = fs[i]; } else ++count; ans += count - 1; } cout << ans << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #define rep(i, n) rep2(i, 0, n) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define PI acos(-1); typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<string> fs(n); ll ans = 0; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); fs.at(i) = s; } sort(fs.begin(), fs.end()); ll count = 1; string now = fs[0]; rep2(i, 1, n) { if (fs[i] != now) { count = 1; now = fs[i]; } else ++count; ans += count - 1; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,396
747,399
u661738979
cpp
p02947
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #define rep(i, n) rep2(i, 0, n) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define PI acos(-1); typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<string> fs(n); int ans = 0; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); fs.at(i) = s; } sort(fs.begin(), fs.end()); int count = 1; string now = fs[0]; rep2(i, 1, n) { if (fs[i] != now) { count = 1; now = fs[i]; } else { ++count; ans += count - 1; } } cout << ans << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <tuple> #include <vector> #define rep(i, n) rep2(i, 0, n) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define PI acos(-1); typedef long long ll; using namespace std; int main() { int n; cin >> n; vector<string> fs(n); ll ans = 0; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); fs.at(i) = s; } sort(fs.begin(), fs.end()); ll count = 1; string now = fs[0]; rep2(i, 1, n) { if (fs[i] != now) { count = 1; now = fs[i]; } else ++count; ans += count - 1; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,398
747,399
u661738979
cpp
p02947
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int N; int count = 0; int result = 0; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); for (int i = 1; i < N; i++) { if (s[i - 1] == s[i]) { count++; } else { result += (count * (count + 1)) / 2; count = 0; } if (i == N - 1) { result += (count * (count + 1)) / 2; } } cout << result; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int N; long long count = 0; long long result = 0; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); for (int i = 1; i < N; i++) { if (s[i - 1] == s[i]) { count++; } else { result += (count * (count + 1)) / 2; count = 0; } if (i == (N - 1)) { result += (count * (count + 1)) / 2; } } cout << result; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "control_flow.branch.if.condition.change" ]
747,400
747,401
u890183645
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); int co = 0; int sum = 0; for (int i = 1; i < N; i++) { if (s.at(i) == s.at(i - 1)) { co++; } else { sum += (co * (co + 1) / 2); co = 0; } if (i == N - 1) { sum += (co * (co + 1) / 2); } } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); long long co = 0; long long sum = 0; for (int i = 1; i < N; i++) { if (s.at(i) == s.at(i - 1)) { co++; } else { sum += (co * (co + 1) / 2); co = 0; } if (i == N - 1) { sum += (co * (co + 1) / 2); } } cout << sum << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,402
747,403
u830237447
cpp
p02947
#define _USE_MATH_DEFINES #include <algorithm> #include <array> #include <iostream> #include <map> #include <vector> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) #define fore(i, a, b) for (int i = (int)a; i < (int)b; i++) #define fr(i, a, b) for (int i = (int)a - 1; i >= (int)b; i--) #define inf INT32_MAX #define N 200005 #define mod 1000000000 + 7 using namespace std; typedef long long ll; typedef pair<int, int> pr; inline void solve() { int n; cin >> n; vector<vector<int>> arr(n); fore(i, 0, n) { string s; cin >> s; fore(j, 0, s.size()) arr[i].push_back(s[j] - 'a'); sort(arr[i].begin(), arr[i].end()); } map<vector<int>, int> mp; fore(i, 0, n) { mp[arr[i]]++; } ll otv = 0; for (pair<vector<int>, int> x : mp) { otv += (x.second * (x.second - 1)) / 2; } cout << otv; } int main() { fast; solve(); return 0; }
#define _USE_MATH_DEFINES #include <algorithm> #include <array> #include <iostream> #include <map> #include <vector> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) #define fore(i, a, b) for (int i = (int)a; i < (int)b; i++) #define fr(i, a, b) for (int i = (int)a - 1; i >= (int)b; i--) #define inf INT32_MAX #define N 200005 #define mod 1000000000 + 7 using namespace std; typedef long long ll; typedef pair<int, int> pr; inline void solve() { int n; cin >> n; vector<vector<ll>> arr(n); fore(i, 0, n) { string s; cin >> s; fore(j, 0, s.size()) arr[i].push_back(s[j] - 'a'); sort(arr[i].begin(), arr[i].end()); } map<vector<ll>, ll> mp; fore(i, 0, n) { mp[arr[i]]++; } ll otv = 0; for (pair<vector<ll>, ll> x : mp) { otv += (x.second * (x.second - 1)) / 2; } cout << otv; } int main() { fast; solve(); return 0; }
[]
747,410
747,411
u542486952
cpp
p02947
#include <bits/stdc++.h> #define i_love_u_Phuong \ ios_base::sync_with_stdio(0); \ cin.tie(0); using ll = long long; using namespace std; const ll mod = 1e9 + 7; ll lt(ll x, ll y) {} int main() { #ifndef RICARDO // freopen("input.txt", "r", stdin); #endif // ONLINE_JUDGE i_love_u_Phuong; map<string, int> mp; int n; cin >> n; vector<string> a; for (int i = 0; i < n; ++i) { string st; cin >> st; sort(st.begin(), st.end()); if (mp[st] == 0) a.push_back(st); mp[st]++; } int ans = 0; for (int i = 0; i < a.size(); ++i) { int id = mp[a[i]]; ans += (id * (id - 1)) >> 1; } cout << ans; return 0; }
#include <bits/stdc++.h> #define i_love_u_Phuong \ ios_base::sync_with_stdio(0); \ cin.tie(0); using ll = long long; using namespace std; const ll mod = 1e9 + 7; ll lt(ll x, ll y) {} int main() { #ifndef RICARDO // freopen("input.txt", "r", stdin); #endif // ONLINE_JUDGE i_love_u_Phuong; map<string, int> mp; int n; cin >> n; vector<string> a; for (int i = 0; i < n; ++i) { string st; cin >> st; sort(st.begin(), st.end()); if (mp[st] == 0) a.push_back(st); mp[st]++; } ll ans = 0; for (int i = 0; i < a.size(); ++i) { ll id = mp[a[i]]; ans += (id * (id - 1)) >> 1; } cout << ans; return 0; }
[ "variable_declaration.type.change" ]
747,412
747,413
u624463308
cpp
p02947
#include <bits/stdc++.h> using namespace std; long long N; map<string, int> str_count; int main() { cin >> N; for (long long i = 0; i < N; i++) { string s; cin >> s; vector<char> tmp; for (int j = 0; j < s.size(); j++) { tmp.push_back(s[j]); } sort(tmp.begin(), tmp.end()); string sorted = ""; for (int j = 0; j < tmp.size(); j++) { sorted += tmp[j]; } str_count[sorted]++; } long long ans = 0; for (auto i = str_count.begin(); i != str_count.end(); ++i) { if (i->second > 1) { ans += (i->second) * (i->second - 1) / 2; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long long N; map<string, long long> str_count; int main() { cin >> N; for (long long i = 0; i < N; i++) { string s; cin >> s; vector<char> tmp; for (int j = 0; j < s.size(); j++) { tmp.push_back(s[j]); } sort(tmp.begin(), tmp.end()); string sorted = ""; for (int j = 0; j < tmp.size(); j++) { sorted += tmp[j]; } str_count[sorted]++; } long long ans = 0; for (auto i = str_count.begin(); i != str_count.end(); ++i) { if (i->second > 1) { ans += (i->second) * (i->second - 1) / 2; } } cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,414
747,415
u920254817
cpp
p02947
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef unsigned int uint; typedef long long ll; // typedef pair<int, int> P; const int INF = 111111111; const ll LLINF = 1e17 + 1; const int DX[9] = {0, 0, 1, -1, 1, 1, -1, -1, 0}; // 4;4近傍 const int DY[9] = {1, -1, 0, 0, 1, -1, 1, -1, 0}; // 8:8近傍 9:(0,0)を含む const int DIV = 1000000007; // 10^9 + 7 const double PI = 3.14159265358979323846264338327950288; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(15); int N; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++) { cin >> S[i]; sort(S[i].begin(), S[i].end()); } sort(S.begin(), S.end()); ll ans = 0; for (int i = 0; i < N - 1;) { int temp = 0; for (int j = i + 1; j < N; j++) { if (S[i] == S[j]) { temp++; } else { ans += (temp + 1) * temp / 2; i = j; break; } if (j = N - 1) { ans += (temp + 1) * temp / 2; i = j; } } } cout << ans; }
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef unsigned int uint; typedef long long ll; // typedef pair<int, int> P; const int INF = 111111111; const ll LLINF = 1e17 + 1; const int DX[9] = {0, 0, 1, -1, 1, 1, -1, -1, 0}; // 4;4近傍 const int DY[9] = {1, -1, 0, 0, 1, -1, 1, -1, 0}; // 8:8近傍 9:(0,0)を含む const int DIV = 1000000007; // 10^9 + 7 const double PI = 3.14159265358979323846264338327950288; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(15); int N; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++) { cin >> S[i]; sort(S[i].begin(), S[i].end()); } sort(S.begin(), S.end()); ll ans = 0; for (int i = 0; i < N - 1;) { ll temp = 0; for (int j = i + 1; j < N; j++) { if (S[i] == S[j]) { temp++; } else { ans += ((temp + 1) * temp) / 2; i = j; break; } if (j == N - 1) { ans += ((temp + 1) * temp) / 2; i = j; } } } cout << ans; }
[ "variable_declaration.type.change", "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
747,421
747,422
u433195318
cpp
p02947
#include <bits/stdc++.h> using namespace std; long long hh(int n) { int ans; if (n == 1) return 0; return ans = hh(n - 1) + n - 1; } int main() { int n; cin >> n; vector<string> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; sort(a[i].begin(), a[i].end()); } sort(a.begin(), a.end()); a.push_back("####"); long long ans = 0; int cut = 1; for (int i = 0; i < n; i++) { if (a[i] == a[i + 1]) { cut++; } else if (a[i] != a[i + 1]) { ans += hh(cut); cut = 1; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long long hh(int n) { if (n == 1) return 0; return hh(n - 1) + n - 1; } int main() { int n; cin >> n; vector<string> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; sort(a[i].begin(), a[i].end()); } sort(a.begin(), a.end()); a.push_back("####"); long long ans = 0; int cut = 1; for (int i = 0; i < n; i++) { if (a[i] == a[i + 1]) { cut++; } else if (a[i] != a[i + 1]) { ans += hh(cut); cut = 1; } } cout << ans << endl; }
[ "variable_declaration.remove", "assignment.change" ]
747,430
747,431
u103850114
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define what_is(x) cerr << #x << " is " << x << endl; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define st first #define nd second #define endl '\n' typedef long long ll; typedef pair<int, int> pii; const int N = 1e5 + 5; const int INF = 1e9; const int MOD = 1e9 + 7; int n; string s[N]; int main() { IOS // freopen("input.txt", "r", stdin); cin >> n; for (int i = 0; i < n; i++) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); s[i] = tmp; } ll ans = 0; sort(s, s + n); for (int i = 0; i < n; i++) cerr << s[i] << endl; int cnt = 1; s[n] = "CC"; for (int i = 1; i <= n; i++) { if (s[i] != s[i - 1]) { ans += cnt * (cnt - 1) / 2; cnt = 1; } else cnt++; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define what_is(x) cerr << #x << " is " << x << endl; #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); #define st first #define nd second #define endl '\n' typedef long long ll; typedef pair<int, int> pii; const int N = 1e5 + 5; const int INF = 1e9; const int MOD = 1e9 + 7; int n; string s[N]; int main() { IOS // freopen("input.txt", "r", stdin); cin >> n; for (int i = 0; i < n; i++) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); s[i] = tmp; } ll ans = 0; sort(s, s + n); for (int i = 0; i < n; i++) cerr << s[i] << endl; int cnt = 1; s[n] = "CC"; for (int i = 1; i <= n; i++) { if (s[i] != s[i - 1]) { ans += 1LL * cnt * (cnt - 1) / 2; cnt = 1; } else cnt++; } cout << ans << endl; return 0; }
[ "assignment.change" ]
747,434
747,435
u411771230
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { map<string, int> ma; int n, aw; aw = 0; string a; cin >> n; for (int i = 0; i < n; i++) { cin >> a; sort(a.begin(), a.end()); aw += ma[a]; ma[a]++; } cout << aw << endl; }
#include <bits/stdc++.h> using namespace std; int main() { map<string, int> ma; int n; long long aw = 0; string a; cin >> n; for (int i = 0; i < n; i++) { cin >> a; sort(a.begin(), a.end()); aw += ma[a]; ma[a]++; } cout << aw << endl; }
[ "variable_declaration.remove" ]
747,436
747,437
u121538479
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i <= n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define VSORTR(v) sort(v.rbegin(), v.rend()); #define ALL(v) (v).begin(), (v).end() using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; using P = pair<ll, ll>; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector<string> s(n); REP(i, n) { cin >> s[i]; VSORT(s[i]); } map<string, int> mp; REP(i, n) { mp[s[i]]++; } ll res = 0; for (auto v : mp) { ll tmp = v.second * (v.second - 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 < n; i++) #define REPR(i, n) for (int i = n - 1; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i <= n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define VSORTR(v) sort(v.rbegin(), v.rend()); #define ALL(v) (v).begin(), (v).end() using ll = long long; using vll = vector<ll>; using vvll = vector<vector<ll>>; using P = pair<ll, ll>; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector<string> s(n); REP(i, n) { cin >> s[i]; VSORT(s[i]); } map<string, ll> mp; REP(i, n) { mp[s[i]]++; } ll res = 0; for (auto v : mp) { ll tmp = v.second * (v.second - 1) / 2; res += tmp; } cout << res << endl; return 0; }
[]
747,440
747,441
u986276444
cpp
p02947
#include <bits/stdc++.h> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long lint; int main() { map<string, int> ans; int n; cin >> n; rep(i, n) { char s[11]; scanf("%s", s); vector<char> moji; rep(j, 10) { moji.push_back(s[j]); } sort(moji.begin(), moji.end()); string ss = ""; for (int j = 0; j < moji.size(); j++) { ss += moji[j]; } ans[ss] += 1; } lint lans = 0; map<string, int>::iterator itr = ans.begin(); for (map<string, int>::iterator k = itr; k != ans.end(); k++) { if (k->second > 1) { lans += (lint)((k->second) * (k->second - 1) / 2); } } printf("%lld", lans); return 0; }
#include <bits/stdc++.h> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) typedef long long lint; int main() { map<string, lint> ans; int n; cin >> n; rep(i, n) { char s[11]; scanf("%s", s); vector<char> moji; rep(j, 10) { moji.push_back(s[j]); } sort(moji.begin(), moji.end()); string ss = ""; for (int j = 0; j < moji.size(); j++) { ss += moji[j]; } ans[ss] += 1; } lint lans = 0; map<string, lint>::iterator itr = ans.begin(); for (map<string, lint>::iterator k = itr; k != ans.end(); k++) { if (k->second > 1) { lans += (lint)((k->second) * (k->second - 1) / 2); } } printf("%lld", lans); return 0; }
[ "control_flow.loop.for.initializer.change" ]
747,442
747,443
u239102032
cpp
p02947
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a, b) memset((a), (b), sizeof(a)) const LL INF = 1e9 + 7; const int N = 2e5 + 10; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); LL ans = 0; int n; cin >> n; map<string, int> ms; while (n--) { string str; cin >> str; sort(str.begin(), str.end()); ans += ms[str]; } cout << ans << endl; return 0; }
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a, b) memset((a), (b), sizeof(a)) const LL INF = 1e9 + 7; const int N = 2e5 + 10; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); LL ans = 0; int n; cin >> n; map<string, int> ms; while (n--) { string str; cin >> str; sort(str.begin(), str.end()); ans += ms[str]++; } cout << ans << endl; return 0; }
[]
747,444
747,445
u861345985
cpp
p02947
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; long long MOD = 1e9 + 7; constexpr ll INF = 1e17; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; unordered_map<string, int> hashMap; int ans = 0; for (int i = 0; i < n; i++) { string s; cin >> s; std::sort(s.begin(), s.end()); hashMap[s]++; } for (const auto &e : hashMap) { ans += e.second * (e.second - 1) / 2; } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; long long MOD = 1e9 + 7; constexpr ll INF = 1e17; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; map<string, ll> hashMap; ll ans = 0; for (int i = 0; i < n; i++) { string s; cin >> s; std::sort(s.begin(), s.end()); hashMap[s]++; } for (const auto &e : hashMap) { ans += e.second * (e.second - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
747,446
747,447
u868702169
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < n; i++) int main() { // vector<int> a(n); sort(a.begin(),a.end()); // cout << "test" << "\n"; cin.tie(0); ios::sync_with_stdio(false); // string ans="YES"; ll ans = 0; ll n; cin >> n; vector<string> a(n); rep(i, n) { cin >> a[i]; sort(a[i].begin(), a[i].end()); } sort(a.begin(), a.end()); int m = 1; // memo rep(i, n - 1) { if (a[i] == a[i + 1]) m++; else { ll c = m * (m - 1) / 2; ans += c; // cout << c << " " << i << endl; m = 1; } } ll c = m * (m - 1) / 2; ans += c; cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < n; i++) int main() { // vector<int> a(n); sort(a.begin(),a.end()); // cout << "test" << "\n"; cin.tie(0); ios::sync_with_stdio(false); // string ans="YES"; ll ans = 0; ll n; cin >> n; vector<string> a(n); rep(i, n) { cin >> a[i]; sort(a[i].begin(), a[i].end()); } sort(a.begin(), a.end()); ll m = 1; // memo rep(i, n - 1) { if (a[i] == a[i + 1]) m++; else { ll c = m * (m - 1) / 2; ans += c; // cout << c << " " << i << endl; m = 1; } } ll c = m * (m - 1) / 2; ans += c; cout << ans << "\n"; return 0; }
[ "variable_declaration.type.change" ]
747,450
747,451
u429911069
cpp
p02947
#include <bits/stdc++.h> using namespace std; int a(int x) { int n = 1; for (int i = x; i > x - 2; --i) { n *= i; } return n / 2; } 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 int count = 0; for (int i = 0; i < n; ++i) { long long int c = 0; for (int j = i; j < n; ++j) { if (s[i] == s[j]) ++c; else break; } count += a(c); i += c - 1; } cout << count << endl; return 0; }
#include <bits/stdc++.h> using namespace std; long int a(long int x) { long int n = 1; for (long int i = x; i > x - 2; --i) { n *= i; } return n / 2; } 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 int count = 0; for (int i = 0; i < n; ++i) { long int c = 0; for (int j = i; j < n; ++j) { if (s[i] == s[j]) ++c; else break; } count += a(c); i += c - 1; } cout << count << endl; return 0; }
[ "variable_declaration.type.widen.change", "variable_declaration.type.narrow.change" ]
747,456
747,457
u561007032
cpp
p02947
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; int main() { ll n, count = 0; string s; cin >> n; map<string, int> m; r(i, n) { cin >> s; sort(s.begin(), s.end()); m[s]++; } for (auto it = m.begin(); it != m.end(); it++) { if ((*it).second > 1) { count += (*it).second * ((*it).second - 1) / 2; } } cout << count << endl; }
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; int main() { ll n, count = 0; string s; cin >> n; map<string, ll> m; r(i, n) { cin >> s; sort(s.begin(), s.end()); m[s]++; } for (auto it = m.begin(); it != m.end(); it++) { if ((*it).second > 1) { count += (*it).second * ((*it).second - 1) / 2; } } cout << count << endl; }
[]
747,460
747,461
u192280767
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int N; cin >> N; map<string, int> mp; rep(i, N) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } int64_t ans = 0; for (auto v : mp) { if (v.second == 1) continue; ans += v.second * (v.second - 1) / 2; } cout << ans << endl; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int N; cin >> N; map<string, int> mp; rep(i, N) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } int64_t ans = 0; for (auto v : mp) { if (v.second == 1) continue; ans += (int64_t)v.second * (v.second - 1) / 2; } cout << ans << endl; }
[ "type_conversion.add" ]
747,462
747,463
u747087681
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> int main() { int n; std::cin >> n; std::map<std::string, int> m; int ans = 0; for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; std::sort(s.begin(), s.end()); ans += m[s]; ++m[s]; } std::cout << ans << std::endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <string> int main() { int n; std::cin >> n; std::map<std::string, int> m; long long ans = 0; for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; std::sort(s.begin(), s.end()); ans += m[s]; ++m[s]; } std::cout << ans << std::endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,464
747,465
u074059053
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using lint = long long; /* bool checkAnagram(string str1, string str2) { int alp1[26] = {0}; int alp2[26] = {0}; for(int i = 0; i < str1.size(); i++){ alp1[str1[i]-'a']++; alp2[str2[i]-'a']++; } bool flag = true; for(int i = 0; i < 26; i++){ if(alp) } } */ lint comb(lint n, lint r) { int num = 1; if (n < r) return 0; for (int i = 1; i <= r; i++) { num = num * (n - i + 1) / i; } return num; } int main(void) { int N; cin >> N; vector<vector<char>> vch(N, vector<char>(10)); rep(i, N) rep(j, 10) cin >> vch[i][j]; vector<string> vstr(N); rep(i, N) { sort(vch[i].begin(), vch[i].end()); string str(vch[i].begin(), vch[i].end()); vstr[i] = str; } sort(vstr.begin(), vstr.end()); lint ans = 0; lint cnt = 0; vstr.push_back(""); for (int i = 0; i < N; i++) { cnt++; if (vstr[i + 1] != vstr[i]) { ans += comb(cnt, 2); cnt = 0; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using lint = unsigned long long; /* bool checkAnagram(string str1, string str2) { int alp1[26] = {0}; int alp2[26] = {0}; for(int i = 0; i < str1.size(); i++){ alp1[str1[i]-'a']++; alp2[str2[i]-'a']++; } bool flag = true; for(int i = 0; i < 26; i++){ if(alp) } } */ lint comb(lint n, lint r) { lint num = 1; if (n < r) return 0; for (lint i = 1; i <= r; i++) { num = num * (n - i + 1) / i; } return num; } int main(void) { int N; cin >> N; vector<vector<char>> vch(N, vector<char>(10)); rep(i, N) rep(j, 10) cin >> vch[i][j]; vector<string> vstr(N); rep(i, N) { sort(vch[i].begin(), vch[i].end()); string str(vch[i].begin(), vch[i].end()); vstr[i] = str; } sort(vstr.begin(), vstr.end()); lint ans = 0; lint cnt = 0; vstr.push_back(""); for (int i = 0; i < N; i++) { cnt++; if (vstr[i + 1] != vstr[i]) { ans += comb(cnt, 2); cnt = 0; } } cout << ans << endl; return 0; }
[ "variable_declaration.type.widen.change", "variable_declaration.type.change", "control_flow.loop.for.initializer.change" ]
747,469
747,470
u104741254
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using lint = long long; /* bool checkAnagram(string str1, string str2) { int alp1[26] = {0}; int alp2[26] = {0}; for(int i = 0; i < str1.size(); i++){ alp1[str1[i]-'a']++; alp2[str2[i]-'a']++; } bool flag = true; for(int i = 0; i < 26; i++){ if(alp) } } */ lint comb(lint n, lint r) { int num = 1; if (n < r) return 0; for (int i = 1; i <= r; i++) { num = num * (n - i + 1) / i; } return num; } int main(void) { int N; cin >> N; vector<vector<char>> vch(N, vector<char>(10)); rep(i, N) rep(j, 10) cin >> vch[i][j]; vector<string> vstr(N); rep(i, N) { sort(vch[i].begin(), vch[i].end()); string str(vch[i].begin(), vch[i].end()); vstr[i] = str; } sort(vstr.begin(), vstr.end()); lint ans = 0; int cnt = 0; vstr.push_back(""); for (int i = 0; i < N; i++) { cnt++; if (vstr[i + 1] != vstr[i]) { ans += comb(cnt, 2); cnt = 0; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using lint = unsigned long long; /* bool checkAnagram(string str1, string str2) { int alp1[26] = {0}; int alp2[26] = {0}; for(int i = 0; i < str1.size(); i++){ alp1[str1[i]-'a']++; alp2[str2[i]-'a']++; } bool flag = true; for(int i = 0; i < 26; i++){ if(alp) } } */ lint comb(lint n, lint r) { lint num = 1; if (n < r) return 0; for (lint i = 1; i <= r; i++) { num = num * (n - i + 1) / i; } return num; } int main(void) { int N; cin >> N; vector<vector<char>> vch(N, vector<char>(10)); rep(i, N) rep(j, 10) cin >> vch[i][j]; vector<string> vstr(N); rep(i, N) { sort(vch[i].begin(), vch[i].end()); string str(vch[i].begin(), vch[i].end()); vstr[i] = str; } sort(vstr.begin(), vstr.end()); lint ans = 0; lint cnt = 0; vstr.push_back(""); for (int i = 0; i < N; i++) { cnt++; if (vstr[i + 1] != vstr[i]) { ans += comb(cnt, 2); cnt = 0; } } cout << ans << endl; return 0; }
[ "variable_declaration.type.widen.change", "variable_declaration.type.change", "control_flow.loop.for.initializer.change" ]
747,471
747,470
u104741254
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long 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()); long long int ans = 0; long long int count = 0; for (int i = 0; i < N - 1; i++) { if (s[i] == s[i + 1]) { count++; } else { ans = ans + ((count * (count - 1)) / 2); count = 0; } } ans = ans + ((count * (count - 1)) / 2); cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long 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()); long long int ans = 0; long long int count = 1; for (int i = 0; i < N - 1; i++) { if (s[i] == s[i + 1]) { count++; } else { ans = ans + ((count * (count - 1)) / 2); count = 1; } } ans = ans + ((count * (count - 1)) / 2); cout << ans; return 0; }
[ "literal.number.change", "variable_declaration.value.change", "assignment.value.change" ]
747,472
747,473
u231455327
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; string p; vector<string> vec(a); for (int i = 0; i < a; i++) { cin >> p; sort(p.begin(), p.end()); vec.at(i) = p; } sort(vec.begin(), vec.end()); int y = 1; long long int answer = 0; for (int i = 0; i < a; i++) { if (i == a - 1) { answer += (y * (y - 1)) / 2; break; } if (vec.at(i) == vec.at(i + 1)) { y++; } if (vec.at(i) != vec.at(i + 1)) { answer += (y * (y - 1)) / 2; y = 1; } } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; string p; vector<string> vec(a); for (int i = 0; i < a; i++) { cin >> p; sort(p.begin(), p.end()); vec.at(i) = p; } sort(vec.begin(), vec.end()); long long int y = 1; long long int answer = 0; for (int i = 0; i < a; i++) { if (i == a - 1) { answer += (y * (y - 1)) / 2; break; } if (vec.at(i) == vec.at(i + 1)) { y++; } if (vec.at(i) != vec.at(i + 1)) { answer += (y * (y - 1)) / 2; y = 1; } } cout << answer << endl; }
[ "variable_declaration.type.widen.change" ]
747,474
747,475
u363369454
cpp
p02947
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, m, n) for (int i = m; i < n; i++) #define INF INT_MAX #define MOD 1000000007 #define fcout cout << fixed << setprecision(15) typedef long long ll; typedef pair<int, int> P; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }; int lcm(int a, int b) { return a * b / gcd(a, b); }; int mod(int a, int b) { return (a + b - 1) / b; }; int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }; int n; string s[100010]; signed main() { cin >> n; rep(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); int ans = 0; rep(i, n) { ans += upper_bound(s, s + n, s[i]) - lower_bound(s, s + n, s[i]) - 1; } cout << ans / 2 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, m, n) for (int i = m; i < n; i++) #define INF INT_MAX #define MOD 1000000007 #define fcout cout << fixed << setprecision(15) typedef long long ll; typedef pair<int, int> P; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }; int lcm(int a, int b) { return a * b / gcd(a, b); }; int mod(int a, int b) { return (a + b - 1) / b; }; int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }; ll n; string s[100010]; signed main() { cin >> n; rep(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); ll ans = 0; rep(i, n) { ans += upper_bound(s, s + n, s[i]) - lower_bound(s, s + n, s[i]) - 1; } cout << ans / 2 << endl; return 0; }
[ "variable_declaration.type.change" ]
747,476
747,477
u681869152
cpp
p02947
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, m, n) for (int i = m; i < n; i++) #define INF INT_MAX #define MOD 1000000007 #define fcout cout << fixed << setprecision(15) typedef long long ll; typedef pair<int, int> P; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }; int lcm(int a, int b) { return a * b / gcd(a, b); }; int mod(int a, int b) { return (a + b - 1) / b; }; int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }; int n; string s[100010]; int main() { cin >> n; rep(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); int ans = 0; rep(i, n) { ans += upper_bound(s, s + n, s[i]) - lower_bound(s, s + n, s[i]) - 1; } cout << ans / 2 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, m, n) for (int i = m; i < n; i++) #define INF INT_MAX #define MOD 1000000007 #define fcout cout << fixed << setprecision(15) typedef long long ll; typedef pair<int, int> P; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }; int lcm(int a, int b) { return a * b / gcd(a, b); }; int mod(int a, int b) { return (a + b - 1) / b; }; int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }; ll n; string s[100010]; signed main() { cin >> n; rep(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); ll ans = 0; rep(i, n) { ans += upper_bound(s, s + n, s[i]) - lower_bound(s, s + n, s[i]) - 1; } cout << ans / 2 << endl; return 0; }
[ "variable_declaration.type.change", "variable_declaration.type.primitive.change" ]
747,478
747,477
u681869152
cpp
p02947
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } ll ans = 0; sort(s.begin(), s.end()); int cnt = 1; string a = s[0]; for (int i = 1; i < n; i++) { if (s[i] == a) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; a = s[i]; } } ans += cnt * (cnt - 1) / 2; cout << ans << endl; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } ll ans = 0; sort(s.begin(), s.end()); ll cnt = 1; string a = s[0]; for (int i = 1; i < n; i++) { if (s[i] == a) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; a = s[i]; } } ans += cnt * (cnt - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,480
747,481
u179970156
cpp
p02947
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector<vi> vvi; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; typedef long double ld; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } int main() { int N, x; cin >> N; map<string, ll> mp; forn(i, N) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } ll ans = 0; for (auto p : mp) { x = p.second; ans += x * (x - 1) / 2; } cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector<vi> vvi; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; typedef long double ld; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } int main() { int N, x; cin >> N; map<string, ll> mp; forn(i, N) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } ll ans = 0; for (auto p : mp) { ll x = p.second; ans += x * (x - 1) / 2; } cout << ans << "\n"; return 0; }
[]
747,482
747,483
u934402094
cpp
p02947
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector<vi> vvi; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; typedef long double ld; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } int main() { int N, x; cin >> N; map<string, ll> mp; forn(i, N) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } ll ans = 0; for (auto p : mp) { x = p.second; ans += x * (x - 1) / 2; } cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector<vi> vvi; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; typedef long double ld; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } int main() { int N, x; cin >> N; map<string, ll> mp; forn(i, N) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } ll ans = 0; for (auto p : mp) { x = p.second; ans += (ll)x * (x - 1) / 2; } cout << ans << "\n"; return 0; }
[ "type_conversion.add" ]
747,482
747,484
u934402094
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cout << fixed; cout.precision(10); if (fopen("joke.in", "r")) { freopen("joke.in", "r", stdin); freopen("joke.out", "w", stdout); } int n; cin >> n; string s; map<string, int> mp; for (int i = 0; i < n; ++i) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } long long res = 0; for (pair<string, int> x : mp) { res += (x.second) * (x.second - 1) / 2; } cout << res; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cout << fixed; cout.precision(10); if (fopen("joke.in", "r")) { freopen("joke.in", "r", stdin); freopen("joke.out", "w", stdout); } int n; cin >> n; string s; map<string, int> mp; for (int i = 0; i < n; ++i) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } long long res = 0; for (pair<string, int> x : mp) { res += (x.second) * 1LL * (x.second - 1) / 2; } cout << res; return 0; }
[ "assignment.change" ]
747,489
747,490
u337959231
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long n; int i, k; long long sum; string a; cin >> n; map<string, int> mp; for (i = 0; i < n; i++) { cin >> a; sort(a.begin(), a.end()); mp[a]++; } sum = 0; for (auto &p : mp) { k = p.second; sum = (long long)k * (k - 1) / 2; } cout << sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; int i, k; long long sum; string a; cin >> n; map<string, int> mp; for (i = 0; i < n; i++) { cin >> a; sort(a.begin(), a.end()); mp[a]++; } sum = 0; for (auto p : mp) { k = p.second; sum += (long long)k * (k - 1) / 2; } cout << sum << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.narrow.change", "assignment.value.change" ]
747,493
747,494
u144029820
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long n; int i, k; long long sum; string a; cin >> n; map<string, int> mp; for (i = 0; i < n; i++) { cin >> a; sort(a.begin(), a.end()); mp[a]++; } sum = 0; for (auto &p : mp) { k = p.second; sum = (long long)k * (k - 1) / 2; } cout << sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; int i, k; long long sum; string a; cin >> n; map<string, int> mp; for (i = 0; i < n; i++) { cin >> a; sort(a.begin(), a.end()); mp[a]++; } sum = 0; for (auto &p : mp) { k = p.second; sum += (long long)k * (k - 1) / 2; } cout << sum << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.narrow.change", "assignment.value.change" ]
747,493
747,495
u144029820
cpp
p02947
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector<vi> vvi; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; typedef double ld; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } const int maxn = 1000005; char store[maxn][10]; int main() { int n; scanf("%d", &n); vector<vector<char>> strings(n); forn(i, n) { scanf("%s", store[i]); for (auto a : store[i]) strings[i].pb(a); sort(all(strings[i])); } sort(all(strings)); int count = 1, total = 0; for (int i = 1; i < n; i++) { bool ok = (strings[i] == strings[i - 1]); if (ok) { total += count; count++; } else { count = 1; } } printf("%d", total); return 0; }
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector<vi> vvi; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<ll, ll> pll; typedef double ld; template <class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } const int maxn = 1000005; char store[maxn][10]; int main() { int n; scanf("%d", &n); vector<vector<char>> strings(n); forn(i, n) { scanf("%s", store[i]); for (auto a : store[i]) strings[i].pb(a); sort(all(strings[i])); } sort(all(strings)); ll count = 1; ll total = 0; for (int i = 1; i < n; i++) { bool ok = (strings[i] == strings[i - 1]); if (ok) { total += count; count++; } else { count = 1; } } printf("%lld", total); return 0; }
[ "variable_declaration.type.change", "literal.string.change", "call.arguments.change", "io.output.change" ]
747,496
747,497
u837233010
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define ll long long int #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define pb push_back #define pp pop_back #define in insert #define ff first #define ss second #define show \ for (int j = 0; j < v.size(); j++) \ cout << v[j] << " "; #define ld long double #define e endl #define bc __builtin_popcount #define MOD 1000000007 #define INT_SIZE 32 #define me(x) memset(x, 0, sizeof(x)) ll fast_expo(ll x, ll p) { if (p == 0) return 1; else if (p % 2 == 0) { ll t = fast_expo(x, p / 2) % MOD; return (t * t) % MOD; } else return (x * (fast_expo(x, p - 1)) % MOD) % MOD; } int main() { int n, i; cin >> n; string s[n]; int ans = 0; map<string, int> mp; for (i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); mp[s[i]]++; } for (i = 0; i < n; i++) { if (mp[s[i]] > 0) { ans += (mp[s[i]] - 1); mp[s[i]]--; } } cout << ans << e; }
#include <bits/stdc++.h> using namespace std; #define ll long long int #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define pb push_back #define pp pop_back #define in insert #define ff first #define ss second #define show \ for (int j = 0; j < v.size(); j++) \ cout << v[j] << " "; #define ld long double #define e endl #define bc __builtin_popcount #define MOD 1000000007 #define INT_SIZE 32 #define me(x) memset(x, 0, sizeof(x)) ll fast_expo(ll x, ll p) { if (p == 0) return 1; else if (p % 2 == 0) { ll t = fast_expo(x, p / 2) % MOD; return (t * t) % MOD; } else return (x * (fast_expo(x, p - 1)) % MOD) % MOD; } int main() { int n, i; cin >> n; string s[n]; ll ans = 0; map<string, int> mp; for (i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); mp[s[i]]++; } for (i = 0; i < n; i++) { if (mp[s[i]] > 0) { ans += (mp[s[i]] - 1); mp[s[i]]--; } } cout << ans << e; }
[ "variable_declaration.type.change" ]
747,498
747,499
u190196352
cpp