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; int main() { int N; cin >> N; string S; map<string, int> count; int result = 0; int i = 0; while (i < N) { cin >> S; sort(S.begin(), S.end()); if (count[S] > 0) { result += count[S]; } count[S]++; i++; } cout << result << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string S; unordered_map<string, int> count; long result = 0; int i = 0; while (i < N) { cin >> S; sort(S.begin(), S.end()); if (count[S] > 0) { result += count[S]; } count[S]++; i++; } cout << result << endl; }
[ "variable_declaration.type.change", "variable_declaration.type.primitive.change" ]
748,371
748,372
u639071683
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string S; map<string, int> count; int result = 0; int i = 0; while (i < N) { cin >> S; sort(S.begin(), S.end()); if (count[S] > 0) { result += count[S]; } count[S]++; i++; } cout << result << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string S; map<string, int> count; long result = 0; int i = 0; while (i < N) { cin >> S; sort(S.begin(), S.end()); if (count[S] > 0) { result += count[S]; } count[S]++; i++; } cout << result << endl; }
[ "variable_declaration.type.primitive.change" ]
748,371
748,373
u639071683
cpp
p02947
#include <bits/stdc++.h> using namespace std; const long long inf = 1e15; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pii; void faster() { ios_base::sync_with_stdio(false); cin.tie(NULL); } const ll MAXN = 1e6 + 10; const ll N = 4000 + 10; const ll MN = 200 + 10; const ll mod = 1e6; ll a[MAXN * 2]; int main() { faster(); int q, ans = 0; cin >> q; string s[q]; map<string, int> m; for (int i = 0; i < q; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); m[s[i]]++; } for (auto itr = m.begin(); itr != m.end(); itr++) { ll k = (*itr).second; ans += k * (k - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; const long long inf = 1e15; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pii; void faster() { ios_base::sync_with_stdio(false); cin.tie(NULL); } const ll MAXN = 1e6 + 10; const ll N = 4000 + 10; const ll MN = 200 + 10; const ll mod = 1e6; ll a[MAXN * 2]; int main() { faster(); ll q, ans = 0; cin >> q; string s[q]; map<string, ll> m; for (int i = 0; i < q; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); m[s[i]]++; } for (auto itr = m.begin(); itr != m.end(); itr++) { ll k = (*itr).second; ans += k * (k - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
748,374
748,375
u080245145
cpp
p02947
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <vector> typedef long long ll; #define REP(i, N) for (int i = 0; i < (N); i++) #define REPP(i, a, b) for (int i = (a); i < (b); i++) #define ALL(v) (v).begin(), (v).end() #define RALL(v) (v).rbegin(), (v).rend() #define VSORT(c) sort((c).begin(), (c).end()) #define SZ(x) ((int)(x).size()) // vvintを作る マクロで  #define vvint(N,M) vector<vector<int>> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string tmp; unordered_map<string, ll> 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; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <vector> typedef long long ll; #define REP(i, N) for (int i = 0; i < (N); i++) #define REPP(i, a, b) for (int i = (a); i < (b); i++) #define ALL(v) (v).begin(), (v).end() #define RALL(v) (v).rbegin(), (v).rend() #define VSORT(c) sort((c).begin(), (c).end()) #define SZ(x) ((int)(x).size()) // vvintを作る マクロで  #define vvint(N,M) vector<vector<int>> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; string tmp; unordered_map<string, ll> mp; ll ans = 0; for (ll i = 0; i < N; i++) { cin >> tmp; sort(tmp.begin(), tmp.end()); ans += mp[tmp]; mp[tmp]++; } cout << ans << endl; return 0; }
[ "variable_declaration.type.change", "control_flow.loop.for.initializer.change" ]
748,384
748,385
u921177152
cpp
p02947
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <vector> typedef long long ll; #define REP(i, N) for (int i = 0; i < (N); i++) #define REPP(i, a, b) for (int i = (a); i < (b); i++) #define ALL(v) (v).begin(), (v).end() #define RALL(v) (v).rbegin(), (v).rend() #define VSORT(c) sort((c).begin(), (c).end()) #define SZ(x) ((int)(x).size()) // vvintを作る マクロで  #define vvint(N,M) vector<vector<int>> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string tmp; unordered_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; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <vector> typedef long long ll; #define REP(i, N) for (int i = 0; i < (N); i++) #define REPP(i, a, b) for (int i = (a); i < (b); i++) #define ALL(v) (v).begin(), (v).end() #define RALL(v) (v).rbegin(), (v).rend() #define VSORT(c) sort((c).begin(), (c).end()) #define SZ(x) ((int)(x).size()) // vvintを作る マクロで  #define vvint(N,M) vector<vector<int>> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; string tmp; unordered_map<string, ll> mp; ll ans = 0; for (ll i = 0; i < N; i++) { cin >> tmp; sort(tmp.begin(), tmp.end()); ans += mp[tmp]; mp[tmp]++; } cout << ans << endl; return 0; }
[ "variable_declaration.type.change", "control_flow.loop.for.initializer.change" ]
748,386
748,385
u921177152
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL << 29; const ll mod = 1e9 + 7; #define rep(i, a, b) for (ll(i) = (a); (i) < (b); ++i) string s[100000]; int main() { ll N; cin >> N; rep(i, 0, N) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } ll ans = 0; map<string, int> maps; rep(i, 0, N) { maps[s[i]]++; } for (auto data : maps) { // cout << data.first << " => " << data.second << "\n"; ans += data.second * (data.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL << 29; const ll mod = 1e9 + 7; #define rep(i, a, b) for (ll(i) = (a); (i) < (b); ++i) string s[100000]; int main() { ll N; cin >> N; rep(i, 0, N) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } ll ans = 0; map<string, ll> maps; rep(i, 0, N) { maps[s[i]]++; } for (auto data : maps) { // cout << data.first << " => " << data.second << "\n"; ans += data.second * (data.second - 1) / 2; // ans += data.second; } cout << ans << endl; return 0; }
[]
748,390
748,391
u386806796
cpp
p02947
#include <bits/stdc++.h> using namespace std; vector<string> anagrams; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int N, ans = 0; string temp; cin >> N; while (N--) { cin >> temp; sort(temp.begin(), temp.end()); anagrams.push_back(temp); } sort(anagrams.begin(), anagrams.end()); // for (auto i : anagrams) cout << i << "\n"; int cnt = 0; for (int i = 1; i < anagrams.size(); i++) { if (anagrams[i] == anagrams[i - 1]) { cnt++; // triangular numbers } else { ans += (cnt * (cnt + 1)) / 2; cnt = 0; } if (i == anagrams.size() - 1) { ans += (cnt * (cnt + 1)) / 2; cnt = 0; } } cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; vector<string> anagrams; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long N, ans = 0; string temp; cin >> N; while (N--) { cin >> temp; sort(temp.begin(), temp.end()); anagrams.push_back(temp); } sort(anagrams.begin(), anagrams.end()); // for (auto i : anagrams) cout << i << "\n"; long long cnt = 0; for (long long i = 1; i < anagrams.size(); i++) { if (anagrams[i] == anagrams[i - 1]) { cnt++; // triangular numbers } else { ans += (cnt * (cnt + 1)) / 2; cnt = 0; } if (i == anagrams.size() - 1) { ans += (cnt * (cnt + 1)) / 2; cnt = 0; } } cout << ans << "\n"; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "control_flow.loop.for.initializer.change" ]
748,392
748,393
u030176410
cpp
p02947
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; ++i) { cin >> s[i]; } for (int i = 0; i < N; ++i) { sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); ll ans = 0; int streak = 1; for (int i = 1; i < N; ++i) { if (s[i] == s[i - 1]) { streak++; if (i == N - 1) { ans = ans + (streak * (streak - 1) / 2); } } else { ans = ans + (streak * (streak - 1) / 2); streak = 1; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int N; cin >> N; vector<string> s(N); for (int i = 0; i < N; ++i) { cin >> s[i]; } for (int i = 0; i < N; ++i) { sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); ll ans = 0; ll streak = 1; for (int i = 1; i < N; ++i) { if (s[i] == s[i - 1]) { streak++; if (i == N - 1) { ans = ans + (streak * (streak - 1) / 2); } } else { ans = ans + (streak * (streak - 1) / 2); streak = 1; } } cout << ans; return 0; }
[ "variable_declaration.type.change" ]
748,396
748,397
u590088474
cpp
p02947
#include <algorithm> #include <iostream> #include <map> using namespace std; long long factorial(long long a) { if (a == 0) return 1; return a * factorial(a - 1); } int main() { int n; cin >> n; string s; map<string, int> m; long long res = 0; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); if (m.find(s) == m.end()) { m[s] = 1; } else { m[s]++; } } for (auto it = m.begin(); it != m.end(); it++) { res += (((it->second) * ((it->second) - 1)) / 2); } cout << res << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> using namespace std; long long factorial(long long a) { if (a == 0) return 1; return a * factorial(a - 1); } int main() { int n; cin >> n; string s; map<string, int> m; long long res = 0; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); if (m.find(s) == m.end()) { m[s] = 1; } else { m[s]++; } } for (auto it = m.begin(); it != m.end(); it++) { res += (((it->second) * 1LL * ((it->second) - 1)) / 2); } cout << res << endl; return 0; }
[ "assignment.change" ]
748,398
748,399
u594272051
cpp
p02947
#include <algorithm> #include <functional> #include <iostream> #include <stdio.h> #include <stdlib.h> #define rep(i, n) for (int i = 0; i < (n); i++) #include <cmath> #include <map> #include <string> #include <vector> using namespace std; int main() { map<string, int> mp; int N; string s; long long int ans = 0; cin >> N; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto itr = mp.begin(); itr != mp.end(); itr++) { int sum = itr->second; ans = ans + sum * (sum - 1) / 2; } cout << ans; }
#include <algorithm> #include <functional> #include <iostream> #include <stdio.h> #include <stdlib.h> #define rep(i, n) for (int i = 0; i < (n); i++) #include <cmath> #include <map> #include <string> #include <vector> using namespace std; int main() { map<string, int> mp; int N; string s; long long int ans = 0; cin >> N; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto itr = mp.begin(); itr != mp.end(); itr++) { long int sum = itr->second; ans = ans + sum * (sum - 1) / 2; } cout << ans; }
[ "variable_declaration.type.widen.change" ]
748,400
748,401
u473116917
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define x first #define y second #define sz(x) (int)x.size() #define endl '\n' #define MOD 1000000007 #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define gcd(a, b) __gcd((a), (b)) #define lcm(a, b) ((a) * (b)) / gcd((a), (b)) #define rep(i, a, b) for (int i = a; i < b; i++) ll mult(ll a, ll b, ll p = MOD) { return ((a % p) * (b % p)) % p; } ll multbig(ll a, ll b, ll mod) { if (a == 0 or b == 0) return 0; if (a == 1 or b == 1) return (a * b) % mod; ll cur = multbig(a, b / 2, mod); cur = (2 * cur) % mod; if (b % 2) cur = (cur + a) % mod; return cur; } ll add(ll a, ll b, ll p = MOD) { return (a % p + b % p) % p; } ll fpow(ll n, ll k, ll p = MOD) { ll r = 1; for (; k; k >>= 1LL) { if (k & 1LL) r = mult(r, n, p); n = mult(n, n, p); } return r; } ll inv(ll a, ll p = MOD) { return fpow(a, p - 2, p); } ll inv_euclid(ll a, ll m = MOD) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; } #define N 100 * 1000 + 5 void solve() { int n; cin >> n; map<string, int> m; rep(i, 0, n) { string s; cin >> s; sort(all(s)); m[s]++; } ll ans = 0; for (auto it : m) ans += (it.y) * (it.y - 1); cout << ans / 2 << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; t = 1; // cin>>t; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define x first #define y second #define sz(x) (int)x.size() #define endl '\n' #define MOD 1000000007 #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define gcd(a, b) __gcd((a), (b)) #define lcm(a, b) ((a) * (b)) / gcd((a), (b)) #define rep(i, a, b) for (int i = a; i < b; i++) ll mult(ll a, ll b, ll p = MOD) { return ((a % p) * (b % p)) % p; } ll multbig(ll a, ll b, ll mod) { if (a == 0 or b == 0) return 0; if (a == 1 or b == 1) return (a * b) % mod; ll cur = multbig(a, b / 2, mod); cur = (2 * cur) % mod; if (b % 2) cur = (cur + a) % mod; return cur; } ll add(ll a, ll b, ll p = MOD) { return (a % p + b % p) % p; } ll fpow(ll n, ll k, ll p = MOD) { ll r = 1; for (; k; k >>= 1LL) { if (k & 1LL) r = mult(r, n, p); n = mult(n, n, p); } return r; } ll inv(ll a, ll p = MOD) { return fpow(a, p - 2, p); } ll inv_euclid(ll a, ll m = MOD) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; } #define N 100 * 1000 + 5 void solve() { ll n; cin >> n; map<string, ll> m; rep(i, 0, n) { string s; cin >> s; sort(all(s)); m[s]++; } ll ans = 0; for (auto it : m) ans += (it.y) * (it.y - 1); cout << ans / 2 << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; t = 1; // cin>>t; while (t--) { solve(); } return 0; }
[ "variable_declaration.type.change" ]
748,402
748,403
u889989471
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define x first #define y second #define sz(x) (int)x.size() #define endl '\n' #define MOD 1000000007 #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define gcd(a, b) __gcd((a), (b)) #define lcm(a, b) ((a) * (b)) / gcd((a), (b)) #define rep(i, a, b) for (int i = a; i < b; i++) ll mult(ll a, ll b, ll p = MOD) { return ((a % p) * (b % p)) % p; } ll multbig(ll a, ll b, ll mod) { if (a == 0 or b == 0) return 0; if (a == 1 or b == 1) return (a * b) % mod; ll cur = multbig(a, b / 2, mod); cur = (2 * cur) % mod; if (b % 2) cur = (cur + a) % mod; return cur; } ll add(ll a, ll b, ll p = MOD) { return (a % p + b % p) % p; } ll fpow(ll n, ll k, ll p = MOD) { ll r = 1; for (; k; k >>= 1LL) { if (k & 1LL) r = mult(r, n, p); n = mult(n, n, p); } return r; } ll inv(ll a, ll p = MOD) { return fpow(a, p - 2, p); } ll inv_euclid(ll a, ll m = MOD) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; } #define N 100 * 1000 + 5 void solve() { int n; cin >> n; map<string, int> m; rep(i, 0, n) { string s; cin >> s; sort(all(s)); m[s]++; } int ans = 0; for (auto it : m) ans += (it.y) * (it.y - 1); cout << ans / 2 << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; t = 1; // cin>>t; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define pii pair<int, int> #define vi vector<int> #define vii vector<pii> #define mi map<int, int> #define mii map<pii, int> #define all(a) (a).begin(), (a).end() #define x first #define y second #define sz(x) (int)x.size() #define endl '\n' #define MOD 1000000007 #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define gcd(a, b) __gcd((a), (b)) #define lcm(a, b) ((a) * (b)) / gcd((a), (b)) #define rep(i, a, b) for (int i = a; i < b; i++) ll mult(ll a, ll b, ll p = MOD) { return ((a % p) * (b % p)) % p; } ll multbig(ll a, ll b, ll mod) { if (a == 0 or b == 0) return 0; if (a == 1 or b == 1) return (a * b) % mod; ll cur = multbig(a, b / 2, mod); cur = (2 * cur) % mod; if (b % 2) cur = (cur + a) % mod; return cur; } ll add(ll a, ll b, ll p = MOD) { return (a % p + b % p) % p; } ll fpow(ll n, ll k, ll p = MOD) { ll r = 1; for (; k; k >>= 1LL) { if (k & 1LL) r = mult(r, n, p); n = mult(n, n, p); } return r; } ll inv(ll a, ll p = MOD) { return fpow(a, p - 2, p); } ll inv_euclid(ll a, ll m = MOD) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; } #define N 100 * 1000 + 5 void solve() { ll n; cin >> n; map<string, ll> m; rep(i, 0, n) { string s; cin >> s; sort(all(s)); m[s]++; } ll ans = 0; for (auto it : m) ans += (it.y) * (it.y - 1); cout << ans / 2 << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; t = 1; // cin>>t; while (t--) { solve(); } return 0; }
[ "variable_declaration.type.change" ]
748,404
748,403
u889989471
cpp
p02947
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; map<string, ll> m; ll count = 0; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); count += m[s]; m[s]++; cout << count << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; map<string, ll> m; ll count = 0; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); count += m[s]; m[s]++; } cout << count << endl; return 0; }
[]
748,405
748,406
u280162245
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s = {}; string x; for (int i = 0; i < n; i++) { cin >> x; s.push_back(x); } map<string, int> s_map; for (auto &x : s) { sort(x.begin(), x.end()); s_map[x]++; } long count = 0; for (auto &x : s_map) { if (x.second > 0) { count += x.second * (x.second - 1) / 2; } } cout << count; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s = {}; string x; for (int i = 0; i < n; i++) { cin >> x; s.push_back(x); } map<string, long> s_map; for (auto &x : s) { sort(x.begin(), x.end()); s_map[x]++; } long count = 0; for (auto &x : s_map) { if (x.second > 0) { count += x.second * (x.second - 1) / 2; } } cout << count; }
[ "variable_declaration.type.primitive.change" ]
748,407
748,408
u874414087
cpp
p02947
#include <algorithm> #include <iostream> #include <string> #include <unordered_map> using namespace std; int main() { int n, sum = 0; cin >> n; unordered_map<string, int> strs; string str; for (int i = 0; i < n; i++) { cin >> str; sort(str.begin(), str.end()); strs[str]++; } for (auto str : strs) { sum += (str.second * (str.second - 1)) / 2; } cout << sum << endl; }
#include <algorithm> #include <iostream> #include <string> #include <unordered_map> using namespace std; int main() { int n; long sum = 0; cin >> n; unordered_map<string, int> strs; string str; for (int i = 0; i < n; i++) { cin >> str; sort(str.begin(), str.end()); strs[str]++; } for (auto str : strs) { sum += ((long)str.second * (str.second - 1)) / 2; } cout << sum << endl; }
[ "variable_declaration.type.widen.change" ]
748,409
748,410
u247407965
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define pi \ 3.1415926535897932384626433832795028841971693993751058209749445923078164062 #define ll long long #define pb push_back #define pf push_front #define mp make_pair #define mt make_tuple #define popb pop_back() #define popf pop_front() #define ff first #define ss second #define vl vector<ll> #define vi vector<int> #define vs vector<string> #define vll vector<pair<ll, ll>> #define vii vector<pair<int, int>> #define viii vector<tuple<int, int, int>> #define vlll vector<tuple<ll, ll, ll>> #define vvl vector<vector<ll>> #define vv vector<vector<int>> #define all(v) v.begin(), v.end() #define sqrt sqrtl #define cbrt cbrtl #define pll pair<ll, ll> #define pii pair<int, int> #define mapcl map<char, ll> #define mapci map<char, int> #define mapll map<ll, ll> #define mapii map<int, int> #define seti set<int> ifstream fin("input.txt"); ofstream fout("output.txt"); ll pows(int a, int b) { ll res = 1; for (int i = 0; i < b; ++i) { res *= a; } return res; } int main() { std::ios::sync_with_stdio(false); // cin.tie(NULL); // cout.tie(NULL); int x; cin >> x; ll sum = 0; vs vec; map<string, int> mps; while (x--) { string s; cin >> s; sort(all(s)); ++mps[s]; } for (auto x : mps) { sum += (x.second * (x.second - 1)) / 2; } cout << sum; }
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define pi \ 3.1415926535897932384626433832795028841971693993751058209749445923078164062 #define ll long long #define pb push_back #define pf push_front #define mp make_pair #define mt make_tuple #define popb pop_back() #define popf pop_front() #define ff first #define ss second #define vl vector<ll> #define vi vector<int> #define vs vector<string> #define vll vector<pair<ll, ll>> #define vii vector<pair<int, int>> #define viii vector<tuple<int, int, int>> #define vlll vector<tuple<ll, ll, ll>> #define vvl vector<vector<ll>> #define vv vector<vector<int>> #define all(v) v.begin(), v.end() #define sqrt sqrtl #define cbrt cbrtl #define pll pair<ll, ll> #define pii pair<int, int> #define mapcl map<char, ll> #define mapci map<char, int> #define mapll map<ll, ll> #define mapii map<int, int> #define seti set<int> ifstream fin("input.txt"); ofstream fout("output.txt"); ll pows(int a, int b) { ll res = 1; for (int i = 0; i < b; ++i) { res *= a; } return res; } int main() { std::ios::sync_with_stdio(false); // cin.tie(NULL); // cout.tie(NULL); int x; cin >> x; ll sum = 0; vs vec; map<string, ll> mps; while (x--) { string s; cin >> s; sort(all(s)); ++mps[s]; } for (auto x : mps) { sum += (x.second * (x.second - 1)) / 2; } cout << sum; }
[]
748,411
748,412
u186089447
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n, i; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); long long ans = 0; for (i = 0; i < n; ++i) { int temp = 0; while (i < n - 1 && s[i] == s[i + 1]) { temp++; i++; } ans += (temp * (temp + 1) / 2); } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, i; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); long long ans = 0; for (i = 0; i < n; ++i) { long long temp = 0; while (i < n - 1 && s[i] == s[i + 1]) { temp++; i++; } ans += (temp * (temp + 1) / 2); } cout << ans; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,413
748,414
u592300048
cpp
p02947
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define watch(x) cout << (#x) << " is " << (x) << endl typedef long long ll; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; int i = 0; ll cnt = 0; cin >> n; vector<string> s(n); for (int j = 0; j < n; j++) { cin >> s[j]; sort(s[j].begin(), s[j].end()); } sort(s.begin(), s.end()); while (i < n) { ll tempcnt = 0; while (i < n && s[i] != s[i - 1]) { i++; } while (i < n && s[i] == s[i - 1]) { tempcnt++; cnt += tempcnt; i++; } } cout << cnt; return 0; }
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define watch(x) cout << (#x) << " is " << (x) << endl typedef long long ll; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; int i = 1; ll cnt = 0; cin >> n; vector<string> s(n); for (int j = 0; j < n; j++) { cin >> s[j]; sort(s[j].begin(), s[j].end()); } sort(s.begin(), s.end()); while (i < n) { ll tempcnt = 0; while (i < n && s[i] != s[i - 1]) { i++; } while (i < n && s[i] == s[i - 1]) { tempcnt++; cnt += tempcnt; i++; } } cout << cnt; return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
748,415
748,416
u117615163
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { // map<string,int>m; int n; cin >> n; string a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; sort(a[i].begin(), a[i].end()); } int br = 0; int kolku = 1; sort(a, a + n); for (int i = 0; i < (n - 1); i++) { if (a[i] == a[i + 1]) { kolku++; // cout<<"here "<<kolku<<" "<<a[i]<<" "<<a[i+1]<<endl; } if (a[i] != a[i + 1] || ((i + 1) == (n - 1) && a[i] == a[i + 1])) { // cout<<kolku<<" "<<a[i]<<" "<<a[i+1]<<endl; br = br + kolku * (kolku - 1) / 2; kolku = 1; } } cout << br << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; sort(a[i].begin(), a[i].end()); } long long int br = 0; long long int kolku = 1; sort(a, a + n); for (int i = 0; i < (n - 1); i++) { if (a[i] == a[i + 1]) { kolku++; // cout<<"here "<<kolku<<" "<<a[i]<<" "<<a[i+1]<<endl; } if (a[i] != a[i + 1] || ((i + 1) == (n - 1) && a[i] == a[i + 1])) { // cout<<kolku<<" "<<a[i]<<" "<<a[i+1]<<endl; br = br + kolku * (kolku - 1) / 2; kolku = 1; } } cout << br << endl; }
[ "variable_declaration.type.widen.change" ]
748,417
748,418
u079553980
cpp
p02947
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main() { int n; long long int ans = 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()); int temp = 1; for (int i = 0; i < n - 1; i++) { if (s[i] == s[i + 1]) { temp++; if (i == n - 2) { ans += temp * (temp - 1) / 2; } } else { ans += temp * (temp - 1) / 2; temp = 1; } } cout << ans << endl; }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main() { int n; long long int ans = 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()); long long int temp = 1; for (int i = 0; i < n - 1; i++) { if (s[i] == s[i + 1]) { temp++; if (i == n - 2) { ans += temp * (temp - 1) / 2; } } else { ans += temp * (temp - 1) / 2; temp = 1; } } cout << ans << endl; }
[ "variable_declaration.type.widen.change" ]
748,419
748,420
u045575753
cpp
p02947
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main() { int n; int ans = 0; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; std::sort(s[i].begin(), s[i].end()); } sort(s.begin(), s.end()); int temp = 1; for (int i = 0; i < n - 1; i++) { if (s[i] == s[i + 1]) { temp++; if (i == n - 2) { ans += temp * (temp - 1) / 2; } } else { ans += temp * (temp - 1) / 2; temp = 1; } } cout << ans << endl; }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main() { int n; long long int ans = 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()); long long int temp = 1; for (int i = 0; i < n - 1; i++) { if (s[i] == s[i + 1]) { temp++; if (i == n - 2) { ans += temp * (temp - 1) / 2; } } else { ans += temp * (temp - 1) / 2; temp = 1; } } cout << ans << endl; }
[ "variable_declaration.type.widen.change" ]
748,421
748,420
u045575753
cpp
p02947
#include <algorithm> #include <cstring> #include <iostream> #include <unordered_map> #include <vector> using namespace std; int main(void) { long N; int count = 0; char *str; string s_str; char tmp; int result = 0; std::unordered_map<std::string, int> mp; cin >> N; for (int k = 0; k < N; k++) { str = new char[10]; cin >> str; for (int i = 1; i < 10; i++) { for (int j = 0; j < 9; j++) { if (str[i] < str[j]) { tmp = str[i]; str[i] = str[j]; str[j] = tmp; } } } s_str = string(str, 10); delete (str); auto itr = mp.find(s_str); if (itr == mp.end()) { mp[s_str] = 1; } else { result += mp[s_str]; mp[s_str] = mp[s_str] + 1; } } cout << result << endl; return 0; }
#include <algorithm> #include <cstring> #include <iostream> #include <unordered_map> #include <vector> using namespace std; int main(void) { long N; char *str; string s_str; char tmp; long result = 0; std::unordered_map<std::string, int> mp; cin >> N; for (int k = 0; k < N; k++) { str = new char[10]; cin >> str; for (int i = 1; i < 10; i++) { for (int j = 0; j < 9; j++) { if (str[i] < str[j]) { tmp = str[i]; str[i] = str[j]; str[j] = tmp; } } } s_str = string(str, 10); delete (str); auto itr = mp.find(s_str); if (itr == mp.end()) { mp[s_str] = 1; } else { result += mp[s_str]; mp[s_str] = mp[s_str] + 1; } } cout << result << endl; return 0; }
[ "variable_declaration.remove", "variable_declaration.type.primitive.change" ]
748,424
748,425
u755989869
cpp
p02947
#define _USE_MATH_DEFINES // #include <bits/stdc++.h> // using namespace std; // #define krep(i, k, n) for (int i = k; i < n; ++i) #define rep(i, n) for (int i = 0; i < n; ++i) #define toupp(s) transform(s.begin(), s.end(), s.begin(), ::toupper) // string #define tolow(s) transform(s.begin(), s.end(), s.begin(), ::tolower) // string #define pb(v) push_back(v) #define all(v) v.begin(), v.end() #define mp make_pair #define __sort(v) sort(v.begin(), v.end()) // vector #define __stable_sort(v) stable_sort(v.begin(), v.end()) // vector #define __exists(c, v) (find(all(c), (v)) != (c).end()) // vector #define __unique(v) \ __sort(v); \ v.erase(unique(v.begin(), v.end()), v.end()) // vector #define __swap(a, b, tmp) \ tmp = a; \ a = b; \ b = tmp; #define __memset(a) memset(a, 0, sizeof(a)); // #define dumpVar(v) cerr << setw(30) << #v " = [" << v << "]" << endl #define dumpArr(v, n) \ for (int i = 0; i < n; ++i) { \ cerr << v[i] << ", "; \ } \ cerr << endl #define dumpPair(p) cerr << "<" << p.first << ", " << p.second << ">" << endl // typedef long long ll; typedef vector<string> vs; typedef vector<double> vd; typedef list<int> li_i; typedef list<double> li_d; typedef vector<int> vi; typedef pair<int, int> pii; typedef pair<double, double> pdd; // long kaijo(long x); int main() { ios::sync_with_stdio(false); // /* code start */ vector<char> _c_arr; int n; long counter = 0; cin >> n; vi arr; vs s_arr; rep(i, n) { string str = ""; rep(j, 10) { char c; cin >> c; if (str == "") { str = c; } else { int flag = 1; for (int k = 0; k < str.length(); ++k) { if (str[k] > c) { string::iterator it = str.begin() + k; str.insert(it, c); flag = 0; break; } } if (flag) { str = str + c; } } // dumpVar(str); } s_arr.pb(str); } dumpArr(s_arr, n); __sort(s_arr); dumpArr(s_arr, n); for (int i = 0; i < n; ++i) { long same_num = 0; long skip_num = 0; for (int j = i + 1; j < n; ++j) { if (i + 1 == j && s_arr[i] == s_arr[j]) same_num++; if (s_arr[i] == s_arr[j]) { same_num++; skip_num++; } else break; } dumpVar(i); dumpVar(same_num); i += skip_num; counter += kaijo(same_num) / kaijo(same_num - 2) / 2; } cout << counter << endl; /* code end */ // return 0; } long kaijo(long x) { long tmp = 1; krep(i, 1, x + 1) { tmp = tmp * i; } return tmp; } /* 3 3 * 2 * 1 / 2 4 * 3 * 2 * 1 / 2 /2 */
#define _USE_MATH_DEFINES // #include <bits/stdc++.h> // using namespace std; // #define krep(i, k, n) for (int i = k; i < n; ++i) #define rep(i, n) for (int i = 0; i < n; ++i) #define toupp(s) transform(s.begin(), s.end(), s.begin(), ::toupper) // string #define tolow(s) transform(s.begin(), s.end(), s.begin(), ::tolower) // string #define pb(v) push_back(v) #define all(v) v.begin(), v.end() #define mp make_pair #define __sort(v) sort(v.begin(), v.end()) // vector #define __stable_sort(v) stable_sort(v.begin(), v.end()) // vector #define __exists(c, v) (find(all(c), (v)) != (c).end()) // vector #define __unique(v) \ __sort(v); \ v.erase(unique(v.begin(), v.end()), v.end()) // vector #define __swap(a, b, tmp) \ tmp = a; \ a = b; \ b = tmp; #define __memset(a) memset(a, 0, sizeof(a)); // #define dumpVar(v) cerr << setw(30) << #v " = [" << v << "]" << endl #define dumpArr(v, n) \ for (int i = 0; i < n; ++i) { \ cerr << v[i] << ", "; \ } \ cerr << endl #define dumpPair(p) cerr << "<" << p.first << ", " << p.second << ">" << endl // typedef long long ll; typedef vector<string> vs; typedef vector<double> vd; typedef list<int> li_i; typedef list<double> li_d; typedef vector<int> vi; typedef pair<int, int> pii; typedef pair<double, double> pdd; // long kaijo(long x); int main() { ios::sync_with_stdio(false); // /* code start */ vector<char> _c_arr; int n; long counter = 0; cin >> n; vi arr; vs s_arr; rep(i, n) { string str = ""; rep(j, 10) { char c; cin >> c; if (str == "") { str = c; } else { int flag = 1; for (int k = 0; k < str.length(); ++k) { if (str[k] > c) { string::iterator it = str.begin() + k; str.insert(it, c); flag = 0; break; } } if (flag) { str = str + c; } } // dumpVar(str); } s_arr.pb(str); } dumpArr(s_arr, n); __sort(s_arr); dumpArr(s_arr, n); for (int i = 0; i < n; ++i) { long same_num = 0; long skip_num = 0; for (int j = i + 1; j < n; ++j) { if (i + 1 == j && s_arr[i] == s_arr[j]) same_num++; if (s_arr[i] == s_arr[j]) { same_num++; skip_num++; } else break; } dumpVar(i); dumpVar(same_num); i += skip_num; counter += same_num * (same_num - 1) / 2; } cout << counter << endl; /* code end */ // return 0; } long kaijo(long x) { long tmp = 1; krep(i, 1, x + 1) { tmp = tmp * i; } return tmp; } /* 3 3 * 2 * 1 / 2 4 * 3 * 2 * 1 / 2 /2 */
[ "call.remove", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "expression.operation.binary.remove", "literal.number.change" ]
748,426
748,427
u387775996
cpp
p02947
//** aman**/ #include <bits/stdc++.h> #define ll long long #define pb push_back #define pii pair<int, int> #define vi vector<int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define dl double #define hell 1000000007 #define endl '\n' #define rep(i, a, b) for (int i = a; i < b; i++) #define lb lower_bound #define ub upper_bound #define bs binary_search #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) using namespace std; int main() { ll n; cin >> n; map<string, int> m; for (ll i = 0; i < n; i++) { string s; cin >> s; sort(all(s)); m[s]++; } ll ans = 0; for (auto u : m) { ans += u.S * (u.S - 1) / 2; } cout << ans << endl; }
//** aman**/ #include <bits/stdc++.h> #define ll long long #define pb push_back #define pii pair<int, int> #define vi vector<int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define dl double #define hell 1000000007 #define endl '\n' #define rep(i, a, b) for (int i = a; i < b; i++) #define lb lower_bound #define ub upper_bound #define bs binary_search #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) using namespace std; int main() { ll n; cin >> n; map<string, ll> m; for (ll i = 0; i < n; i++) { string s; cin >> s; sort(all(s)); m[s]++; } ll ans = 0; for (auto u : m) { ans += u.S * (u.S - 1) / 2; } cout << ans << endl; }
[]
748,428
748,429
u006069211
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; unordered_map<string, int> cnt; int ans = 0; while (n--) { string s; cin >> s; sort(s.begin(), s.end()); cnt[s]++; ans += cnt[s] - 1; } cout << ans << '\n'; }
#include <bits/stdc++.h> using namespace std; typedef long long LL; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; unordered_map<string, int> cnt; LL ans = 0; while (n--) { string s; cin >> s; sort(s.begin(), s.end()); cnt[s]++; ans += cnt[s] - 1; } cout << ans << '\n'; }
[ "variable_declaration.type.change" ]
748,437
748,438
u194917097
cpp
p02947
#include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; int main() { string s; int N; unordered_map<string, int> hash; ll sum = 0; cin >> N; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); hash[s]++; } for (auto itr = hash.begin(); itr != hash.end(); ++itr) { sum += itr->second * (itr->second - 1) / 2; } cout << sum; return 0; }
#include <algorithm> #include <cmath> #include <fstream> #include <functional> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <vector> using namespace std; using ll = long long; int main() { string s; int N; unordered_map<string, ll> hash; ll sum = 0; cin >> N; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); hash[s]++; } for (auto itr = hash.begin(); itr != hash.end(); ++itr) { sum += itr->second * (itr->second - 1) / 2; } cout << sum; return 0; }
[]
748,439
748,440
u577599930
cpp
p02947
#include <bits/stdc++.h> #include <unordered_map> #include <vector> using namespace std; int main() { int N; cin >> N; vector<string> s(N); int count = 0; unordered_map<string, int> num; for (int i = 0; i < N; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); if (num[s[i]]) { num[s[i]]++; count += (num[s[i]] - 1); } else { num[s[i]] = 1; } } cout << count << endl; return 0; }
#include <bits/stdc++.h> #include <unordered_map> #include <vector> using namespace std; int main() { int N; cin >> N; vector<string> s(N); long count = 0; unordered_map<string, int> num; for (int i = 0; i < N; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); if (num[s[i]]) { num[s[i]]++; count += (num[s[i]] - 1); } else { num[s[i]] = 1; } } cout << count << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
748,443
748,444
u413488238
cpp
p02947
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<string> S; while (N--) { string s; vector<char> s_vec; cin >> s; for (int i = 0; i < s.size(); i++) { s_vec.push_back(s[i]); } sort(s_vec.begin(), s_vec.end()); s = ""; for (int i = 0; i < s_vec.size(); i++) { s += s_vec[i]; } S.push_back(s); } sort(S.begin(), S.end()); // for (int i=0; i<S.size(); i++) { // cout << S[i] << endl; // } int count = 0; int groupCount = 1; string tmp = S[0]; for (int i = 1; i < S.size(); i++) { if (tmp == S[i]) { groupCount++; } else { count += groupCount * (groupCount - 1) / 2; groupCount = 1; } tmp = S[i]; } count += groupCount * (groupCount - 1) / 2; cout << count << endl; return 0; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<string> S; while (N--) { string s; vector<char> s_vec; cin >> s; for (int i = 0; i < s.size(); i++) { s_vec.push_back(s[i]); } sort(s_vec.begin(), s_vec.end()); s = ""; for (int i = 0; i < s_vec.size(); i++) { s += s_vec[i]; } S.push_back(s); } sort(S.begin(), S.end()); // for (int i=0; i<S.size(); i++) { // cout << S[i] << endl; // } long int count = 0; long int groupCount = 1; string tmp = S[0]; for (int i = 1; i < S.size(); i++) { if (tmp == S[i]) { groupCount++; } else { count += groupCount * (groupCount - 1) / 2; groupCount = 1; } tmp = S[i]; } count += groupCount * (groupCount - 1) / 2; cout << count << endl; return 0; }
[ "variable_declaration.type.widen.change" ]
748,445
748,446
u074372598
cpp
p02947
#include <algorithm> #include <iostream> #include <map> int main() { int N; std::string s; std::map<std::string, int> mp; std::cin >> N; for (int i = 0; i < N; i++) { std::cin >> s; // std::cout << i << " " << s << std::endl; std::sort(s.begin(), s.end()); // std::cout << i << " " << s << std::endl; mp[s]++; } static long long int ans = 0; for (auto &p : mp) { // std::cout << p.first << " " << p.second << std::endl; ans += p.second * (p.second - 1) / 2; } std::cout << ans << std::endl; }
#include <algorithm> #include <iostream> #include <map> int main() { int N; std::string s; std::map<std::string, int> mp; std::cin >> N; for (int i = 0; i < N; i++) { std::cin >> s; // std::cout << i << " " << s << std::endl; std::sort(s.begin(), s.end()); // std::cout << i << " " << s << std::endl; mp[s]++; } static long long int ans = 0; for (auto &p : mp) { // std::cout << p.first << " " << p.second << std::endl; ans += (long long int)p.second * (p.second - 1) / 2; } std::cout << ans << std::endl; }
[ "type_conversion.add" ]
748,447
748,448
u632628124
cpp
p02947
#include <bits/stdc++.h> #include <unordered_map> #include <vector> using namespace std; int main(void) { int N; cin >> N; int ans = 0; vector<string> s(N); unordered_map<string, int> mp; //文字列を入力後ソート for (int i = 0; i < N; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); // mpが設定されていなかったら設定、設定されてたら加算 if (mp[s[i]]) { mp[s[i]] += 1; ans += (mp[s[i]] - 1); } else { mp[s[i]] = 1; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #include <unordered_map> #include <vector> using namespace std; int main(void) { int N; cin >> N; long long ans = 0; vector<string> s(N); unordered_map<string, int> mp; //文字列を入力後ソート for (int i = 0; i < N; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); // mpが設定されていなかったら設定、設定されてたら加算 if (mp[s[i]]) { mp[s[i]] += 1; ans += (mp[s[i]] - 1); } else { mp[s[i]] = 1; } } cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,449
748,450
u281840563
cpp
p02947
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; typedef long long ll; map<string, int> mp; int main() { int n; scanf("%d", &n); string s[N]; for (int i = 0; i < n; ++i) { cin >> s[i]; sort(s[i].begin(), s[i].end()); mp[s[i]]++; } ll ans = 0; for (auto it = mp.begin(); it != mp.end(); ++it) { ans += it->second * (it->second - 1) / 2; } printf("%lld", ans); return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; typedef long long ll; map<string, ll> mp; int main() { int n; scanf("%d", &n); string s[N]; for (int i = 0; i < n; ++i) { cin >> s[i]; sort(s[i].begin(), s[i].end()); mp[s[i]]++; } ll ans = 0; for (auto it = mp.begin(); it != mp.end(); ++it) { ans += 1ll * it->second * (it->second - 1) / 2; } printf("%lld\n", ans); return 0; }
[ "assignment.change", "literal.string.change", "call.arguments.change", "io.output.change", "io.output.newline.add" ]
748,454
748,455
u936668693
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<ll, int> pli; typedef pair<int, ll> pil; // long long ccw(const Point& A, const Point& B, const Point& C) { // return 1LL * (B.x - A.x)*(C.y - A.y) - 1LL * (B.y - A.y)*(C.x - A.x); //} int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); vector<string> v; int n; cin >> n; rep(i, n) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); v.push_back(tmp); } sort(v.begin(), v.end()); int ans = 0; int cnt = 1; rep(i, (int)v.size()) { if (i == 0) continue; if (v[i] == v[i - 1]) { cnt += 1; } else { ans += cnt * (cnt - 1) / 2; cnt = 1; } } ans += cnt * (cnt - 1) / 2; cout << ans << '\n'; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<ll, int> pli; typedef pair<int, ll> pil; // long long ccw(const Point& A, const Point& B, const Point& C) { // return 1LL * (B.x - A.x)*(C.y - A.y) - 1LL * (B.y - A.y)*(C.x - A.x); //} int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); vector<string> v; int n; cin >> n; rep(i, n) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); v.push_back(tmp); } sort(v.begin(), v.end()); ll ans = 0; ll cnt = 1; rep(i, (int)v.size()) { if (i == 0) continue; if (v[i] == v[i - 1]) { cnt += 1; } else { ans += cnt * (cnt - 1) / 2; cnt = 1; } } ans += cnt * (cnt - 1) / 2; cout << ans << '\n'; }
[ "variable_declaration.type.change" ]
748,456
748,457
u064087840
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s[n]; for (int i = 0; i < n; ++i) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); long long ans = 0, cnt = 1; for (int i = 1; i < n; ++i) if (s[i] == s[i - 1]) { ans += cnt; cnt++; } else cnt = 0; cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s[n]; for (int i = 0; i < n; ++i) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); long long ans = 0, cnt = 1; for (int i = 1; i < n; ++i) if (s[i] == s[i - 1]) { ans += cnt; cnt++; } else cnt = 1; cout << ans; }
[ "literal.number.change", "assignment.value.change" ]
748,458
748,459
u971421535
cpp
p02947
#include <bits/stdc++.h> #include <cmath> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define SUBL \ freopen("/home/ajinkya/Desktop/input.txt", "r", stdin); \ freopen("/home/ajinkya/Desktop/output.txt", "w", stdout); #define ll long long #define ull unsigned long long #define FI(i, a, n) for (int i = a; i <= n; i++) #define RFI(i, n, a) for (int i = n; i >= a; i--) #define FLL(i, a, n) for (ll i = a; i <= n; i++) #define RFLL(i, n, a) for (ll i = n; i >= a; i--) #define vi vector<int> #define vll vector<ll> #define all(v) v.begin(), v.end() #define pll pair<ll, ll> #define pi pair<int, int> #define GCD(a, b) __gcd(a, b) #define MP make_pair #define PB push_back #define PF push_front #define LB lower_bound #define UB upper_bound #define debug(x) cout << x << endl #define MOD 1000000007 #define INF LLONG_MAX #define PI 3.14159265359 using namespace std; int main() { fastio // SUBL int n; cin >> n; map<string, int> m; string s; for (int i = 0; i < n; i++) { cin >> s; sort(all(s)); m[s]++; } ll ans = 0; for (auto &i : m) { ans += (i.second * (i.second - 1)) / 2; } cout << ans; return 0; }
#include <bits/stdc++.h> #include <cmath> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define SUBL \ freopen("/home/ajinkya/Desktop/input.txt", "r", stdin); \ freopen("/home/ajinkya/Desktop/output.txt", "w", stdout); #define ll long long #define ull unsigned long long #define FI(i, a, n) for (int i = a; i <= n; i++) #define RFI(i, n, a) for (int i = n; i >= a; i--) #define FLL(i, a, n) for (ll i = a; i <= n; i++) #define RFLL(i, n, a) for (ll i = n; i >= a; i--) #define vi vector<int> #define vll vector<ll> #define all(v) v.begin(), v.end() #define pll pair<ll, ll> #define pi pair<int, int> #define GCD(a, b) __gcd(a, b) #define MP make_pair #define PB push_back #define PF push_front #define LB lower_bound #define UB upper_bound #define debug(x) cout << x << endl #define MOD 1000000007 #define INF LLONG_MAX #define PI 3.14159265359 using namespace std; int main() { fastio // SUBL ll n; cin >> n; map<string, ll> m; string s; for (ll i = 0; i < n; i++) { cin >> s; sort(all(s)); m[s]++; } ll ans = 0; for (auto &i : m) { ans += (i.second * (i.second - 1)) / 2; } cout << ans; return 0; }
[ "identifier.change", "control_flow.loop.for.initializer.change", "variable_declaration.type.change" ]
748,460
748,461
u851831516
cpp
p02947
#include <bits/stdc++.h> #include <cmath> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define SUBL \ freopen("/home/ajinkya/Desktop/input.txt", "r", stdin); \ freopen("/home/ajinkya/Desktop/output.txt", "w", stdout); #define ll long long #define ull unsigned long long #define FI(i, a, n) for (int i = a; i <= n; i++) #define RFI(i, n, a) for (int i = n; i >= a; i--) #define FLL(i, a, n) for (ll i = a; i <= n; i++) #define RFLL(i, n, a) for (ll i = n; i >= a; i--) #define vi vector<int> #define vll vector<ll> #define all(v) v.begin(), v.end() #define pll pair<ll, ll> #define pi pair<int, int> #define GCD(a, b) __gcd(a, b) #define MP make_pair #define PB push_back #define PF push_front #define LB lower_bound #define UB upper_bound #define debug(x) cout << x << endl #define MOD 1000000007 #define INF LLONG_MAX #define PI 3.14159265359 using namespace std; int main() { fastio // SUBL int n; cin >> n; map<string, int> m; string s; for (int i = 0; i < n; i++) { cin >> s; sort(all(s)); m[s]++; } int ans = 0; for (auto &i : m) { ans += (i.second * (i.second - 1)) / 2; } cout << ans; return 0; }
#include <bits/stdc++.h> #include <cmath> #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define SUBL \ freopen("/home/ajinkya/Desktop/input.txt", "r", stdin); \ freopen("/home/ajinkya/Desktop/output.txt", "w", stdout); #define ll long long #define ull unsigned long long #define FI(i, a, n) for (int i = a; i <= n; i++) #define RFI(i, n, a) for (int i = n; i >= a; i--) #define FLL(i, a, n) for (ll i = a; i <= n; i++) #define RFLL(i, n, a) for (ll i = n; i >= a; i--) #define vi vector<int> #define vll vector<ll> #define all(v) v.begin(), v.end() #define pll pair<ll, ll> #define pi pair<int, int> #define GCD(a, b) __gcd(a, b) #define MP make_pair #define PB push_back #define PF push_front #define LB lower_bound #define UB upper_bound #define debug(x) cout << x << endl #define MOD 1000000007 #define INF LLONG_MAX #define PI 3.14159265359 using namespace std; int main() { fastio // SUBL ll n; cin >> n; map<string, ll> m; string s; for (ll i = 0; i < n; i++) { cin >> s; sort(all(s)); m[s]++; } ll ans = 0; for (auto &i : m) { ans += (i.second * (i.second - 1)) / 2; } cout << ans; return 0; }
[ "identifier.change", "control_flow.loop.for.initializer.change", "variable_declaration.type.change" ]
748,462
748,461
u851831516
cpp
p02947
#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <map> #include <set> #include <vector> using namespace std; int mainC() { string str; cin >> str; int n = stoi(str); map<string, int> strMap; for (int i = 0; i < n; ++i) { cin >> str; sort(str.begin(), str.end()); strMap[str]++; } long long m = 0; for (const auto &x : strMap) { auto k = x.second; if (k > 1) m += (k - 1) * k; } m /= 2; cout << m << endl; return 0; } int main() { return mainC(); }
#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <map> #include <set> #include <vector> using namespace std; int mainC() { string str; cin >> str; int n = stoi(str); map<string, long long> strMap; for (int i = 0; i < n; ++i) { cin >> str; sort(str.begin(), str.end()); strMap[str]++; } long long m = 0; for (const auto &x : strMap) { auto k = x.second; if (k > 1) m += (k - 1) * k; } m /= 2; cout << m << endl; return 0; } int main() { return mainC(); }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,465
748,466
u227117171
cpp
p02947
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define VSORT(v) sort(v.begin(), v.end()); #define VE vector<int> #define VEP vector<pair<int, int>> #define llong long long #define pb(a) push_back(a) using namespace std; long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { int n; cin >> n; map<string, int> ma; for (int i = 0; i < n; ++i) { string str; cin >> str; sort(str.begin(), str.end()); int before_size = ma.size(); ma[str]; if (ma.size() == before_size) { ma[str]++; } } llong ans = 0; for (auto itr = ma.begin(); itr != ma.end(); itr++) { ans += itr->second * (itr->second + 1) / 2; } // auto ans = accumulate(ma.begin(), ma.end(), 0LL, [](llong acc, auto itr) // {return acc + itr.second * (itr.second + 1) / 2; }); cout << ans << endl; return 0; }
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define VSORT(v) sort(v.begin(), v.end()); #define VE vector<int> #define VEP vector<pair<int, int>> #define llong long long #define pb(a) push_back(a) using namespace std; long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { int n; cin >> n; map<string, int> ma; for (int i = 0; i < n; ++i) { string str; cin >> str; sort(str.begin(), str.end()); int before_size = ma.size(); ma[str]; if (ma.size() == before_size) { ma[str]++; } } llong ans = 0; for (auto itr = ma.begin(); itr != ma.end(); itr++) { ans += (llong)itr->second * (itr->second + 1) / 2; } // auto ans = accumulate(ma.begin(), ma.end(), 0LL, [](llong acc, auto itr) // {return acc + itr.second * (itr.second + 1) / 2; }); cout << ans << endl; return 0; }
[ "type_conversion.add" ]
748,468
748,469
u343110708
cpp
p02947
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define VSORT(v) sort(v.begin(), v.end()); #define VE vector<int> #define VEP vector<pair<int, int>> #define llong long long #define pb(a) push_back(a) using namespace std; long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { int n; cin >> n; map<string, int> ma; for (int i = 0; i < n; ++i) { string str; cin >> str; sort(str.begin(), str.end()); int before_size = ma.size(); ma[str]; if (ma.size() == before_size) { ma[str]++; } } llong ans = 0; for (auto itr = ma.begin(); itr != ma.end(); itr++) { ans += itr->second * (itr->second + 1); } // auto ans = accumulate(ma.begin(), ma.end(), 0LL, [](llong acc, auto itr) // {return acc + itr.second * (itr.second + 1) / 2; }); cout << ans << endl; return 0; }
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define VSORT(v) sort(v.begin(), v.end()); #define VE vector<int> #define VEP vector<pair<int, int>> #define llong long long #define pb(a) push_back(a) using namespace std; long long GCD(long long a, long long b) { if (b == 0) return a; else return GCD(b, a % b); } int main() { int n; cin >> n; map<string, int> ma; for (int i = 0; i < n; ++i) { string str; cin >> str; sort(str.begin(), str.end()); int before_size = ma.size(); ma[str]; if (ma.size() == before_size) { ma[str]++; } } llong ans = 0; for (auto itr = ma.begin(); itr != ma.end(); itr++) { ans += (llong)itr->second * (itr->second + 1) / 2; } // auto ans = accumulate(ma.begin(), ma.end(), 0LL, [](llong acc, auto itr) // {return acc + itr.second * (itr.second + 1) / 2; }); cout << ans << endl; return 0; }
[ "assignment.change" ]
748,470
748,469
u343110708
cpp
p02947
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <utility> #include <vector> using namespace std; int main() { int N; cin >> N; vector<string> str(N); map<string, int> m; for (int i = 0; i < N; i++) { cin >> str.at(i); sort(str[i].begin(), str[i].end()); m[str[i]]++; } int ans = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { int t = itr->second; ans += t * (t - 1) / 2; } cout << ans << endl; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <utility> #include <vector> using namespace std; int main() { int N; cin >> N; vector<string> str(N); map<string, long long> m; for (int i = 0; i < N; i++) { cin >> str.at(i); sort(str[i].begin(), str[i].end()); m[str[i]]++; } long long ans = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { long long t = itr->second; ans += t * (t - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,471
748,472
u803481017
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define V vector #define VI vector<int> #define VVI vector<vector<int>> using namespace std; int main(void) { int N, ans = 0, cnt = 0; cin >> N; vector<string> s(N); rep(i, N) { 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]) { cnt += 1; ans += cnt; } else { cnt = 0; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define V vector #define VI vector<int> #define VVI vector<vector<int>> using namespace std; int main(void) { long N, ans = 0, cnt = 0; cin >> N; vector<string> s(N); rep(i, N) { 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]) { cnt += 1; ans += cnt; } else { cnt = 0; } } cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
748,473
748,474
u144980750
cpp
p02947
#include <bits/stdc++.h> #include <unordered_map> using namespace std; typedef long long ll; typedef long double ld; typedef complex<ld> cd; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<ld, ld> pd; typedef vector<int> vi; typedef vector<ld> vd; typedef vector<ll> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; typedef vector<cd> vcd; #define FOR(i, a, b) for (int i = a; i < (b); i++) #define F0R(i, a) for (int i = 0; i < (a); i++) #define FORd(i, a, b) for (int i = (b)-1; i >= a; i--) #define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--) #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define f first #define s second #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() #define shandom_ruffle random_shuffle const long MOD = 3.037e+09; // sqrt(LONG_MAX) const ll INF = 1e18; const int MX = 100001; // check the limits, dummy int main() { ios_base::sync_with_stdio(0); cin.tie(0); unordered_map<string, int> h2c; // hash => count int n; cin >> n; string str; for (int i = 0; i < n; ++i) { cin >> str; string sstr = str; sort(sstr.begin(), sstr.end()); ++h2c[sstr]; } ll ans = 0; for (auto pa : h2c) { ans += (pa.second) * (pa.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #include <unordered_map> using namespace std; typedef long long ll; typedef long double ld; typedef complex<ld> cd; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<ld, ld> pd; typedef vector<int> vi; typedef vector<ld> vd; typedef vector<ll> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; typedef vector<cd> vcd; #define FOR(i, a, b) for (int i = a; i < (b); i++) #define F0R(i, a) for (int i = 0; i < (a); i++) #define FORd(i, a, b) for (int i = (b)-1; i >= a; i--) #define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--) #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define f first #define s second #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() #define shandom_ruffle random_shuffle const long MOD = 3.037e+09; // sqrt(LONG_MAX) const ll INF = 1e18; const int MX = 100001; // check the limits, dummy int main() { ios_base::sync_with_stdio(0); cin.tie(0); unordered_map<string, ll> h2c; // hash => count int n; cin >> n; string str; for (int i = 0; i < n; ++i) { cin >> str; string sstr = str; sort(sstr.begin(), sstr.end()); ++h2c[sstr]; } unsigned long long ans = 0; for (auto pa : h2c) { ans += (pa.second) * (pa.second - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.widen.change" ]
748,479
748,480
u655810450
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += (long)(count * (count - 1)) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; long count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
748,483
748,484
u680087927
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; long count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
748,485
748,484
u680087927
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; long count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.narrow.change", "variable_declaration.type.primitive.change" ]
748,486
748,484
u680087927
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += (long)(count * (count - 1)) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += (count * (long)(count - 1)) / 2; cout << ans << endl; }
[ "type_conversion.add" ]
748,483
748,488
u680087927
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += (count * (long)(count - 1)) / 2; cout << ans << endl; }
[ "type_conversion.add" ]
748,485
748,488
u680087927
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += (count * (long)(count - 1)) / 2; cout << ans << endl; }
[ "variable_declaration.type.narrow.change" ]
748,486
748,488
u680087927
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long long ans = 0; int count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int n; cin >> n; 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, s + n); long ans = 0; long count = 1; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { count += 1; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2l; cout << ans << endl; }
[ "variable_declaration.type.narrow.change", "variable_declaration.type.primitive.change" ]
748,486
748,490
u680087927
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define debug(x) cout << #x << " " << x << '\n'; int main() { int n; cin >> n; string s; vector<string> v(n); for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); v[i] = s; } long int cnt = 0; sort(v.begin(), v.end()); int pos = 0, en = 0; while (pos <= n - 1) { en = pos; int t = 0; while (en <= n - 1) { if (v[pos] == v[en]) en++; else break; } t = en - pos; cnt += t * (t - 1) / 2; pos = en; ; } cout << cnt; }
#include <bits/stdc++.h> using namespace std; #define debug(x) cout << #x << " " << x << '\n'; #define int long long signed main() { int n; cin >> n; string s; vector<string> v(n); for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); v[i] = s; } int cnt = 0; sort(v.begin(), v.end()); int pos = 0, en = 0; while (pos <= n - 1) { en = pos; int t = 0; while (en <= n - 1) { if (v[pos] == v[en]) en++; else break; } t = en - pos; cnt += t * (t - 1) / 2; pos = en; ; } cout << cnt; }
[ "variable_declaration.type.widen.change", "variable_declaration.type.narrow.change" ]
748,491
748,492
u502092128
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; //#include <boost/multiprecision/cpp_int.hpp> // typedef boost::multiprecision::cpp_int ll; typedef long double dd; #define i_7 (ll)(1E9 + 7) //#define i_7 998244353 #define i_5 i_7 - 2 ll mod(ll a) { ll c = a % i_7; if (c >= 0) return c; return c + i_7; } typedef pair<ll, ll> l_l; ll inf = (ll)1E17; #define rep(i, l, r) for (ll i = l; i <= r; i++) #define pb push_back ll max(ll a, ll b) { if (a < b) return b; else return a; } ll min(ll a, ll b) { if (a > b) return b; else return a; } void Max(ll &pos, ll val) { pos = max(pos, val); } // Max(dp[n],dp[n-1]); void Min(ll &pos, ll val) { pos = min(pos, val); } void Add(ll &pos, ll val) { pos = mod(pos + val); } dd EPS = 1E-9; #define fastio \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); /////////////////////////////////////// int main() { fastio ll n; cin >> n; string s[n]; rep(i, 0, n - 1) { string k; cin >> k; sort(k.begin(), k.end()); s[i] = k; } sort(s, s + n); ll ans = 0; ll pos = 0; while (pos <= n - 1) { ll ne = pos; while (ne <= n - 1) { if (s[pos] == s[ne]) { ne++; } else { break; } } ll x = ne - pos; Add(ans, x * (x - 1) / 2); pos = ne; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; //#include <boost/multiprecision/cpp_int.hpp> // typedef boost::multiprecision::cpp_int ll; typedef long double dd; #define i_7 (ll)(1E9 + 7) //#define i_7 998244353 #define i_5 i_7 - 2 ll mod(ll a) { ll c = a % i_7; if (c >= 0) return c; return c + i_7; } typedef pair<ll, ll> l_l; ll inf = (ll)1E17; #define rep(i, l, r) for (ll i = l; i <= r; i++) #define pb push_back ll max(ll a, ll b) { if (a < b) return b; else return a; } ll min(ll a, ll b) { if (a > b) return b; else return a; } void Max(ll &pos, ll val) { pos = max(pos, val); } // Max(dp[n],dp[n-1]); void Min(ll &pos, ll val) { pos = min(pos, val); } void Add(ll &pos, ll val) { pos = mod(pos + val); } dd EPS = 1E-9; #define fastio \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); /////////////////////////////////////// int main() { fastio ll n; cin >> n; string s[n]; rep(i, 0, n - 1) { string k; cin >> k; sort(k.begin(), k.end()); s[i] = k; } sort(s, s + n); ll ans = 0; ll pos = 0; while (pos <= n - 1) { ll ne = pos; while (ne <= n - 1) { if (s[pos] == s[ne]) { ne++; } else { break; } } ll x = ne - pos; ans += x * (x - 1) / 2; pos = ne; } cout << ans << endl; return 0; }
[ "call.remove", "call.arguments.change" ]
748,493
748,494
u763881112
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { map<string, int> mp; int n; cin >> n; int cnt = 0; while (n--) { string s; cin >> s; sort(s.begin(), s.end()); cnt += mp[s]; mp[s]++; } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { map<string, ll> mp; ll n; cin >> n; ll cnt = 0; while (n--) { string s; cin >> s; sort(s.begin(), s.end()); cnt += mp[s]; mp[s]++; } cout << cnt << endl; return 0; }
[ "variable_declaration.type.change" ]
748,499
748,500
u983588973
cpp
p02947
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; long long ans = 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()); int i = 0, j = 0; while (i < n) { if (s[j] == s[i]) { i++; } else { ans += (i - j) * (i - j - 1) / 2; j = i; } } ans += (i - j) * (i - j - 1) / 2; cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; long long ans = 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()); long long i = 0, j = 0; while (i < n) { if (s[j] == s[i]) { i++; } else { ans += (i - j) * (i - j - 1) / 2; j = i; } } ans += (i - j) * (i - j - 1) / 2; cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,505
748,506
u219041750
cpp
p02947
#pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; const long long MOD = 1000000007LL; const long long INF = 1e18; int GCD(int a, int b) { return b == 0 ? a : GCD(b, a % b); } long long fast_exp(long long base, long long exp, long long mod = MOD) { long long tot = 1; for (; exp > 0; exp >>= 1) { if ((exp & 1) == 1) tot = tot * base % mod; base = base * base % mod; } return tot; } long long mult_mod(long long base, long long exp, long long mod = MOD) { long long tot = 0; for (; exp > 0; exp >>= 1) { if ((exp & 1) == 1) tot = (tot + base) % mod; base = base * 2 % mod; } return tot; } struct chash { static uint64_t splitmix64(uint64_t x) { x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } size_t operator()(pair<uint64_t, uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM) ^ (splitmix64(x.second + FIXED_RANDOM) >> 1); } }; // ree always check bounds // int vs long long // bitset cheese <3 long long get_sum(long long n, long long a) { if (n & 1 == 0) { return mult_mod(n >> 1, 2 * a + mult_mod(n - 1, 2)); } long long inv = fast_exp(2, MOD - 2); return inv * mult_mod(n, 2 * a + mult_mod(n - 1, 2)); } map<string, int> d; int main() { cin.sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int n; cin >> n; string s; for (int i = 0; i < n; ++i) { cin >> s; sort(s.begin(), s.end()); ++d[s]; } long long tot = 0; for (auto i : d) { tot += i.second * (i.second - 1) / 2; } cout << tot; return 0; }
#pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; const long long MOD = 1000000007LL; const long long INF = 1e18; int GCD(int a, int b) { return b == 0 ? a : GCD(b, a % b); } long long fast_exp(long long base, long long exp, long long mod = MOD) { long long tot = 1; for (; exp > 0; exp >>= 1) { if ((exp & 1) == 1) tot = tot * base % mod; base = base * base % mod; } return tot; } long long mult_mod(long long base, long long exp, long long mod = MOD) { long long tot = 0; for (; exp > 0; exp >>= 1) { if ((exp & 1) == 1) tot = (tot + base) % mod; base = base * 2 % mod; } return tot; } struct chash { static uint64_t splitmix64(uint64_t x) { x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } size_t operator()(pair<uint64_t, uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM) ^ (splitmix64(x.second + FIXED_RANDOM) >> 1); } }; // ree always check bounds // int vs long long // bitset cheese <3 long long get_sum(long long n, long long a) { if (n & 1 == 0) { return mult_mod(n >> 1, 2 * a + mult_mod(n - 1, 2)); } long long inv = fast_exp(2, MOD - 2); return inv * mult_mod(n, 2 * a + mult_mod(n - 1, 2)); } map<string, long long> d; int main() { cin.sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int n; cin >> n; string s; for (int i = 0; i < n; ++i) { cin >> s; sort(s.begin(), s.end()); ++d[s]; } long long tot = 0; for (auto i : d) { tot += i.second * (i.second - 1) / 2; } cout << tot; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,509
748,510
u276568758
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long total = 0; vector<string> s(N); map<string, int> sM{}; for (int i = 0; i < N; i++) { string temp; cin >> temp; sort(temp.begin(), temp.end()); /* s[i] = temp;*/ sM[temp]++; } for (auto val : sM) { total += val.second * (val.second - 1) / 2; } cout << total << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; long long total = 0; vector<string> s(N); map<string, int> sM{}; for (int i = 0; i < N; i++) { string temp; cin >> temp; sort(temp.begin(), temp.end()); /* s[i] = temp;*/ sM[temp]++; } for (auto val : sM) { total += (long long)val.second * (val.second - 1) / 2; } cout << total << endl; }
[ "type_conversion.add" ]
748,515
748,516
u142253890
cpp
p02947
#include <algorithm> #include <cassert> #include <functional> #include <iostream> #include <unordered_map> #include <vector> using namespace std; int main() { int n; cin >> n; vector<string> vec(n); unordered_map<string, int> mp; int count = 0; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); if (mp[s] == 0) { mp[s] = 1; // cout<<"ご新規"<<endl; } else { count += mp[s]; mp[s]++; } } cout << count << endl; }
#include <algorithm> #include <cassert> #include <functional> #include <iostream> #include <unordered_map> #include <vector> using namespace std; int main() { int n; cin >> n; vector<string> vec(n); unordered_map<string, int> mp; long long count = 0; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); if (mp[s] == 0) { mp[s] = 1; // cout<<"ご新規"<<endl; } else { count += mp[s]; mp[s]++; } } cout << count << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,524
748,525
u759162415
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> array(N); string s; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); array[i] = s; } sort(array.begin(), array.end()); long long ans = 0; int count = 1; for (int i = 1; i < N; i++) { if (array[i] == array[i - 1]) { count++; if (i == N - 1) { ans += count * (count - 1) / 2; count = 1; } } else { ans += count * (count - 1) / 2; count = 1; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> array(N); string s; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); array[i] = s; } sort(array.begin(), array.end()); long long ans = 0; long long count = 1; for (int i = 1; i < N; i++) { if (array[i] == array[i - 1]) { count++; if (i == N - 1) { ans += count * (count - 1) / 2; count = 1; } } else { ans += count * (count - 1) / 2; count = 1; } } cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,535
748,536
u507188501
cpp
p02947
#include <bits/stdc++.h> using namespace std; int ans; int main() { ios::sync_with_stdio(0); int 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] = 1; } else { ans += m[s]; m[s]++; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; long long ans; int main() { ios::sync_with_stdio(0); int 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] = 1; } else { ans += m[s]; m[s]++; } } cout << ans; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,537
748,538
u058333722
cpp
p02947
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; #define MAX_N 100050 int N; string s[MAX_N]; void solve() { long long ans = 0; int count = 1; for (int i = 0; i < N; i++) { sort(s[i].begin(), s[i].end()); } sort(s, s + N); for (int i = 1; i < N; i++) { if (s[i] == s[i - 1]) { count++; } else { ans += (count * (count - 1)) / 2; count = 1; } if (i == N - 1) ans += (count * (count - 1)) / 2; } cout << ans; } int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> s[i]; } solve(); return 0; }
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; #define MAX_N 100050 int N; string s[MAX_N]; void solve() { long long ans = 0; long long count = 1; for (int i = 0; i < N; i++) { sort(s[i].begin(), s[i].end()); } sort(s, s + N); for (int i = 1; i < N; i++) { if (s[i] == s[i - 1]) { count++; } else { ans += (count * (count - 1)) / 2; count = 1; } if (i == N - 1) ans += (count * (count - 1)) / 2; } cout << ans; } int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> s[i]; } solve(); return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,549
748,550
u835561357
cpp
p02947
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> 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 i = 0; i < n; i++) sort(s[i].begin(), s[i].end()); map<string, int> cnt_map; long long sum = 0; for (int i = 0; i < n; i++) cnt_map[s[i]]++; // for(int i=0; i<cnt_map.size(); i++) sum += cnt_map[s[i]]*(cnt_map[s[i]]-1) // / 2; for (auto itr = cnt_map.begin(); itr != cnt_map.end(); itr++) { sum += itr->second * (itr->second - 1) / 2; } // cout << "--sorting result--" << endl; // for(int i=0; i<n; i++) cout << s[i] << endl; cout << sum << endl; };
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> 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 i = 0; i < n; i++) sort(s[i].begin(), s[i].end()); map<string, long long> cnt_map; long sum = 0; for (int i = 0; i < n; i++) cnt_map[s[i]]++; // for(int i=0; i<cnt_map.size(); i++) sum += cnt_map[s[i]]*(cnt_map[s[i]]-1) // / 2; for (auto itr = cnt_map.begin(); itr != cnt_map.end(); itr++) { sum += (itr->second * (itr->second - 1) / 2); // sum += static_cast<long long>(itr->second*(itr->second-1) / 2); } // cout << "--sorting result--" << endl; // for(int i=0; i<n; i++) cout << s[i] << endl; cout << sum << endl; };
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "variable_declaration.type.narrow.change" ]
748,551
748,552
u100919930
cpp
p02947
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> 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 i = 0; i < n; i++) sort(s[i].begin(), s[i].end()); map<string, int> cnt_map; long sum = 0; for (int i = 0; i < n; i++) cnt_map[s[i]]++; // for(int i=0; i<cnt_map.size(); i++) sum += cnt_map[s[i]]*(cnt_map[s[i]]-1) // / 2; for (auto itr = cnt_map.begin(); itr != cnt_map.end(); itr++) { sum += itr->second * (itr->second - 1) / 2; } // cout << "--sorting result--" << endl; // for(int i=0; i<n; i++) cout << s[i] << endl; cout << sum << endl; };
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> 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 i = 0; i < n; i++) sort(s[i].begin(), s[i].end()); map<string, long long> cnt_map; long sum = 0; for (int i = 0; i < n; i++) cnt_map[s[i]]++; // for(int i=0; i<cnt_map.size(); i++) sum += cnt_map[s[i]]*(cnt_map[s[i]]-1) // / 2; for (auto itr = cnt_map.begin(); itr != cnt_map.end(); itr++) { sum += (itr->second * (itr->second - 1) / 2); // sum += static_cast<long long>(itr->second*(itr->second-1) / 2); } // cout << "--sorting result--" << endl; // for(int i=0; i<n; i++) cout << s[i] << endl; cout << sum << endl; };
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,553
748,552
u100919930
cpp
p02947
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> 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 i = 0; i < n; i++) sort(s[i].begin(), s[i].end()); map<string, int> cnt_map; long sum = 0; for (int i = 0; i < n; i++) cnt_map[s[i]]++; for (auto itr = cnt_map.begin(); itr != cnt_map.end(); ++itr) { sum += itr->second * (itr->second - 1) / 2; } // cout << "--sorting result--" << endl; // for(int i=0; i<n; i++) cout << s[i] << endl; cout << sum << endl; };
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <utility> #include <vector> 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 i = 0; i < n; i++) sort(s[i].begin(), s[i].end()); map<string, long long> cnt_map; long sum = 0; for (int i = 0; i < n; i++) cnt_map[s[i]]++; // for(int i=0; i<cnt_map.size(); i++) sum += cnt_map[s[i]]*(cnt_map[s[i]]-1) // / 2; for (auto itr = cnt_map.begin(); itr != cnt_map.end(); itr++) { sum += (itr->second * (itr->second - 1) / 2); // sum += static_cast<long long>(itr->second*(itr->second-1) / 2); } // cout << "--sorting result--" << endl; // for(int i=0; i<n; i++) cout << s[i] << endl; cout << sum << endl; };
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,554
748,552
u100919930
cpp
p02947
#include <bits/stdc++.h> using namespace std; long INF = 1000000000000000; int main() { long N; cin >> N; vector<string> s(N + 1); s.at(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 ans = 0, count; for (int i = 1; i <= N; i++) { if (s.at(i - 1) != s.at(i)) count = 0; else count++; ans += count; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long INF = 1000000000000000; int main() { long N; cin >> N; vector<string> s(N + 1); s.at(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 ans = 0, count; for (int i = 1; i <= N; i++) { if (s.at(i - 1) != s.at(i)) count = 0; else count++; ans += count; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
748,555
748,556
u968365254
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; string str; map<string, int> dic; for (int i = 0; i < N; ++i) { cin >> str; sort(str.begin(), str.end()); auto itr = dic.find(str); if (itr != dic.end()) { // アナグラムあり dic[str] += 1; } else { // 新規 dic[str] = 1; } } long long ans = 0; for (auto itr = dic.begin(); itr != dic.end(); ++itr) { int num = itr->second; ans += num * (num - 1) / 2; } cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; string str; map<string, int> dic; for (int i = 0; i < N; ++i) { cin >> str; sort(str.begin(), str.end()); auto itr = dic.find(str); if (itr != dic.end()) { // 新規 dic[str] += 1; } else { // アナグラムあり dic[str] = 1; } } long long ans = 0; for (auto itr = dic.begin(); itr != dic.end(); ++itr) { long long num = itr->second; ans += num * (num - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,557
748,558
u774160580
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; string str; map<string, int> dic; for (int i = 0; i < N; ++i) { cin >> str; sort(str.begin(), str.end()); auto itr = dic.find(str); if (itr != dic.end()) { // 新規 dic[str] += 1; } else { // アナグラムあり dic[str] = 1; } } int ans = 0; for (auto itr = dic.begin(); itr != dic.end(); ++itr) { int num = itr->second; ans += num * (num - 1) / 2; } cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; string str; map<string, int> dic; for (int i = 0; i < N; ++i) { cin >> str; sort(str.begin(), str.end()); auto itr = dic.find(str); if (itr != dic.end()) { // 新規 dic[str] += 1; } else { // アナグラムあり dic[str] = 1; } } long long ans = 0; for (auto itr = dic.begin(); itr != dic.end(); ++itr) { long long num = itr->second; ans += num * (num - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,559
748,558
u774160580
cpp
p02947
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(a, b) for (int a = 0; a < (b); ++a) #define REP1(i, n) for (int i = 1; i <= (n); ++i) #define debug(x) cerr << #x << ": " << x << '\n' #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define pb push_back #define mp make_pair #define INF (1 << 29) using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; int dy[] = {0, 0, 1, -1, 0}; int dx[] = {1, -1, 0, 0, 0}; template <class T = int> T in() { T x; cin >> x; return (x); } template <class T> void print(T &x) { cout << x << '\n'; } const int MOD = (int)1e9 + 7; const int MAX = 510000; ll fac[MAX], finv[MAX], inv[MAX]; void COMint() { 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; } } ll COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll gcd(ll a, ll b) { if (b == 0) return a; if (a > b) { swap(a, b); } return gcd(a, b % a); } ll lcm(ll a, ll b) { ll g; g = gcd(a, b); return a * b / g; } bool compare_by_b(pair<int, int> a, pair<int, int> b) { if (a.second != b.second) { return a.second < b.second; } else { return a.first < b.first; } } bool compare_by_a(pair<int, int> a, pair<int, int> b) { if (a.first != b.first) { return a.first < b.first; } else { return a.second < b.second; } } int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<string> vec; REP(i, N) { string s; cin >> s; vector<char> c; REP(j, 10) { c.pb(s[j]); } sort(all(c)); REP(j, 10) { s[j] = c[j]; } vec.pb(s); } sort(all(vec)); int cnt; cnt = 1; ll ans; ans = 0; REP1(i, N - 1) { if (vec[i] == vec[i - 1]) { cnt++; } else { if (cnt > 1) { ans += cnt * (cnt - 1) / 2; } cnt = 1; } } if (cnt > 1) { ans += cnt * (cnt - 1) / 2; } print(ans); return 0; }
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(a, b) for (int a = 0; a < (b); ++a) #define REP1(i, n) for (int i = 1; i <= (n); ++i) #define debug(x) cerr << #x << ": " << x << '\n' #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define pb push_back #define mp make_pair #define INF (1 << 29) using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; int dy[] = {0, 0, 1, -1, 0}; int dx[] = {1, -1, 0, 0, 0}; template <class T = int> T in() { T x; cin >> x; return (x); } template <class T> void print(T &x) { cout << x << '\n'; } const int MOD = (int)1e9 + 7; const int MAX = 510000; ll fac[MAX], finv[MAX], inv[MAX]; void COMint() { 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; } } ll COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll gcd(ll a, ll b) { if (b == 0) return a; if (a > b) { swap(a, b); } return gcd(a, b % a); } ll lcm(ll a, ll b) { ll g; g = gcd(a, b); return a * b / g; } bool compare_by_b(pair<int, int> a, pair<int, int> b) { if (a.second != b.second) { return a.second < b.second; } else { return a.first < b.first; } } bool compare_by_a(pair<int, int> a, pair<int, int> b) { if (a.first != b.first) { return a.first < b.first; } else { return a.second < b.second; } } int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<string> vec; REP(i, N) { string s; cin >> s; vector<char> c; REP(j, 10) { c.pb(s[j]); } sort(all(c)); REP(j, 10) { s[j] = c[j]; } vec.pb(s); } sort(all(vec)); ll cnt; cnt = 1; ll ans; ans = 0; REP1(i, N - 1) { if (vec[i] == vec[i - 1]) { cnt++; } else { if (cnt > 1) { ans += cnt * (cnt - 1) / 2; } cnt = 1; } } if (cnt > 1) { ans += cnt * (cnt - 1) / 2; } print(ans); return 0; }
[ "variable_declaration.type.change" ]
748,560
748,561
u311671153
cpp
p02947
#include <bits/stdc++.h> int main() { std::cin.tie(0); std::cin.sync_with_stdio(false); int n; std::cin >> n; std::vector<std::string> s(n); for (auto &x : s) { std::cin >> x; std::sort(x.begin(), x.end()); } std::sort(s.begin(), s.end()); s.push_back(std::string{}); auto prv = std::string{}; int ret = 0, tmp = 0; for (auto x : s) { if (x != prv) { ret += tmp * (tmp - 1) / 2; tmp = 0; } tmp++; prv = x; } std::cout << ret << std::endl; return 0; }
#include <bits/stdc++.h> int main() { std::cin.tie(0); std::cin.sync_with_stdio(false); int n; std::cin >> n; std::vector<std::string> s(n); for (auto &x : s) { std::cin >> x; std::sort(x.begin(), x.end()); } std::sort(s.begin(), s.end()); s.push_back(std::string{}); auto prv = std::string{}; long long ret = 0, tmp = 0; for (auto x : s) { if (x != prv) { ret += tmp * (tmp - 1) / 2; tmp = 0; } tmp++; prv = x; } std::cout << ret << std::endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,566
748,567
u846041485
cpp
p02947
#include <algorithm> #include <iostream> #include <map> using namespace std; typedef long long ll; const int MAXN = 1e5 + 10; int n; string s[MAXN]; void solve() { map<string, int> m; for (int i = 0; i < n; i++) { sort(s[i].begin(), s[i].end()); m[s[i]]++; } ll sum = 0; for (auto x : m) { sum += x.second * (x.second - 1) / 2; } cout << sum << endl; } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; } solve(); }
#include <algorithm> #include <iostream> #include <map> using namespace std; typedef long long ll; const int MAXN = 1e5 + 10; int n; string s[MAXN]; void solve() { map<string, ll> m; for (int i = 0; i < n; i++) { sort(s[i].begin(), s[i].end()); m[s[i]]++; } ll sum = 0; for (auto x : m) { sum += x.second * (x.second - 1) / 2; } cout << sum << endl; } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; } solve(); }
[]
748,570
748,571
u550178285
cpp
p02947
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int n; cin >> n; map<string, int> count; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); count[s]++; } int64_t ans = 0; for (auto x : count) { ans += x.second * (x.second - 1) / 2; // nC2 = n*(n-1)/(2*1) } cout << ans << endl; }
#include <algorithm> #include <iostream> #include <map> using namespace std; int main() { int n; cin >> n; map<string, int> count; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); count[s]++; } int64_t ans = 0; for (auto x : count) { ans += (int64_t)x.second * (x.second - 1) / 2; // nC2 = n*(n-1)/(2*1) } cout << ans << endl; }
[ "type_conversion.add" ]
748,572
748,573
u716314620
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ct(string) cout << string << endl int main() { int n; int64_t ans = 0; cin >> n; map<string, int> data; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); data[s]++; } for (auto x : data) { if (x.second > 1) { ans += (x.second * (x.second - 1) / 2); } } ct(ans); }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ct(string) cout << string << endl int main() { int n; int64_t ans = 0; cin >> n; map<string, int64_t> data; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); data[s]++; } for (auto x : data) { if (x.second > 1) { ans += x.second * (x.second - 1) / 2; } } ct(ans); }
[ "variable_declaration.type.primitive.change" ]
748,574
748,575
u716314620
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, cnt = 0; cin >> n; unordered_map<string, long long> mp; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto itr = mp.begin(); itr != mp.end(); ++itr) { cnt += itr->second * (itr->second - 1) / 2; } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, cnt = 0; cin >> n; unordered_map<string, long long> mp; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto itr = mp.begin(); itr != mp.end(); ++itr) { cnt += itr->second * (itr->second - 1) / 2; } cout << cnt << endl; return 0; }
[ "variable_declaration.type.change" ]
748,576
748,577
u952437626
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int n; long long res = 0; cin >> n; map<string, int> mp; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { int r = p.second; res = r * (r - 1) / 2; } cout << res << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int n; long long res = 0; cin >> n; map<string, int> mp; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { int r = p.second; res += (long long)r * (r - 1) / 2; } cout << res << endl; }
[ "assignment.value.change" ]
748,578
748,579
u779636842
cpp
p02947
#include <bits/stdc++.h> using namespace std; signed main() { int N; cin >> N; vector<string> strings(N); for (int n = 0; n < N; ++n) { cin >> strings[n]; sort(strings[n].begin(), strings[n].end()); } sort(strings.begin(), strings.end()); int previdx = 0; string prev = strings[0]; long long ans = 0; for (int k = 0; k < N; ++k) { if (strings[k] != prev) { ans += (k - previdx) * (k - previdx - 1) / 2; prev = strings[k]; previdx = k; } } ans += (N - previdx) * (N - previdx - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int N; cin >> N; vector<string> strings(N); for (int n = 0; n < N; ++n) { cin >> strings[n]; sort(strings[n].begin(), strings[n].end()); } sort(strings.begin(), strings.end()); int previdx = 0; string prev = strings[0]; long long ans = 0; for (int k = 0; k < N; ++k) { if (strings[k] != prev) { ans += (k - previdx) * (k - previdx - 1) / 2; prev = strings[k]; previdx = k; } } ans += (N - previdx) * (N - previdx - 1) / 2; cout << ans << endl; }
[]
748,582
748,583
u071203963
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { map<string, int> vis; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); vis[s]++; } long long ans = 0; for (auto it : vis) ans += (it.second - 1) * it.second / 2; cout << ans << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { map<string, long long> vis; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); vis[s]++; } long long ans = 0; for (auto it : vis) ans += (it.second - 1) * it.second / 2; cout << ans << endl; } return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,586
748,587
u659003514
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 5; const ll mod = 1e9 + 9; ll key(string s) { ll ans = 0; for (int i = 0; i < (int)s.length(); i++) { ans = ((ans * 233LL) + s[i]) % mod; } return ans; } int main() { int n; while (cin >> n) { string s; map<ll, ll> hash; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); ll temp = key(s); hash[temp]++; } ll ans = 0; for (auto it : hash) { ans += (it.second - 1) * (it.second) / 2LL; } cout << ans << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; // typedef long long ll; typedef unsigned long long ll; const int maxn = 1e5 + 5; const ll mod = 1e9 + 9; ll key(string s) { ll ans = 0; for (int i = 0; i < (int)s.length(); i++) { ans = ((ans * 233LL) + s[i]); } return ans; } int main() { int n; while (cin >> n) { string s; map<ll, ll> hash; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); ll temp = key(s); hash[temp]++; } ll ans = 0; for (auto it : hash) { ans += (it.second - 1) * (it.second) / 2LL; } cout << ans << endl; } return 0; }
[ "variable_declaration.type.widen.change", "expression.operation.binary.remove" ]
748,588
748,589
u659003514
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; map<string, int> m; for (int i = 0; i < N; i++) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } long long ans = 0; for (auto n : m) ans += n.second * (n.second - 1) / 2; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; map<string, long long> m; for (int i = 0; i < N; i++) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } long long ans = 0; for (auto n : m) ans += n.second * (n.second - 1) / 2; cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,590
748,591
u898331860
cpp
p02947
//============================ // ABC137c Green Bin // // 2019/08/12 //============================ #include <algorithm> #include <functional> #include <iostream> #include <map> #include <string> using namespace std; #define NUM 100000 int main(int argc, char *argv[]) { int N; map<string, int> m; cin >> N; for (int i = 0; i < N; i++) { string str; cin >> str; sort(str.begin(), str.end()); m[str] += 1; } long cnt = 0; for (auto i = m.begin(); i != m.end(); ++i) { int temp; temp = i->second; cnt += temp * (temp - 1) / 2; } cout << cnt << endl; return 0; }
//============================ // ABC137c Green Bin // // 2019/08/12 //============================ #include <algorithm> #include <functional> #include <iostream> #include <map> #include <string> using namespace std; int main(int argc, char *argv[]) { int N; map<string, int> m; cin >> N; for (int i = 0; i < N; i++) { string str; cin >> str; sort(str.begin(), str.end()); m[str] += 1; } long cnt = 0; for (auto i = m.begin(); i != m.end(); ++i) { long temp; temp = i->second; cnt += temp * (temp - 1) / 2; } cout << cnt << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
748,595
748,596
u235027735
cpp
p02947
//============================ // ABC137c Green Bin // // 2019/08/12 //============================ #include <algorithm> #include <functional> #include <iostream> #include <map> #include <string> using namespace std; #define NUM 100000 int main(int argc, char *argv[]) { int N; map<string, int> m; cin >> N; for (int i = 0; i < N; i++) { string str; cin >> str; sort(str.begin(), str.end()); m[str] += 1; } int cnt = 0; for (auto i = m.begin(); i != m.end(); ++i) { int temp; temp = i->second; cnt += temp * (temp - 1) / 2; } cout << cnt << endl; return 0; }
//============================ // ABC137c Green Bin // // 2019/08/12 //============================ #include <algorithm> #include <functional> #include <iostream> #include <map> #include <string> using namespace std; int main(int argc, char *argv[]) { int N; map<string, int> m; cin >> N; for (int i = 0; i < N; i++) { string str; cin >> str; sort(str.begin(), str.end()); m[str] += 1; } long cnt = 0; for (auto i = m.begin(); i != m.end(); ++i) { long temp; temp = i->second; cnt += temp * (temp - 1) / 2; } cout << cnt << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
748,597
748,596
u235027735
cpp
p02947
#include <bits/stdc++.h> #include <cstdlib> using namespace std; int main() { int N; cin >> N; map<string, int> mp; string s; int count; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); count += mp[s]; mp[s]++; } cout << count; }
#include <bits/stdc++.h> #include <cstdlib> using namespace std; int main() { int N; cin >> N; map<string, int> mp; string s; uint64_t count = 0; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); count += mp[s]; mp[s]++; } cout << count; }
[ "variable_declaration.type.primitive.change", "variable_declaration.value.change" ]
748,601
748,599
u628597699
cpp
p02947
#include <bits/stdc++.h> const int INF = 1e9; const int MOD = 1e9 + 7; const long long LINF = 1e18; #define dump(x) cout << 'x' << ' = ' << (x) << ` `; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOREACH(x, a) for (auto &(x) : (a)) typedef long long ll; using namespace std; typedef pair<ll, ll> P; int main(int argc, char const *argv[]) { int n; cin >> n; map<string, int> s; rep(i, n) { vector<char> c(10); rep(j, 10) cin >> c[j]; sort(c.begin(), c.end()); string t; rep(j, 10) t.push_back(c[j]); s[t]++; } ll ans = 0ll; for (auto &&e : s) { int m = e.second; ans += m * (m - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> const int INF = 1e9; const int MOD = 1e9 + 7; const long long LINF = 1e18; #define dump(x) cout << 'x' << ' = ' << (x) << ` `; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOREACH(x, a) for (auto &(x) : (a)) typedef long long ll; using namespace std; typedef pair<ll, ll> P; int main(int argc, char const *argv[]) { int n; cin >> n; map<string, int> s; rep(i, n) { vector<char> c(10); rep(j, 10) cin >> c[j]; sort(c.begin(), c.end()); string t; rep(j, 10) t.push_back(c[j]); s[t]++; } ll ans = 0ll; for (auto &&e : s) { ll m = e.second; ans += m * (m - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
748,614
748,615
u102602414
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define N 100000 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 s = p.second; ans += (ll)(s * (s - 1)) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define N 100000 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 s = p.second; ans += (ll)s * (s - 1) / 2; } cout << ans << endl; return 0; }
[ "call.arguments.change" ]
748,620
748,621
u120967809
cpp
p02947
#include <algorithm> #include <assert.h> #include <bitset> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long lli; typedef long double ld; typedef pair<lli, lli> plli; typedef vector<lli> vlli; typedef vector<plli> vplli; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define lcm(a, b) ((a * b) / gcd(a, b)) #define sqr(x) (x) * (x) #define all(a) a.begin(), a.end() #define UN(v) sort(all(v)), v.resize(unique(all(v)) - v.begin()) #define endl '\n' const long long INF = 100000000000000000; const long long MOD = 1000000007; const long long MAXN = 100005; lli dx[] = {0, 0, -1, 1, -1, -1, 1, 1}; lli dy[] = {1, -1, 0, 0, 1, -1, -1, 1}; lli gcd(lli a, lli b) { if (b == 0) return a; a %= b; return gcd(b, a); } void solve() { lli n, ans = 0; cin >> n; vector<string> v; for (int i = 0; i < n; ++i) { string s; cin >> s; sort(all(s)); v.push_back(s); } sort(all(v)); int i = 1, cnt = 0; while (i < n) { if (v[i] == v[i - 1]) { cnt++; } else { ans += (cnt * (cnt + 1)) / 2; cnt = 0; } i++; } ans += (cnt * (cnt + 1)) / 2; cout << ans << endl; } int main() { IOS; // comment it out // freopen("input.txt", "r", stdin); lli t = 1; // cin >> t; while (t--) { solve(); } return 0; }
#include <algorithm> #include <assert.h> #include <bitset> #include <deque> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long lli; typedef long double ld; typedef pair<lli, lli> plli; typedef vector<lli> vlli; typedef vector<plli> vplli; #define IOS \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define lcm(a, b) ((a * b) / gcd(a, b)) #define sqr(x) (x) * (x) #define all(a) a.begin(), a.end() #define UN(v) sort(all(v)), v.resize(unique(all(v)) - v.begin()) #define endl '\n' const long long INF = 100000000000000000; const long long MOD = 1000000007; const long long MAXN = 100005; lli dx[] = {0, 0, -1, 1, -1, -1, 1, 1}; lli dy[] = {1, -1, 0, 0, 1, -1, -1, 1}; lli gcd(lli a, lli b) { if (b == 0) return a; a %= b; return gcd(b, a); } void solve() { lli n, ans = 0; cin >> n; vector<string> v; for (int i = 0; i < n; ++i) { string s; cin >> s; sort(all(s)); v.push_back(s); } sort(all(v)); lli i = 1, cnt = 0; while (i < n) { if (v[i] == v[i - 1]) { cnt++; } else { ans += (cnt * (cnt + 1)) / 2; cnt = 0; } i++; } ans += (cnt * (cnt + 1)) / 2; cout << ans << endl; } int main() { IOS; // comment it out // freopen("input.txt", "r", stdin); lli t = 1; // cin >> t; while (t--) { solve(); } return 0; }
[ "variable_declaration.type.change" ]
748,622
748,623
u989928804
cpp
p02947
// this is moxin's code #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef unsigned long long ULL; #ifdef _LOCAL struct Tester { Tester() { freopen("sample.in", "r", stdin); } ~Tester() { fprintf(stderr, "\nTime: %d ms\n", int(1000.0 * clock() / CLOCKS_PER_SEC)); } } _tester; #endif const int INF = 0x3F3F3F3F; const LL INFLL = 0x3F3F3F3F3F3F3F3FLL; const int N = 2550; map<string, int> mp; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } LL sum = 0; for (auto it = mp.begin(); it != mp.end(); ++it) { sum += (it->second - 1) * it->second / 2; } cout << sum; return 0; }
// this is moxin's code #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef unsigned long long ULL; #ifdef _LOCAL struct Tester { Tester() { freopen("sample.in", "r", stdin); } ~Tester() { fprintf(stderr, "\nTime: %d ms\n", int(1000.0 * clock() / CLOCKS_PER_SEC)); } } _tester; #endif const int INF = 0x3F3F3F3F; const LL INFLL = 0x3F3F3F3F3F3F3F3FLL; const int N = 2550; map<string, int> mp; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } LL sum = 0; for (auto it = mp.begin(); it != mp.end(); ++it) { sum += (it->second - 1LL) * it->second / 2; } cout << sum; return 0; }
[ "literal.number.type.widen.change" ]
748,626
748,627
u221505564
cpp
p02947
// this is moxin's code #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef unsigned long long ULL; #ifdef _LOCAL struct Tester { Tester() { freopen("sample.in", "r", stdin); } ~Tester() { fprintf(stderr, "\nTime: %d ms\n", int(1000.0 * clock() / CLOCKS_PER_SEC)); } } _tester; #endif const int INF = 0x3F3F3F3F; const LL INFLL = 0x3F3F3F3F3F3F3F3FLL; const int N = 2550; map<string, int> mp; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } int sum = 0; for (auto it = mp.begin(); it != mp.end(); ++it) { sum += (it->second - 1) * it->second / 2; } cout << sum; return 0; }
// this is moxin's code #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; typedef unsigned long long ULL; #ifdef _LOCAL struct Tester { Tester() { freopen("sample.in", "r", stdin); } ~Tester() { fprintf(stderr, "\nTime: %d ms\n", int(1000.0 * clock() / CLOCKS_PER_SEC)); } } _tester; #endif const int INF = 0x3F3F3F3F; const LL INFLL = 0x3F3F3F3F3F3F3F3FLL; const int N = 2550; map<string, int> mp; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } LL sum = 0; for (auto it = mp.begin(); it != mp.end(); ++it) { sum += (it->second - 1LL) * it->second / 2; } cout << sum; return 0; }
[ "variable_declaration.type.change", "literal.number.type.widen.change" ]
748,628
748,627
u221505564
cpp
p02947
#include <bits/stdc++.h> // include all standard C++ libraries using namespace std; // Loops #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define _rrep(i, n) rrepi(i, n, 0) #define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__) #define each(xi, x) for (auto &&xi : x) // Note: we can use rep(i,N) or rep(i,from,to) // typedef using ll = long long; template <class T> using vec = vector<T>; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; using pii = pair<int, int>; // Constants // Shorter repr for frequently used terms #define pb push_back #define eb emplace_back #define mp make_pair #define Fi first #define Se second // Algorithms #define all(x) (x).begin(), (x).end() #define uniq(v) v.erase(unique(all(v)), v.end()) #define perm(c) \ sort(all(c)); \ for (bool c##p = 1; c##p; c##p = next_permutation(all(c))) template <class T> pair<T, size_t> max(vector<T> &x) { auto it = max_element(all(x)); return mp(*it, it - x.begin()); } template <class T> pair<T, size_t> min(vector<T> &x) { auto it = min_element(all(x)); return mp(*it, it - x.begin()); } template <class T> inline bool chmax(T &maxval, const T &newval) { if (maxval < newval) { maxval = newval; return 1; } return 0; } template <class T> inline bool chmin(T &minval, const T &newval) { if (minval > newval) { minval = newval; return 1; } return 0; } // Utilities // Grid world utilities int dx[4] = {0, 1, 0, -1}; int dy[4] = {1, 0, -1, 0}; #define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H) inline int in() { int x; cin >> x; return x; } // read int from cin inline ll IN() { ll x; cin >> x; return x; } // read ll from cin // Debug #ifdef LOCAL #include "dump.hpp" #define debug(x) cerr << #x << ": " << x << '\n' #else #define dump(...) #define debug(x) #endif // Paste snippets here!! // int main() { cin.tie(0); ios::sync_with_stdio(false); // Magic for faster cin int n = in(); vector<string> s(n); rep(i, n) { cin >> s[i]; sort(all(s[i])); } unordered_map<string, int> m; rep(i, n) { m[s[i]]++; } ll ret = 0; for (auto kv : m) { int n = kv.second; ret += n * (n - 1) / 2; } cout << ret << endl; return 0; }
#include <bits/stdc++.h> // include all standard C++ libraries using namespace std; // Loops #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #define _rrep(i, n) rrepi(i, n, 0) #define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__) #define each(xi, x) for (auto &&xi : x) // Note: we can use rep(i,N) or rep(i,from,to) // typedef using ll = long long; template <class T> using vec = vector<T>; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; using pii = pair<int, int>; // Constants // Shorter repr for frequently used terms #define pb push_back #define eb emplace_back #define mp make_pair #define Fi first #define Se second // Algorithms #define all(x) (x).begin(), (x).end() #define uniq(v) v.erase(unique(all(v)), v.end()) #define perm(c) \ sort(all(c)); \ for (bool c##p = 1; c##p; c##p = next_permutation(all(c))) template <class T> pair<T, size_t> max(vector<T> &x) { auto it = max_element(all(x)); return mp(*it, it - x.begin()); } template <class T> pair<T, size_t> min(vector<T> &x) { auto it = min_element(all(x)); return mp(*it, it - x.begin()); } template <class T> inline bool chmax(T &maxval, const T &newval) { if (maxval < newval) { maxval = newval; return 1; } return 0; } template <class T> inline bool chmin(T &minval, const T &newval) { if (minval > newval) { minval = newval; return 1; } return 0; } // Utilities // Grid world utilities int dx[4] = {0, 1, 0, -1}; int dy[4] = {1, 0, -1, 0}; #define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H) inline int in() { int x; cin >> x; return x; } // read int from cin inline ll IN() { ll x; cin >> x; return x; } // read ll from cin // Debug #ifdef LOCAL #include "dump.hpp" #define debug(x) cerr << #x << ": " << x << '\n' #else #define dump(...) #define debug(x) #endif // Paste snippets here!! // int main() { cin.tie(0); ios::sync_with_stdio(false); // Magic for faster cin int n = in(); vector<string> s(n); rep(i, n) { cin >> s[i]; sort(all(s[i])); } unordered_map<string, int> m; rep(i, n) { m[s[i]]++; } ll ret = 0; for (auto kv : m) { ll n = kv.second; ret += (n * (n - 1)) / 2; } cout << ret << endl; return 0; }
[ "variable_declaration.type.change" ]
748,631
748,632
u292813062
cpp
p02947
/* 友利奈緒ぱわーでACしてくれ!!!!!!!!!!!! Charlotteまだ見てない人は見ような!!!!!!! /  /:/              \:ヽ \         /  /                     \  ヽ      \__L 彡                    ヽ  ',        フ /   /  /  /   ,         ヽ  ',  j        レ    /  /  /                ',  ヽ j         //     ! /_l_/__ノ   { \}       ',  ',/       i ハ     { 从j ハ i    ',  ト-、}  i i  }  jj       ( ハ   (  川 ハ ハ  !  ' ハ  ハ j j ,'   八     <_,ィ∧   斗芹テミxハ ハ  レ } /__レレ /   ∧ \ ノ         ∨ \  ゝ 辷:ソ    ) 芹レ心ヾレ′ / ト-- ´    \ー‐' ノ   \ゝ           ゞ:_ソ "/  /  ヽ        フ    i八 " "   ,       ム彡    \       /  /  j  ト           " "イト<      \\      /  /   j //ヽ、   ∩     イ { {   ̄ フフへ \\     ( /    ,/ /   i >――<ニニニニ┐  〃/: : ヽ ヽヽ     /  ィT´/ /┌―  ̄ ̄ /::: , ,)      〃//: : : : : :} ヽヽ)    / /  ∧ヾi┌― { { ̄    ノ:::ト゚<      ∥//: : : : : : : : i  ノ ノ .   ( 人  {:ヽヾi∨ ∧V    /:::/ 、ヽ    ∥/: : : : : : : : : :} /    V ( ∧: :\'∨ ∧V   ノ:::/  ∧ 〉___∥: : : : : :/: : : :レ        /∧: : : : ∨ ∧V┬イ:::ノ  〈 TT | |{{: : : : /: : : : : ∧   ノ       ( ハ: : : : :∨'T∧Vi i (    V ! ! {{: : / : : : : : : / ー ノ      V ハ: : : : :∨ヘ∧V i ゝゝ  i/⌒\{/ : : : : : : : /ー― ´       ∨ ヽ: : : : :∨ヘ∧∨i 〉 〉 / /二  ): : : : : : : : :/ (https://seesaawiki.jp/asciiart/d/Charlotte より) */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; // #define int ll // #define DEBUG 42 inline void nprint() {} template <class Head, class... Tail> inline void nprint(Head &&head, Tail &&...tail) { cout << head << endl; nprint(move(tail)...); } #ifdef DEBUG #define eprint(...) nprint(__VA_ARGS__) #else #define eprint(...) \ if (0 == 1) \ cout << 1 << endl; #endif #define Yes(a) cout << (a ? "Yes" : "No") << endl #define YES(a) cout << (a ? "YES" : "NO") << endl #define POSSIBLE(a) cout << (a ? "POSSIBLE" : "IMPOSSIBLE") << endl using cmp = complex<double>; using vb = vector<bool>; using vvb = vector<vb>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; template <class T> using V = vector<T>; template <class T> using VV = vector<V<T>>; #define fi first #define se second #define maxs(x, y) (x = max(x, y)) #define mins(x, y) (x = min(x, y)) using pii = pair<int, int>; using pll = pair<ll, ll>; #define FOR(i, a, b) for (ll i = (a); i < (ll)(b); ++i) #define REP(i, n) FOR(i, 0, n) #define FORS(i, a, b) FOR(i, a, b + 1) #define REPS(i, n) REP(i, n + 1) #define RFOR(i, a, b) for (ll i = (ll)(b)-1; i >= a; --i) #define RREP(i, n) RFOR(i, 0, n) #define RREPS(i, n) RREP(i, n + 1) #define RFORS(i, a, b) RFOR(i, a, b + 1) #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend() #define PERM(c) \ sort(ALL(c)); \ for (bool cp = true; cp; cp = next_permutation(ALL(c))) #define eb(val) emplace_back(val) const double PI = acos(-1), EPS = 1e-10; const ll MOD = 1E9 + 7; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; template <typename T1, typename T2> ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s << "(" << p.first << ", " << p.second << ")"; } template <class T> istream &operator>>(istream &is, vector<T> &st) { for (size_t i = 0; i < st.size(); ++i) is >> st[i]; return is; } template <class T> istream &operator>>(istream &is, vector<vector<T>> &st) { for (size_t i = 0; i < st.size(); ++i) is >> st[i]; return is; } template <class T> ostream &operator<<(ostream &os, const vector<T> &st) { for (size_t i = 0; i < st.size(); ++i) { if (i == st.size() - 1) os << st[i]; else os << st[i] << " "; } return os; } template <class T> ostream &operator<<(ostream &os, const vector<vector<T>> &st) { for (size_t i = 0; i < st.size(); ++i) { os << st[i]; if (i != st.size() - 1) os << endl; } return os; } signed main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); int n; cin >> n; string t; map<string, int> mp; REP(i, n) { cin >> t; sort(ALL(t)); mp[t]++; } int ans = 0; for (auto i : mp) { ans += i.second * (i.second - 1) / 2; } cout << ans << endl; }
/* 友利奈緒ぱわーでACしてくれ!!!!!!!!!!!! Charlotteまだ見てない人は見ような!!!!!!! /  /:/              \:ヽ \         /  /                     \  ヽ      \__L 彡                    ヽ  ',        フ /   /  /  /   ,         ヽ  ',  j        レ    /  /  /                ',  ヽ j         //     ! /_l_/__ノ   { \}       ',  ',/       i ハ     { 从j ハ i    ',  ト-、}  i i  }  jj       ( ハ   (  川 ハ ハ  !  ' ハ  ハ j j ,'   八     <_,ィ∧   斗芹テミxハ ハ  レ } /__レレ /   ∧ \ ノ         ∨ \  ゝ 辷:ソ    ) 芹レ心ヾレ′ / ト-- ´    \ー‐' ノ   \ゝ           ゞ:_ソ "/  /  ヽ        フ    i八 " "   ,       ム彡    \       /  /  j  ト           " "イト<      \\      /  /   j //ヽ、   ∩     イ { {   ̄ フフへ \\     ( /    ,/ /   i >――<ニニニニ┐  〃/: : ヽ ヽヽ     /  ィT´/ /┌―  ̄ ̄ /::: , ,)      〃//: : : : : :} ヽヽ)    / /  ∧ヾi┌― { { ̄    ノ:::ト゚<      ∥//: : : : : : : : i  ノ ノ .   ( 人  {:ヽヾi∨ ∧V    /:::/ 、ヽ    ∥/: : : : : : : : : :} /    V ( ∧: :\'∨ ∧V   ノ:::/  ∧ 〉___∥: : : : : :/: : : :レ        /∧: : : : ∨ ∧V┬イ:::ノ  〈 TT | |{{: : : : /: : : : : ∧   ノ       ( ハ: : : : :∨'T∧Vi i (    V ! ! {{: : / : : : : : : / ー ノ      V ハ: : : : :∨ヘ∧V i ゝゝ  i/⌒\{/ : : : : : : : /ー― ´       ∨ ヽ: : : : :∨ヘ∧∨i 〉 〉 / /二  ): : : : : : : : :/ (https://seesaawiki.jp/asciiart/d/Charlotte より) */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; #define int ll // #define DEBUG 42 inline void nprint() {} template <class Head, class... Tail> inline void nprint(Head &&head, Tail &&...tail) { cout << head << endl; nprint(move(tail)...); } #ifdef DEBUG #define eprint(...) nprint(__VA_ARGS__) #else #define eprint(...) \ if (0 == 1) \ cout << 1 << endl; #endif #define Yes(a) cout << (a ? "Yes" : "No") << endl #define YES(a) cout << (a ? "YES" : "NO") << endl #define POSSIBLE(a) cout << (a ? "POSSIBLE" : "IMPOSSIBLE") << endl using cmp = complex<double>; using vb = vector<bool>; using vvb = vector<vb>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; template <class T> using V = vector<T>; template <class T> using VV = vector<V<T>>; #define fi first #define se second #define maxs(x, y) (x = max(x, y)) #define mins(x, y) (x = min(x, y)) using pii = pair<int, int>; using pll = pair<ll, ll>; #define FOR(i, a, b) for (ll i = (a); i < (ll)(b); ++i) #define REP(i, n) FOR(i, 0, n) #define FORS(i, a, b) FOR(i, a, b + 1) #define REPS(i, n) REP(i, n + 1) #define RFOR(i, a, b) for (ll i = (ll)(b)-1; i >= a; --i) #define RREP(i, n) RFOR(i, 0, n) #define RREPS(i, n) RREP(i, n + 1) #define RFORS(i, a, b) RFOR(i, a, b + 1) #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend() #define PERM(c) \ sort(ALL(c)); \ for (bool cp = true; cp; cp = next_permutation(ALL(c))) #define eb(val) emplace_back(val) const double PI = acos(-1), EPS = 1e-10; const ll MOD = 1E9 + 7; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; template <typename T1, typename T2> ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s << "(" << p.first << ", " << p.second << ")"; } template <class T> istream &operator>>(istream &is, vector<T> &st) { for (size_t i = 0; i < st.size(); ++i) is >> st[i]; return is; } template <class T> istream &operator>>(istream &is, vector<vector<T>> &st) { for (size_t i = 0; i < st.size(); ++i) is >> st[i]; return is; } template <class T> ostream &operator<<(ostream &os, const vector<T> &st) { for (size_t i = 0; i < st.size(); ++i) { if (i == st.size() - 1) os << st[i]; else os << st[i] << " "; } return os; } template <class T> ostream &operator<<(ostream &os, const vector<vector<T>> &st) { for (size_t i = 0; i < st.size(); ++i) { os << st[i]; if (i != st.size() - 1) os << endl; } return os; } signed main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); int n; cin >> n; string t; map<string, int> mp; REP(i, n) { cin >> t; sort(ALL(t)); mp[t]++; } int ans = 0; for (auto i : mp) { ans += i.second * (i.second - 1) / 2; } cout << ans << endl; }
[]
748,633
748,634
u949798495
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long ans = 0, sum = 0; int n; cin >> n; // string s; vector<char> sarray(10); map<vector<char>, int> sames; char c; for (int i = 0; i < n; i++) { for (int j = 0; j < 10; j++) { cin >> c; sarray[j] = c; } sort(sarray.begin(), sarray.end()); sames[sarray]++; /* for (int j = 0; j < 10; j++) { cout << sarray[i][j]; } cout << endl; */ } long long add = 0; for (auto p : sames) { if (p.second < 2) { add = 0; } else { add = ((p.second) * (p.second - 1)) / 2; } ans += add; } // cout <<fixed<<setprecision(16)<< << endl; cout << ans << endl; // if(flag==1)cout << "Yes" <<endl; // else cout << "No" <<endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long ans = 0, sum = 0; int n; cin >> n; // string s; vector<char> sarray(10); map<vector<char>, long long> sames; char c; for (int i = 0; i < n; i++) { for (int j = 0; j < 10; j++) { cin >> c; sarray[j] = c; } sort(sarray.begin(), sarray.end()); sames[sarray]++; /* for (int j = 0; j < 10; j++) { cout << sarray[i][j]; } cout << endl; */ } long long add = 0; for (auto p : sames) { if (p.second < 2) { add = 0; } else { add = ((p.second) * (p.second - 1)) / 2; } ans += add; } // cout <<fixed<<setprecision(16)<< << endl; cout << ans << endl; // if(flag==1)cout << "Yes" <<endl; // else cout << "No" <<endl; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,635
748,636
u355424600
cpp
p02947
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; vector<string> v; string tmp; cin >> n; for (int i = 0; i < n; i++) { cin >> tmp; sort(tmp.begin(), tmp.end()); v.push_back(tmp); } sort(v.begin(), v.end()); int cnt = 0, cur = 1; tmp = v[0]; for (int i = 1; i < n; i++) { if (v[i] == tmp) { cur++; } if (i == n - 1 || v[i] != tmp) { if (cur > 1) { cnt += (cur * (cur - 1)) / 2; } cur = 1; tmp = v[i]; } } cout << cnt << endl; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { long long n; vector<string> v; string tmp; cin >> n; for (int i = 0; i < n; i++) { cin >> tmp; sort(tmp.begin(), tmp.end()); v.push_back(tmp); } sort(v.begin(), v.end()); long long int cnt = 0, cur = 1; tmp = v[0]; for (int i = 1; i < n; i++) { if (v[i] == tmp) { cur++; } if (i == n - 1 || v[i] != tmp) { if (cur > 1) { cnt += (cur * (cur - 1)) / 2; } cur = 1; tmp = v[i]; } } cout << cnt << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
748,643
748,644
u112318601
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } long long ans = 0; for (auto &p : mp) { int num = p.second; ans += (long long)(num * (num - 1) / 2); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } long long ans = 0; for (auto &p : mp) { int num = p.second; ans += (long long)num * (num - 1) / 2; } cout << ans << endl; return 0; }
[]
748,645
748,646
u460608786
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define MAX 100000 + 5 typedef long long ll; int main() { int n; cin >> n; int a = 0; int b = 10; string s; vector<string> t(n); map<string, int> mp; int ans = 0; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } // combinationで数えないとTLE for (auto &p : mp) { int s = p.second; ans += (ll)s * (s - 1) / 2; // combination of sC2 } cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define MAX 100000 + 5 typedef long long ll; int main() { int n; cin >> n; int a = 0; int b = 10; string s; vector<string> t(n); map<string, int> mp; ll ans = 0; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } // combinationで数えないとTLE for (auto &p : mp) { int s = p.second; ans += (ll)s * (s - 1) / 2; // combination of sC2 } cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
748,651
748,652
u085230936
cpp
p02947
#include <bits/stdc++.h> #define int long long using namespace std; const int maxn = 1e5 + 10; char s[20]; int n, ans, p[maxn]; signed main() { scanf("%lld", &n); for (register int i = 1; i <= n; i++) { scanf("%s", s + 1); int len = strlen(s + 1); sort(s + 1, s + len + 1); for (register int j = 1; j <= len; j++) p[i] = (p[i] * 13331 + s[j] - 96) % 19260817; } sort(p + 1, p + n + 1); int pre = -1, cnt = 0; for (register int i = 1; i <= n; i++) if (p[i] == pre) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; pre = p[i]; } ans += cnt * (cnt - 1) / 2; printf("%lld", ans); return 0; }
#include <bits/stdc++.h> #define int long long using namespace std; const int maxn = 1e5 + 10; char s[20]; int n, ans, p[maxn]; signed main() { scanf("%lld", &n); for (register int i = 1; i <= n; i++) { scanf("%s", s + 1); int len = strlen(s + 1); sort(s + 1, s + len + 1); for (register int j = 1; j <= len; j++) p[i] = (p[i] * 13331 + s[j] - 96) % 9223372036854775807; } sort(p + 1, p + n + 1); int pre = -1, cnt = 0; for (register int i = 1; i <= n; i++) if (p[i] == pre) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; pre = p[i]; } ans += cnt * (cnt - 1) / 2; printf("%lld", ans); return 0; }
[ "literal.number.change", "assignment.value.change", "expression.operation.binary.change" ]
748,653
748,654
u038806998
cpp
p02947
#include <bits/stdc++.h> #define int long long using namespace std; const int maxn = 1e5 + 10; char s[20]; int n, ans, p[maxn]; signed main() { scanf("%lld", &n); for (register int i = 1; i <= n; i++) { scanf("%s", s + 1); int len = strlen(s + 1); sort(s + 1, s + len + 1); for (register int j = 1; j <= len; j++) p[i] = (p[i] * 131 + s[j] - 96) % 19260817; } sort(p + 1, p + n + 1); int pre = -1, cnt = 0; for (register int i = 1; i <= n; i++) if (p[i] == pre) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; pre = p[i]; } ans += cnt * (cnt - 1) / 2; printf("%lld", ans); return 0; }
#include <bits/stdc++.h> #define int long long using namespace std; const int maxn = 1e5 + 10; char s[20]; int n, ans, p[maxn]; signed main() { scanf("%lld", &n); for (register int i = 1; i <= n; i++) { scanf("%s", s + 1); int len = strlen(s + 1); sort(s + 1, s + len + 1); for (register int j = 1; j <= len; j++) p[i] = (p[i] * 13331 + s[j] - 96) % 9223372036854775807; } sort(p + 1, p + n + 1); int pre = -1, cnt = 0; for (register int i = 1; i <= n; i++) if (p[i] == pre) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; pre = p[i]; } ans += cnt * (cnt - 1) / 2; printf("%lld", ans); return 0; }
[ "literal.number.change", "assignment.value.change", "expression.operation.binary.change" ]
748,655
748,654
u038806998
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) const long long mod = 1e9 + 7; typedef long long ll; int main() { int n, ans = 0; string s; map<string, int> mp; cin >> n; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; if (mp[s] > 1) ans += mp[s] - 1; } cout << ans << endl; }
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) const long long mod = 1e9 + 7; typedef long long ll; int main() { int n; ll ans = 0; string s; map<string, int> mp; cin >> n; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; if (mp[s] > 1) ans += (ll)mp[s] - 1; } cout << ans << endl; }
[ "type_conversion.add" ]
748,656
748,657
u969617556
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; string s; char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; int main() { int N, ans = 0; vector<int> al(26, 0); bool ana; cin >> N; vector<vector<int>> snum(N, al); map<string, int> map; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); if (map.find(s) == map.end()) { map[s] = 1; } else { ans += map[s]; map[s]++; } /*for(int a = 0;a<26;a++){ snum[i][a] = count(s[i].begin(),s[i].end(),alpha[a]); }*/ } /*sort(snum.begin(),snum.end()); for(int i = 0;i < N-1; i++){ for(int j = i+1; j<N; j++){ if(snum[i] == snum[j]){ ans ++; } else break; } }*/ cout << ans << endl; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; string s; char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; int main() { long int N, ans = 0; vector<int> al(26, 0); bool ana; cin >> N; vector<vector<int>> snum(N, al); map<string, int> map; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); if (map.find(s) == map.end()) { map[s] = 1; } else { ans += map[s]; map[s]++; } /*for(int a = 0;a<26;a++){ snum[i][a] = count(s[i].begin(),s[i].end(),alpha[a]); }*/ } /*sort(snum.begin(),snum.end()); for(int i = 0;i < N-1; i++){ for(int j = i+1; j<N; j++){ if(snum[i] == snum[j]){ ans ++; } else break; } }*/ cout << ans << endl; }
[ "variable_declaration.type.widen.change" ]
748,664
748,665
u071036035
cpp
p02947
#include <bits/stdc++.h> #define watch(x) cout << (#x) << " is " << (x) << endl #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define gcd(x, y) __gcd(x, y) #define PI 3.14159265 #define endl "\n" #define count_ones __builtin_popcountl #define piii pair<int, pair<int, int>> const int N = 1e5 + 20, MOD = (int)(1e9) + 7; const int oo = 0x3f3f3f3f; typedef long long ll; using namespace std; void boost() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } /* -------------------------------------- */ int main() { boost(); ll t; cin >> t; unordered_map<string, int> m; while (t--) { string a; cin >> a; sort(a.begin(), a.end()); m[a]++; } ll sum = 0; for (auto it = m.begin(); it != m.end(); it++) { int fr = it->second; if (fr > 1) { sum += (fr * (fr - 1)) / 2; } } cout << sum; }
#include <bits/stdc++.h> #define watch(x) cout << (#x) << " is " << (x) << endl #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define gcd(x, y) __gcd(x, y) #define PI 3.14159265 #define endl "\n" #define count_ones __builtin_popcountl #define piii pair<int, pair<int, int>> const int N = 1e5 + 20, MOD = (int)(1e9) + 7; const int oo = 0x3f3f3f3f; typedef long long ll; using namespace std; void boost() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } /* -------------------------------------- */ int main() { boost(); ll t; cin >> t; map<string, ll> m; while (t--) { string a; cin >> a; sort(a.begin(), a.end()); m[a]++; } ll sum = 0; for (auto it = m.begin(); it != m.end(); it++) { ll fr = it->second; if (fr > 1) { sum += (fr * (fr - 1)) / 2; } } cout << sum; }
[ "variable_declaration.type.change" ]
748,675
748,674
u787337234
cpp
p02947
#include <bits/stdc++.h> #define watch(x) cout << (#x) << " is " << (x) << endl #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define gcd(x, y) __gcd(x, y) #define PI 3.14159265 #define endl "\n" #define count_ones __builtin_popcountl #define piii pair<int, pair<int, int>> const int N = 1e5 + 20, MOD = (int)(1e9) + 7; const int oo = 0x3f3f3f3f; typedef long long ll; using namespace std; void boost() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } /* -------------------------------------- */ int main() { boost(); ll t; cin >> t; unordered_map<string, int> m; while (t--) { string a; cin >> a; sort(a.begin(), a.end()); m[a]++; } ll sum = 0; for (auto it = m.begin(); it != m.end(); it++) { int fr = it->second; if (fr > 1) { sum += fr * (fr - 1) / 2; } } cout << sum; }
#include <bits/stdc++.h> #define watch(x) cout << (#x) << " is " << (x) << endl #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define gcd(x, y) __gcd(x, y) #define PI 3.14159265 #define endl "\n" #define count_ones __builtin_popcountl #define piii pair<int, pair<int, int>> const int N = 1e5 + 20, MOD = (int)(1e9) + 7; const int oo = 0x3f3f3f3f; typedef long long ll; using namespace std; void boost() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } /* -------------------------------------- */ int main() { boost(); ll t; cin >> t; map<string, ll> m; while (t--) { string a; cin >> a; sort(a.begin(), a.end()); m[a]++; } ll sum = 0; for (auto it = m.begin(); it != m.end(); it++) { ll fr = it->second; if (fr > 1) { sum += (fr * (fr - 1)) / 2; } } cout << sum; }
[ "variable_declaration.type.change" ]
748,676
748,674
u787337234
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define ll long long ll fun(int x) { return (x * (x - 1)) / (2 * 1LL); } int main() { ll t, tot = 0; cin >> t; map<string, ll> m; string s; while (t--) { cin >> s; sort(s.begin(), s.end()); m[s]++; } for (auto i : m) tot += fun(i.second); cout << tot << endl; }
#include <bits/stdc++.h> using namespace std; #define ll long long ll fun(ll x) { return (x * (x - 1)) / (2 * 1LL); } int main() { ll t, tot = 0; cin >> t; map<string, ll> m; string s; while (t--) { cin >> s; sort(s.begin(), s.end()); m[s]++; } for (auto i : m) tot += fun(i.second); cout << tot << endl; }
[]
748,677
748,678
u452198080
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < n; ++i) #define MOD (int)1e9 + 7 int main() { int n; cin >> n; map<string, int> mp; // vector<ll> vals(n); rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } ll ans = 0; for (auto u : mp) { ans += u.second * (u.second - 1) / 2; } cout << ans << endl; // printf("%d\n", N); return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, n) for (int i = 0; i < n; ++i) #define MOD (int)1e9 + 7 int main() { int n; cin >> n; map<string, int> mp; // vector<ll> vals(n); rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); mp[s]++; } ll ans = 0; for (auto u : mp) { ans += (ll)u.second * (u.second - 1) / 2; } cout << ans << endl; // printf("%d\n", N); return 0; }
[ "type_conversion.add" ]
748,680
748,681
u263654061
cpp
p02947
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll n, sm = 0; cin >> n; map<string, ll> mp; string s; for (ll i = 0; i < n; i++) { cin >> s; sort(all(s)); mp[s]++; } for (auto i : mp) { ll j = i.second; s += j * (j - 1) / 2; } cout << s << endl; return 0; }
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { ll n, sm = 0; cin >> n; map<string, ll> mp; string s; for (ll i = 0; i < n; i++) { cin >> s; sort(all(s)); mp[s]++; } for (auto i : mp) { ll j = i.second; sm += j * (j - 1) / 2; } cout << sm << endl; return 0; }
[ "assignment.variable.change", "identifier.change", "io.output.change" ]
748,682
748,683
u930561195
cpp
p02947
/* AUTHOR:shivam51 IIESTS */ #include <bits/stdc++.h> using namespace std; // #define add accumulate #define ll long long int #define ff first #define ss second #define pb push_back #define pob pop_back #define pf push_front #define pof pop_front #define mp make_pair #define vll vector<ll> #define lb lower_bound #define ub upper_bound #define pll pair<ll, ll> #define vpll vector<pll> #define all(v) v.begin(), v.end() #define rep(i, k, n) for (int i = k; i < n; i++) #define hs \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); template <class C> void setmin(C &a, C b) { if (a > b) a = b; } template <class C> void setmax(C &a, C b) { if (a < b) a = b; } const ll mod = 1e9 + 7; const ll MAX = 1e5; // // void solve() { ll n, ans = 0; cin >> n; map<string, int> m; rep(i, 0, n) { string s; cin >> s; sort(all(s)); m[s]++; } for (auto itr : m) { ans += max(0, (itr.ss) * (itr.ss - 1) / 2); } cout << ans; } int main() { hs; ll t; // cin>>t; t = 1; while (t--) solve(); return 0; }
/* AUTHOR:shivam51 IIESTS */ #include <bits/stdc++.h> using namespace std; // #define add accumulate #define ll long long int #define ff first #define ss second #define pb push_back #define pob pop_back #define pf push_front #define pof pop_front #define mp make_pair #define vll vector<ll> #define lb lower_bound #define ub upper_bound #define pll pair<ll, ll> #define vpll vector<pll> #define all(v) v.begin(), v.end() #define rep(i, k, n) for (int i = k; i < n; i++) #define hs \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); template <class C> void setmin(C &a, C b) { if (a > b) a = b; } template <class C> void setmax(C &a, C b) { if (a < b) a = b; } const ll mod = 1e9 + 7; const ll MAX = 1e5; // // void solve() { ll n, ans = 0; cin >> n; map<string, ll> m; rep(i, 0, n) { string s; cin >> s; sort(all(s)); m[s]++; } for (auto itr : m) { ans += max(0ll, (itr.ss) * (itr.ss - 1) / 2); } cout << ans; } int main() { hs; ll t; // cin>>t; t = 1; while (t--) solve(); return 0; }
[ "call.arguments.change" ]
748,686
748,687
u216557283
cpp
p02947
#pragma GCC optimize "-O3" #pragma GCC target("avx") #define _USE_MATH_DEFINES #include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < n; ++i) #define vi vector<int> #define vvi vector<vi> #define pb push_back #define pi pair<int, int> #define vp vector<pair<int, int>> #define mp make_pair #define all(v) (v).begin(), (v).end() #define fi first #define se second #define MEMSET(a) memset(a, 0, sizeof(a)) #define inf (1ll << 60) #define SORT(v) sort(all(v)) #define RSORT(v) sort(all(v), greater<int>()) #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout << fixed << setprecision(12) #define erase(i) erase(i, 1) signed gcd(int a, int b) { return b ? gcd(b, a % b) : a; } signed lcm(int a, int b) { return a * b / gcd(a, b); } template <typename T> void remove(std::vector<T> &vector, unsigned int index) { vector.erase(vector.begin() + index); } // priority_queue<int, vi, greater<int> > que;//昇順 using namespace std; const int mod = 1e9 + 7; signed kumiawase(int n) { return n * (n - 1) / 2; } signed main() { SPEED; int n; cin >> n; vector<string> str(n); rep(i, n) cin >> str[i]; rep(i, n) SORT(str[i]); SORT(str); int ans = 0; string now = str[0]; int renzoku = 1; for (int i = 1; i < n; ++i) { if (now == str[i]) ++renzoku; else { ans += kumiawase(renzoku); now = str[i]; renzoku = 1; } } ans += kumiawase(renzoku); cout << ans << endl; }
#pragma GCC optimize "-O3" #pragma GCC target("avx") #define _USE_MATH_DEFINES #include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < n; ++i) #define vi vector<int> #define vvi vector<vi> #define pb push_back #define pi pair<int, int> #define vp vector<pair<int, int>> #define mp make_pair #define all(v) (v).begin(), (v).end() #define fi first #define se second #define MEMSET(a) memset(a, 0, sizeof(a)) #define inf (1ll << 60) #define SORT(v) sort(all(v)) #define RSORT(v) sort(all(v), greater<int>()) #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout << fixed << setprecision(12) #define erase(i) erase(i, 1) signed gcd(int a, int b) { return b ? gcd(b, a % b) : a; } signed lcm(int a, int b) { return a * b / gcd(a, b); } template <typename T> void remove(std::vector<T> &vector, unsigned int index) { vector.erase(vector.begin() + index); } // priority_queue<int, vi, greater<int> > que;//昇順 using namespace std; const int mod = 1e9 + 7; int kumiawase(int n) { return n * (n - 1) / 2; } signed main() { SPEED; int n; cin >> n; vector<string> str(n); rep(i, n) cin >> str[i]; rep(i, n) SORT(str[i]); SORT(str); int ans = 0; string now = str[0]; int renzoku = 1; for (int i = 1; i < n; ++i) { if (now == str[i]) ++renzoku; else { ans += kumiawase(renzoku); now = str[i]; renzoku = 1; } } ans += kumiawase(renzoku); cout << ans << endl; }
[ "function.return_type.change" ]
748,688
748,689
u775507068
cpp