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
8 values
p02947
#include <bits/stdc++.h> #define all(x) begin(x), end(x) #define dbg(x) cerr << #x << " = " << x << endl #define _ << ' ' << using namespace std; using ll = long long; using vi = vector<int>; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; map<string, int> m; for (int i = 0; i < n; ++i) { string s; cin >> s; sort(all(s)); m[s]++; } ll sol = 0; for (auto it = m.begin(); it != m.end(); ++it) { sol += it->second * (it->second - 1) / 2; } cout << sol; }
#include <bits/stdc++.h> #define all(x) begin(x), end(x) #define dbg(x) cerr << #x << " = " << x << endl #define _ << ' ' << using namespace std; using ll = long long; using vi = vector<int>; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; map<string, int> m; for (int i = 0; i < n; ++i) { string s; cin >> s; sort(all(s)); m[s]++; } ll sol = 0; for (auto it = m.begin(); it != m.end(); ++it) { sol += 1ll * it->second * (it->second - 1) / 2; } cout << sol; }
[ "assignment.change" ]
746,979
746,980
u562319622
cpp
p02947
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<ll> c(1000001); for (ll i = 1; i < 1000001; i++) { c.at(i) = i - 1 + c.at(i - 1); } int n, ans = 0; string s; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto p : mp) { auto a = p.first; auto b = p.second; if (b >= 2) { ans += c.at(b); } } cout << ans << endl; }
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<ll> c(1000001); for (ll i = 1; i < 1000001; i++) { c.at(i) = i - 1 + c.at(i - 1); } ll n, ans = 0; string s; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto p : mp) { auto a = p.first; auto b = p.second; if (b >= 2) { ans += c.at(b); } } cout << ans << endl; }
[ "variable_declaration.type.change" ]
746,986
746,987
u573909039
cpp
p02947
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<ll> c(1000001); for (int i = 1; i < 1000001; i++) { c.at(i) = i - 1 + c.at(i - 1); } int n, ans = 0; string s; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto p : mp) { auto a = p.first; auto b = p.second; if (b >= 2) { ans += c.at(b); } } cout << ans << endl; }
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<ll> c(1000001); for (ll i = 1; i < 1000001; i++) { c.at(i) = i - 1 + c.at(i - 1); } ll n, ans = 0; string s; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto p : mp) { auto a = p.first; auto b = p.second; if (b >= 2) { ans += c.at(b); } } cout << ans << endl; }
[ "control_flow.loop.for.initializer.change", "variable_declaration.type.change" ]
746,988
746,987
u573909039
cpp
p02947
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<ll> c(100001); for (int i = 1; i < 100001; i++) { c.at(i) = i - 1 + c.at(i - 1); } int n, ans = 0; string s; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto p : mp) { auto a = p.first; auto b = p.second; if (b >= 2) { ans += c.at(b); } } cout << ans << endl; }
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); vector<ll> c(1000001); for (ll i = 1; i < 1000001; i++) { c.at(i) = i - 1 + c.at(i - 1); } ll n, ans = 0; string s; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto p : mp) { auto a = p.first; auto b = p.second; if (b >= 2) { ans += c.at(b); } } cout << ans << endl; }
[ "literal.number.change", "call.arguments.change", "control_flow.loop.for.initializer.change", "variable_declaration.type.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
746,989
746,987
u573909039
cpp
p02947
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define _GLIBCXX_DEBAC /*map<Keyの型, Valueの型> 変数名; queue<型> 変数名; priority_queue<型> 変数名; priority_queue<型, vector<型>, greater<型>> 変数名;*/ // copy(v1.begin(), v1.end(), back_inserter(v2)); using namespace std; int gcd(int a, int b) { int c; if (a < b) { c = a; a = b; b = c; } while (b != 0) { c = a % b; a = b; b = c; } return a; } int sort_greater(int m, int n) { vector<int> a(m); for (int i = 0; i < m; i++) { cin >> a[i]; } sort(a.begin(), a.end(), greater<int>()); for (int i = 0; i < n; i++) { cout << a[i]; } return 0; } int bubblesort(int a[], int n) { int sw = 0; bool flag = 1; for (int i = 0; flag; i++) { flag = 0; for (int j = n - 1; j >= i + 1; j--) { if (a[j] < a[j - 1]) { swap(a[j], a[j - 1]); flag = 1; sw += 1; } } } return sw; } int a_z() { for (int i = 0; i <= ('Z' - 'A'); i++) { cout << (char)('A' + i); } return 0; } int selecttionsort(int a[], int n) { int t, sw = 0, minj; for (int i = 0; i < n - 1; i++) { minj = i; for (int j = 0; j < n - 1; j++) { if (a[j] < a[minj]) { minj = j; } } t = a[i]; a[i] = a[minj]; a[minj] = t; if (i != minj) sw += 1; } return sw; } bool is_prime(int x) { if (x <= 1) return false; for (int i = 2; i * i <= x; i++) { if (x % i == 0) return false; } return true; } map<string, int> memo; using P = pair<int, int>; struct Clock { int hour, minute, second; void set(int h, int m, int s) { hour = h; minute = m; second = s; } string to_str() { string h, m, s; h = to_string(hour); m = to_string(minute); s = to_string(second); if (h.size() < 2) h = "0" + h; if (m.size() < 2) m = "0" + m; if (s.size() < 2) s = "0" + s; return h + ":" + m + ":" + s; } void shift(int diff_second) { int h, m; h = diff_second / 3600; m = diff_second / 60; diff_second %= 60; second += diff_second; } }; /*void dfs(int v, int p = -1) { for (int u : to[v]) { if (u == p) continue; ans[u] += ans[v]; dfs(u, v); } }*/ int main() { // sort(a.begin(),a.end()); int n; cin >> n; vector<string> s(n); rep(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } int ans = 0, a = 1; sort(s.begin(), s.end()); rep(i, n - 1) { if (s[i] == s[i + 1]) { ans += a; a++; } else { a = 1; } } cout << ans; return 0; }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define _GLIBCXX_DEBAC /*map<Keyの型, Valueの型> 変数名; queue<型> 変数名; priority_queue<型> 変数名; priority_queue<型, vector<型>, greater<型>> 変数名;*/ // copy(v1.begin(), v1.end(), back_inserter(v2)); using namespace std; int gcd(int a, int b) { int c; if (a < b) { c = a; a = b; b = c; } while (b != 0) { c = a % b; a = b; b = c; } return a; } int sort_greater(int m, int n) { vector<int> a(m); for (int i = 0; i < m; i++) { cin >> a[i]; } sort(a.begin(), a.end(), greater<int>()); for (int i = 0; i < n; i++) { cout << a[i]; } return 0; } int bubblesort(int a[], int n) { int sw = 0; bool flag = 1; for (int i = 0; flag; i++) { flag = 0; for (int j = n - 1; j >= i + 1; j--) { if (a[j] < a[j - 1]) { swap(a[j], a[j - 1]); flag = 1; sw += 1; } } } return sw; } int a_z() { for (int i = 0; i <= ('Z' - 'A'); i++) { cout << (char)('A' + i); } return 0; } int selecttionsort(int a[], int n) { int t, sw = 0, minj; for (int i = 0; i < n - 1; i++) { minj = i; for (int j = 0; j < n - 1; j++) { if (a[j] < a[minj]) { minj = j; } } t = a[i]; a[i] = a[minj]; a[minj] = t; if (i != minj) sw += 1; } return sw; } bool is_prime(int x) { if (x <= 1) return false; for (int i = 2; i * i <= x; i++) { if (x % i == 0) return false; } return true; } map<string, int> memo; using P = pair<int, int>; struct Clock { int hour, minute, second; void set(int h, int m, int s) { hour = h; minute = m; second = s; } string to_str() { string h, m, s; h = to_string(hour); m = to_string(minute); s = to_string(second); if (h.size() < 2) h = "0" + h; if (m.size() < 2) m = "0" + m; if (s.size() < 2) s = "0" + s; return h + ":" + m + ":" + s; } void shift(int diff_second) { int h, m; h = diff_second / 3600; m = diff_second / 60; diff_second %= 60; second += diff_second; } }; /*void dfs(int v, int p = -1) { for (int u : to[v]) { if (u == p) continue; ans[u] += ans[v]; dfs(u, v); } }*/ int main() { // sort(a.begin(),a.end()); int n; cin >> n; vector<string> s(n); rep(i, n) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } ll ans = 0, a = 1; sort(s.begin(), s.end()); rep(i, n - 1) { if (s[i] == s[i + 1]) { ans += a; a++; } else { a = 1; } } cout << ans; return 0; }
[ "variable_declaration.type.change" ]
746,990
746,991
u545938555
cpp
p02947
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; int main() { int N; cin >> N; vector<vector<char>> A(N, vector<char>(10, ' ')); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { cin >> A[i][j]; }; } for (int i = 0; i < N; i++) { sort(A[i].begin(), A[i].end()); ; } vector<string> B(N, ""); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { B[i] += A[i][j]; }; } sort(B.begin(), B.end()); int counter = 0; deque<int> dq; for (int i = 0; i < N - 1; i++) { if (B[i] == B[i + 1]) { counter++; } else { if (counter != 0) { dq.emplace_back(counter + 1); counter = 0; } }; } if (counter != 0) { dq.emplace_back(counter + 1); } ll Ans = 0; while (dq.size()) { Ans += (dq.front() - 1) * (dq.front()) / 2; dq.pop_front(); } cout << Ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll N; cin >> N; vector<vector<char>> A(N, vector<char>(10, ' ')); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { cin >> A[i][j]; }; } for (int i = 0; i < N; i++) { sort(A[i].begin(), A[i].end()); ; } vector<string> B(N, ""); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { B[i] += A[i][j]; }; } sort(B.begin(), B.end()); ll counter = 0; deque<ll> dq; for (int i = 0; i < N - 1; i++) { if (B[i] == B[i + 1]) { counter++; } else { if (counter != 0) { dq.emplace_back(counter + 1); counter = 0; } }; } if (counter != 0) { dq.emplace_back(counter + 1); } ll Ans = 0; while (dq.size()) { Ans += (dq.front() - 1) * (dq.front()) / 2; dq.pop_front(); } cout << Ans << endl; return 0; }
[ "variable_declaration.type.change" ]
746,994
746,995
u575802441
cpp
p02947
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; int main() { int N; cin >> N; vector<vector<char>> A(N, vector<char>(10, ' ')); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { cin >> A[i][j]; }; } for (int i = 0; i < N; i++) { sort(A[i].begin(), A[i].end()); ; } vector<string> B(N, ""); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { B[i] += A[i][j]; }; } sort(B.begin(), B.end()); int counter = 0; deque<int> dq; for (int i = 0; i < N - 1; i++) { if (B[i] == B[i + 1]) { counter++; } else { if (counter != 0) { dq.emplace_back(counter + 1); counter = 0; } }; } if (counter != 0) { dq.emplace_back(counter + 1); } int Ans = 0; while (dq.size()) { Ans += (dq.front() - 1) * (dq.front()) / 2; dq.pop_front(); } cout << Ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll N; cin >> N; vector<vector<char>> A(N, vector<char>(10, ' ')); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { cin >> A[i][j]; }; } for (int i = 0; i < N; i++) { sort(A[i].begin(), A[i].end()); ; } vector<string> B(N, ""); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { B[i] += A[i][j]; }; } sort(B.begin(), B.end()); ll counter = 0; deque<ll> dq; for (int i = 0; i < N - 1; i++) { if (B[i] == B[i + 1]) { counter++; } else { if (counter != 0) { dq.emplace_back(counter + 1); counter = 0; } }; } if (counter != 0) { dq.emplace_back(counter + 1); } ll Ans = 0; while (dq.size()) { Ans += (dq.front() - 1) * (dq.front()) / 2; dq.pop_front(); } cout << Ans << endl; return 0; }
[ "variable_declaration.type.change" ]
746,996
746,995
u575802441
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int n, ans = 0; cin >> n; map<string, int> mp; rep(i, n) { string str; cin >> str; sort(str.begin(), str.end()); mp[str]++; ans += mp[str] - 1; } cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { long n, ans = 0; cin >> n; map<string, long> mp; rep(i, n) { string str; cin >> str; sort(str.begin(), str.end()); mp[str]++; ans += mp[str] - 1; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
746,997
746,998
u675751622
cpp
p02947
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MAX 1000000001 using ll = long long; int main() { int n; cin >> n; map<string, int> S; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); S[s]++; } ll ans = 0; for (const auto &i : S) { ans += i.second * (i.second - 1) / 2; } cout << ans << endl; }
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MAX 1000000001 using ll = long long; int main() { int n; cin >> n; map<string, int> S; rep(i, n) { string s; cin >> s; sort(s.begin(), s.end()); S[s]++; } ll ans = 0; for (const auto &i : S) { ans += (ll)i.second * (ll)(i.second - 1) / 2; } cout << ans << endl; }
[ "type_conversion.add" ]
746,999
747,000
u765815947
cpp
p02947
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(x) (x).begin(), (x).end() typedef long long ll; typedef pair<int, int> P; typedef vector<vector<int>> Matrix; ll nC2(int n) { ll ans = n * (n - 1) / 2; return ans; } int main() { int n; cin >> n; vector<string> str(n); rep(i, n) { string s; cin >> s; sort(ALL(s)); str[i] = s; } sort(ALL(str)); ll ans = 0; int c = 1; rep(i, n - 1) { if (str[i] == str[i + 1]) { c++; } else { if (c > 1) ans += nC2(c); c = 1; } } if (c > 1) ans += nC2(c); cout << ans << endl; }
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(x) (x).begin(), (x).end() typedef long long ll; typedef pair<int, int> P; typedef vector<vector<int>> Matrix; ll nC2(int n) { ll ans = (ll)n * (n - 1) / 2; return ans; } int main() { int n; cin >> n; vector<string> str(n); rep(i, n) { string s; cin >> s; sort(ALL(s)); str[i] = s; } sort(ALL(str)); ll ans = 0; int c = 1; rep(i, n - 1) { if (str[i] == str[i + 1]) { c++; } else { if (c > 1) ans += nC2(c); c = 1; } } if (c > 1) ans += nC2(c); cout << ans << endl; }
[ "type_conversion.add" ]
747,003
747,004
u263000123
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define PI acos(-1) using namespace std; using ll = long long; using P = pair<int, int>; using LP = pair<ll, ll>; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; map<map<int, int>, int> mp; rep(i, n) { string s; cin >> s; ll m = s.size(); map<int, int> temp; rep(j, m) { temp[s[j] - 'a']++; } mp[temp]++; } ll ans = 0; for (auto m : mp) { ans += m.second * (m.second - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define PI acos(-1) using namespace std; using ll = long long; using P = pair<int, int>; using LP = pair<ll, ll>; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; map<map<ll, ll>, ll> mp; rep(i, n) { string s; cin >> s; ll m = s.size(); map<ll, ll> temp; rep(j, m) { temp[s[j] - 'a']++; } mp[temp]++; } ll ans = 0; for (auto m : mp) { ans += m.second * (m.second - 1) / 2; } cout << ans << endl; }
[]
747,005
747,006
u482770395
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<string, int> m; long long ans; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); ans += m[s]; m[s]++; } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<string, int> m; long long ans = 0; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); ans += m[s]; m[s]++; } cout << ans; }
[ "variable_declaration.value.change" ]
747,007
747,008
u297195722
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<string, int> m; long long ans; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); ans += m[s]; m[s]++; } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; unordered_map<string, int> m; long long ans = 0; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); ans += m[s]; m[s]++; } cout << ans; }
[ "variable_declaration.type.change", "variable_declaration.value.change" ]
747,007
747,009
u297195722
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; string s[100000]; unordered_map<string, int> wordcnt; void Main() { int N; cin >> N; rep(i, N) { cin >> s[i]; /* rep(j, s[i].size()) { if (wordcnt[i].find(s[i][j]) == wordcnt[i].end()) wordcnt[i][s[i][j]] = 1; else wordcnt[i][s[i][j]]++; } */ sort(s[i].begin(), s[i].end()); if (wordcnt.find(s[i]) == wordcnt.end()) wordcnt[s[i]] = 1; else wordcnt[s[i]]++; } /* ll ans = 0; rep(i,N) { for (int j = i+1; j < N; j++) { if (wordcnt[i] == wordcnt[j]) ans++; } } */ ll ans = 0; for (auto it = wordcnt.begin(); it != wordcnt.end(); ++it) { ans += it->second * (it->second - 1) / 2; } cout << ans << endl; } int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); Main(); return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; string s[100000]; unordered_map<string, int> wordcnt; void Main() { int N; cin >> N; rep(i, N) { cin >> s[i]; /* rep(j, s[i].size()) { if (wordcnt[i].find(s[i][j]) == wordcnt[i].end()) wordcnt[i][s[i][j]] = 1; else wordcnt[i][s[i][j]]++; } */ sort(s[i].begin(), s[i].end()); if (wordcnt.find(s[i]) == wordcnt.end()) wordcnt[s[i]] = 1; else wordcnt[s[i]]++; } /* ll ans = 0; rep(i,N) { for (int j = i+1; j < N; j++) { if (wordcnt[i] == wordcnt[j]) ans++; } } */ ll ans = 0; for (auto it = wordcnt.begin(); it != wordcnt.end(); ++it) { ans += (ll)it->second * (ll)(it->second - 1) / 2; } cout << ans << endl; } int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); Main(); return 0; }
[ "type_conversion.add" ]
747,010
747,011
u900523387
cpp
p02947
// // main.cpp // CoderProj // // Created by Minoru Hayashi on 2020/03/12. // Copyright © 2020 Minoru Hayashi. All rights reserved. // // // // #include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) using ll = long long; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } // const ll INF = 1LL<<60; // const int INF = 1<<29; // const ll MOD = 1000000007; //#define __DBG__ void solve(void) { int N; cin >> N; vector<string> S(N); map<string, int> A; REP(i, N) { cin >> S[i]; sort(ALL(S[i])); if (A.count(S[i])) { A[S[i]]++; } else { A[S[i]] = 1; } // cout << S[i] << " " << A[S[i]] << endl; } int nc = 0; for (auto v : A) { nc += v.second * (v.second - 1) / 2; } cout << nc << endl; return; } #define TESTCASES 1 int main(int argc, const char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); REP(i, TESTCASES) { solve(); } return 0; }
// // main.cpp // CoderProj // // Created by Minoru Hayashi on 2020/03/12. // Copyright © 2020 Minoru Hayashi. All rights reserved. // // // // #include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define ALL(n) begin(n), end(n) using ll = long long; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } // const ll INF = 1LL<<60; // const int INF = 1<<29; // const ll MOD = 1000000007; //#define __DBG__ void solve(void) { int N; cin >> N; vector<string> S(N); map<string, ll> A; REP(i, N) { cin >> S[i]; sort(ALL(S[i])); if (A.count(S[i])) { A[S[i]]++; } else { A[S[i]] = 1; } // cout << S[i] << " " << A[S[i]] << endl; } ll nc = 0; for (auto v : A) { nc += v.second * (v.second - 1) / 2; } cout << nc << endl; return; } #define TESTCASES 1 int main(int argc, const char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); REP(i, TESTCASES) { solve(); } return 0; }
[ "variable_declaration.type.change" ]
747,012
747,013
u671267423
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { ll n; cin >> n; vector<string> s(n); rep(j, n) { cin >> s.at(j); vector<char> memo(10); rep(i, 10) memo.at(i) = s.at(j).at(i); sort(memo.begin(), memo.end()); rep(i, 10) s.at(j).at(i) = memo.at(i); } map<string, int> time; ll ans = 0; rep(i, n) time[s.at(i)]++; for (auto p : time) { auto k = p.second; ans += k * (k - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { ll n; cin >> n; vector<string> s(n); rep(j, n) { cin >> s.at(j); vector<char> memo(10); rep(i, 10) memo.at(i) = s.at(j).at(i); sort(memo.begin(), memo.end()); rep(i, 10) s.at(j).at(i) = memo.at(i); } map<string, int> time; ll ans = 0; rep(i, n) time[s.at(i)]++; for (auto p : time) { ll k = p.second; ans += k * (k - 1) / 2; } cout << ans << endl; }
[]
747,016
747,017
u297398560
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { int n; cin >> n; vector<string> s(n); rep(j, n) { cin >> s.at(j); vector<char> memo(10); rep(i, 10) memo.at(i) = s.at(j).at(i); sort(memo.begin(), memo.end()); rep(i, 10) s.at(j).at(i) = memo.at(i); } map<string, int> time; ll ans = 0; rep(i, n) time[s.at(i)]++; for (auto p : time) { auto k = p.second; ans += k * (k - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { ll n; cin >> n; vector<string> s(n); rep(j, n) { cin >> s.at(j); vector<char> memo(10); rep(i, 10) memo.at(i) = s.at(j).at(i); sort(memo.begin(), memo.end()); rep(i, 10) s.at(j).at(i) = memo.at(i); } map<string, int> time; ll ans = 0; rep(i, n) time[s.at(i)]++; for (auto p : time) { ll k = p.second; ans += k * (k - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,018
747,017
u297398560
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N, ans = 0; cin >> N; unordered_map<string, int> m(N); string s; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); ans += m[s]; m[s]++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; ll ans = 0; cin >> N; unordered_map<string, int> m(N); string s; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); ans += m[s]; m[s]++; } cout << ans << endl; }
[]
747,019
747,020
u115106582
cpp
p02947
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long int; int main() { int n; cin >> n; map<string, int> mp; for (size_t i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end(), [](const char lhs, const char rhs) { return lhs < rhs; }); mp[s]++; } ll ans = 0; for (auto &&e : mp) { if (e.second > 1) { ans += (e.second) * (e.second - 1) / 2; } } cout << ans << endl; }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long int; int main() { int n; cin >> n; map<string, ll> mp; for (size_t i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end(), [](const char lhs, const char rhs) { return lhs < rhs; }); mp[s]++; } ll ans = 0; for (auto &&e : mp) { if (e.second > 1) { ans += (e.second) * (e.second - 1) / 2; } } cout << ans << endl; }
[]
747,021
747,022
u789199225
cpp
p02947
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define ll long long #define imfor(i, n) for (int i = 0; i < n; i++) using namespace std; ll MOD = 1000000007; int main() { int n; char s[100010][10]; cin >> n; map<string, int> mp; int ans = 0; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i], s[i] + 10); if (mp.find(s[i]) == mp.end()) { mp[s[i]] = 1; } else { ans += mp[s[i]]; mp[s[i]]++; } } cout << ans << endl; }
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define ll long long #define imfor(i, n) for (int i = 0; i < n; i++) using namespace std; ll MOD = 1000000007; int main() { int n; char s[100010][10]; cin >> n; map<string, int> mp; ll ans = 0; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i], s[i] + 10); if (mp.find(s[i]) == mp.end()) { mp[s[i]] = 1; } else { ans += mp[s[i]]; mp[s[i]]++; } } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,023
747,024
u921391957
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string x; vector<string> c(n + 1); for (int i = 0; i < n; i++) { cin >> x; sort(x.begin(), x.end()); c[i] = x; } c[n] = "zzzzzzzzzzz"; sort(c.begin(), c.end()); int ans = 0; int count = 1; for (int i = 0; i < n; i++) { if (c[i] == c[i + 1]) count++; else { ans += count * (count - 1) / 2; count = 1; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string x; vector<string> c(n + 1); for (int i = 0; i < n; i++) { cin >> x; sort(x.begin(), x.end()); c[i] = x; } c[n] = "zzzzzzzzzzz"; sort(c.begin(), c.end()); int64_t ans = 0; int64_t count = 1; for (int i = 0; i < n; i++) { if (c[i] == c[i + 1]) count++; else { ans += count * (count - 1) / 2; count = 1; } } cout << ans << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
747,025
747,026
u028906014
cpp
p02947
#include <bits/stdc++.h> using namespace std; using ll = long long; long nCr(int n, int r) { long ans = 1; for (int i = n; i > n - r; --i) { ans = ans * i; } for (int i = 1; i < r + 1; ++i) { ans = ans / i; } return ans; } int main() { int n; cin >> n; map<string, int> s; for (int i = 0; i < n; i++) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); s[tmp]++; } int ans = 0; for (auto _s : s) if (_s.second > 1) ans += nCr(_s.second, 2); cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; long nCr(int n, int r) { long ans = 1; for (int i = n; i > n - r; --i) { ans = ans * i; } for (int i = 1; i < r + 1; ++i) { ans = ans / i; } return ans; } int main() { ll n; cin >> n; map<string, ll> s; for (int i = 0; i < n; i++) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); s[tmp]++; } ll ans = 0; for (auto _s : s) if (_s.second > 1) ans += nCr(_s.second, 2); cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
747,027
747,028
u998732100
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { int N; cin >> N; map<string, int> m; for (int i = 0; i < N; i++) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } ll ans = 0; for (auto &r : m) { ans += r.second * (r.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9; int main() { int N; cin >> N; map<string, int> m; for (int i = 0; i < N; i++) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } ll ans = 0; for (auto &r : m) { ans += (ll)r.second * (r.second - 1) / 2; } cout << ans << endl; return 0; }
[ "type_conversion.add" ]
747,029
747,030
u146594935
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); int now = 0; string nows = s.at(0); long long ans = 0; for (int i = 0; i < n; i++) { if (s.at(i) == nows) continue; int k = i - now; if (k == 2) ans++; else if (k > 2) ans += k * (k - 1) / 2; now = i; nows = s.at(i); } int k = n - now; if (k == 2) ans++; else if (k > 1) ans += k * (k - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); int now = 0; string nows = s.at(0); long long ans = 0; for (int i = 0; i < n; i++) { if (s.at(i) == nows) continue; int k = i - now; if (k == 2) ans++; else if (k > 2) ans += k * (k - 1) / 2; now = i; nows = s.at(i); } long long k = n - now; if (k == 2) ans++; else if (k > 1) ans += k * (k - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,031
747,032
u412837450
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); int now = 0; string nows = s.at(0); long long ans = 0; for (int i = 0; i < n; i++) { if (s.at(i) == nows) continue; int k = i - now; if (k == 2) ans++; else if (k > 2) ans += k * (k - 1) / 2; now = i; nows = s.at(i); } int k = n - 1 - now; if (k == 1) ans++; else if (k > 1) ans += k * (k - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s.at(i); sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); int now = 0; string nows = s.at(0); long long ans = 0; for (int i = 0; i < n; i++) { if (s.at(i) == nows) continue; int k = i - now; if (k == 2) ans++; else if (k > 2) ans += k * (k - 1) / 2; now = i; nows = s.at(i); } long long k = n - now; if (k == 2) ans++; else if (k > 1) ans += k * (k - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "expression.operation.binary.remove", "literal.number.change", "control_flow.branch.if.condition.change" ]
747,033
747,032
u412837450
cpp
p02947
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { int n, cnt = 1; long long ans = 0; cin >> n; vector<string> s(n); rep(i, n) cin >> s[i]; rep(k, n) sort(s[k].begin(), s[k].end()); sort(s.begin(), s.end()); s.push_back(""); rep(l, n) { if (s[l + 1] == s[l]) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; } } cout << ans; return 0; }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { long long n, cnt = 1; long long ans = 0; cin >> n; vector<string> s(n); rep(i, n) cin >> s[i]; rep(k, n) sort(s[k].begin(), s[k].end()); sort(s.begin(), s.end()); s.push_back(""); rep(l, n) { if (s[l + 1] == s[l]) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; } } cout << ans; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,034
747,035
u088751997
cpp
p02947
#include <bits/stdc++.h> #ifdef HIRO #define d(f_, ...) printf((f_), ##__VA_ARGS__) #else #define d(f_, ...) #endif using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<long long> vll; typedef queue<int> qi; typedef queue<pair<int, int>> qp; #define mp make_pair #define pi 3.14159265358979323846 #define MAX max_element #define MIN min_element #define all(v) v.begin(), v.end() #define gt(T) greater<T>() #define sum(v) accumulate(v.begin(), v.end(), 0) #define uni(v) \ do { \ sort(v.begin(), v.end()); \ decltype(v)::iterator result = unique(v.begin(), v.end()); \ v.erase(result, v.end()); \ } while (0) #define fi(init, n) for (int i = init; i < n; ++i) #define fj(init, n) for (int j = init; j < n; ++j) #define fk(init, n) for (int k = init; k < n; ++k) #define zero(x) memset(x, 0, sizeof(x)) #define negative(x) memset(x, ~0, sizeof(x)) const ll MOD = 1e9 + 7; const int INF = 1e9; const int di[] = {0, 1, 0, -1}; const int dj[] = {1, 0, -1, 0}; template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); } template <typename T> int finder(vector<T> vec, T number) { auto itr = find(vec.begin(), vec.end(), number); size_t index = distance(vec.begin(), itr); if (index != vec.size()) return 1; else return 0; } ll frac(ll n) { if (n == 0) return 1; return (n * frac(n - 1)) % MOD; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main(int argc, char **argv) { #ifdef HIRO string quiz(argv[1]); string id(argv[2]); string filename("input/" + quiz + "/" + id + ".txt"); ifstream fin(filename); if (fin.peek() == ifstream::traits_type::eof()) { cout << "No input."; return 0; } ifstream cin(filename); std::cin.rdbuf(cin.rdbuf()); #endif ll ans = 0; ll n; cin >> n; // ll n, m; // cin >> n >> m; // ll n, m, k; // cin >> n >> m >> k; map<string, int> m; while (n--) { string s; cin >> s; sort(all(s)); m[s] += 1; } for (auto x : m) { if (x.second == 1) continue; ans += x.second * (x.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #ifdef HIRO #define d(f_, ...) printf((f_), ##__VA_ARGS__) #else #define d(f_, ...) #endif using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<long long> vll; typedef queue<int> qi; typedef queue<pair<int, int>> qp; #define mp make_pair #define pi 3.14159265358979323846 #define MAX max_element #define MIN min_element #define all(v) v.begin(), v.end() #define gt(T) greater<T>() #define sum(v) accumulate(v.begin(), v.end(), 0) #define uni(v) \ do { \ sort(v.begin(), v.end()); \ decltype(v)::iterator result = unique(v.begin(), v.end()); \ v.erase(result, v.end()); \ } while (0) #define fi(init, n) for (int i = init; i < n; ++i) #define fj(init, n) for (int j = init; j < n; ++j) #define fk(init, n) for (int k = init; k < n; ++k) #define zero(x) memset(x, 0, sizeof(x)) #define negative(x) memset(x, ~0, sizeof(x)) const ll MOD = 1e9 + 7; const int INF = 1e9; const int di[] = {0, 1, 0, -1}; const int dj[] = {1, 0, -1, 0}; template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); } template <typename T> int finder(vector<T> vec, T number) { auto itr = find(vec.begin(), vec.end(), number); size_t index = distance(vec.begin(), itr); if (index != vec.size()) return 1; else return 0; } ll frac(ll n) { if (n == 0) return 1; return (n * frac(n - 1)) % MOD; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main(int argc, char **argv) { #ifdef HIRO string quiz(argv[1]); string id(argv[2]); string filename("input/" + quiz + "/" + id + ".txt"); ifstream fin(filename); if (fin.peek() == ifstream::traits_type::eof()) { cout << "No input."; return 0; } ifstream cin(filename); std::cin.rdbuf(cin.rdbuf()); #endif ll ans = 0; ll n; cin >> n; // ll n, m; // cin >> n >> m; // ll n, m, k; // cin >> n >> m >> k; map<string, ll> m; while (n--) { string s; cin >> s; sort(all(s)); m[s] += 1; } for (auto x : m) { if (x.second == 1) continue; ans += x.second * (x.second - 1) / 2; } cout << ans << endl; return 0; }
[]
747,036
747,037
u640888913
cpp
p02947
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #define rep(i, n) for (ll i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, ll> P; int main() { int n; ll ans = 0; cin >> n; vector<string> s(n); rep(i, n) { string ts; cin >> ts; sort(ts.begin(), ts.end()); s[i] = ts; } map<string, int> m; rep(i, n) { m[s[i]] += 1; } for (auto itr = m.begin(); itr != m.end(); itr++) { ans += (itr->second) * (itr->second - 1) / 2; } cout << ans; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #define rep(i, n) for (ll i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<int, ll> P; int main() { ll n; ll ans = 0; cin >> n; vector<string> s(n); rep(i, n) { string ts; cin >> ts; sort(ts.begin(), ts.end()); s[i] = ts; } map<string, ll> m; rep(i, n) { m[s[i]] += 1; } for (auto itr = m.begin(); itr != m.end(); itr++) { ans += (itr->second) * (itr->second - 1) / 2; } cout << ans; }
[ "variable_declaration.type.change" ]
747,038
747,039
u721082205
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define P pair<int, int> using ll = int64_t; using namespace std; // define gcd and lcm (using 64bit) ll gcd(ll a, ll b) { if (a < b) { //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。 a ^= b; b ^= a; a ^= b; } // only when b==0,this program finds that b means false and returns a. return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { int n; ll ans = 0; string s; cin >> n; map<string, int> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { ans += p.second * (p.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define P pair<int, int> using ll = int64_t; using namespace std; // define gcd and lcm (using 64bit) ll gcd(ll a, ll b) { if (a < b) { //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。 a ^= b; b ^= a; a ^= b; } // only when b==0,this program finds that b means false and returns a. return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { int n; ll ans = 0; string s; cin >> n; map<string, int> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { ans += (ll)p.second * (p.second - 1) / 2; } cout << ans << endl; return 0; }
[ "type_conversion.add" ]
747,040
747,041
u737491054
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define P pair<int, int> using ll = int64_t; using namespace std; // define gcd and lcm (using 64bit) ll gcd(ll a, ll b) { if (a < b) { //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。 a ^= b; b ^= a; a ^= b; } // only when b==0,this program finds that b means false and returns a. return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { int n, ans = 0; string s; cin >> n; map<string, int> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { ans += p.second * (p.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define P pair<int, int> using ll = int64_t; using namespace std; // define gcd and lcm (using 64bit) ll gcd(ll a, ll b) { if (a < b) { //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。 a ^= b; b ^= a; a ^= b; } // only when b==0,this program finds that b means false and returns a. return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { int n; ll ans = 0; string s; cin >> n; map<string, int> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { ans += (ll)p.second * (p.second - 1) / 2; } cout << ans << endl; return 0; }
[ "type_conversion.add" ]
747,042
747,041
u737491054
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define P pair<int, int> using ll = int64_t; using namespace std; // define gcd and lcm (using 64bit) ll gcd(ll a, ll b) { if (a < b) { //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。 a ^= b; b ^= a; a ^= b; } // only when b==0,this program finds that b means false and returns a. return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { int n; ll ans = 0; string s; cin >> n; map<string, int> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { ans += p.second * (p.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define P pair<int, int> using ll = int64_t; using namespace std; // define gcd and lcm (using 64bit) ll gcd(ll a, ll b) { if (a < b) { //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。 a ^= b; b ^= a; a ^= b; } // only when b==0,this program finds that b means false and returns a. return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { int n; ll ans = 0; string s; cin >> n; map<string, ll> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { ans += p.second * (p.second - 1) / 2; } cout << ans << endl; return 0; }
[]
747,040
747,043
u737491054
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define P pair<int, int> using ll = int64_t; using namespace std; // define gcd and lcm (using 64bit) ll gcd(ll a, ll b) { if (a < b) { //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。 a ^= b; b ^= a; a ^= b; } // only when b==0,this program finds that b means false and returns a. return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { int n, ans = 0; string s; cin >> n; map<string, int> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { ans += p.second * (p.second - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define P pair<int, int> using ll = int64_t; using namespace std; // define gcd and lcm (using 64bit) ll gcd(ll a, ll b) { if (a < b) { //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。 a ^= b; b ^= a; a ^= b; } // only when b==0,this program finds that b means false and returns a. return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { int n; ll ans = 0; string s; cin >> n; map<string, ll> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto &p : mp) { ans += p.second * (p.second - 1) / 2; } cout << ans << endl; return 0; }
[]
747,042
747,043
u737491054
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N; ll ans = 0; cin >> N; map<string, int> s; rep(i, N) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); s[tmp]++; } for (auto p : s) { ans += p.second * (p.second - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int N; ll ans = 0; cin >> N; map<string, ll> s; rep(i, N) { string tmp; cin >> tmp; sort(tmp.begin(), tmp.end()); s[tmp]++; } for (auto p : s) { ans += p.second * (p.second - 1) / 2; } cout << ans << endl; }
[]
747,044
747,045
u433189059
cpp
p02947
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 1; i <= n; ++i) #define all(x) begin(x), end(x) #define showall(obj) \ for (auto x : obj) \ cout << x << endl; typedef long long ll; typedef pair<int, int> ip; typedef pair<ll, ll> lp; typedef vector<int> vint; typedef vector<ll> vll; const int inf = 100100100; const ll INF = 1LL << 60; const int MOD = (int)1e9 + 7; int main() { int n; cin >> n; map<map<char, int>, int> r; rep(i, n) { string s; cin >> s; map<char, int> ss; rep(i, 10) { ss[s[i]]++; } r[ss]++; } ll ans = 0; for (auto x : r) { ans += (x.second * (x.second - 1)) / 2; } cout << ans << endl; return 0; }
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, n) for (int i = 1; i <= n; ++i) #define all(x) begin(x), end(x) #define showall(obj) \ for (auto x : obj) \ cout << x << endl; typedef long long ll; typedef pair<int, int> ip; typedef pair<ll, ll> lp; typedef vector<int> vint; typedef vector<ll> vll; const int inf = 100100100; const ll INF = 1LL << 60; const int MOD = (int)1e9 + 7; int main() { int n; cin >> n; map<map<char, ll>, ll> r; rep(i, n) { string s; cin >> s; map<char, ll> ss; rep(i, 10) { ss[s[i]]++; } r[ss]++; } ll ans = 0; for (auto x : r) { ans += (x.second * (x.second - 1)) / 2; } cout << ans << endl; return 0; }
[]
747,048
747,049
u190761897
cpp
p02947
#include <bits/stdc++.h> using namespace std; namespace FAST_IO { template <typename T> void read(T &a) { a = 0; int f = 1; char c = getchar(); while (!isdigit(c)) { if (c == '-') { f = -1; } c = getchar(); } while (isdigit(c)) { a = a * 10 + c - '0'; c = getchar(); } a = a * f; } template <typename T> void write(T a) { if (a < 0) { a = -a; putchar('-'); } if (a > 9) { write(a / 10); } putchar(a % 10 + '0'); } template <typename T> void writeln(T a) { write(a); puts(""); } } // namespace FAST_IO long long n, ans; string tmp; map<string, long long> m; int main() { cin >> n; while (n--) { cin >> tmp; sort(tmp.begin(), tmp.end()); m[tmp]++; } for (map<string, long long>::iterator i = m.begin(); i != m.end(); i++) { int q = i->second; ans += q * (q - 1) / 2; } cout << ans; }
#include <bits/stdc++.h> using namespace std; namespace FAST_IO { template <typename T> void read(T &a) { a = 0; int f = 1; char c = getchar(); while (!isdigit(c)) { if (c == '-') { f = -1; } c = getchar(); } while (isdigit(c)) { a = a * 10 + c - '0'; c = getchar(); } a = a * f; } template <typename T> void write(T a) { if (a < 0) { a = -a; putchar('-'); } if (a > 9) { write(a / 10); } putchar(a % 10 + '0'); } template <typename T> void writeln(T a) { write(a); puts(""); } } // namespace FAST_IO long long n, ans; string tmp; map<string, long long> m; int main() { cin >> n; while (n--) { cin >> tmp; sort(tmp.begin(), tmp.end()); m[tmp]++; } for (map<string, long long>::iterator i = m.begin(); i != m.end(); i++) { long long q = i->second; ans += q * (q - 1) / 2; } cout << ans; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,052
747,053
u207310767
cpp
p02947
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <vector> using namespace std; void solve() { int n; cin >> n; string s[n]; map<string, int> m; for (int i = 0; i < n; i++) { vector<char> v; for (int j = 0; j < 10; j++) { char c; cin >> c; v.push_back(c); } sort(v.begin(), v.end()); for (int j = 0; j < 10; j++) s[i] += v[j]; m[s[i]]++; } int sum = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { for (int j = itr->second - 1; j > 0; j--) sum += j; } cout << sum << endl; return; } int main() { solve(); return 0; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <vector> using namespace std; void solve() { int n; cin >> n; string s[n]; map<string, int> m; for (int i = 0; i < n; i++) { vector<char> v; for (int j = 0; j < 10; j++) { char c; cin >> c; v.push_back(c); } sort(v.begin(), v.end()); for (int j = 0; j < 10; j++) s[i] += v[j]; m[s[i]]++; } unsigned long long int sum = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { for (int j = itr->second - 1; j > 0; j--) sum += j; } cout << sum << endl; return; } int main() { solve(); return 0; }
[ "variable_declaration.type.widen.change" ]
747,054
747,055
u489302942
cpp
p02947
#include <bits/stdc++.h> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++) #define repr(i, n) for (ll i = (n - 1); i >= 0; i--) #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define br cout << "\n"; using namespace std; const int INF = 1e9; const int MOD = 1e9 + 7; using Graph = vector<vector<ll>>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } // 0 false, 1 true // string to int : -48 // ceil(a) 1.2->2.0 // c++17 g++ -std=c++17 a.cpp int main() { std::cout << std::fixed << std::setprecision(15); ll n; cin >> n; map<string, ll> res; rep(i, n) { string s; cin >> s; sort(all(s)); res[s]++; } ll ans; for (auto i : res) { if (i.second != 1) { ll tmp = i.second * (i.second - 1) / 2; ans += tmp; } } cout << ans << endl; }
#include <bits/stdc++.h> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++) #define repr(i, n) for (ll i = (n - 1); i >= 0; i--) #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define br cout << "\n"; using namespace std; const int INF = 1e9; const int MOD = 1e9 + 7; using Graph = vector<vector<ll>>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } // 0 false, 1 true // string to int : -48 // ceil(a) 1.2->2.0 // c++17 g++ -std=c++17 a.cpp int main() { std::cout << std::fixed << std::setprecision(15); ll n; cin >> n; map<string, ll> res; rep(i, n) { string s; cin >> s; sort(all(s)); res[s]++; } ll ans = 0; for (auto i : res) { if (i.second != 1) { ll tmp = i.second * (i.second - 1) / 2; ans += tmp; } } cout << ans << endl; }
[ "variable_declaration.value.change" ]
747,056
747,057
u799939777
cpp
p02947
#include <bits/stdc++.h> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++) #define repr(i, n) for (ll i = (n - 1); i >= 0; i--) #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define br cout << "\n"; using namespace std; const int INF = 1e9; const int MOD = 1e9 + 7; using Graph = vector<vector<ll>>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } // 0 false, 1 true // string to int : -48 // ceil(a) 1.2->2.0 // c++17 g++ -std=c++17 a.cpp int main() { std::cout << std::fixed << std::setprecision(15); ll n; cin >> n; map<string, ll> res; rep(i, n) { string s; cin >> s; sort(all(s)); res[s]++; } ll ans; for (auto i : res) { if (i.second != 1) { ll tmp = i.second * (i.second - 1) / 2; ans += tmp; } } cout << ans << endl; }
#include <bits/stdc++.h> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (n); i++) #define repr(i, n) for (ll i = (n - 1); i >= 0; i--) #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define br cout << "\n"; using namespace std; const int INF = 1e9; const int MOD = 1e9 + 7; using Graph = vector<vector<ll>>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } // 0 false, 1 true // string to int : -48 // ceil(a) 1.2->2.0 // c++17 g++ -std=c++17 a.cpp int main() { std::cout << std::fixed << std::setprecision(15); ll n; cin >> n; map<string, ll> res; rep(i, n) { string s; cin >> s; sort(all(s)); res[s]++; } ll ans = 0; for (auto i : res) { if (i.second != 1) { ll tmp = i.second * (i.second - 1) / 2; ans += tmp; } } cout << ans << endl; }
[ "variable_declaration.value.change" ]
747,058
747,057
u799939777
cpp
p02947
#include <bits/stdc++.h> typedef long long int ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define Sort(a) sort(a.begin(), a.end()) #define Reverse(a) reverse(a.begin(), a.end()) using namespace std; ll calc(int x) { return x * (x - 1) / 2; } int main() { ll n, count = 0; cin >> n; vector<string> s(n); vector<ll> a; rep(i, n) cin >> s[i]; rep(i, n) Sort(s[i]); Sort(s); for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) count++; else { a.push_back(count + 1); count = 0; } } a.push_back(count + 1); count = 0; rep(i, a.size()) count += calc(a[i]); // cout<<a[i]<<endl; cout << count << endl; return 0; }
#include <bits/stdc++.h> typedef long long int ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define Sort(a) sort(a.begin(), a.end()) #define Reverse(a) reverse(a.begin(), a.end()) using namespace std; ll calc(ll x) { return x * (x - 1) / 2; } int main() { ll n, count = 0; cin >> n; vector<string> s(n); vector<ll> a; rep(i, n) cin >> s[i]; rep(i, n) Sort(s[i]); Sort(s); for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) count++; else { a.push_back(count + 1); count = 0; } } a.push_back(count + 1); count = 0; rep(i, a.size()) count += calc(a[i]); // cout<<a[i]<<endl; cout << count << endl; return 0; }
[]
747,061
747,062
u259170411
cpp
p02947
#include <bits/stdc++.h> typedef long long int ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define Sort(a) sort(a.begin(), a.end()) #define Reverse(a) reverse(a.begin(), a.end()) using namespace std; int calc(int x) { return x * (x - 1) / 2; } int main() { ll n, count = 0; cin >> n; vector<string> s(n); vector<ll> a; rep(i, n) cin >> s[i]; rep(i, n) Sort(s[i]); Sort(s); for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) count++; else { a.push_back(count + 1); count = 0; } } a.push_back(count + 1); count = 0; rep(i, a.size()) count += calc(a[i]); // cout<<a[i]<<endl; cout << count << endl; return 0; }
#include <bits/stdc++.h> typedef long long int ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define Sort(a) sort(a.begin(), a.end()) #define Reverse(a) reverse(a.begin(), a.end()) using namespace std; ll calc(ll x) { return x * (x - 1) / 2; } int main() { ll n, count = 0; cin >> n; vector<string> s(n); vector<ll> a; rep(i, n) cin >> s[i]; rep(i, n) Sort(s[i]); Sort(s); for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) count++; else { a.push_back(count + 1); count = 0; } } a.push_back(count + 1); count = 0; rep(i, a.size()) count += calc(a[i]); // cout<<a[i]<<endl; cout << count << endl; return 0; }
[]
747,063
747,062
u259170411
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long int N, X = 0; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++) { cin >> S.at(i); sort(S.at(i).begin(), S.at(i).end()); } sort(S.begin(), S.end()); for (int i = 1; i < N; i++) { if (S.at(i - 1) == S.at(i)) { int j = i + 1; while (j < N && S.at(i - 1) == S.at(j)) j++; X += (j - i + 1) * (j - i) / 2; i = j - 1; } } cout << X << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long int N, X = 0; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++) { cin >> S.at(i); sort(S.at(i).begin(), S.at(i).end()); } sort(S.begin(), S.end()); for (int i = 1; i < N; i++) { if (S.at(i - 1) == S.at(i)) { long long int j = i + 1; while (j < N && S.at(i - 1) == S.at(j)) j++; X += (j - i + 1) * (j - i) / 2; i = j - 1; } } cout << X << endl; }
[ "variable_declaration.type.widen.change" ]
747,064
747,065
u820224016
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long int N, X = 0; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++) { cin >> S.at(i); sort(S.at(i).begin(), S.at(i).end()); } sort(S.begin(), S.end()); for (int i = 1; i < N; i++) { if (S.at(i - 1) == S.at(i)) { int j = i + 1; while (j < N && S.at(i - 1) == S.at(j)) j++; X += (j - i) * (j - i - 1) / 2; i = j - 1; } } cout << X << endl; }
#include <bits/stdc++.h> using namespace std; int main() { long long int N, X = 0; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++) { cin >> S.at(i); sort(S.at(i).begin(), S.at(i).end()); } sort(S.begin(), S.end()); for (int i = 1; i < N; i++) { if (S.at(i - 1) == S.at(i)) { long long int j = i + 1; while (j < N && S.at(i - 1) == S.at(j)) j++; X += (j - i + 1) * (j - i) / 2; i = j - 1; } } cout << X << endl; }
[ "assignment.change", "expression.operation.binary.remove" ]
747,066
747,065
u820224016
cpp
p02947
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int n, count = 0; map<string, int> check; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); count += check[s]++; } cout << count << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int n; long long int count = 0; map<string, int> check; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); count += check[s]++; } cout << count << endl; }
[ "variable_declaration.type.widen.change" ]
747,067
747,068
u270272336
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <utility> using namespace std; int main() { int n, sum = 0; map<string, int> m; map<string, int> m2; cin >> n; 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; m2[s] = 0; } else { m[s]++; m2[s] += m[s] - 1; } } for (auto &i : m2) { sum += i.second; } cout << sum << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <utility> using namespace std; int main() { long long int n, sum = 0; map<string, int> m; map<string, long long int> m2; cin >> n; 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; m2[s] = 0; } else { m[s]++; m2[s] += m[s] - 1; } } for (auto &i : m2) { sum += i.second; } cout << sum << endl; return 0; }
[ "variable_declaration.type.widen.change" ]
747,071
747,072
u964987395
cpp
p02947
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REPR(i, n) for (int i = (int)(n); i >= 0; i--) #define FOR(i, s, n) for (int i = (s); i < (int)(n); i++) #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; ll N, K, T, W, H, M, C; const int MAX = 5100000; const int MOD = 1e9 + 7; const double PI = 3.14159265358979323846; long long fac[MAX], finv[MAX], inv[MAX]; vector<double> cx, cy, c; ll MM = 1e12; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } std::vector<int> Eratosthenes(int n) { std::vector<bool> is_prime(n + 1); for (int i = 0; i <= n; i++) is_prime[i] = true; std::vector<int> P; for (int i = 2; i <= n; i++) { if (is_prime[i]) { for (int j = 2 * i; j <= n; j += i) { is_prime[j] = false; } P.emplace_back(i); } } return P; } ll gcd(ll a, ll b) { if (a % b == 0) return b; else return gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { map<map<char, int>, int> dict; cin >> N; string str; while (N) { cin >> str; map<char, int> mp; for (int i = 0; i < 10; ++i) { mp[str[i]]++; } dict[mp]++; --N; } ll ans = 0; for (auto i = dict.begin(); i != dict.end(); ++i) { int n = i->second; ans += n * (n - 1) / 2; } cout << ans; return 0; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REPR(i, n) for (int i = (int)(n); i >= 0; i--) #define FOR(i, s, n) for (int i = (s); i < (int)(n); i++) #define ALL(v) v.begin(), v.end() using namespace std; typedef long long ll; ll N, K, T, W, H, M, C; const int MAX = 5100000; const int MOD = 1e9 + 7; const double PI = 3.14159265358979323846; long long fac[MAX], finv[MAX], inv[MAX]; vector<double> cx, cy, c; ll MM = 1e12; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } std::vector<int> Eratosthenes(int n) { std::vector<bool> is_prime(n + 1); for (int i = 0; i <= n; i++) is_prime[i] = true; std::vector<int> P; for (int i = 2; i <= n; i++) { if (is_prime[i]) { for (int j = 2 * i; j <= n; j += i) { is_prime[j] = false; } P.emplace_back(i); } } return P; } ll gcd(ll a, ll b) { if (a % b == 0) return b; else return gcd(b, a % b); } ll lcm(ll a, ll b) { return a * b / gcd(a, b); } int main() { map<map<char, int>, int> dict; cin >> N; string str; while (N) { cin >> str; map<char, int> mp; for (int i = 0; i < 10; ++i) { mp[str[i]]++; } dict[mp]++; --N; } ll ans = 0; for (auto i = dict.begin(); i != dict.end(); ++i) { ll n = i->second; ans += n * (n - 1) / 2; } cout << ans; return 0; }
[ "variable_declaration.type.change" ]
747,073
747,074
u178618463
cpp
p02947
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define INF 1e9 #define MAXN 100005 #define MAXM 100005 #define ll long long #define vi vector<int> #define vll vector<long long> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define pii pair<int, int> int N; ll ans = 0; string st[MAXN]; map<string, int> mp; ll Combi(int a) { return a * (a - 1) / 2; } void solve() { rep(i, N) { sort(st[i].begin(), st[i].end()); mp[st[i]]++; } for (auto it = mp.begin(); it != mp.end(); ++it) ans += Combi(it->second); cout << ans << endl; } int main() { cin >> N; rep(i, N) { cin >> st[i]; } solve(); }
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; #define INF 1e9 #define MAXN 100005 #define MAXM 100005 #define ll long long #define vi vector<int> #define vll vector<long long> #define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define pii pair<int, int> int N; ll ans = 0; string st[MAXN]; map<string, int> mp; ll Combi(int a) { return (ll)a * (a - 1) / 2; } void solve() { rep(i, N) { sort(st[i].begin(), st[i].end()); mp[st[i]]++; } for (auto it = mp.begin(); it != mp.end(); ++it) ans += Combi(it->second); cout << ans << endl; } int main() { cin >> N; rep(i, N) { cin >> st[i]; } solve(); }
[ "type_conversion.add" ]
747,077
747,078
u718394671
cpp
p02947
// https://atcoder.jp/contests/abc018/tasks/abc018_4 #include <bits/stdc++.h> using namespace std; #define REP1(i, n) for (int i = 1, i##_len = (n); i < i##_len; ++i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define pow(x) x *x #define ll long long static const int MAX = 10000; static const ll INFTY = 1e18; struct edge { ll to, cost; }; using Graph = vector<vector<int>>; using _Graph = vector<vector<edge>>; // 入力 // int H, W; vector<vector<char>> field; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; // 深さ優先探索 vector<bool> seen; vector<int> colors; ll nC2(int n) { return (ll)(n * (n - 1) / 2); } int main() { int N; cin >> N; vector<string> _s(N); map<string, int> _m; REP(i, N) { cin >> _s[i]; sort(_s[i].begin(), _s[i].end()); _m[_s[i]]++; } ll ans = 0; for (auto i = _m.begin(); i != _m.end(); ++i) { ans += nC2(i->second); // cout << i->second << endl; } cout << ans << endl; } /* _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ / _||||| -:- |||||- \ | | \\\ - /// | | | \_| ''\---/'' | | \ .-\__ `-` ___/-. / ___`. .' /--.--\ `. . __ ."" '< `.___\_<|>_/___.' >'"". | | : `- \`.;`\ _ /`;.`/ - ` : | | \ \ `-. \_ __\ /__ _/ .-` / / ======`-.____`-.___\_____/___.-`____.-'====== `=---=' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pass System Test! */
// https://atcoder.jp/contests/abc018/tasks/abc018_4 #include <bits/stdc++.h> using namespace std; #define REP1(i, n) for (int i = 1, i##_len = (n); i < i##_len; ++i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define pow(x) x *x #define ll long long static const int MAX = 10000; static const ll INFTY = 1e18; struct edge { ll to, cost; }; using Graph = vector<vector<int>>; using _Graph = vector<vector<edge>>; // 入力 // int H, W; vector<vector<char>> field; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; // 深さ優先探索 vector<bool> seen; vector<int> colors; ll nC2(ll n) { return (ll)(n * (n - 1) / 2); } int main() { int N; cin >> N; vector<string> _s(N); map<string, int> _m; REP(i, N) { cin >> _s[i]; sort(_s[i].begin(), _s[i].end()); _m[_s[i]]++; } ll ans = 0; for (auto i = _m.begin(); i != _m.end(); ++i) { ans += nC2((ll)i->second); // cout << i->second << endl; } cout << ans << endl; } /* _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ / _||||| -:- |||||- \ | | \\\ - /// | | | \_| ''\---/'' | | \ .-\__ `-` ___/-. / ___`. .' /--.--\ `. . __ ."" '< `.___\_<|>_/___.' >'"". | | : `- \`.;`\ _ /`;.`/ - ` : | | \ \ `-. \_ __\ /__ _/ .-` / / ======`-.____`-.___\_____/___.-`____.-'====== `=---=' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pass System Test! */
[ "type_conversion.add" ]
747,083
747,084
u488878376
cpp
p02947
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using large = long long; int main() { int n; cin >> n; auto s = vector<string>(n); auto table = map<string, int>(); for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); table[s[i]]++; } auto counter = large(0); for (const auto &kv : table) { if (kv.second <= 1) continue; auto c = (kv.second * (kv.second - 1)) / 2; counter += c; } cout << counter; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using large = long long; int main() { int n; cin >> n; auto s = vector<string>(n); auto table = map<string, int>(); for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); table[s[i]]++; } auto counter = large(0); for (const auto &kv : table) { if (kv.second <= 1) continue; auto c = (large(kv.second) * (kv.second - 1)) / 2; counter += c; } cout << counter; return 0; }
[ "call.add", "call.arguments.change" ]
747,085
747,086
u723394740
cpp
p02947
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; map<string, int> already; for (int i = 0; i < N; ++i) { string s; cin >> s; sort(s.begin(), s.end()); if (already.count(s) == 0) { already.insert(make_pair(s, 1)); } else if (already.count(s) == 1) { ++already[s]; } } long long count = 0; for (auto itr = already.begin(); itr != already.end(); ++itr) { long long n = itr->second; count += n * (n - 1) / 2 + n - 1; } cout << count << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <string> #include <vector> using namespace std; int main() { int N; cin >> N; map<string, int> already; for (int i = 0; i < N; ++i) { string s; cin >> s; sort(s.begin(), s.end()); if (already.count(s) == 0) { already.insert(make_pair(s, 1)); } else if (already.count(s) == 1) { ++already[s]; } } long long count = 0; for (auto itr = already.begin(); itr != already.end(); ++itr) { long long n = itr->second; count += n * (n - 1) / 2; } cout << count << endl; }
[ "expression.operation.binary.remove" ]
747,087
747,088
u323542775
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n; cin >> n; string s; map<string, int> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } long long cnt = 0; for (auto iter = mp.begin(); iter != mp.end(); iter++) { int a = iter->second; cnt += a * (a - 1) / 2; } cout << cnt; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n; cin >> n; string s; map<string, int> mp; rep(i, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } long long cnt = 0; for (auto iter = mp.begin(); iter != mp.end(); iter++) { long long a = iter->second; cnt += a * (a - 1) / 2; } cout << cnt; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,089
747,090
u928712536
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 typedef long long ll; typedef pair<int, int> P; int main() { int n, i, count, res = 0; cin >> n; string mem, s[n]; for (i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); mem = s[0]; count = 0; for (i = 0; i < n; i++) { if (mem == s[i]) count++; else { res += count * (count - 1) / 2; mem = s[i]; count = 1; } } res += count * (count - 1) / 2; cout << res << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 typedef long long ll; typedef pair<int, int> P; int main() { ll n, i, count, res = 0; cin >> n; string mem, s[n]; for (i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); mem = s[0]; count = 0; for (i = 0; i < n; i++) { if (mem == s[i]) count++; else { res += count * (count - 1) / 2; mem = s[i]; count = 1; } } res += count * (count - 1) / 2; cout << res << "\n"; return 0; }
[ "variable_declaration.type.change" ]
747,091
747,092
u058348416
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define inf (ll)2147483647 #define mod (ll)(1e9 + 7) #define d(x) cerr << #x << "=" << x << endl; #define p(x) cout << (x) << endl #define ps(x) cout << (x) #define pk(x) cout << (x) << " " #define pfix(d, x) cout << fixed << setprecision(d) << x << endl #define pb push_back #define sz(v) (v).size() #define all(v) (v).begin(), (v).end() #define minel(v) *min_element(all(v)) #define minind(v) distance((v).begin(), min_element(all(v))) #define maxel(v) *max_element(all(v)) #define maxind(v) distance((v).begin(), max_element(all(v))) #define p2d(v, n, m) \ rep(i, n) { \ rep(j, m) { pk(v[i][j]); } \ p(""); \ } #define fi first #define se second template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); } typedef map<ll, ll> imap; typedef pair<ll, ll> P; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<pair<ll, ll>> VP; void pyn(bool ans) { p(ans ? "Yes" : "No"); } // Prime bool is_prime(ll n) { if (n == 1) return false; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } vector<ll> divisor(ll n) { vector<ll> res; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { res.push_back(i); if (i != n / i) res.push_back(n / i); } } return res; } map<ll, int> prime_factor(ll n) { map<ll, int> res; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { res[i]++; n /= i; } } if (n != 1) res[n]++; return res; } vector<ll> prime_enum(int n) { vector<bool> is_prime(n + 1, true); is_prime[0] = is_prime[1] = false; vector<ll> res; for (int i = 2; i <= n; i++) { if (!is_prime[i]) continue; res.push_back(i); for (int j = 2 * i; j <= n; j += i) { is_prime[j] = false; } } return res; } // Mod // mod_tools #define MFACT_SIZE 1000001 ll fact[MFACT_SIZE]; ll mpow(ll x, ll y) { // d(x) if (y == 0) return 1; if (y % 2 == 0) { return mpow(x * x % mod, y / 2) % mod; } else { return x * mpow(x, y - 1) % mod; } } ll minv(ll x) { // only available for mod=10^9+7 return mpow(x, mod - 2); } ll ms(ll a, ll b) { return (a + b) % mod; } ll mm(ll a, ll b) { return (a * b) % mod; } void mfact() { // prepare fact-array fact[0] = 1; rep(i, 1, MFACT_SIZE) { fact[i] = fact[i - 1] * i % mod; } } ll mcombi(ll n, ll k) { return (fact[n] * minv(fact[k]) % mod) * minv(fact[n - k]) % mod; } ll llceil(ll a, ll b) { if (a >= 0) { return (a + b - 1) / b; } else { return a / b; } } ll llfloor(ll a, ll b) { if (a < 0) { return (a - b + 1) / b; } else { return a / b; } } struct UnionFind { VL data; UnionFind(int size) : data(size, -1) {} bool unite(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool find(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } ll size(int x) { return -data[root(x)]; } ll num_root(ll size) { VL roots; rep(i, size) roots.pb(root(i)); sort(all(roots)); roots.erase(unique(all(roots)), roots.end()); return roots.size(); } }; struct graph { int V; vector<VP> v; graph(int V) : V(V), v(vector<VP>(V)) {} void add_diedge(int v1, int v2, ll w) { v[v1].pb({v2, w}); v[v2].pb({v1, w}); } void add_edge(int v1, int v2, ll w) { v[v1].pb({v2, w}); } VL dist = vector<ll>(V, -1); VI prever = vector<int>(V, -1); VL dijkstra(int start) { priority_queue<P, vector<P>, greater<P>> que; que.push(P(0, start)); while (!que.empty()) { P pa = que.top(); que.pop(); int u = pa.se; if (dist[u] >= 0 && dist[u] < pa.fi) continue; dist[u] = pa.fi; for (P e : v[u]) { if (dist[e.fi] < 0 || dist[e.fi] > dist[u] + e.se) { dist[e.fi] = dist[u] + e.se; prever[e.fi] = u; que.push(P(dist[e.fi], e.fi)); } } } return dist; } void dfs(ll now, ll prv, ll c) { dist[now] = c; for (auto nxt : v[now]) if (nxt.fi != prv) { if (nxt.se % 2) dfs(nxt.fi, now, !c); else dfs(nxt.fi, now, c); } } void gprint() { rep(i, V) { ps(i); ps(": "); for (P x : v[i]) { ps(x.fi); ps(","); ps(x.se); ps(" "); } p(""); } } }; struct SegmentTree { private: int n; VL node; public: // 元配列 v をセグメント木で表現する SegmentTree(VL v) { // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく // セグメント木全体で必要なノード数は 2n-1 個である int sz = v.size(); n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, inf); for (int i = 0; i < sz; i++) node[i + n - 1] = v[i]; for (int i = n - 2; i >= 0; i--) node[i] = min(node[2 * i + 1], node[2 * i + 2]); } void update(int x, int val) { x += (n - 1); node[x] = val; while (x > 0) { x = (x - 1) / 2; node[x] = min(node[2 * x + 1], node[2 * x + 2]); } } // 要求区間 [a, b) 中の要素の最小値を答える // // k := 自分がいるノードのインデックス // // 対象区間は [l, r) にあたる // get a,b+1で呼び出す int get(int a, int b, int k = 0, int l = 0, int r = -1) { if (r < 0) r = n; d(l) d(r) d(a) d(b) if (r <= a || b <= l) return inf; // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う if (a <= l && r <= b) return node[k]; // 要求区間が対象区間の一部を被覆 -> 子について探索を行う // 左側の子を vl ・ 右側の子を vr としている // 新しい対象区間は、現在の対象区間を半分に割ったもの int vl = get(a, b, 2 * k + 1, l, (l + r) / 2); int vr = get(a, b, 2 * k + 2, (l + r) / 2, r); return min(vl, vr); } }; ll a[100001], b[100001], c[100001], d, n, m, x, y, z, h, w, k, mi = inf, ma = -inf, ans, sum, cnt, s, t, l, r, res, tmp, itr, p, q; bool flag; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1}; char cha; string st; P pa; bool fl; int main(void) { cin >> n; // mapのmapを作る。 map<map<char, int>, int> mapset; rep(i, n) { cin >> st; map<char, int> cset; rep(i, sz(st)) cset[st[i]]++; mapset[cset]++; } for (auto i = mapset.begin(); i != mapset.end(); ++i) { auto value = i->se; sum += (value - 1) * value / 2; } p(sum); return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct fast_ios { fast_ios() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define _overload3(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i) #define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__) #define inf (ll)2147483647 #define mod (ll)(1e9 + 7) #define d(x) cerr << #x << "=" << x << endl; #define p(x) cout << (x) << endl #define ps(x) cout << (x) #define pk(x) cout << (x) << " " #define pfix(d, x) cout << fixed << setprecision(d) << x << endl #define pb push_back #define sz(v) (v).size() #define all(v) (v).begin(), (v).end() #define minel(v) *min_element(all(v)) #define minind(v) distance((v).begin(), min_element(all(v))) #define maxel(v) *max_element(all(v)) #define maxind(v) distance((v).begin(), max_element(all(v))) #define p2d(v, n, m) \ rep(i, n) { \ rep(j, m) { pk(v[i][j]); } \ p(""); \ } #define fi first #define se second template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); } typedef map<ll, ll> imap; typedef pair<ll, ll> P; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<pair<ll, ll>> VP; void pyn(bool ans) { p(ans ? "Yes" : "No"); } // Prime bool is_prime(ll n) { if (n == 1) return false; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } vector<ll> divisor(ll n) { vector<ll> res; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { res.push_back(i); if (i != n / i) res.push_back(n / i); } } return res; } map<ll, int> prime_factor(ll n) { map<ll, int> res; for (ll i = 2; i * i <= n; i++) { while (n % i == 0) { res[i]++; n /= i; } } if (n != 1) res[n]++; return res; } vector<ll> prime_enum(int n) { vector<bool> is_prime(n + 1, true); is_prime[0] = is_prime[1] = false; vector<ll> res; for (int i = 2; i <= n; i++) { if (!is_prime[i]) continue; res.push_back(i); for (int j = 2 * i; j <= n; j += i) { is_prime[j] = false; } } return res; } // Mod // mod_tools #define MFACT_SIZE 1000001 ll fact[MFACT_SIZE]; ll mpow(ll x, ll y) { // d(x) if (y == 0) return 1; if (y % 2 == 0) { return mpow(x * x % mod, y / 2) % mod; } else { return x * mpow(x, y - 1) % mod; } } ll minv(ll x) { // only available for mod=10^9+7 return mpow(x, mod - 2); } ll ms(ll a, ll b) { return (a + b) % mod; } ll mm(ll a, ll b) { return (a * b) % mod; } void mfact() { // prepare fact-array fact[0] = 1; rep(i, 1, MFACT_SIZE) { fact[i] = fact[i - 1] * i % mod; } } ll mcombi(ll n, ll k) { return (fact[n] * minv(fact[k]) % mod) * minv(fact[n - k]) % mod; } ll llceil(ll a, ll b) { if (a >= 0) { return (a + b - 1) / b; } else { return a / b; } } ll llfloor(ll a, ll b) { if (a < 0) { return (a - b + 1) / b; } else { return a / b; } } struct UnionFind { VL data; UnionFind(int size) : data(size, -1) {} bool unite(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool find(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } ll size(int x) { return -data[root(x)]; } ll num_root(ll size) { VL roots; rep(i, size) roots.pb(root(i)); sort(all(roots)); roots.erase(unique(all(roots)), roots.end()); return roots.size(); } }; struct graph { int V; vector<VP> v; graph(int V) : V(V), v(vector<VP>(V)) {} void add_diedge(int v1, int v2, ll w) { v[v1].pb({v2, w}); v[v2].pb({v1, w}); } void add_edge(int v1, int v2, ll w) { v[v1].pb({v2, w}); } VL dist = vector<ll>(V, -1); VI prever = vector<int>(V, -1); VL dijkstra(int start) { priority_queue<P, vector<P>, greater<P>> que; que.push(P(0, start)); while (!que.empty()) { P pa = que.top(); que.pop(); int u = pa.se; if (dist[u] >= 0 && dist[u] < pa.fi) continue; dist[u] = pa.fi; for (P e : v[u]) { if (dist[e.fi] < 0 || dist[e.fi] > dist[u] + e.se) { dist[e.fi] = dist[u] + e.se; prever[e.fi] = u; que.push(P(dist[e.fi], e.fi)); } } } return dist; } void dfs(ll now, ll prv, ll c) { dist[now] = c; for (auto nxt : v[now]) if (nxt.fi != prv) { if (nxt.se % 2) dfs(nxt.fi, now, !c); else dfs(nxt.fi, now, c); } } void gprint() { rep(i, V) { ps(i); ps(": "); for (P x : v[i]) { ps(x.fi); ps(","); ps(x.se); ps(" "); } p(""); } } }; struct SegmentTree { private: int n; VL node; public: // 元配列 v をセグメント木で表現する SegmentTree(VL v) { // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく // セグメント木全体で必要なノード数は 2n-1 個である int sz = v.size(); n = 1; while (n < sz) n *= 2; node.resize(2 * n - 1, inf); for (int i = 0; i < sz; i++) node[i + n - 1] = v[i]; for (int i = n - 2; i >= 0; i--) node[i] = min(node[2 * i + 1], node[2 * i + 2]); } void update(int x, int val) { x += (n - 1); node[x] = val; while (x > 0) { x = (x - 1) / 2; node[x] = min(node[2 * x + 1], node[2 * x + 2]); } } // 要求区間 [a, b) 中の要素の最小値を答える // // k := 自分がいるノードのインデックス // // 対象区間は [l, r) にあたる // get a,b+1で呼び出す int get(int a, int b, int k = 0, int l = 0, int r = -1) { if (r < 0) r = n; d(l) d(r) d(a) d(b) if (r <= a || b <= l) return inf; // 要求区間が対象区間を完全に被覆 -> 対象区間を答えの計算に使う if (a <= l && r <= b) return node[k]; // 要求区間が対象区間の一部を被覆 -> 子について探索を行う // 左側の子を vl ・ 右側の子を vr としている // 新しい対象区間は、現在の対象区間を半分に割ったもの int vl = get(a, b, 2 * k + 1, l, (l + r) / 2); int vr = get(a, b, 2 * k + 2, (l + r) / 2, r); return min(vl, vr); } }; ll a[100001], b[100001], c[100001], d, n, m, x, y, z, h, w, k, mi = inf, ma = -inf, ans, sum, cnt, s, t, l, r, res, tmp, itr, p, q; bool flag; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1}; char cha; string st; P pa; bool fl; int main(void) { cin >> n; // mapのmapを作る。 map<map<char, ll>, ll> mapset; rep(i, n) { cin >> st; map<char, ll> cset; rep(i, sz(st)) cset[st[i]]++; mapset[cset]++; } for (auto i = mapset.begin(); i != mapset.end(); ++i) { auto value = i->se; sum += (value - 1) * value / 2; } p(sum); return 0; }
[]
747,100
747,101
u001566280
cpp
p02947
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i)) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll INF = (1ll << 60); ll power(ll x, ll y) { ll ans = 1; while (y) { if (y & 1) ans = (ans * x) % MOD; x = (x * x) % MOD; y >>= 1; } return ans; } ll comb(ll n, ll k) { ll ans = 1; ll i; if (n < k || n < 0 || k < 0) { return 0; } rep(i, 0, k) { ans *= n - i; ans %= MOD; ans *= power(i + 1, MOD - 2); ans %= MOD; } return ans; } int main(void) { int n; ll ans = 0; cin >> n; vector<string> s(n); map<string, int> count; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); count[s[i]]++; } for (auto x : count) { ans += x.second * (x.second - 1) / 2; } cout << ans << endl; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <forward_list> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> #define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i)) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1e9 + 7; const ll INF = (1ll << 60); ll power(ll x, ll y) { ll ans = 1; while (y) { if (y & 1) ans = (ans * x) % MOD; x = (x * x) % MOD; y >>= 1; } return ans; } ll comb(ll n, ll k) { ll ans = 1; ll i; if (n < k || n < 0 || k < 0) { return 0; } rep(i, 0, k) { ans *= n - i; ans %= MOD; ans *= power(i + 1, MOD - 2); ans %= MOD; } return ans; } int main(void) { int n; ll ans = 0; cin >> n; vector<string> s(n); map<string, ll> count; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); count[s[i]]++; } for (auto x : count) { ans += x.second * (x.second - 1) / 2; } cout << ans << endl; }
[]
747,102
747,103
u880221923
cpp
p02947
#include <algorithm> #include <bitset> #include <cctype> #include <cstdint> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; //#define int long long #define m_p make_pair #define mod 1000000007 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define vecin(v) \ for (int i = 0; i < (int)v.size(); i++) \ cin >> vec[i]; using namespace std; int jousu(int, int); int jousu(int x00, int y00) { int z00 = 1; for (int i = 0; i < y00; i++) { z00 *= x00; } return z00; } int kurai(int x00, int y00) { int z00 = (x00 % jousu(10, y00)) / jousu(10, y00 - 1); return z00; } int keta(int x00) { int z00 = x00; int w00 = 0; while (z00 != 0) { z00 /= 10; w00++; } return w00; } int main() { int n, ans = 0; string s; cin >> n; map<string, int> m; for (int i = 0; i < n; i++) { cin >> s; sort(all(s)); if (!m.count(s)) { m[s] = 1; } else { ans += m[s]; m[s]++; } } cout << ans << endl; }
#include <algorithm> #include <bitset> #include <cctype> #include <cstdint> #include <cstdio> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; #define int long long #define m_p make_pair #define mod 1000000007 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define vecin(v) \ for (int i = 0; i < (int)v.size(); i++) \ cin >> vec[i]; using namespace std; int jousu(int, int); int jousu(int x00, int y00) { int z00 = 1; for (int i = 0; i < y00; i++) { z00 *= x00; } return z00; } int kurai(int x00, int y00) { int z00 = (x00 % jousu(10, y00)) / jousu(10, y00 - 1); return z00; } int keta(int x00) { int z00 = x00; int w00 = 0; while (z00 != 0) { z00 /= 10; w00++; } return w00; } signed main() { int n, ans = 0; string s; cin >> n; map<string, int> m; for (int i = 0; i < n; i++) { cin >> s; sort(all(s)); if (!m.count(s)) { m[s] = 1; } else { ans += m[s]; m[s]++; } } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
747,109
747,110
u294700660
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<vector<char>> s(N, vector<char>(10)); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { cin >> s.at(i).at(j); } sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); long long ans = 0; int num = 1; for (int i = 0; i < N - 1; i++) { bool flag = true; for (int j = 0; j < 10; j++) { if (s.at(i).at(j) != s.at(i + 1).at(j)) { flag = false; break; } } if (flag) { num++; } if (!flag || i == N - 2) { ans += num * (num - 1) / 2; num = 1; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<vector<char>> s(N, vector<char>(10)); for (int i = 0; i < N; i++) { for (int j = 0; j < 10; j++) { cin >> s.at(i).at(j); } sort(s.at(i).begin(), s.at(i).end()); } sort(s.begin(), s.end()); long long ans = 0; long long num = 1; for (int i = 0; i < N - 1; i++) { bool flag = true; for (int j = 0; j < 10; j++) { if (s.at(i).at(j) != s.at(i + 1).at(j)) { flag = false; break; } } if (flag) { num++; } if (!flag || i == N - 2) { ans += num * (num - 1) / 2; num = 1; } } cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,111
747,112
u630211216
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string s; unordered_map<string, int> MAP; int ans = 0; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); if (MAP.count(s)) { MAP[s]++; ans += MAP[s]; } else { MAP[s] = 0; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string s; unordered_map<string, int> MAP; long long ans = 0; for (int i = 0; i < N; i++) { cin >> s; sort(s.begin(), s.end()); if (MAP.count(s)) { MAP[s]++; ans += MAP[s]; } else { MAP[s] = 0; } } cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,117
747,118
u265359795
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(c, i, n) for (int i = c; i < (int)(n); i++) #define all(v) v.begin(), v.end() int main() { int N; cin >> N; vector<string> S(N); rep(0, i, N) { cin >> S.at(i); sort(all(S.at(i))); } sort(all(S)); ll ans = 0; int count = 1; rep(0, i, N - 1) { if (S.at(i) == S.at(i + 1)) { count++; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(c, i, n) for (int i = c; i < (int)(n); i++) #define all(v) v.begin(), v.end() int main() { int N; cin >> N; vector<string> S(N); rep(0, i, N) { cin >> S.at(i); sort(all(S.at(i))); } sort(all(S)); ll ans = 0; ll count = 1; rep(0, i, N - 1) { if (S.at(i) == S.at(i + 1)) { count++; } else { ans += count * (count - 1) / 2; count = 1; } } ans += count * (count - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,121
747,122
u124659583
cpp
p02947
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define SORT(c) sort((c).begin(), (c).end()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define SUM(c) accumulate((c).begin(), (c).end(), 0) #define ALL(a) (a).begin(), (a).end() // int gcd(int a,int b){return b?gcd(b,a%b):a;} long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } using namespace std; inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } template <class T> T maxt(T x, T y) { if (x > y) return x; else return y; } template <class T> T mint(T x, T y) { if (x > y) return y; else return x; } // sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];}); // cout << fixed << setprecision(10) << ans << defaultfloat << endl; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef vector<string> vs; //小数出力 double print_double(double d) { printf("%.10f", d); } long long m = 1e9 + 7, mod = 1e9 + 7; //逆元 a/b の modをとるとき -> a*modinv(b)%mod long long modinv(long long a, long long m = 1e9 + 7) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } //約数列挙 vector<ll> divisor(ll n) { vector<ll> ret; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(begin(ret), end(ret)); return (ret); } // Union Find struct UnionFind { vector<int> par; // 親ノード vector<int> rank; // ランク UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n); rank.resize(n); for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; return true; } }; ll combination_mod(int n, int k) { k = mint(k, n - k); ll ans = 1; if (n == 0 || k == 0) return ans; rep(i, k) { ans = ans * (n - i) % mod; ans = ans * modinv(i + 1) % mod; } return ans; } struct edge { int from; //出発点 int to; //到達点 int cost; //移動コスト }; //ベルマンフォード法 vector<ll> bellman_ford(vector<edge> edges, int V, int E, int r, ll INF = 100000000000) { vl cost_to(V, INF); cost_to[r] = 0; rep(i, V) { rep(j, E) { edge e = edges[j]; if (cost_to[e.from] == INF) continue; if (cost_to[e.to] > cost_to[e.from] + e.cost) { cost_to[e.to] = cost_to[e.from] + e.cost; if (i == V - 1) { printf("NEGATIVE CYCLE\n"); return {}; } } } } return cost_to; } // combination const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll _pow(ll a, ll b) { ll ans = 1; rep(i, b) ans *= a; return ans; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { int N; string s; vector<string> ss; cin >> N; rep(i, N) { cin >> s; SORT(s); ss.push_back(s); } SORT(ss); // for (auto k:ss) cout << k << endl; int cnt = 1; ll ans = 0; FOR(i, 1, N) { if (ss[i] == ss[i - 1]) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; } } ans += cnt * (cnt - 1) / 2; cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define SORT(c) sort((c).begin(), (c).end()) #define REVERSE(c) reverse((c).begin(), (c).end()) #define SUM(c) accumulate((c).begin(), (c).end(), 0) #define ALL(a) (a).begin(), (a).end() // int gcd(int a,int b){return b?gcd(b,a%b):a;} long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } using namespace std; inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } template <class T> T maxt(T x, T y) { if (x > y) return x; else return y; } template <class T> T mint(T x, T y) { if (x > y) return y; else return x; } // sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];}); // cout << fixed << setprecision(10) << ans << defaultfloat << endl; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef vector<string> vs; //小数出力 double print_double(double d) { printf("%.10f", d); } long long m = 1e9 + 7, mod = 1e9 + 7; //逆元 a/b の modをとるとき -> a*modinv(b)%mod long long modinv(long long a, long long m = 1e9 + 7) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } //約数列挙 vector<ll> divisor(ll n) { vector<ll> ret; for (ll i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(begin(ret), end(ret)); return (ret); } // Union Find struct UnionFind { vector<int> par; // 親ノード vector<int> rank; // ランク UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n); rank.resize(n); for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; return true; } }; ll combination_mod(int n, int k) { k = mint(k, n - k); ll ans = 1; if (n == 0 || k == 0) return ans; rep(i, k) { ans = ans * (n - i) % mod; ans = ans * modinv(i + 1) % mod; } return ans; } struct edge { int from; //出発点 int to; //到達点 int cost; //移動コスト }; //ベルマンフォード法 vector<ll> bellman_ford(vector<edge> edges, int V, int E, int r, ll INF = 100000000000) { vl cost_to(V, INF); cost_to[r] = 0; rep(i, V) { rep(j, E) { edge e = edges[j]; if (cost_to[e.from] == INF) continue; if (cost_to[e.to] > cost_to[e.from] + e.cost) { cost_to[e.to] = cost_to[e.from] + e.cost; if (i == V - 1) { printf("NEGATIVE CYCLE\n"); return {}; } } } } return cost_to; } // combination const int MAX = 510000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll _pow(ll a, ll b) { ll ans = 1; rep(i, b) ans *= a; return ans; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int main() { int N; string s; vector<string> ss; cin >> N; rep(i, N) { cin >> s; SORT(s); ss.push_back(s); } SORT(ss); // for (auto k:ss) cout << k << endl; ll cnt = 1; ll ans = 0; FOR(i, 1, N) { if (ss[i] == ss[i - 1]) cnt++; else { ans += cnt * (cnt - 1) / 2; cnt = 1; } } ans += cnt * (cnt - 1) / 2; cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,123
747,124
u335278042
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; using P = pair<ll, ll>; const ll mod = 1e9 + 7; #define ALL(x) (x).begin(), (x).end() #define pow(x, y) modpow(x, y) #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) template <class T = int> T in() { T x; cin >> x; return (x); } signed main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); int N = in(); vector<string> S(N); REP(i, N) { S[i] = in<string>(); sort(ALL(S[i])); } sort(ALL(S)); ll answer = 0; int counter = 1; string before = "a"; REP(i, N) { if (before == S[i]) { counter++; } else { if (counter > 1) answer += counter * (counter - 1) / 2; counter = 1; } before = S[i]; } if (counter > 1) answer += counter * (counter - 1) / 2; cout << answer << "\n"; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; using P = pair<ll, ll>; const ll mod = 1e9 + 7; #define ALL(x) (x).begin(), (x).end() #define pow(x, y) modpow(x, y) #define REP(i, n) for (ll(i) = 0; (i) < (n); (i)++) template <class T = int> T in() { T x; cin >> x; return (x); } signed main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); int N = in(); vector<string> S(N); REP(i, N) { S[i] = in<string>(); sort(ALL(S[i])); } sort(ALL(S)); ll answer = 0; ll counter = 1; string before = "a"; REP(i, N) { if (before == S[i]) { counter++; } else { if (counter > 1) answer += counter * (counter - 1) / 2; counter = 1; } before = S[i]; } if (counter > 1) answer += counter * (counter - 1) / 2; cout << answer << "\n"; }
[ "variable_declaration.type.change" ]
747,125
747,126
u017078415
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; int seqsum(int N) { int count = 0; for (int i = 1; i < N; i++) { count += i; } return count; } int main() { int N; map<string, int> ans; cin >> N; ll count = 0; for (int i = 0; i < N; i++) { string s; cin >> s; sort(s.begin(), s.end()); ans[s]++; } for (pair<string, int> t : ans) { if (t.second > 1) count += seqsum(t.second); } cout << count << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll seqsum(ll N) { ll count = 0; for (int i = 1; i < N; i++) { count += i; } return count; } int main() { ll N; map<string, ll> ans; cin >> N; ll count = 0; for (int i = 0; i < N; i++) { string s; cin >> s; sort(s.begin(), s.end()); ans[s]++; } for (pair<string, ll> t : ans) { if (t.second > 1) count += seqsum(t.second); } cout << count << endl; return 0; }
[ "variable_declaration.type.change" ]
747,127
747,128
u241312295
cpp
p02947
#include <bits/stdc++.h>- using namespace std; int main() { int n; cin >> n; map<string, int> mp; while (n--) { string x; cin >> x; sort(x.begin(), x.end()); mp[x]++; } long long int C = 0; for (auto i : mp) { C += ((i.second * (i.second - 1)) / 2); } cout << C << endl; return 0; }
#include <bits/stdc++.h>- using namespace std; int main() { long long int n; cin >> n; map<string, long long int> mp; while (n--) { string x; cin >> x; sort(x.begin(), x.end()); mp[x]++; } long long int C = 0; for (auto i : mp) { C += ((i.second * (i.second - 1)) / 2); } cout << C << endl; return 0; }
[ "variable_declaration.type.widen.change" ]
747,130
747,131
u011250027
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long int num, val = 0; map<string, long long int> mp; vector<int> vec; string word; cin >> num; for (int i = 0; i < num; i++) { cin >> word; sort(word.begin(), word.end()); mp[word]++; } for (auto it : mp) vec.push_back(it.second); for (int y = 0; y < vec.size(); y++) val += vec[y] * (vec[y] - 1) * 0.5; cout << val << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int num, val = 0; map<string, long long int> mp; vector<long long int> vec; string word; cin >> num; for (int i = 0; i < num; i++) { cin >> word; sort(word.begin(), word.end()); mp[word]++; } for (auto it : mp) vec.push_back(it.second); for (int y = 0; y < vec.size(); y++) val += vec[y] * (vec[y] - 1) * 0.5; cout << val << endl; return 0; }
[ "variable_declaration.type.widen.change" ]
747,134
747,135
u461825790
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long int num, val = 0; map<string, int> mp; vector<int> vec; string word; cin >> num; for (int i = 0; i < num; i++) { cin >> word; sort(word.begin(), word.end()); mp[word]++; } for (auto it : mp) vec.push_back(it.second); for (int y = 0; y < vec.size(); y++) val += vec[y] * (vec[y] - 1) * 0.5; cout << val << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int num, val = 0; map<string, long long int> mp; vector<long long int> vec; string word; cin >> num; for (int i = 0; i < num; i++) { cin >> word; sort(word.begin(), word.end()); mp[word]++; } for (auto it : mp) vec.push_back(it.second); for (int y = 0; y < vec.size(); y++) val += vec[y] * (vec[y] - 1) * 0.5; cout << val << endl; return 0; }
[ "variable_declaration.type.widen.change" ]
747,136
747,135
u461825790
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int num, val = 0; map<string, int> mp; vector<int> vec; string word; cin >> num; for (int i = 0; i < num; i++) { cin >> word; sort(word.begin(), word.end()); mp[word]++; } for (auto it : mp) vec.push_back(it.second); for (int y = 0; y < vec.size(); y++) val += vec[y] * (vec[y] - 1) * 0.5; cout << val << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int num, val = 0; map<string, long long int> mp; vector<long long int> vec; string word; cin >> num; for (int i = 0; i < num; i++) { cin >> word; sort(word.begin(), word.end()); mp[word]++; } for (auto it : mp) vec.push_back(it.second); for (int y = 0; y < vec.size(); y++) val += vec[y] * (vec[y] - 1) * 0.5; cout << val << endl; return 0; }
[ "variable_declaration.type.widen.change" ]
747,137
747,135
u461825790
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; // Welcome to my source code! int main() { int n; cin >> n; map<string, ll> mp; for (int i = 0; i < n; i++) { string c; cin >> c; sort(c.begin(), c.end()); mp[c]++; } int ans = 0; for (auto x : mp) { if (x.second >= 2) { ans += x.second * (x.second - 1) / 2; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; // Welcome to my source code! int main() { int n; cin >> n; map<string, ll> mp; for (int i = 0; i < n; i++) { string c; cin >> c; sort(c.begin(), c.end()); mp[c]++; } ll ans = 0; for (auto x : mp) { if (x.second >= 2) { ans += x.second * (x.second - 1) / 2; } } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,138
747,139
u440217234
cpp
p02947
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stdio.h> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; map<string, int> m; for (int i = 0; i < N; i++) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } ll count = 0; for (auto i : m) { count += i.second * (i.second - 1) / 2; } cout << count << endl; }
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stdio.h> #include <string> #include <tuple> #include <vector> using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; map<string, ll> m; for (int i = 0; i < N; i++) { string s; cin >> s; sort(s.begin(), s.end()); m[s]++; } ll count = 0; for (auto &i : m) { count += i.second * (i.second - 1) / 2; } cout << count << endl; }
[]
747,140
747,141
u412039195
cpp
p02947
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; int main() { int N; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++) { string temp; cin >> temp; sort(temp.begin(), temp.end()); S[i] = temp; } sort(S.begin(), S.end()); long ans = 0; int n = 1; string prev = ""; for (int i = 0; i < N; i++) { if (prev == S[i]) { n += 1; } else { ans += (n * (n - 1)) / 2; n = 1; } prev = S[i]; } ans += (n * (n - 1)) / 2; cout << ans << endl; }
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG using namespace std; int main() { int N; cin >> N; vector<string> S(N); for (int i = 0; i < N; i++) { string temp; cin >> temp; sort(temp.begin(), temp.end()); S[i] = temp; } sort(S.begin(), S.end()); long ans = 0; long n = 1; string prev = ""; for (int i = 0; i < N; i++) { if (prev == S[i]) { n += 1; } else { ans += (n * (n - 1)) / 2; n = 1; } prev = S[i]; } ans += (n * (n - 1)) / 2; cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
747,142
747,143
u886569237
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 ss; cin >> ss; sort(ss.begin(), ss.end()); mp[ss]++; } int ans = 0; for (auto &i : mp) { int s = i.second; ans += s * (s - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; map<string, int> mp; for (int i = 0; i < N; i++) { string ss; cin >> ss; sort(ss.begin(), ss.end()); mp[ss]++; } long long ans = 0; for (auto &i : mp) { int s = i.second; ans += (long long)s * (s - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,144
747,145
u770009793
cpp
p02947
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; constexpr ll INF = 1e16; constexpr ll MOD = 1000000007; // modint: mod 計算を int を扱うように扱える構造体 template <int MOD> struct Fp { long long val; constexpr Fp(long long v = 0) noexcept : val(v % MOD) { if (val < 0) v += MOD; } constexpr int getmod() { return MOD; } constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; } constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; } constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; } constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; } constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; } constexpr Fp &operator+=(const Fp &r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr Fp &operator-=(const Fp &r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr Fp &operator*=(const Fp &r) noexcept { val = val * r.val % MOD; return *this; } constexpr Fp &operator/=(const Fp &r) noexcept { long long a = r.val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator==(const Fp &r) const noexcept { return this->val == r.val; } constexpr bool operator!=(const Fp &r) const noexcept { return this->val != r.val; } friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept { return os << x.val; } friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept { return is >> x.val; } friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept { if (n == 0) return 1; auto t = modpow(a, n / 2); t = t * t; if (n & 1) t = t * a; return t; } }; using mint = Fp<((int)MOD)>; #define rep(i, N) for (ll i = 0; i < (N); ++i) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } else { return 0; } } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } else { return 0; } } ll max(ll a, ll b) { return a < b ? b : a; } ll min(ll a, ll b) { return a > b ? b : a; } double maxf(double a, double b) { return a < b ? b : a; } template <typename T> inline string toString(const T &a) { ostringstream oss; oss << a; return oss.str(); } ll gcd(ll x, ll y) { return x % y ? gcd(y, x % y) : y; } ll lcm(ll x, ll y) { return x * y / gcd(x, y); } struct hash_pair { template <class T1, class T2> size_t operator()(const pair<T1, T2> &p) const { auto hash1 = hash<T1>{}(p.first); auto hash2 = hash<T2>{}(p.second); return hash1 ^ hash2; } }; // lower_bound: equal or greater than // upper_bound: greater than // Remember "upper_bound is greater" int main() { unordered_map<string, int> found; ll N; cin >> N; rep(i, N) { string s; cin >> s; sort(s.begin(), s.end()); if (found.find(s) != found.end()) { ++found[s]; } else { found.emplace(s, 1); } } //計算 ll sum = 0; for (auto fpr : found) { if (fpr.second >= 2) { sum += fpr.second * (fpr.second - 1) / 2; } } cout << sum << endl; }
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; constexpr ll INF = 1e16; constexpr ll MOD = 1000000007; // modint: mod 計算を int を扱うように扱える構造体 template <int MOD> struct Fp { long long val; constexpr Fp(long long v = 0) noexcept : val(v % MOD) { if (val < 0) v += MOD; } constexpr int getmod() { return MOD; } constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; } constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; } constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; } constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; } constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; } constexpr Fp &operator+=(const Fp &r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr Fp &operator-=(const Fp &r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr Fp &operator*=(const Fp &r) noexcept { val = val * r.val % MOD; return *this; } constexpr Fp &operator/=(const Fp &r) noexcept { long long a = r.val, b = MOD, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator==(const Fp &r) const noexcept { return this->val == r.val; } constexpr bool operator!=(const Fp &r) const noexcept { return this->val != r.val; } friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept { return os << x.val; } friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept { return is >> x.val; } friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept { if (n == 0) return 1; auto t = modpow(a, n / 2); t = t * t; if (n & 1) t = t * a; return t; } }; using mint = Fp<((int)MOD)>; #define rep(i, N) for (ll i = 0; i < (N); ++i) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } else { return 0; } } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } else { return 0; } } ll max(ll a, ll b) { return a < b ? b : a; } ll min(ll a, ll b) { return a > b ? b : a; } double maxf(double a, double b) { return a < b ? b : a; } template <typename T> inline string toString(const T &a) { ostringstream oss; oss << a; return oss.str(); } ll gcd(ll x, ll y) { return x % y ? gcd(y, x % y) : y; } ll lcm(ll x, ll y) { return x * y / gcd(x, y); } struct hash_pair { template <class T1, class T2> size_t operator()(const pair<T1, T2> &p) const { auto hash1 = hash<T1>{}(p.first); auto hash2 = hash<T2>{}(p.second); return hash1 ^ hash2; } }; // lower_bound: equal or greater than // upper_bound: greater than // Remember "upper_bound is greater" int main() { unordered_map<string, ll> found; ll N; cin >> N; rep(i, N) { string s; cin >> s; sort(s.begin(), s.end()); if (found.find(s) != found.end()) { ++found[s]; } else { found.emplace(s, 1); } } //計算 ll sum = 0; for (auto fpr : found) { if (fpr.second >= 2) { sum += fpr.second * (fpr.second - 1) / 2; } } cout << sum << endl; }
[]
747,146
747,147
u554843701
cpp
p02947
#define _LIBCPP_DEBUG 0 #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = int(a); i < int(b); i++) typedef vector<int> vi; typedef long long ll; int main() { int n; ll ans = 0; cin >> n; string s; map<string, int> mp; rep(i, 0, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto ite = mp.begin(); ite != mp.end(); ite++) { auto cn = *ite; ans += cn.second * (cn.second - 1) / 2; } cout << ans << endl; }
#define _LIBCPP_DEBUG 0 #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = int(a); i < int(b); i++) typedef vector<int> vi; typedef long long ll; int main() { int n; ll ans = 0; cin >> n; string s; map<string, ll> mp; rep(i, 0, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto ite = mp.begin(); ite != mp.end(); ite++) { auto cn = *ite; ans += cn.second * (cn.second - 1) / 2; } cout << ans << endl; }
[]
747,148
747,149
u293156359
cpp
p02947
#define _LIBCPP_DEBUG 0 #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = int(a); i < int(b); i++) typedef vector<int> vi; typedef long long ll; int main() { int n, ans = 0; cin >> n; string s; map<string, int> mp; rep(i, 0, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto ite = mp.begin(); ite != mp.end(); ite++) { auto cn = *ite; ans += cn.second * (cn.second - 1) / 2; } cout << ans << endl; }
#define _LIBCPP_DEBUG 0 #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = int(a); i < int(b); i++) typedef vector<int> vi; typedef long long ll; int main() { int n; ll ans = 0; cin >> n; string s; map<string, ll> mp; rep(i, 0, n) { cin >> s; sort(s.begin(), s.end()); mp[s]++; } for (auto ite = mp.begin(); ite != mp.end(); ite++) { auto cn = *ite; ans += cn.second * (cn.second - 1) / 2; } cout << ans << endl; }
[]
747,150
747,149
u293156359
cpp
p02947
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < n; i++) #define mrep(p, mp) for (auto p : mp) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin >> n; map<string, ll> mp; rep(i, n) { string a; cin >> a; sort(a.begin(), a.end()); mp[a]++; } int sum = 0; mrep(p, mp) { sum += p.second * (p.second - 1) / 2; } cout << sum << endl; }
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < n; i++) #define mrep(p, mp) for (auto p : mp) using namespace std; using ll = long long; using P = pair<int, int>; int main() { ll n; cin >> n; map<string, ll> mp; rep(i, n) { string a; cin >> a; sort(a.begin(), a.end()); mp[a]++; } ll sum = 0; mrep(p, mp) { sum += p.second * (p.second - 1) / 2; } cout << sum << endl; }
[ "variable_declaration.type.change" ]
747,151
747,152
u383402878
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define mfill(x, y) memset(x, y, sizeof(x)) #define all(v) v.begin(), v.end() #define in(x, y, h, w) if (0 <= x && x < h && 0 <= y && y < w) #define y0 y12345 #define y1 y54321 #ifdef LOCAL #define debug(...) fprintf(stderr, __VA_ARGS__) #else #define debug(...) 42 #endif using ul = unsigned long; using ll = long long; using P = pair<int, int>; using vint = vector<int>; using vvint = vector<vector<int>>; using vll = vector<ll>; using vvll = vector<vector<ll>>; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template <class T> void initvv(vector<vector<T>> &v, int a, int b, const T &t = T()) { v.assign(a, vector<T>(b, t)); } template <class T> T gcd(T &a, T &b) { if (a < b) { swap(a, b); } T r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1}; vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1}; int main() { cin.tie(0); ios::sync_with_stdio(false); debug("debug test\n"); int n, m; cin >> n; vector<string> v; rep(i, n) { string s; cin >> s; vint num(10); rep(j, 10) { num[j] = s[j] - 'a'; } sort(all(num)); rep(j, 10) { s[j] = num[j] + 'a'; } // cout << s << endl; v.push_back(s); // cout << s << endl; // cout << sort(all(s)); } sort(all(v)); int streak = 0; ll ans = 0; string now = ""; rep(i, n) { // cout << v[i] << endl; if (v[i] != now) { ans += streak * (streak - 1) / 2; // COM(streak, 2); // cout << streak << endl; streak = 1; now = v[i]; } else { streak++; } } ans += streak * (streak - 1) / 2; // COM(streak, 2); cout << ans << endl; // cout << COM(3, 2) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define mfill(x, y) memset(x, y, sizeof(x)) #define all(v) v.begin(), v.end() #define in(x, y, h, w) if (0 <= x && x < h && 0 <= y && y < w) #define y0 y12345 #define y1 y54321 #ifdef LOCAL #define debug(...) fprintf(stderr, __VA_ARGS__) #else #define debug(...) 42 #endif using ul = unsigned long; using ll = long long; using P = pair<int, int>; using vint = vector<int>; using vvint = vector<vector<int>>; using vll = vector<ll>; using vvll = vector<vector<ll>>; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template <class T> void initvv(vector<vector<T>> &v, int a, int b, const T &t = T()) { v.assign(a, vector<T>(b, t)); } template <class T> T gcd(T &a, T &b) { if (a < b) { swap(a, b); } T r = a % b; while (r != 0) { a = b; b = r; r = a % b; } return b; } vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1}; vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1}; int main() { cin.tie(0); ios::sync_with_stdio(false); debug("debug test\n"); int n, m; cin >> n; vector<string> v; rep(i, n) { string s; cin >> s; vint num(10); rep(j, 10) { num[j] = s[j] - 'a'; } sort(all(num)); rep(j, 10) { s[j] = num[j] + 'a'; } // cout << s << endl; v.push_back(s); // cout << s << endl; // cout << sort(all(s)); } sort(all(v)); ll streak = 0; ll ans = 0; string now = ""; rep(i, n) { // cout << v[i] << endl; if (v[i] != now) { ans += streak * (streak - 1) / 2; // COM(streak, 2); // cout << streak << endl; streak = 1; now = v[i]; } else { streak++; } } ans += streak * (streak - 1) / 2; // COM(streak, 2); cout << ans << endl; // cout << COM(3, 2) << endl; return 0; }
[ "variable_declaration.type.change" ]
747,153
747,154
u398437835
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; string s[214514]; int main() { ll n; cin >> n; map<string, ll> mp; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); mp[s[i]]++; } sort(s, s + n); vector<string> v; for (int i = 1; i < n; i++) { if (s[i - 1] != s[i] && mp[s[i]] >= 2) v.push_back(s[i - 1]); } if (mp[s[n - 1]] >= 2) v.push_back(s[n - 1]); ll ans = 0; for (int i = 0; i < v.size(); i++) { ans += mp[v[i]] * (mp[v[i]] - 1) / 2; } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; string s[214514]; int main() { ll n; cin >> n; map<string, ll> mp; for (int i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(), s[i].end()); mp[s[i]]++; } sort(s, s + n); vector<string> v; for (int i = 1; i < n; i++) { if (s[i - 1] != s[i] && mp[s[i - 1]] >= 2) v.push_back(s[i - 1]); } if (mp[s[n - 1]] >= 2) v.push_back(s[n - 1]); ll ans = 0; for (int i = 0; i < v.size(); i++) { ans += mp[v[i]] * (mp[v[i]] - 1) / 2; } cout << ans; return 0; }
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
747,155
747,156
u774202056
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define endk '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; map<string, int> s; string entra; unsigned long long ans = 0; while (n--) { cin >> entra; sort(entra.begin(), entra.end()); if (s.count(entra)) s[entra]++; else s.insert({entra, 1}); } for (auto x : s) { // cout << "x.first " << x.first << "x.second " << x.second << endk; ans += (x.second * (x.second - 1)) / 2; } cout << ans << endk; return 0; }
#include <bits/stdc++.h> using namespace std; #define endk '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; map<string, long long> s; string entra; unsigned long long ans = 0; while (n--) { cin >> entra; sort(entra.begin(), entra.end()); if (s.count(entra)) s[entra]++; else s.insert({entra, 1}); } for (auto x : s) { // cout << "x.first " << x.first << "x.second " << x.second << endk; ans += (x.second * (x.second - 1)) / 2; } cout << ans << endk; return 0; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,157
747,158
u842789193
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define endk '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; unordered_map<string, int> s; string entra; unsigned long long ans = 0; while (n--) { cin >> entra; sort(entra.begin(), entra.end()); if (s.count(entra)) s[entra]++; else s.insert({entra, 1}); } for (auto x : s) { // cout << "x.first " << x.first << "x.second " << x.second << endk; ans += (x.second * (x.second - 1)) / 2; } cout << ans << endk; return 0; }
#include <bits/stdc++.h> using namespace std; #define endk '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; map<string, long long> s; string entra; unsigned long long ans = 0; while (n--) { cin >> entra; sort(entra.begin(), entra.end()); if (s.count(entra)) s[entra]++; else s.insert({entra, 1}); } for (auto x : s) { // cout << "x.first " << x.first << "x.second " << x.second << endk; ans += (x.second * (x.second - 1)) / 2; } cout << ans << endk; return 0; }
[ "variable_declaration.type.change", "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,159
747,158
u842789193
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define endk '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; unordered_map<string, int> s; string entra; unsigned long long ans = 0; while (n--) { cin >> entra; sort(entra.begin(), entra.end()); if (s.count(entra)) s[entra]++; else s.insert({entra, 0}); } for (auto x : s) { // cout << "x.first " << x.first << "x.second " << x.second << endk; ans += (x.second * (x.second + 1)) / 2; } cout << ans << endk; return 0; }
#include <bits/stdc++.h> using namespace std; #define endk '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; map<string, long long> s; string entra; unsigned long long ans = 0; while (n--) { cin >> entra; sort(entra.begin(), entra.end()); if (s.count(entra)) s[entra]++; else s.insert({entra, 1}); } for (auto x : s) { // cout << "x.first " << x.first << "x.second " << x.second << endk; ans += (x.second * (x.second - 1)) / 2; } cout << ans << endk; return 0; }
[ "variable_declaration.type.change", "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "literal.number.change", "call.arguments.change", "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
747,160
747,158
u842789193
cpp
p02947
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1e18 #define PI 3.14159265358979 using namespace std; ll power(ll n, ll k); ll inv(ll n); ll genfact(ll n, ll k); ll fact(ll n); ll nck(ll n, ll k); int main(void) { int n; cin >> n; map<string, int> m; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); m[s]++; } ll ret = 0; for (auto i = m.begin(); i != m.end(); i++) { ret += i->second * (i->second - 1) / 2; } cout << ret << endl; return 0; } ll power(ll n, ll k) { ll res = 1; while (k > 0) { if (k & 1) res = res * n % MOD; n = n * n % MOD; k >>= 1; } return res; } ll genfact(ll n, ll k) { ll res = 1; while (k >= 0) { res = (res * (n - k)) % MOD; k--; } return res; } ll inv(ll n) { return power(n, MOD - 2); } ll fact(ll n) { return genfact(n, n - 1); } ll nck(ll n, ll k) { if (k == 0) return 1; if (n <= 0) return 0; return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD; }
#include <bits/stdc++.h> #define ll long long int #define MOD 1000000007 #define INF 1e18 #define PI 3.14159265358979 using namespace std; ll power(ll n, ll k); ll inv(ll n); ll genfact(ll n, ll k); ll fact(ll n); ll nck(ll n, ll k); int main(void) { int n; cin >> n; map<string, ll> m; string s; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); m[s]++; } ll ret = 0; for (auto i = m.begin(); i != m.end(); i++) { ret += i->second * (i->second - 1) / 2; } cout << ret << endl; return 0; } ll power(ll n, ll k) { ll res = 1; while (k > 0) { if (k & 1) res = res * n % MOD; n = n * n % MOD; k >>= 1; } return res; } ll genfact(ll n, ll k) { ll res = 1; while (k >= 0) { res = (res * (n - k)) % MOD; k--; } return res; } ll inv(ll n) { return power(n, MOD - 2); } ll fact(ll n) { return genfact(n, n - 1); } ll nck(ll n, ll k) { if (k == 0) return 1; if (n <= 0) return 0; return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD; }
[]
747,161
747,162
u755121033
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long int ans = 0; int N; cin >> N; vector<string> s(N); map<string, int> p; for (int i = 0; i < N; i++) cin >> s[i]; for (int i = 0; i < N; i++) sort(s[i].begin(), s[i].end()); for (int i = 0; i < N; i++) { p[s[i]] += 1; } map<string, int> q; for (int i = 0; i < N; i++) { if (q[s[i]] == 0) { ans += (p[s[i]] - 1) * p[s[i]] / 2; q[s[i]] = 1; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int ans = 0; long int N; cin >> N; vector<string> s(N); map<string, long int> p; for (int i = 0; i < N; i++) cin >> s[i]; for (int i = 0; i < N; i++) sort(s[i].begin(), s[i].end()); for (int i = 0; i < N; i++) { p[s[i]] += 1; } map<string, int> q; for (int i = 0; i < N; i++) { if (q[s[i]] == 0) { ans = ans + (p[s[i]] - 1) * p[s[i]] / 2; q[s[i]] = 1; } } cout << ans; return 0; }
[ "variable_declaration.type.widen.change", "assignment.value.change", "assignment.change" ]
747,163
747,164
u109191542
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { long long int ans = 0; int N; cin >> N; vector<string> s(N); map<string, int> p; for (int i = 0; i < N; i++) cin >> s[i]; for (int i = 0; i < N; i++) sort(s[i].begin(), s[i].end()); for (int i = 0; i < N; i++) { p[s[i]] += 1; } map<string, int> q; for (int i = 0; i < N; i++) { if (q[s[i]] == 0) { ans += (p[s[i]] - 1) * p[s[i]] / 2; q[s[i]] = 1; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int ans = 0; long int N; cin >> N; vector<string> s(N); map<string, long int> p; for (int i = 0; i < N; i++) cin >> s[i]; for (int i = 0; i < N; i++) sort(s[i].begin(), s[i].end()); for (int i = 0; i < N; i++) { p[s[i]] += 1; } map<string, int> q; for (int i = 0; i < N; i++) { if (q[s[i]] == 0) { ans += ((p[s[i]] - 1) * p[s[i]]) / 2; q[s[i]] = 1; } } cout << ans; return 0; }
[ "variable_declaration.type.widen.change" ]
747,163
747,165
u109191542
cpp
p02947
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; int main() { int N, same_num; ull ans = 0; vector<string> vec; string si, prev_si; cin >> N; for (int i = 0; i < N; i++) { cin >> si; sort(si.begin(), si.end()); vec.push_back(si); } sort(vec.begin(), vec.end()); prev_si = vec[0]; same_num = 1; for (int i = 1; i < N; i++) { si = vec[i]; if (si == prev_si) same_num++; else if (same_num >= 2) { ans += same_num * (same_num - 1) / 2; same_num = 1; } prev_si = si; } if (same_num >= 2) ans += same_num * (same_num - 1) / 2; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; int main() { ull N, same_num; ull ans = 0; vector<string> vec; string si, prev_si; cin >> N; for (int i = 0; i < N; i++) { cin >> si; sort(si.begin(), si.end()); vec.push_back(si); } sort(vec.begin(), vec.end()); prev_si = vec[0]; same_num = 1; for (int i = 1; i < N; i++) { si = vec[i]; if (si == prev_si) same_num++; else if (same_num >= 2) { ans += same_num * (same_num - 1) / 2; same_num = 1; } prev_si = si; } if (same_num >= 2) ans += same_num * (same_num - 1) / 2; cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
747,166
747,167
u494249944
cpp
p02947
// _/ _/ _/_/_/ _/ //_/_/_/_/ _/_/ _/_/_/_/ _/_/ _/ _/_/ // _/ _/ _/ _/ _/ _/ _/_/_/ _/ //_/ _/ _/ _/ _/ _/ _/ _/ _/ // _/_/ _/_/ _/_/ _/_/ _/_/ _/ #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const double pi = 3.14159265358979323846; const int inf = 1e9; const ll INF = 1e18; int main() { cin.tie(0), cout.tie(0); ios::sync_with_stdio(false); int n, ans = 0; string s; map<string, int> m; cin >> n; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); ans += m[s]; m[s]++; } cout << ans << endl; }
// _/ _/ _/_/_/ _/ //_/_/_/_/ _/_/ _/_/_/_/ _/_/ _/ _/_/ // _/ _/ _/ _/ _/ _/ _/_/_/ _/ //_/ _/ _/ _/ _/ _/ _/ _/ _/ // _/_/ _/_/ _/_/ _/_/ _/_/ _/ #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const double pi = 3.14159265358979323846; const int inf = 1e9; const ll INF = 1e18; int main() { cin.tie(0), cout.tie(0); ios::sync_with_stdio(false); ll n, ans = 0; string s; map<string, int> m; cin >> n; for (int i = 0; i < n; i++) { cin >> s; sort(s.begin(), s.end()); ans += m[s]; m[s]++; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,168
747,169
u401900157
cpp
p02947
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll MOD = 1e9 + 7; #define vec vector<int> #define vecll vector<ll> #define vpair vector<pair<int, int>> #define vpairll vector<pair<ll, ll>> #define rep(i, n) for (int i = (int)0; i < (int)n; i++) #define REP(i, m, n) for (int i = (int)m; i < (int)n; i++) #define arr(var, n) \ vecll var(n); \ rep(i, n) { cin >> var[i]; } #define arrll(var, n) \ vecll var(n); \ rep(i, n) { cin >> var[i]; } #define all(var) (var).begin(), (var).end() #define sortall(var) sort(all(var)) #define prt(var) cout << var << endl #define prtd(n, var) cout << fixed << setprecision(n) << var << endl #define prt2(var1, var2) cout << var1 << " " << var2 << endl #define prseq(var, n) \ rep(i, n) { cout << var[i] << " "; } \ cout << endl #define prseql(var, n) \ rep(i, n) { cout << var[i] << " " << endl; } //---------------------------------------------------------------- int main(void) { int n; cin >> n; vector<string> s(n); rep(i, n) { string tmp; cin >> tmp; sort(all(tmp)); s[i] = tmp; } sort(all(s)); int num = 1; ll ans = 0; rep(i, n - 1) { if (s[i] == s[i + 1]) { num++; } else { ans += num * (num - 1) / 2; num = 1; } } ans += num * (num - 1) / 2; prt(ans); }
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll MOD = 1e9 + 7; #define vec vector<int> #define vecll vector<ll> #define vpair vector<pair<int, int>> #define vpairll vector<pair<ll, ll>> #define rep(i, n) for (int i = (int)0; i < (int)n; i++) #define REP(i, m, n) for (int i = (int)m; i < (int)n; i++) #define arr(var, n) \ vecll var(n); \ rep(i, n) { cin >> var[i]; } #define arrll(var, n) \ vecll var(n); \ rep(i, n) { cin >> var[i]; } #define all(var) (var).begin(), (var).end() #define sortall(var) sort(all(var)) #define prt(var) cout << var << endl #define prtd(n, var) cout << fixed << setprecision(n) << var << endl #define prt2(var1, var2) cout << var1 << " " << var2 << endl #define prseq(var, n) \ rep(i, n) { cout << var[i] << " "; } \ cout << endl #define prseql(var, n) \ rep(i, n) { cout << var[i] << " " << endl; } //---------------------------------------------------------------- int main(void) { int n; cin >> n; vector<string> s(n); rep(i, n) { string tmp; cin >> tmp; sort(all(tmp)); s[i] = tmp; } sort(all(s)); ll num = 1; ll ans = 0; rep(i, n - 1) { if (s[i] == s[i + 1]) { num++; } else { ans += num * (num - 1) / 2; num = 1; } } ans += num * (num - 1) / 2; prt(ans); }
[ "variable_declaration.type.change" ]
747,172
747,173
u929977034
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> v(N); for (int i = 0; i < N; i++) { cin >> v[i]; sort(v[i].begin(), v[i].end()); } sort(v.begin(), v.end()); int count = 1; long long sum = 0; for (int i = 1; i < N; i++) { if (v[i - 1] == v[i]) { count++; } else { sum += count * (count - 1) / 2; count = 1; } if (i == N - 1) { sum += count * (count - 1) / 2; } } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> v(N); for (int i = 0; i < N; i++) { cin >> v[i]; sort(v[i].begin(), v[i].end()); } sort(v.begin(), v.end()); long long count = 1; long long sum = 0; for (int i = 1; i < N; i++) { if (v[i - 1] == v[i]) { count++; } else { sum += count * (count - 1) / 2; count = 1; } if (i == N - 1) { sum += count * (count - 1) / 2; } } cout << sum << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,174
747,175
u275786410
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> v(N); for (int i = 0; i < N; i++) { cin >> v[i]; sort(v[i].begin(), v[i].end()); } sort(v.begin(), v.end()); int count = 1, sum = 0; for (int i = 1; i < N; i++) { if (v[i - 1] == v[i]) { count++; } else { sum += count * (count - 1) / 2; count = 1; } if (i == N - 1) { sum += count * (count - 1) / 2; } } cout << sum << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<string> v(N); for (int i = 0; i < N; i++) { cin >> v[i]; sort(v[i].begin(), v[i].end()); } sort(v.begin(), v.end()); long long count = 1; long long sum = 0; for (int i = 1; i < N; i++) { if (v[i - 1] == v[i]) { count++; } else { sum += count * (count - 1) / 2; count = 1; } if (i == N - 1) { sum += count * (count - 1) / 2; } } cout << sum << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,176
747,175
u275786410
cpp
p02947
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define INF 999999999 #define M_PI 3.14159265358979323846 #define ALL(X) (X).begin(), (X).end() #ifdef __LOCAL #define DBG(X) cout << #X << " = " << (X) << endl; #define SAY(X) cout << (X) << endl; #else #define DBG(X) #define SAY(X) #endif #ifdef __LOCAL #include <filesystem> namespace fs = std::filesystem; #endif using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; int dx[] = {1, 0, -1, 0, 0}; int dy[] = {0, 1, 0, -1, 0}; const int INT_INF = (int)(2e9); const ll LL_INF = (ll)(2e18); const int NIL = -1; static mt19937 _g(time(nullptr)); std::string pad(int num) { char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer; } inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); } inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }; template <typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); } template <typename T, typename S> inline ostream &operator<<(ostream &os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; } template <typename T, typename S> inline ostream &operator<<(ostream &os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << "," << el.second << "] "; return os; } template <typename T> inline ostream &operator<<(ostream &os, const vector<T> &v) { for (auto el : v) cout << el << " "; return os; } template <typename T> inline T fetch() { T ret; cin >> ret; return ret; } template <typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto &elem : ret) cin >> elem; return ret; } int N; vector<string> V; map<string, ll> C; int input() { #ifdef __LOCAL fs::path path_to_file = __FILE__; fs::path input, output; input = output = path_to_file.parent_path(); input += string("/input/") + string(path_to_file.stem()) + string(".txt"); output += string("/output/") + string(path_to_file.stem()) + string(".txt"); freopen(input.c_str(), "r", stdin); freopen(output.c_str(), "w", stdout); #endif cin >> N; V = fetch_vec<string>(N); REP(i, N) sort(V[i].begin(), V[i].end()); // VSORT(V) return 0; } int solve() { REP(i, N) C[V[i]]++; ll ans = 0; for (auto c : C) ans += (c.second - 1); cout << ans << endl; return 0; } int main() { input(); solve(); return 0; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORR(i, m, n) for (int i = m; i >= n; i--) #define SORT(v, n) sort(v, v + n); #define VSORT(v) sort(v.begin(), v.end()); #define INF 999999999 #define M_PI 3.14159265358979323846 #define ALL(X) (X).begin(), (X).end() #ifdef __LOCAL #define DBG(X) cout << #X << " = " << (X) << endl; #define SAY(X) cout << (X) << endl; #else #define DBG(X) #define SAY(X) #endif #ifdef __LOCAL #include <filesystem> namespace fs = std::filesystem; #endif using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; int dx[] = {1, 0, -1, 0, 0}; int dy[] = {0, 1, 0, -1, 0}; const int INT_INF = (int)(2e9); const ll LL_INF = (ll)(2e18); const int NIL = -1; static mt19937 _g(time(nullptr)); std::string pad(int num) { char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer; } inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); } inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }; template <typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); } template <typename T, typename S> inline ostream &operator<<(ostream &os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; } template <typename T, typename S> inline ostream &operator<<(ostream &os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << "," << el.second << "] "; return os; } template <typename T> inline ostream &operator<<(ostream &os, const vector<T> &v) { for (auto el : v) cout << el << " "; return os; } template <typename T> inline T fetch() { T ret; cin >> ret; return ret; } template <typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto &elem : ret) cin >> elem; return ret; } int N; vector<string> V; map<string, ll> C; int input() { #ifdef __LOCAL fs::path path_to_file = __FILE__; fs::path input, output; input = output = path_to_file.parent_path(); input += string("/input/") + string(path_to_file.stem()) + string(".txt"); output += string("/output/") + string(path_to_file.stem()) + string(".txt"); freopen(input.c_str(), "r", stdin); freopen(output.c_str(), "w", stdout); #endif cin >> N; V = fetch_vec<string>(N); REP(i, N) sort(V[i].begin(), V[i].end()); // VSORT(V) return 0; } int solve() { REP(i, N) C[V[i]]++; ll ans = 0; for (auto c : C) ans += c.second * (c.second - 1) / 2; cout << ans << endl; return 0; } int main() { input(); solve(); return 0; }
[ "assignment.change" ]
747,177
747,178
u858670323
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int64_t cnt = 0; map<string, int> b; set<string> a; for (int i = 0; i < n; i++) { string s; cin >> s; vector<char> t(10); for (int j = 0; j < 10; j++) t.at(j) = s.at(j); sort(t.begin(), t.end()); string r; for (int j = 0; j < 10; j++) r += t.at(j); if (!a.insert(r).second) b[r]++; } for (auto itr = b.begin(); itr != b.end(); itr++) { cnt += itr->second * (itr->second + 1) / 2; } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int64_t cnt = 0; map<string, int64_t> b; set<string> a; for (int i = 0; i < n; i++) { string s; cin >> s; vector<char> t(10); for (int j = 0; j < 10; j++) t.at(j) = s.at(j); sort(t.begin(), t.end()); string r; for (int j = 0; j < 10; j++) r += t.at(j); if (!a.insert(r).second) b[r]++; } for (auto itr = b.begin(); itr != b.end(); itr++) { cnt += itr->second * (itr->second + 1) / 2; } cout << cnt << endl; return 0; }
[ "variable_declaration.type.primitive.change" ]
747,181
747,182
u168860135
cpp
p02947
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int64_t cnt; map<string, int> b; set<string> a; for (int i = 0; i < n; i++) { string s; cin >> s; vector<char> t(10); for (int j = 0; j < 10; j++) t.at(j) = s.at(j); sort(t.begin(), t.end()); string r; for (int j = 0; j < 10; j++) r += t.at(j); if (!a.insert(r).second) b[r]++; } for (auto itr = b.begin(); itr != b.end(); itr++) { cnt += itr->second * (itr->second + 1) / 2; } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int64_t cnt = 0; map<string, int64_t> b; set<string> a; for (int i = 0; i < n; i++) { string s; cin >> s; vector<char> t(10); for (int j = 0; j < 10; j++) t.at(j) = s.at(j); sort(t.begin(), t.end()); string r; for (int j = 0; j < 10; j++) r += t.at(j); if (!a.insert(r).second) b[r]++; } for (auto itr = b.begin(); itr != b.end(); itr++) { cnt += itr->second * (itr->second + 1) / 2; } cout << cnt << endl; return 0; }
[ "variable_declaration.value.change", "variable_declaration.type.primitive.change" ]
747,183
747,182
u168860135
cpp
p02947
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; long long n, cntr = 0, ans = 0; string s[N], temp; vector<long long> v; int main() { cin >> n; for (int i = 0; i < n; ++i) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); temp = s[0]; cntr = 0; for (int i = 0; i < n; ++i) { if (s[i] != temp) { v.push_back(cntr); cntr = 0; temp = s[i]; } cntr++; } v.push_back(cntr); for (int i = 0; i < v.size(); ++i) { if (v[i] == 2) ans += 1; else if (v[i] == 3) ans += 3; else if (v[i] > 3) { ans += v[i] * (v[i] - 1); } // cout << v[i] << " " << ans << endl; } cout << ans << endl; // for(int i = 0 ; i < n ; ++i) cout << s[i] << " "; // puts(""); // for(int i = 0 ; i < v.size() ; ++i) cout << v[i] << " "; return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; long long n, cntr = 0, ans = 0; string s[N], temp; vector<long long> v; int main() { cin >> n; for (int i = 0; i < n; ++i) { cin >> s[i]; sort(s[i].begin(), s[i].end()); } sort(s, s + n); temp = s[0]; cntr = 0; for (int i = 0; i < n; ++i) { if (s[i] != temp) { v.push_back(cntr); cntr = 0; temp = s[i]; } cntr++; } v.push_back(cntr); for (int i = 0; i < v.size(); ++i) { if (v[i] == 2) ans += 1; else if (v[i] == 3) ans += 3; else if (v[i] > 3) { ans += v[i] * (v[i] - 1) / 2; } // cout << v[i] << " " << ans << endl; } cout << ans << endl; // for(int i = 0 ; i < n ; ++i) cout << s[i] << " "; // puts(""); // for(int i = 0 ; i < v.size() ; ++i) cout << v[i] << " "; return 0; }
[ "assignment.change" ]
747,184
747,185
u453901836
cpp
p02947
#include <bits/stdc++.h> using namespace std; map<string, int> mp = {}; signed main() { int n, ans = 0, a = 0; string t; cin >> n; for (int i = 0; i < n; i++) { cin >> t; for (int j = 0; j < t.size() - 1; j++) { for (int k = j + 1; k < t.size(); k++) { if (t[k] > t[j]) { swap(t[k], t[j]); } } } ans += mp[t]; mp[t]++; } cout << ans << endl; return (0); }
#include <bits/stdc++.h> using namespace std; map<string, int> mp = {}; signed main() { long long n, ans = 0, a = 0; string t; cin >> n; for (int i = 0; i < n; i++) { cin >> t; for (int j = 0; j < t.size() - 1; j++) { for (int k = j + 1; k < t.size(); k++) { if (t[k] > t[j]) { swap(t[k], t[j]); } } } ans += mp[t]; mp[t]++; } cout << ans << endl; return (0); }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,186
747,187
u899084195
cpp
p02947
#include <bits/stdc++.h> using namespace std; map<string, int> mp; signed main() { int n, ans = 0, a = 0; string t; cin >> n; for (int i = 0; i < n; i++) { cin >> t; for (int j = 0; j < t.size() - 1; j++) { for (int k = j + 1; k < t.size(); k++) { if (t[k] > t[j]) { swap(t[k], t[j]); } } } ans += mp[t]; mp[t]++; } cout << ans << endl; return (0); }
#include <bits/stdc++.h> using namespace std; map<string, int> mp = {}; signed main() { long long n, ans = 0, a = 0; string t; cin >> n; for (int i = 0; i < n; i++) { cin >> t; for (int j = 0; j < t.size() - 1; j++) { for (int k = j + 1; k < t.size(); k++) { if (t[k] > t[j]) { swap(t[k], t[j]); } } } ans += mp[t]; mp[t]++; } cout << ans << endl; return (0); }
[ "variable_declaration.value.change", "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,188
747,187
u899084195
cpp
p02947
#include <bits/stdc++.h> #include <stdlib.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; map<string, int> m; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); m[s] += 1; } int ans = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { int v = itr->second; ans += v * (v - 1) / 2; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #include <stdlib.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; map<string, ll> m; for (int i = 0; i < n; i++) { string s; cin >> s; sort(s.begin(), s.end()); m[s] += 1; } ll ans = 0; for (auto itr = m.begin(); itr != m.end(); itr++) { ll v = itr->second; ans += v * (v - 1) / 2; } cout << ans << endl; return 0; }
[ "variable_declaration.type.change" ]
747,189
747,190
u201553784
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) typedef long long ll; int main() { ll n; cin >> n; map<string, int> strs; ll ans = 0; rep(i, n) { string str; cin >> str; sort(str.begin(), str.end()); if (strs.find(str) == strs.end()) { strs[str] = 1; } else { strs[str]++; } } for (auto itr = strs.begin(); itr != strs.end(); ++itr) { int value = itr->second; ans += value * (value - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) typedef long long ll; int main() { ll n; cin >> n; map<string, int> strs; ll ans = 0; rep(i, n) { string str; cin >> str; sort(str.begin(), str.end()); if (strs.find(str) == strs.end()) { strs[str] = 1; } else { strs[str]++; } } for (auto itr = strs.begin(); itr != strs.end(); ++itr) { ll value = itr->second; ans += value * (value - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,191
747,192
u564182781
cpp
p02947
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) typedef long long ll; int main() { int n; cin >> n; map<string, int> strs; ll ans = 0; rep(i, n) { string str; cin >> str; sort(str.begin(), str.end()); if (strs.find(str) == strs.end()) { strs[str] = 1; } else { strs[str]++; } } for (auto itr = strs.begin(); itr != strs.end(); ++itr) { int value = itr->second; ans += value * (value - 1) / 2; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define sz(x) int(x.size()) typedef long long ll; int main() { ll n; cin >> n; map<string, int> strs; ll ans = 0; rep(i, n) { string str; cin >> str; sort(str.begin(), str.end()); if (strs.find(str) == strs.end()) { strs[str] = 1; } else { strs[str]++; } } for (auto itr = strs.begin(); itr != strs.end(); ++itr) { ll value = itr->second; ans += value * (value - 1) / 2; } cout << ans << endl; }
[ "variable_declaration.type.change" ]
747,193
747,192
u564182781
cpp
p02947
#include <bits/stdc++.h> using namespace std; long long com(int i) { return i * (i - 1) / 2; } 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()); } // cout << endl;for(int i = 0; i < N; i++){cout << s[i] << endl;} sort(s.begin(), s.end()); // cout << endl;for(int i = 0; i < N; i++){cout << s[i] << endl;} long long ans = 0; int cnt = 1; for (int i = 0; i < N - 1; i++) { if (s[i] == s[i + 1]) { cnt++; } else { ans += com(cnt); cnt = 1; } } ans += com(cnt); cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long long com(long long i) { return i * (i - 1) / 2; } 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()); } // cout << endl;for(int i = 0; i < N; i++){cout << s[i] << endl;} sort(s.begin(), s.end()); // cout << endl;for(int i = 0; i < N; i++){cout << s[i] << endl;} long long ans = 0; long long cnt = 1; for (int i = 0; i < N - 1; i++) { if (s[i] == s[i + 1]) { cnt++; } else { ans += com(cnt); cnt = 1; } } ans += com(cnt); cout << ans << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
747,198
747,199
u613931538
cpp
p02947
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 1e9 #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } // const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; // const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; ll C(int n) { return (n * (n - 1) / 2); } int main() { int n; cin >> n; string s; map<string, ll> m; ll ans = 0; for (int i = 0; i < n; i++) { cin >> s; sort(ALL(s)); m[s]++; } for (auto x : m) { ans += C(x.second); } cout << ans << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 1e9 #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } // const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; // const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; ll C(ll n) { return (n * (n - 1) / 2); } int main() { int n; cin >> n; string s; map<string, ll> m; ll ans = 0; for (int i = 0; i < n; i++) { cin >> s; sort(ALL(s)); m[s]++; } for (auto x : m) { ans += C(x.second); } cout << ans << endl; }
[]
747,202
747,203
u222509161
cpp
p02947
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 1e9 #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } // const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; // const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; ll C(int n) { return (n * (n - 1) / 2); } int main() { int n; cin >> n; string s; map<string, int> m; ll ans = 0; for (int i = 0; i < n; i++) { cin >> s; sort(ALL(s)); m[s]++; } for (auto x : m) { ans += C(x.second); } cout << ans << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define INF 1e9 #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); } // const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; // const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; ll C(ll n) { return (n * (n - 1) / 2); } int main() { int n; cin >> n; string s; map<string, ll> m; ll ans = 0; for (int i = 0; i < n; i++) { cin >> s; sort(ALL(s)); m[s]++; } for (auto x : m) { ans += C(x.second); } cout << ans << endl; }
[]
747,204
747,203
u222509161
cpp
p02947
#include <algorithm> #include <fstream> #include <iostream> #include <unordered_map> #include <vector> using namespace std; int main() { // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); int N; cin >> N; unordered_map<string, int> mp; int ans = 0; for (int i = 0; i < N; i++) { string S; cin >> S; sort(S.begin(), S.end()); // cout<<S<<endl; mp[S]++; } // for(auto p:mp){ // auto k = p.first; // auto t = p.second; // cout<<k<<','<<t<<endl; //} for (auto p : mp) { auto t = p.second; // cout<<t<<endl; int temp = 0; while (t > 0) { t -= 1; temp += t; } // cout<<"temp"<<temp<<endl; ans += temp; } cout << ans << endl; }
#include <algorithm> #include <fstream> #include <iostream> #include <unordered_map> #include <vector> using namespace std; int main() { // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); int N; cin >> N; unordered_map<string, long> mp; long ans = 0; for (int i = 0; i < N; i++) { string S; cin >> S; sort(S.begin(), S.end()); // cout<<S<<endl; mp[S]++; } // for(auto p:mp){ // auto k = p.first; // auto t = p.second; // cout<<k<<','<<t<<endl; //} for (auto p : mp) { auto t = p.second; // cout<<t<<endl; long temp = 0; while (t > 0) { t -= 1; temp += t; } // cout<<"temp"<<temp<<endl; ans += temp; } cout << ans << endl; }
[ "variable_declaration.type.primitive.change" ]
747,205
747,206
u845937249
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1LL << 60; #define tl 1'000'000'007 #define REP(i, n) for (ll i = 0; i < n; i++) #define REREP(i, n) for (ll i = n; i >= 0; i--) #define FOR(i, a, n) for (ll i = a; i < n; i++) #define REFOR(i, n, a) for (ll i = n; i >= a; i--) struct pref { int num, p, y; }; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector<string> A(n); map<string, int> B; REP(i, n) { cin >> A[i]; sort(A[i].begin(), A[i].end()); B[A[i]]++; } ll cnt = 0; for (auto x : B) { cnt += x.second * (x.second - 1) / 2; } cout << cnt << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1LL << 60; #define tl 1'000'000'007 #define REP(i, n) for (ll i = 0; i < n; i++) #define REREP(i, n) for (ll i = n; i >= 0; i--) #define FOR(i, a, n) for (ll i = a; i < n; i++) #define REFOR(i, n, a) for (ll i = n; i >= a; i--) struct pref { int num, p, y; }; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector<string> A(n); map<string, ll> B; REP(i, n) { cin >> A[i]; sort(A[i].begin(), A[i].end()); B[A[i]]++; } ll cnt = 0; for (auto x : B) { cnt += x.second * (x.second - 1) / 2; } cout << cnt << endl; }
[]
747,218
747,219
u852839243
cpp
p02947
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1LL << 60; #define REP(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, n) for (ll i = a; i < n; i++) int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<string> S(n); ll ans = 0; ll cnt = 1; REP(i, n) { cin >> S[i]; sort(S[i].begin(), S[i].end()); } sort(S.begin(), S.end()); REP(i, n) { if (i != 0) { if (S[i - 1] == S[i]) { cnt++; } else { ans += (cnt * (cnt - 1)) / 2; cnt = 1; } } } ans += (cnt * (cnt - 1)) / 2; if (ans >= 1000000000) { cout << 1000000000 << endl; } else { cout << ans << endl; } }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1LL << 60; #define REP(i, n) for (ll i = 0; i < n; i++) #define FOR(i, a, n) for (ll i = a; i < n; i++) int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<string> S(n); ll ans = 0; ll cnt = 1; REP(i, n) { cin >> S[i]; sort(S[i].begin(), S[i].end()); } sort(S.begin(), S.end()); REP(i, n) { if (i != 0) { if (S[i - 1] == S[i]) { cnt++; } else { ans += (cnt * (cnt - 1)) / 2; cnt = 1; } } } ans += (cnt * (cnt - 1)) / 2; if (ans >= 1000000000) { cout << ans << endl; } else { cout << ans << endl; } }
[ "identifier.replace.add", "literal.replace.remove", "io.output.change" ]
747,220
747,221
u852839243
cpp