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 rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int n;
string s[100005];
map<string, int> mp;
cin >> n;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
rep(i, n - 1) {
if (s[i] == s[i + 1])
mp[s[i]]++;
}
ll ans = 0;
for (auto m : mp) {
int v = m.second + 1;
ans += (v * (v - 1) / 2);
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int n;
string s[100005];
map<string, int> mp;
cin >> n;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
rep(i, n - 1) {
if (s[i] == s[i + 1])
mp[s[i]]++;
}
ll ans = 0;
for (auto m : mp) {
ll v = m.second + 1;
ans += (v * (v - 1) / 2);
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,198
| 746,199
|
u529722835
|
cpp
|
p02947
|
// Author: Fuadul Hasan(fuadul202@gmail.com)
// BSMRSTU,Gopalganj
#include <bits/stdc++.h>
using namespace std;
int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1) * 4
#define pb push_back
#define vpr vector<pr>
#define pr pair<int, int>
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(), n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ", tc++);
#define Unique(c) (c).resize(unique(all(c)) - (c).begin())
#define vout(v) \
for (auto z : v) \
cout << z << " "; \
cout << endl;
#define error(args...) \
{ \
vector<string> _v = split(#args, ','); \
err(_v.begin(), args); \
cout << endl; \
}
vector<string> split(const string &s, char c) {
vector<string> v;
stringstream ss(s);
string x;
while (getline(ss, x, c))
v.emplace_back(x);
return move(v);
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " ";
err(++it, args...);
}
const int M = 1e9 + 7;
const ll Inf = (ll)2e18 + 5;
const int N = 2e5 + 5;
ll vis[N], res[N];
int solve() {
// happy coding
int n;
cin >> n;
string s[n];
unordered_map<string, int> m;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(all(s[i]));
m[s[i]]++;
}
int cnt = 0;
for (auto i : m) {
cnt += ((i.S) * (i.S - 1)) / 2;
}
cout << cnt << endl;
return 0;
}
int main() {
int test = 1;
// scanf("%d", &test);
while (test--)
solve();
return 0;
}
|
// Author: Fuadul Hasan(fuadul202@gmail.com)
// BSMRSTU,Gopalganj
#include <bits/stdc++.h>
using namespace std;
int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1) * 4
#define pb push_back
#define vpr vector<pr>
#define pr pair<int, int>
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(), n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ", tc++);
#define Unique(c) (c).resize(unique(all(c)) - (c).begin())
#define vout(v) \
for (auto z : v) \
cout << z << " "; \
cout << endl;
#define error(args...) \
{ \
vector<string> _v = split(#args, ','); \
err(_v.begin(), args); \
cout << endl; \
}
vector<string> split(const string &s, char c) {
vector<string> v;
stringstream ss(s);
string x;
while (getline(ss, x, c))
v.emplace_back(x);
return move(v);
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " ";
err(++it, args...);
}
const int M = 1e9 + 7;
const ll Inf = (ll)2e18 + 5;
const int N = 2e5 + 5;
ll vis[N], res[N];
int solve() {
// happy coding
ll n;
cin >> n;
string s[n];
unordered_map<string, ll> m;
for (ll i = 0; i < n; i++) {
cin >> s[i];
sort(all(s[i]));
m[s[i]]++;
}
ll cnt = 0;
for (auto i : m) {
cnt += ((i.S) * (i.S - 1)) / 2;
}
cout << cnt << endl;
return 0;
}
int main() {
int test = 1;
// scanf("%d", &test);
while (test--)
solve();
return 0;
}
|
[
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 746,200
| 746,201
|
u526278960
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int resum(int64_t n) {
int64_t t = 0;
for (int64_t i = 1; i <= n; i++) {
t += i;
}
return t;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
}
map<string, long long> v;
for (int i = 0; i < n; i++) {
sort(s.at(i).begin(), s.at(i).end());
if (v.count(s.at(i))) {
v.at(s.at(i))++;
} else {
v.insert(make_pair(s.at(i), 0));
}
}
int64_t ans = 0;
for (map<string, long long>::iterator it = v.begin(); it != v.end(); it++) {
long long partial_sum = 0;
ans += it->second * (it->second - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int resum(int64_t n) {
int64_t t = 0;
for (int64_t i = 1; i <= n; i++) {
t += i;
}
return t;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
}
map<string, long long> v;
for (int i = 0; i < n; i++) {
sort(s.at(i).begin(), s.at(i).end());
if (v.count(s.at(i))) {
v.at(s.at(i))++;
} else {
v.insert(make_pair(s.at(i), 1));
}
}
int64_t ans = 0;
for (map<string, long long>::iterator it = v.begin(); it != v.end(); it++) {
long long partial_sum = 0;
ans += it->second * (it->second - 1) / 2;
}
cout << ans << endl;
}
|
[
"literal.number.change",
"call.arguments.change"
] | 746,202
| 746,203
|
u690326065
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;
#define REP(i, n) for (ll i = 0; i < n; i++)
//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
int main() {
std::cout << std::fixed << std::setprecision(10);
ll N;
cin >> N;
unordered_map<string, int> S;
REP(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
S[s]++;
}
ll count = 0;
for (auto i : S) {
if (i.second > 1) {
if (i.second % 2 == 0) {
count += (i.second / 2) * (i.second - 1);
} else {
count += (i.second * ((i.second - 1) / 2));
}
}
}
cout << count << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;
#define REP(i, n) for (ll i = 0; i < n; i++)
//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
int main() {
std::cout << std::fixed << std::setprecision(10);
ll N;
cin >> N;
unordered_map<string, ll> S;
REP(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
S[s]++;
}
ll count = 0;
for (auto i : S) {
if (i.second > 1) {
if (i.second % 2 == 0) {
count += (i.second / 2) * (i.second - 1);
} else {
count += (i.second * ((i.second - 1) / 2));
}
}
}
cout << count << endl;
}
|
[] | 746,211
| 746,212
|
u014854522
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
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); }
using P = pair<int, int>;
ll MOD = 1000000007;
ll INF = 1 << 29;
ll cnt(ll y) {
if (y == 1)
return 0;
return (y - 2) * (y + 1) / 2 + 1;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> mp;
for (string x : s) {
mp[x]++;
}
int ans = 0;
for (auto x : mp) {
ll t = x.second;
ans += cnt(t);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
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); }
using P = pair<int, int>;
ll MOD = 1000000007;
ll INF = 1 << 29;
ll cnt(ll y) {
if (y == 1)
return 0;
return (y - 2) * (y + 1) / 2 + 1;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> mp;
for (string x : s) {
mp[x]++;
}
ll ans = 0;
for (auto x : mp) {
ll t = x.second;
ans += cnt(t);
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,213
| 746,214
|
u937618939
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
string s[n + 1];
for (int i = 0; i < n; i++) {
cin >> s[i];
for (int j = 0; j < 10; j++) {
for (int k = 9; k >= j; k--) {
if (s[i][k] < s[i][k - 1]) {
char a;
a = s[i][k];
s[i][k] = s[i][k - 1];
s[i][k - 1] = a;
}
}
}
}
sort(s, s + n);
int c = 1;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
c++;
} else {
if (c != 1)
ans += c * (c - 1) / 2;
c = 1;
}
}
ans += c * (c - 1) / 2;
cout << ans << endl;
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
string s[n + 1];
for (int i = 0; i < n; i++) {
cin >> s[i];
for (int j = 0; j < 10; j++) {
for (int k = 9; k >= j; k--) {
if (s[i][k] < s[i][k - 1]) {
char a;
a = s[i][k];
s[i][k] = s[i][k - 1];
s[i][k - 1] = a;
}
}
}
}
sort(s, s + n);
long long c = 1;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
c++;
} else {
if (c != 1)
ans += c * (c - 1) / 2;
c = 1;
}
}
ans += c * (c - 1) / 2;
cout << ans << endl;
return (0);
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,221
| 746,222
|
u490965711
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
string s[n + 1];
for (int i = 0; i < n; i++) {
cin >> s[i];
for (int j = 0; j < 10; j++) {
for (int k = 9; k > j; k--) {
if (s[i][k] < s[i][k - 1]) {
char a;
a = s[i][k];
s[i][k] = s[i][k - 1];
s[i][k - 1] = a;
}
}
}
}
sort(s, s + n);
int c = 1;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
c++;
} else {
if (c != 1)
ans += c * (c - 1) / 2;
c = 1;
}
}
ans += c * (c - 1) / 2;
cout << ans << endl;
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
string s[n + 1];
for (int i = 0; i < n; i++) {
cin >> s[i];
for (int j = 0; j < 10; j++) {
for (int k = 9; k >= j; k--) {
if (s[i][k] < s[i][k - 1]) {
char a;
a = s[i][k];
s[i][k] = s[i][k - 1];
s[i][k - 1] = a;
}
}
}
}
sort(s, s + n);
long long c = 1;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
c++;
} else {
if (c != 1)
ans += c * (c - 1) / 2;
c = 1;
}
}
ans += c * (c - 1) / 2;
cout << ans << endl;
return (0);
}
|
[
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,223
| 746,222
|
u490965711
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
string s[n + 1];
for (int i = 0; i < n; i++) {
cin >> s[i];
for (int j = 0; j < 10; j++) {
for (int k = 10; k > j; k--) {
if (s[i][k] < s[i][k - 1]) {
char a;
a = s[i][k];
s[i][k] = s[i][k - 1];
s[i][k - 1] = a;
}
}
}
}
sort(s, s + n);
int c = 1;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
c++;
} else {
if (c != 1)
ans += c * (c - 1) / 2;
c = 1;
}
}
ans += c * (c - 1) / 2;
cout << ans << endl;
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
string s[n + 1];
for (int i = 0; i < n; i++) {
cin >> s[i];
for (int j = 0; j < 10; j++) {
for (int k = 9; k >= j; k--) {
if (s[i][k] < s[i][k - 1]) {
char a;
a = s[i][k];
s[i][k] = s[i][k - 1];
s[i][k - 1] = a;
}
}
}
}
sort(s, s + n);
long long c = 1;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
c++;
} else {
if (c != 1)
ans += c * (c - 1) / 2;
c = 1;
}
}
ans += c * (c - 1) / 2;
cout << ans << endl;
return (0);
}
|
[
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,224
| 746,222
|
u490965711
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int u = p.second;
ans += u * (u - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int u = p.second;
ans += (long long)u * (u - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,226
| 746,227
|
u834753207
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
using namespace std;
void solve(long N, vector<string> s) {
unordered_map<string, int> count;
REP(i, N) {
string si = s[i];
sort(si.begin(), si.end());
count[si]++;
}
long ans(0);
for (const auto &kv : count) {
int v = kv.second;
if (v < 2)
continue;
ans += v * (v - 1) / 2;
}
cout << ans << endl;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long N;
cin >> N;
vector<string> s(N);
REP(i, N)
cin >> s[i];
solve(N, move(s));
return 0;
}
|
#include <bits/stdc++.h>
#define REP(i, n) for (long i = 0; i < n; ++i)
using namespace std;
void solve(long N, vector<string> s) {
unordered_map<string, long> count;
REP(i, N) {
string si = s[i];
sort(si.begin(), si.end());
count[si]++;
}
long ans(0);
for (const auto &kv : count) {
long v = kv.second;
if (v < 2)
continue;
ans += v * (v - 1) / 2;
}
cout << ans << endl;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long N;
cin >> N;
vector<string> s(N);
REP(i, N)
cin >> s[i];
solve(N, move(s));
return 0;
}
|
[
"preprocessor.define.value.change",
"variable_declaration.type.primitive.change"
] | 746,229
| 746,230
|
u280941196
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
ll n;
cin >> n;
vector<string> S(n);
rep(i, n) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
}
sort(S.begin(), S.end());
ll ans = 0, kotae = 0;
rep(i, n - 1) {
if (S[i] == S[i + 1]) {
kotae++;
ans += kotae;
} else {
kotae = 0;
}
}
cout << kotae << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
ll n;
cin >> n;
vector<string> S(n);
rep(i, n) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
}
sort(S.begin(), S.end());
ll ans = 0, kotae = 0;
rep(i, n - 1) {
if (S[i] == S[i + 1]) {
kotae++;
ans += kotae;
} else {
kotae = 0;
}
}
cout << ans << endl;
}
|
[
"identifier.change",
"io.output.change"
] | 746,231
| 746,232
|
u553123421
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin >> n;
map<string, ll> s;
rep(i, n) {
string S;
cin >> S;
sort(S.begin(), S.end());
s[S]++;
}
ll ans = 0;
for (auto x : s) {
if (x.second != 1) {
ans += x.second * (x.second) / 2;
}
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin >> n;
map<string, ll> s;
rep(i, n) {
string S;
cin >> S;
sort(S.begin(), S.end());
s[S]++;
}
ll ans = 0;
for (auto x : s) {
if (x.second != 1) {
ans += x.second * (x.second - 1) / 2;
}
}
cout << ans << endl;
}
|
[
"assignment.change"
] | 746,233
| 746,234
|
u692550512
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
cin >> n;
vector<map<char, int>> ana(n);
map<map<char, int>, int> koromo;
rep(i, n) {
string s;
cin >> s;
rep(j, 10) { ana[i][s[j]]++; }
koromo[ana[i]]++;
}
ll ans = 0;
for (auto x : koromo) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
ll n;
cin >> n;
vector<map<char, ll>> ana(n);
map<map<char, ll>, ll> koromo;
rep(i, n) {
string s;
cin >> s;
rep(j, 10) { ana[i][s[j]]++; }
koromo[ana[i]]++;
}
ll ans = 0;
for (auto x : koromo) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,235
| 746,236
|
u692550512
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
ll N = 0;
map<string, int> mp;
cin >> N;
rep(i, N) {
string S;
cin >> S;
sort(S.begin(), S.end());
mp[S]++;
}
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
ll N = 0;
map<string, ll> mp;
cin >> N;
rep(i, N) {
string S;
cin >> S;
sort(S.begin(), S.end());
mp[S]++;
}
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans;
}
|
[] | 746,237
| 746,238
|
u213375012
|
cpp
|
p02947
|
#include <bits/stdc++.h>
// DEEP
using namespace std;
#define boost \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define fwd(i, a, n) for (int i = a; i <= n; i++)
#define bak(i, a, n) for (int i = a; i >= n; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
ull power(ull x, ull y) {
if (y == 0)
return 1;
else {
if (y % 2 == 0)
return power(x * x, y / 2);
else
return x * power(x * x, (y - 1) / 2);
}
}
ull gcd(ull x, ull y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
int main() {
boost;
int TESTS = 1;
// cin>>TESTS;
while (TESTS--) {
ll n;
cin >> n;
map<string, int> M;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
M[s] += 1;
}
map<string, int>::iterator ip = M.begin();
ull ans = 0;
for (ip; ip != M.end(); ip++) {
if (ip->second >= 2)
ans += (ip->second) * (ip->second - 1) / 2;
}
cout << ans << endl;
}
}
/* Be careful about integer ranges;
Check the corner cases before submitting.
*/
|
#include <bits/stdc++.h>
// DEEP
using namespace std;
#define boost \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define fwd(i, a, n) for (int i = a; i <= n; i++)
#define bak(i, a, n) for (int i = a; i >= n; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
ull power(ull x, ull y) {
if (y == 0)
return 1;
else {
if (y % 2 == 0)
return power(x * x, y / 2);
else
return x * power(x * x, (y - 1) / 2);
}
}
ull gcd(ull x, ull y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
int main() {
boost;
int TESTS = 1;
// cin>>TESTS;
while (TESTS--) {
ll n;
cin >> n;
map<string, ull> M;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
M[s] += 1;
}
map<string, ull>::iterator ip = M.begin();
ll ans = 0;
for (ip; ip != M.end(); ip++) {
if (ip->second >= 2)
ans += (ip->second) * (ip->second - 1) / 2;
}
cout << ans << endl;
}
}
/* Be careful about integer ranges;
Check the corner cases before submitting.
*/
|
[
"variable_declaration.type.change"
] | 746,239
| 746,240
|
u915716225
|
cpp
|
p02947
|
#include <bits/stdc++.h>
// DEEP
using namespace std;
#define boost \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define fwd(i, a, n) for (int i = a; i <= n; i++)
#define bak(i, a, n) for (int i = a; i >= n; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
ull power(ull x, ull y) {
if (y == 0)
return 1;
else {
if (y % 2 == 0)
return power(x * x, y / 2);
else
return x * power(x * x, (y - 1) / 2);
}
}
ull gcd(ull x, ull y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
int main() {
boost;
int TESTS = 1;
// cin>>TESTS;
while (TESTS--) {
ll n;
cin >> n;
map<string, int> M;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
M[s] += 1;
}
map<string, int>::iterator ip = M.begin();
ll ans = 0;
for (ip; ip != M.end(); ip++) {
if (ip->second >= 2)
ans += (ip->second) * (ip->second - 1) / 2;
}
cout << ans << endl;
}
}
/* Be careful about integer ranges;
Check the corner cases before submitting.
*/
|
#include <bits/stdc++.h>
// DEEP
using namespace std;
#define boost \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define fwd(i, a, n) for (int i = a; i <= n; i++)
#define bak(i, a, n) for (int i = a; i >= n; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
ull power(ull x, ull y) {
if (y == 0)
return 1;
else {
if (y % 2 == 0)
return power(x * x, y / 2);
else
return x * power(x * x, (y - 1) / 2);
}
}
ull gcd(ull x, ull y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
int main() {
boost;
int TESTS = 1;
// cin>>TESTS;
while (TESTS--) {
ll n;
cin >> n;
map<string, ull> M;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
M[s] += 1;
}
map<string, ull>::iterator ip = M.begin();
ll ans = 0;
for (ip; ip != M.end(); ip++) {
if (ip->second >= 2)
ans += (ip->second) * (ip->second - 1) / 2;
}
cout << ans << endl;
}
}
/* Be careful about integer ranges;
Check the corner cases before submitting.
*/
|
[] | 746,241
| 746,240
|
u915716225
|
cpp
|
p02947
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cstring>
#include <deque> // deque
#include <float.h>
#include <iostream> // cout, endl, cin
#include <map> // map
#include <math.h>
#include <numeric>
#include <queue> // queue, priority_queue
#include <set> // set
#include <sstream>
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;
int ctoi(char c) {
switch (c) {
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8;
case '9':
return 9;
default:
return 0;
}
}
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
map<string, int> mp;
string x;
rep(i, N) {
sort(s[i].begin(), s[i].end());
x = s[i];
if (!mp.count(x)) {
mp[x] = 0;
} else {
mp[x] = mp[x] + 1;
}
}
int64_t cnt = 0;
for (auto p : mp) {
cnt += (p.second + 1) * p.second / 2;
}
cout << cnt << endl;
}
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cstring>
#include <deque> // deque
#include <float.h>
#include <iostream> // cout, endl, cin
#include <map> // map
#include <math.h>
#include <numeric>
#include <queue> // queue, priority_queue
#include <set> // set
#include <sstream>
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;
int ctoi(char c) {
switch (c) {
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8;
case '9':
return 9;
default:
return 0;
}
}
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
map<string, ll> mp;
string x;
rep(i, N) {
sort(s[i].begin(), s[i].end());
x = s[i];
if (!mp.count(x)) {
mp[x] = 0;
} else {
mp[x] = mp[x] + 1;
}
}
ll cnt = 0;
for (auto p : mp) {
cnt += (p.second + 1) * p.second / 2;
}
cout << cnt << endl;
}
|
[
"variable_declaration.type.change"
] | 746,242
| 746,243
|
u830770242
|
cpp
|
p02947
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cstring>
#include <deque> // deque
#include <float.h>
#include <iostream> // cout, endl, cin
#include <map> // map
#include <math.h>
#include <numeric>
#include <queue> // queue, priority_queue
#include <set> // set
#include <sstream>
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;
int ctoi(char c) {
switch (c) {
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8;
case '9':
return 9;
default:
return 0;
}
}
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
map<string, int> mp;
string x;
rep(i, N) {
sort(s[i].begin(), s[i].end());
x = s[i];
if (!mp.count(x)) {
mp[x] = 0;
} else {
mp[x] = mp[x] + 1;
}
}
ll cnt = 0;
for (auto p : mp) {
cnt += (p.second + 1) * p.second / 2;
}
cout << cnt << endl;
}
|
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cstring>
#include <deque> // deque
#include <float.h>
#include <iostream> // cout, endl, cin
#include <map> // map
#include <math.h>
#include <numeric>
#include <queue> // queue, priority_queue
#include <set> // set
#include <sstream>
#include <stack> // stack
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;
int ctoi(char c) {
switch (c) {
case '0':
return 0;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8;
case '9':
return 9;
default:
return 0;
}
}
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
map<string, ll> mp;
string x;
rep(i, N) {
sort(s[i].begin(), s[i].end());
x = s[i];
if (!mp.count(x)) {
mp[x] = 0;
} else {
mp[x] = mp[x] + 1;
}
}
ll cnt = 0;
for (auto p : mp) {
cnt += (p.second + 1) * p.second / 2;
}
cout << cnt << endl;
}
|
[] | 746,244
| 746,243
|
u830770242
|
cpp
|
p02947
|
// Green Bin
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, x, y) for (ll i = x; i < y; i++)
#define irep(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n, a) \
ll n; \
cin >> n; \
vector<ll> a(n); \
rep(i, 0, n) cin >> a[i]
#define vecrep(n, name, type) \
vector<type> name(n); \
rep(i, 0, n) cin >> name[i]
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a / __gcd(a, b) * b)
#define range(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n", a)
template <class T> inline bool chmin(T &a, T b, bool f) {
if (f == 1) {
if (a > b) {
a = b;
return true;
}
return false;
} else if (f == 0) {
if (a < b) {
a = b;
return true;
}
return false;
}
return false;
}
typedef pair<ll, string> p;
using g = vector<vector<ll>>;
const int inf = 2147483647; // 2*10^9
const ll INF = 9223372036854775807; // 9*10^18
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, 0, n) {
string t;
cin >> t;
sort(range(t));
s[i] = t;
}
sort(range(s));
map<int, int> m{};
m[0]++;
int c = 0;
ll ans = 0;
rep(i, 1, n) {
if (s[i] != s[i - 1]) {
c++;
}
m[c]++;
}
irep(i, m) {
if (i->second > 1)
ans += (i->second) * (i->second - 1) / 2;
}
cout << ans << nnn;
return 0;
}
|
// Green Bin
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, x, y) for (ll i = x; i < y; i++)
#define irep(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n, a) \
ll n; \
cin >> n; \
vector<ll> a(n); \
rep(i, 0, n) cin >> a[i]
#define vecrep(n, name, type) \
vector<type> name(n); \
rep(i, 0, n) cin >> name[i]
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a / __gcd(a, b) * b)
#define range(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n", a)
template <class T> inline bool chmin(T &a, T b, bool f) {
if (f == 1) {
if (a > b) {
a = b;
return true;
}
return false;
} else if (f == 0) {
if (a < b) {
a = b;
return true;
}
return false;
}
return false;
}
typedef pair<ll, string> p;
using g = vector<vector<ll>>;
const int inf = 2147483647; // 2*10^9
const ll INF = 9223372036854775807; // 9*10^18
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, 0, n) {
string t;
cin >> t;
sort(range(t));
s[i] = t;
}
sort(range(s));
map<ll, ll> m{};
m[0]++;
ll c = 0;
ll ans = 0;
rep(i, 1, n) {
if (s[i] != s[i - 1]) {
c++;
}
m[c]++;
}
irep(i, m) {
if (i->second > 1)
ans += (i->second) * (i->second - 1) / 2;
}
cout << ans << nnn;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,245
| 746,246
|
u663842230
|
cpp
|
p02947
|
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン1
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン2
// cout << fixed << setprecision(10);
// cout << ma << endl;
/*01 02 03 12 13 23 と6回見ていくパターン
for(int i=0;i<n-1;i++){
for(int j=i+1;j<n;j++){
}
}
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
// int64_t a;
// 10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
cin >> s;
rep(i,s.size()-2) {
int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
int mx = 0;
string s;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
int64_t sum = 0;
for (auto p : m) {
if (p.second >= 2) {
sum += (p.second - 1) * p.second * 0.5;
}
}
cout << sum << endl;
}
|
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン1
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン2
// cout << fixed << setprecision(10);
// cout << ma << endl;
/*01 02 03 12 13 23 と6回見ていくパターン
for(int i=0;i<n-1;i++){
for(int j=i+1;j<n;j++){
}
}
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
// int64_t a;
// 10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
cin >> s;
rep(i,s.size()-2) {
int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int n;
int mx = 0;
string s;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
int64_t sum = 0;
for (auto p : m) {
if (p.second >= 2) {
sum += (int64_t)(p.second - 1) * p.second * 0.5;
}
}
cout << sum << endl;
}
|
[
"type_conversion.add"
] | 746,249
| 746,250
|
u037563046
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint, vector<llint>, greater<llint>> que;
priority_queue<llint> Que;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
void solve() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto &p : mp) {
int x = p.second;
ans += (x * (x - 1)) / 2;
}
cout << ans << endl;
}
int main() {
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint, vector<llint>, greater<llint>> que;
priority_queue<llint> Que;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
void solve() {
int n;
cin >> n;
map<string, llint> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
llint ans = 0;
for (auto &p : mp) {
llint x = p.second;
ans += x * (x - 1) / 2;
}
cout << ans << endl;
}
int main() {
solve();
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,253
| 746,254
|
u332253305
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template <typename T, typename U> T pow_(T a, U b) {
return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1;
}
ll modpow(ll a, ll b, ll _mod) {
return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << p.F << " " << p.S;
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) {
rep(i, sz(vec)) {
if (i)
os << " ";
os << vec[i];
}
return os;
}
template <typename T> inline istream &operator>>(istream &is, vector<T> &v) {
rep(j, sz(v)) is >> v[j];
return is;
}
template <class T, class T2> inline void add(T &a, T2 b) {
a += b;
if (a >= mod)
a -= mod;
}
template <class T> void operator+=(vector<T> &v, vector<T> v2) {
rep(i, sz(v2)) v.eb(v2[i]);
}
void solve();
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed << setprecision(11);
int T;
T = 1;
while (T--)
solve();
}
void solve() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto e : mp)
ans += e.S * (e.S - 1) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
ll gcd(ll a, ll b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template <typename T, typename U> T pow_(T a, U b) {
return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1;
}
ll modpow(ll a, ll b, ll _mod) {
return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << p.F << " " << p.S;
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &vec) {
rep(i, sz(vec)) {
if (i)
os << " ";
os << vec[i];
}
return os;
}
template <typename T> inline istream &operator>>(istream &is, vector<T> &v) {
rep(j, sz(v)) is >> v[j];
return is;
}
template <class T, class T2> inline void add(T &a, T2 b) {
a += b;
if (a >= mod)
a -= mod;
}
template <class T> void operator+=(vector<T> &v, vector<T> v2) {
rep(i, sz(v2)) v.eb(v2[i]);
}
void solve();
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed << setprecision(11);
int T;
T = 1;
while (T--)
solve();
}
void solve() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto e : mp)
ans += 1LL * e.S * (e.S - 1) / 2;
cout << ans << endl;
}
|
[
"assignment.change"
] | 746,255
| 746,256
|
u277556971
|
cpp
|
p02947
|
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID * 2) + 1)
#define R(ID) ((ID * 2) + 2)
#define M(L, R) ((L + R) / 2)
#define forr(start, end) for (int i = start; i < end; i++)
#define gap ' '
const int MAXN = 1e5 + 5;
int k[MAXN];
int largest(int a, int b) { return (a < b) ? b : a; }
int main() {
int n = 0;
cin >> n;
int ans = 0;
string s;
map<string, ll> mymap;
for (int i = 0; i < n; ++i) {
cin >> s;
sort(s.begin(), s.end());
mymap[s]++;
ans += mymap[s] - 1;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID * 2) + 1)
#define R(ID) ((ID * 2) + 2)
#define M(L, R) ((L + R) / 2)
#define forr(start, end) for (int i = start; i < end; i++)
#define gap ' '
const int MAXN = 1e5 + 5;
int k[MAXN];
int largest(int a, int b) { return (a < b) ? b : a; }
int main() {
int n = 0;
cin >> n;
ll ans = 0;
string s;
map<string, ll> mymap;
for (int i = 0; i < n; ++i) {
cin >> s;
sort(s.begin(), s.end());
mymap[s]++;
ans += mymap[s] - 1;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,257
| 746,258
|
u577511087
|
cpp
|
p02947
|
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID * 2) + 1)
#define R(ID) ((ID * 2) + 2)
#define M(L, R) ((L + R) / 2)
#define forr(start, end) for (int i = start; i < end; i++)
#define gap ' '
const int MAXN = 1e5 + 5;
int k[MAXN];
int largest(int a, int b) { return (a < b) ? b : a; }
int main() {
int n = 0;
cin >> n;
int ans = 0;
string s;
map<string, int> mymap;
for (int i = 0; i < n; ++i) {
cin >> s;
sort(s.begin(), s.end());
mymap[s]++;
ans += mymap[s] - 1;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID * 2) + 1)
#define R(ID) ((ID * 2) + 2)
#define M(L, R) ((L + R) / 2)
#define forr(start, end) for (int i = start; i < end; i++)
#define gap ' '
const int MAXN = 1e5 + 5;
int k[MAXN];
int largest(int a, int b) { return (a < b) ? b : a; }
int main() {
int n = 0;
cin >> n;
ll ans = 0;
string s;
map<string, ll> mymap;
for (int i = 0; i < n; ++i) {
cin >> s;
sort(s.begin(), s.end());
mymap[s]++;
ans += mymap[s] - 1;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,259
| 746,258
|
u577511087
|
cpp
|
p02947
|
//#include<bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vii;
const double pi = 2 * acos(0);
#define pf printf
#define sf scanf
#define pb(a) push_back(a)
#define mp make_pair
#define fi first
#define se second
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define forab(i, a, b) for (int i = a; i <= b; i++)
#define lcm(a, b) ((a) * ((b) / gcd(a, b)))
#define sq(a) (a) * (a)
#define nw "\n"
#define abs(x) fabs(x)
#define pcase(z, x) cout << "Case " << z << ": " << x << "\n"
int main() {
int i, j, n, c = 0;
cin >> n;
map<string, int> m;
for0(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
c += m[s] - 1;
}
cout << c << nw;
return 0;
}
|
//#include<bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vii;
const double pi = 2 * acos(0);
#define pf printf
#define sf scanf
#define pb(a) push_back(a)
#define mp make_pair
#define fi first
#define se second
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define forab(i, a, b) for (int i = a; i <= b; i++)
#define lcm(a, b) ((a) * ((b) / gcd(a, b)))
#define sq(a) (a) * (a)
#define nw "\n"
#define abs(x) fabs(x)
#define pcase(z, x) cout << "Case " << z << ": " << x << "\n"
int main() {
ll i, n, c = 0;
cin >> n;
map<string, ll> m;
for0(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
c += m[s] - 1;
}
cout << c << nw;
return 0;
}
|
[
"variable_declaration.type.change",
"variable_declaration.remove"
] | 746,260
| 746,261
|
u339430228
|
cpp
|
p02947
|
//#include<bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vii;
const double pi = 2 * acos(0);
#define pf printf
#define sf scanf
#define pb(a) push_back(a)
#define mp make_pair
#define fi first
#define se second
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define forab(i, a, b) for (int i = a; i <= b; i++)
#define lcm(a, b) ((a) * ((b) / gcd(a, b)))
#define sq(a) (a) * (a)
#define nw "\n"
#define abs(x) fabs(x)
#define pcase(z, x) cout << "Case " << z << ": " << x << "\n"
int main() {
int i, j, n, x;
cin >> n;
map<string, int> m;
for0(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll c = 0;
for (auto it : m) {
x = it.se;
c += (x * (x - 1)) / 2;
}
cout << c << nw;
return 0;
}
|
//#include<bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vii;
const double pi = 2 * acos(0);
#define pf printf
#define sf scanf
#define pb(a) push_back(a)
#define mp make_pair
#define fi first
#define se second
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define forab(i, a, b) for (int i = a; i <= b; i++)
#define lcm(a, b) ((a) * ((b) / gcd(a, b)))
#define sq(a) (a) * (a)
#define nw "\n"
#define abs(x) fabs(x)
#define pcase(z, x) cout << "Case " << z << ": " << x << "\n"
int main() {
ll i, n, x;
cin >> n;
map<string, ll> m;
for0(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll c = 0;
for (auto it : m) {
x = it.se;
c += (x * (x - 1)) / 2;
}
cout << c << nw;
return 0;
}
|
[
"variable_declaration.type.change",
"variable_declaration.remove"
] | 746,262
| 746,263
|
u339430228
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int Ans = 0;
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());
int64_t now = 0;
for (int i = 0; i < N; i++) {
if (i == 0) {
now++;
} else if (S.at(i) == S.at(i - 1)) {
now++;
} else {
Ans += now * (now - 1) / 2;
now = 1;
}
}
Ans += now * (now - 1) / 2;
cout << Ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int64_t Ans = 0;
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());
int64_t now = 0;
for (int i = 0; i < N; i++) {
if (i == 0) {
now++;
} else if (S.at(i) == S.at(i - 1)) {
now++;
} else {
Ans += now * (now - 1) / 2;
now = 1;
}
}
Ans += now * (now - 1) / 2;
cout << Ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,264
| 746,265
|
u164730704
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int Ans = 0;
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());
int now = 0;
for (int i = 0; i < N; i++) {
if (i == 0) {
now++;
} else if (S.at(i) == S.at(i - 1)) {
now++;
} else {
Ans += now * (now - 1) / 2;
now = 1;
}
}
Ans += now * (now - 1) / 2;
cout << Ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int64_t Ans = 0;
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());
int64_t now = 0;
for (int i = 0; i < N; i++) {
if (i == 0) {
now++;
} else if (S.at(i) == S.at(i - 1)) {
now++;
} else {
Ans += now * (now - 1) / 2;
now = 1;
}
}
Ans += now * (now - 1) / 2;
cout << Ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,266
| 746,265
|
u164730704
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000 // 1E+12
// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;
using namespace std;
// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cout << H << " ";
debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
// typedef
typedef long long ll;
typedef unsigned long long ul;
// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int 最大値2147483647 〜2E+9
// long long 最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
int main() {
// faster
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin >> n;
map<string, int> d;
rep(i, n) {
string temp;
cin >> temp;
sort(ALL(temp));
if (d.count(temp) == 0)
d[temp] = 0;
d[temp]++;
}
ll res = 0;
for (pair<string, int> i : d) {
int temp = i.second;
res += temp * (temp - 1) / 2;
}
cout << res << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000 // 1E+12
// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;
using namespace std;
// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
cout << H << " ";
debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
// typedef
typedef long long ll;
typedef unsigned long long ul;
// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int 最大値2147483647 〜2E+9
// long long 最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
int main() {
// faster
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n;
cin >> n;
map<string, ll> d;
rep(i, n) {
string temp;
cin >> temp;
sort(ALL(temp));
if (d.count(temp) == 0)
d[temp] = 0;
d[temp]++;
}
ll res = 0;
for (pair<string, ll> i : d) {
ll temp = i.second;
res += temp * (temp - 1) / 2;
}
cout << res << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,267
| 746,268
|
u354953865
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
template <typename K, typename V, typename A>
void key_count(map<K, V> &mapBuff, A a) {
for (auto c : a) {
if (mapBuff.count(c) == 0) {
mapBuff.insert(make_pair(c, 1));
} else {
auto it = mapBuff.find(c);
mapBuff.insert(make_pair(c, it->second++));
}
}
}
int main() {
int n;
cin >> n;
vector<string> vec(n);
map<string, int> m;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> vec.at(i);
sort(vec[i].begin(), vec[i].end());
}
key_count(m, vec);
for (auto i = m.begin(); i != m.end(); ++i) {
if (i->second >= 2) {
ans += (i->second * (i->second - 1)) / 2;
}
// cout << i->first << i->second << endl;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
template <typename K, typename V, typename A>
void key_count(map<K, V> &mapBuff, A a) {
for (auto c : a) {
if (mapBuff.count(c) == 0) {
mapBuff.insert(make_pair(c, 1));
} else {
auto it = mapBuff.find(c);
mapBuff.insert(make_pair(c, it->second++));
}
}
}
int main() {
int n;
cin >> n;
vector<string> vec(n);
map<string, long long> m;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> vec.at(i);
sort(vec[i].begin(), vec[i].end());
}
key_count(m, vec);
for (auto i = m.begin(); i != m.end(); ++i) {
if (i->second >= 2) {
ans += (i->second * (i->second - 1)) / 2;
}
// cout << i->first << i->second << endl;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,269
| 746,270
|
u048238198
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll INF = 1 << 29;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> map;
int cnt = 0;
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
cnt += map[s[i]];
map[s[i]]++;
}
cout << cnt << endl;
}
|
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll INF = 1 << 29;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> map;
ll cnt = 0;
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
cnt += map[s[i]];
map[s[i]]++;
}
cout << cnt << endl;
}
|
[
"variable_declaration.type.change"
] | 746,271
| 746,272
|
u090005176
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int, int>
#define _FastIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define MAXX 100005
int n;
string s;
int main() {
_FastIO;
cin >> n;
set<string> ms;
map<string, int> m;
set<string>::iterator it;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ms.insert(s);
m[s]++;
}
int ans = 0;
for (it = ms.begin(); it != ms.end(); it++) {
int k = m[*it];
if (k > 1) {
int sum = (k * (k - 1)) / 2;
ans += sum;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int, int>
#define _FastIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define MAXX 100005
ll n;
string s;
int main() {
_FastIO;
cin >> n;
set<string> ms;
map<string, ll> m;
set<string>::iterator it;
for (ll i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ms.insert(s);
m[s]++;
}
ll ans = 0;
for (it = ms.begin(); it != ms.end(); it++) {
ll k = m[*it];
if (k > 1) {
ll sum = (k * (k - 1)) / 2;
ans += sum;
}
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 746,275
| 746,276
|
u958323734
|
cpp
|
p02947
|
#import <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repp(i, n) for (ll i = 1; i <= (n); ++i)
#define red(i, n) for (ll i = (n)-1; i >= 0; --i)
#define all(a) begin(a), end(a)
#define pb(a) push_back(a)
#define yn(a) cout << ((a) ? "Yes\n" : "No\n")
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll INF = 1e9 + 9, LINF = 1e18;
int main() {
ll n, ans = 0;
cin >> n;
map<string, int> a;
string s;
rep(i, n) cin >> s, sort(all(s)), a[s]++;
for (auto x : a)
ans += x.second * (x.second - 1) / 2;
cout << ans << endl;
}
|
#import <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repp(i, n) for (ll i = 1; i <= (n); ++i)
#define red(i, n) for (ll i = (n)-1; i >= 0; --i)
#define all(a) begin(a), end(a)
#define pb(a) push_back(a)
#define yn(a) cout << ((a) ? "Yes\n" : "No\n")
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll INF = 1e9 + 9, LINF = 1e18;
int main() {
ll n, ans = 0;
cin >> n;
map<string, ll> a;
string s;
rep(i, n) cin >> s, sort(all(s)), a[s]++;
for (auto x : a)
ans += x.second * (x.second - 1) / 2;
cout << ans << endl;
}
|
[] | 746,277
| 746,278
|
u049191820
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define rush() \
int T; \
scanf("%d", &T); \
while (T--)
#define mm(a, b) memset(a, b, sizeof(a))
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define pf(a) printf("%d\n", a)
#define pf2(a, b) printf("%d %d\n", a, b)
#define p_f(a) printf("%d ", a)
#define pyn(a) \
if (a) \
puts("Yes"); \
else \
puts("No");
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const db eps = 1e-9;
int n, ans;
string s;
map<string, int> m;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ans += m[s]++;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define rush() \
int T; \
scanf("%d", &T); \
while (T--)
#define mm(a, b) memset(a, b, sizeof(a))
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define pf(a) printf("%d\n", a)
#define pf2(a, b) printf("%d %d\n", a, b)
#define p_f(a) printf("%d ", a)
#define pyn(a) \
if (a) \
puts("Yes"); \
else \
puts("No");
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const db eps = 1e-9;
ll n, ans;
string s;
map<string, int> m;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ans += m[s]++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,281
| 746,282
|
u827277099
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a, b) make_pair((a), (b))
#define MT(...) make_tuple(__VA_ARGS__)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define DCOUT(x, n) cout << fixed << setprecision(n) << (x) << endl;
#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
template <typename T> inline istream &operator>>(istream &i, vector<T> &v) {
REP(j, sz(v)) i >> v[j];
return i;
}
const int INF = 1e9;
int gcd(ll a, ll b) {
if (a < b)
swap(a, b);
if (a % b == 0) {
return b;
}
return gcd(a % b, b);
}
int main() {
int N;
cin >> N;
vector<string> s(N);
REP(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
s.push_back("");
vi num;
int count = 1;
REP(i, N) {
if (s[i] != s[i + 1]) {
num.push_back(count);
count = 1;
} else
count++;
}
ll ans = 0;
REP(i, num.size()) { ans += num[i] * (num[i] - 1) / 2; }
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a, b) make_pair((a), (b))
#define MT(...) make_tuple(__VA_ARGS__)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define DCOUT(x, n) cout << fixed << setprecision(n) << (x) << endl;
#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
template <typename T> inline istream &operator>>(istream &i, vector<T> &v) {
REP(j, sz(v)) i >> v[j];
return i;
}
const int INF = 1e9;
int gcd(ll a, ll b) {
if (a < b)
swap(a, b);
if (a % b == 0) {
return b;
}
return gcd(a % b, b);
}
int main() {
ll N;
cin >> N;
vector<string> s(N);
REP(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
s.push_back("");
vector<ll> num;
ll count = 1;
REP(i, N) {
if (s[i] != s[i + 1]) {
num.push_back(count);
count = 1;
} else
count++;
}
ll ans = 0;
REP(i, num.size()) { ans += num[i] * (num[i] - 1) / 2; }
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,285
| 746,286
|
u556983878
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string str;
cin >> str;
sort(str.begin(), str.end());
mp[str]++;
}
int ans = 0;
for (auto itr : mp) {
int temp = itr.second;
if (temp != 1)
ans += temp * (temp - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
//もう一度
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string str;
cin >> str;
sort(str.begin(), str.end());
mp[str]++;
}
ll ans = 0;
for (auto itr : mp) {
int temp = itr.second;
if (temp != 1)
ans += (ll)temp * (temp - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,287
| 746,288
|
u876174845
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; ++i)
cin >> S.at(i), sort(S.at(i).begin(), S.at(i).end());
map<string, int> m;
for (int i = 0; i < N; ++i)
m[S.at(i)] += 1;
long long int cnt = 0;
for (auto p : m) {
cnt += (p.second - 1) * p.second / 2;
}
cout << cnt << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; ++i)
cin >> S.at(i), sort(S.at(i).begin(), S.at(i).end());
map<string, long long int> m;
for (int i = 0; i < N; ++i)
m[S.at(i)] += 1;
long long int cnt = 0;
for (auto p : m) {
cnt += (p.second - 1) * p.second / 2;
}
cout << cnt << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 746,292
| 746,293
|
u107338145
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
const long long INFLL = 1LL << 60;
const int INFI = 1000000000;
int main() {
int N;
cin >> N;
map<string, int> m{};
int count = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
count += m[s];
m[s]++;
}
cout << count << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
const long long INFLL = 1LL << 60;
const int INFI = 1000000000;
int main() {
int N;
cin >> N;
map<string, int> m{};
long long count = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
count += m[s];
m[s]++;
}
cout << count << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,294
| 746,295
|
u583701239
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> a;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
a[s]++;
}
ll ans = 0;
for (auto c : a)
ans += c.second * (c.second - 1) / 2;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, ll> a;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
a[s]++;
}
ll ans = 0;
for (auto c : a)
ans += c.second * (c.second - 1) / 2;
cout << ans << endl;
return 0;
}
|
[] | 746,298
| 746,299
|
u907525511
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> a;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
a[s]++;
}
int ans = 0;
for (auto c : a)
ans += c.second * (c.second - 1) / 2;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, ll> a;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
a[s]++;
}
ll ans = 0;
for (auto c : a)
ans += c.second * (c.second - 1) / 2;
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,300
| 746,299
|
u907525511
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto s : m) {
if (s.second >= 2)
ans += s.second * (s.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, ll> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto s : m) {
if (s.second >= 2)
ans += s.second * (s.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,301
| 746,302
|
u907525511
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
int ans = 0;
for (auto s : m) {
if (s.second > 0)
ans += s.second * (s.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, ll> m;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto s : m) {
if (s.second >= 2)
ans += s.second * (s.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,303
| 746,302
|
u907525511
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> S;
ll ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
S[s]++;
}
for (auto s : S) {
if (s.second == 1)
continue;
ans += s.second * (s.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, ll> S;
ll ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
S[s]++;
}
for (auto s : S) {
if (s.second == 1)
continue;
ans += s.second * (s.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,304
| 746,305
|
u907525511
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long count;
for (auto &x : mp) {
long long i = x.second;
count += i * (i - 1) / 2;
}
cout << count << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long count = 0;
for (auto &x : mp) {
long long i = x.second;
count += i * (i - 1) / 2;
}
cout << count << endl;
}
|
[
"variable_declaration.value.change"
] | 746,312
| 746,313
|
u495881622
|
cpp
|
p02947
|
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
map<string, int> cnt;
int ans = 0;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
ans += cnt[s]++;
}
cout << ans << endl;
return 0;
}
|
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
map<string, ll> cnt;
ll ans = 0;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
ans += cnt[s]++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,314
| 746,315
|
u415325136
|
cpp
|
p02947
|
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> cnt;
int ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += cnt[s]++;
}
cout << ans << endl;
return 0;
}
|
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, ll> cnt;
ll ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += cnt[s]++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,316
| 746,317
|
u415325136
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#include <cstdlib>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
typedef long long ll;
int main() {
int n;
cin >> n;
vector<vector<char>> s(n, vector<char>(10));
rep(i, n) { rep(j, 10) cin >> s.at(i).at(j); }
rep(i, n) sort(s.at(i).begin(), s.at(i).end());
// rep(j, 10) cout << s.at(0).at(j);
sort(s.begin(), s.end());
int64_t ans = 0;
int pair = 1;
rep(i, n - 1) {
if (s.at(i) == s.at(i + 1))
pair++;
else
ans += pair * (pair - 1) / 2, pair = 1;
}
ans += pair * (pair - 1) / 2;
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
#include <cstdlib>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
typedef long long ll;
int main() {
int n;
cin >> n;
vector<vector<char>> s(n, vector<char>(10));
rep(i, n) { rep(j, 10) cin >> s.at(i).at(j); }
rep(i, n) sort(s.at(i).begin(), s.at(i).end());
// rep(j, 10) cout << s.at(0).at(j);
sort(s.begin(), s.end());
int64_t ans = 0;
int64_t pair = 1;
rep(i, n - 1) {
if (s.at(i) == s.at(i + 1))
pair++;
else
ans += pair * (pair - 1) / 2, pair = 1;
}
ans += pair * (pair - 1) / 2;
cout << ans;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,318
| 746,319
|
u748819456
|
cpp
|
p02947
|
//(・ω・)
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip> //setprecision
#include <iostream> // cout, endl, cin
#include <iterator> //std::advance()
#include <limits>
#include <list>
#include <map> // map
#include <math.h>
#include <queue> // queue, priority_queue
#include <set> // set
#include <sstream> //istringstream
#include <stack> // stack
#include <stdio.h>
#include <stdlib.h>
#include <string> // string, to_string, atoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int a = 1;
long long sum = 0;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1])
a++;
else {
sum += a * (a - 1);
a = 1;
}
}
sum += a * (a - 1);
cout << sum / 2 << endl;
}
|
//(・ω・)
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <deque> // deque
#include <iomanip> //setprecision
#include <iostream> // cout, endl, cin
#include <iterator> //std::advance()
#include <limits>
#include <list>
#include <map> // map
#include <math.h>
#include <queue> // queue, priority_queue
#include <set> // set
#include <sstream> //istringstream
#include <stack> // stack
#include <stdio.h>
#include <stdlib.h>
#include <string> // string, to_string, atoi
#include <tuple> // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility> // pair, make_pair
#include <vector> // vector
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
long long a = 1;
long long sum = 0;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1])
a++;
else {
sum += a * (a - 1);
a = 1;
}
}
sum += a * (a - 1);
cout << sum / 2 << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,320
| 746,321
|
u121106629
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
long long comb2(int n) {
long long r;
if (n % 2 & 1) {
r = (n - 1) / 2 * n;
} else {
r = n / 2 * (n - 1);
}
return r;
}
int main() {
int n;
std::cin >> n;
std::vector<std::string> s(n);
for (int i = 0; i < n; i++) {
std::cin >> s[i];
std::sort(s[i].begin(), s[i].end());
}
std::sort(s.begin(), s.end());
std::vector<int> ansp;
std::string tmp = s[0];
int anss = 0;
for (int i = 0; i < n; i++) {
if (s[i] == tmp) {
anss++;
} else {
ansp.push_back(anss);
anss = 1;
tmp = s[i];
}
}
ansp.push_back(anss);
ansp.push_back(0);
long long ans = 0;
for (int i = 0; i < ansp.size(); i++) {
ans += comb2(ansp[i]);
}
std::cout << ans << "\n";
}
|
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
long long comb2(long long n) {
long long r;
if (n % 2 & 1) {
r = (n - 1) / 2 * n;
} else {
r = n / 2 * (n - 1);
}
return r;
}
int main() {
int n;
std::cin >> n;
std::vector<std::string> s(n);
for (int i = 0; i < n; i++) {
std::cin >> s[i];
std::sort(s[i].begin(), s[i].end());
}
std::sort(s.begin(), s.end());
std::vector<long long> ansp;
std::string tmp = s[0];
int anss = 0;
for (int i = 0; i < n; i++) {
if (s[i] == tmp) {
anss++;
} else {
ansp.push_back(anss);
anss = 1;
tmp = s[i];
}
}
ansp.push_back(anss);
ansp.push_back(0);
long long ans = 0;
for (int i = 0; i < ansp.size(); i++) {
ans += comb2(ansp[i]);
}
std::cout << ans << "\n";
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,327
| 746,328
|
u825343780
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, int> list;
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
list[s[i]]++;
}
ll ans = 0;
for (auto x : list) {
if (x.second != 1) {
ll y = x.second * (x.second - 1) / 2;
ans += y;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, ll> list;
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
list[s[i]]++;
}
ll ans = 0;
for (auto x : list) {
if (x.second != 1) {
ll y = x.second * (x.second - 1) / 2;
ans += y;
}
}
cout << ans << endl;
return 0;
}
|
[] | 746,329
| 746,330
|
u721094090
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, int> list;
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
list[s[i]]++;
}
int ans = 0;
for (auto x : list) {
if (x.second != 1) {
int y = x.second * (x.second - 1) / 2;
ans += y;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, ll> list;
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
list[s[i]]++;
}
ll ans = 0;
for (auto x : list) {
if (x.second != 1) {
ll y = x.second * (x.second - 1) / 2;
ans += y;
}
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,331
| 746,330
|
u721094090
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define cool \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve() {
int n, ans = 0;
cin >> n;
string s;
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto x : mp) {
ans += ((x.second * (x.second - 1)) / 2);
}
cout << ans;
}
int main() {
cool;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
return 0;
}
|
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define cool \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve() {
ll int n, ans = 0;
cin >> n;
string s;
map<string, ll int> mp;
for (ll int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto x : mp) {
ans += ((x.second * (x.second - 1)) / 2);
}
cout << ans;
}
int main() {
cool;
int t;
// cin>>t;
t = 1;
while (t--) {
solve();
}
return 0;
}
|
[] | 746,332
| 746,333
|
u883167571
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main() {
int n;
cin >> n;
map<string, int> cnt;
ll ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
cnt[s]++;
}
for (auto c : cnt) {
ans += c.second * (c.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main() {
int n;
cin >> n;
map<string, int> cnt;
ll ans = 0;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
cnt[s]++;
}
for (auto c : cnt) {
ans += (ll)c.second * (c.second - 1) / 2;
}
cout << ans << endl;
}
|
[
"type_conversion.add"
] | 746,334
| 746,335
|
u796273093
|
cpp
|
p02947
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, int> vec;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
vec[s] += 1;
}
ll ans = 0;
for (auto v : vec) {
ans += v.second * (v.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, ll> vec;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
vec[s] += 1;
}
ll ans = 0;
for (auto v : vec)
ans += v.second * (v.second - 1) / 2;
cout << ans << endl;
}
|
[] | 746,336
| 746,337
|
u393658518
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto iter = mp.begin(); iter != mp.end(); ++iter) {
int tmp;
tmp = iter->second;
ans += tmp * (tmp - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto iter = mp.begin(); iter != mp.end(); ++iter) {
ll tmp;
tmp = iter->second;
ans += tmp * (tmp - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,340
| 746,341
|
u748757847
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define fs first
#define sc second
#define _GLIBCXX_DEBUG
template <class S> S sum(vector<S> &a) { return accumulate(all(a), S()); }
template <class S> S max(vector<S> &a) { return *max_element(all(a)); }
template <class S> S min(vector<S> &a) { return *min_element(all(a)); }
ll max(int a, ll b) { return max((ll)a, b); }
ll max(ll a, int b) { return max(a, (ll)b); }
ll min(int a, ll b) { return min((ll)a, b); }
ll min(ll a, int b) { return min(a, (ll)b); }
template <class S> void print(vector<S> &v) {
for (ll i = 0; i < (ll)v.size(); i++) {
cerr << v[i] << ' ';
}
cerr << endl;
}
template <class S> void print(vector<vector<S>> &v) {
for (ll i = 0; i < (ll)v.size(); i++) {
for (ll j = 0; j < (ll)v[i].size(); j++) {
cerr << v[i][j] << ' ';
}
cerr << endl;
}
}
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string q;
cin >> q;
vector<char> s;
rep(i, 10) { s.push_back(q[i]); }
sort(all(s));
string k(all(s));
m[k]++;
}
int ans = 0;
for (auto p : m) {
int v = p.sc;
ans += (v - 1) * v / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define fs first
#define sc second
#define _GLIBCXX_DEBUG
template <class S> S sum(vector<S> &a) { return accumulate(all(a), S()); }
template <class S> S max(vector<S> &a) { return *max_element(all(a)); }
template <class S> S min(vector<S> &a) { return *min_element(all(a)); }
ll max(int a, ll b) { return max((ll)a, b); }
ll max(ll a, int b) { return max(a, (ll)b); }
ll min(int a, ll b) { return min((ll)a, b); }
ll min(ll a, int b) { return min(a, (ll)b); }
template <class S> void print(vector<S> &v) {
for (ll i = 0; i < (ll)v.size(); i++) {
cerr << v[i] << ' ';
}
cerr << endl;
}
template <class S> void print(vector<vector<S>> &v) {
for (ll i = 0; i < (ll)v.size(); i++) {
for (ll j = 0; j < (ll)v[i].size(); j++) {
cerr << v[i][j] << ' ';
}
cerr << endl;
}
}
int main() {
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string q;
cin >> q;
vector<char> s;
rep(i, 10) { s.push_back(q[i]); }
sort(all(s));
string k(all(s));
m[k]++;
}
ll ans = 0;
for (auto p : m) {
int v = p.sc;
ans += (ll)(v - 1) * v / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change",
"call.add"
] | 746,344
| 746,345
|
u466335531
|
cpp
|
p02947
|
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const long long INF = 1LL << 61;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string str;
cin >> str;
sort(str.begin(), str.end());
++mp[str];
}
int ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
int num = itr->second;
ans += num * (num - 1) / 2;
}
cout << ans;
}
|
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const long long INF = 1LL << 61;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string str;
cin >> str;
sort(str.begin(), str.end());
++mp[str];
}
long long ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
long long num = itr->second;
ans += num * (num - 1) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,346
| 746,347
|
u289578952
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string ss;
cin >> ss;
sort(ss.begin(), ss.end());
s.at(i) = ss;
}
sort(s.begin(), s.end());
// rep(i, n) cout << s.at(i) << endl;
vector<int> equal(n, 0);
int ans = 0;
rep(i, n) {
if (i == 0)
continue;
if (s.at(i) == s.at(i - 1)) {
equal.at(i) = equal.at(i - 1) + 1;
}
ans += equal.at(i);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string ss;
cin >> ss;
sort(ss.begin(), ss.end());
s.at(i) = ss;
}
sort(s.begin(), s.end());
// rep(i, n) cout << s.at(i) << endl;
vector<ll> equal(n, 0);
ll ans = 0;
rep(i, n) {
if (i == 0)
continue;
if (s.at(i) == s.at(i - 1)) {
equal.at(i) = equal.at(i - 1) + 1;
}
ans += equal.at(i);
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,348
| 746,349
|
u695037420
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, s, n) for (long long i = (s); i < (long long)(n); i++)
#define repi(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2i(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
const ll INF = (1LL << 60);
const int INFi = (1 << 29);
int main() {
ll n;
cin >> n;
unordered_map<string, ll> hashmap;
string in;
ll ans = 0;
rep(i, n) {
cin >> in;
sort(all(in));
if (hashmap[in] == 0) {
hashmap[in] = 1;
} else {
ans += hashmap[in];
hashmap[in] += hashmap[in];
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, s, n) for (long long i = (s); i < (long long)(n); i++)
#define repi(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2i(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
const ll INF = (1LL << 60);
const int INFi = (1 << 29);
int main() {
ll n;
cin >> n;
unordered_map<string, ll> hashmap;
string in;
ll ans = 0;
rep(i, n) {
cin >> in;
sort(all(in));
if (hashmap[in] == 0) {
hashmap[in] = 1;
} else {
ans += hashmap[in];
hashmap[in]++;
}
}
cout << ans << endl;
return 0;
}
|
[
"assignment.change"
] | 746,350
| 746,351
|
u994630752
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define whole(f, x, ...) \
([&](decltype((x)) whole) { \
return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
})(x)
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
unordered_map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
++m[s];
}
ll res = 0;
for (auto &a : m) {
res += a.second * (a.second - 1) / 2;
}
cout << res << endl;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(15);
solve();
return 0;
}
|
#include <bits/stdc++.h>
#define whole(f, x, ...) \
([&](decltype((x)) whole) { \
return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
})(x)
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
unordered_map<string, ll> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
++m[s];
}
ll res = 0;
for (auto &a : m) {
res += a.second * (a.second - 1) / 2;
}
cout << res << endl;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(15);
solve();
return 0;
}
|
[] | 746,352
| 746,353
|
u000975152
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
signed main() {
int N;
cin >> N;
map<string, int> st;
int ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += st[s];
st[s]++;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
signed main() {
int N;
cin >> N;
map<string, int> st;
long long ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += st[s];
st[s]++;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,356
| 746,357
|
u934469795
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
string s;
map<string, int> dict;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
dict[s]++;
}
ll cnum = 0;
for (auto p : dict) {
auto key = p.first;
auto value = p.second;
cnum += (p.second * (p.second - 1)) / 2;
}
cout << cnum << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
string s;
map<string, ll> dict;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
dict[s]++;
}
ll cnum = 0;
for (auto p : dict) {
auto key = p.first;
auto value = p.second;
cnum += (p.second * (p.second - 1)) / 2;
}
cout << cnum << endl;
return 0;
}
|
[] | 746,363
| 746,364
|
u118647609
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long int;
ll C(int n) {
if (n == 0 || n == 1)
return 0;
return (n * (n - 1)) / 2;
}
int main(void) {
int n;
cin >> n;
vector<vector<char>> str(n, vector<char>(10));
rep(i, n) { rep(j, 10) cin >> str[i][j]; }
rep(i, n) sort(str[i].begin(), str[i].end());
sort(str.begin(), str.end());
ll sum = 0;
int chain = 1;
rep(i, n - 1) {
bool t = true;
rep(j, 10) {
if (str[i][j] != str[i + 1][j])
t = false;
}
if (t) {
chain++;
} else {
sum += C(chain);
chain = 1;
}
if (i == n - 2)
sum += C(chain);
}
cout << sum << endl;
}
|
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long int;
ll C(ll n) {
if (n == 0 || n == 1)
return 0;
return (n * (n - 1)) / 2;
}
int main(void) {
int n;
cin >> n;
vector<vector<char>> str(n, vector<char>(10));
rep(i, n) { rep(j, 10) cin >> str[i][j]; }
rep(i, n) sort(str[i].begin(), str[i].end());
sort(str.begin(), str.end());
ll sum = 0;
ll chain = 1;
rep(i, n - 1) {
bool t = true;
rep(j, 10) {
if (str[i][j] != str[i + 1][j])
t = false;
}
if (t) {
chain++;
} else {
sum += C(chain);
chain = 1;
}
if (i == n - 2)
sum += C(chain);
}
cout << sum << endl;
}
|
[
"variable_declaration.type.change"
] | 746,365
| 746,366
|
u406132951
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#define MOD 1e9 + 7;
#define INF 1e17 + 9;
#define PI acos(-1);
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long sum = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
int temp = itr->second;
sum += temp * (temp - 1) / 2;
}
cout << sum << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#define MOD 1e9 + 7;
#define INF 1e17 + 9;
#define PI acos(-1);
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long sum = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
long long temp = itr->second;
sum += temp * (temp - 1) / 2;
}
cout << sum << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,367
| 746,368
|
u198469037
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll binom_two(int n) {
if (n % 2 == 0)
return n / 2 * (n - 1);
else
return (n - 1) / 2 * n;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int h = 0;
vector<int> rec(N);
rec[0]++;
for (int i = 1; i < N; i++) {
if (s[i] != s[i - 1]) {
h++;
rec[h]++;
} else
rec[h]++;
}
ll ans = 0;
for (int i = 0; i <= h; i++) {
ans += binom_two(rec[i]);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll binom_two(ll n) {
if (n % 2 == 0)
return n / 2 * (n - 1);
else
return (n - 1) / 2 * n;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int h = 0;
vector<int> rec(N);
rec[0]++;
for (int i = 1; i < N; i++) {
if (s[i] != s[i - 1]) {
h++;
rec[h]++;
} else
rec[h]++;
}
ll ans = 0;
for (int i = 0; i <= h; i++) {
ans += binom_two(rec[i]);
}
cout << ans << endl;
}
|
[] | 746,369
| 746,370
|
u147808483
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
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)
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
ans += (ll)p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 746,373
| 746,374
|
u754114382
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int x = p.second;
ans += (ll)((x * (x - 1)) / 2);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int x = p.second;
ans += (ll)x * (x - 1) / 2;
}
cout << ans << endl;
}
|
[
"call.arguments.change"
] | 746,375
| 746,376
|
u754114382
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, i;
map<map<char, int>, int> index;
cin >> n;
for (i = 0; i < n; i++) {
string input;
map<char, int> cnt;
cin >> input;
for (int j = 0; input[j]; j++) {
cnt[input[j]]++;
}
index[cnt]++;
}
long int res = 0;
for (auto it = index.begin(); it != index.end(); it++) {
if (it->second > 1) {
res += ((it->second) * (it->second - 1)) / 2;
}
}
cout << res << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, i;
map<map<char, long int>, long int> index;
cin >> n;
for (i = 0; i < n; i++) {
string input;
map<char, long int> cnt;
cin >> input;
for (int j = 0; input[j]; j++) {
cnt[input[j]]++;
}
index[cnt]++;
}
long int res = 0;
for (auto it = index.begin(); it != index.end(); it++) {
if (it->second > 1) {
res += ((it->second) * (it->second - 1)) / 2;
}
}
cout << res << '\n';
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,379
| 746,380
|
u953471422
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, i;
map<map<char, int>, int> index;
cin >> n;
for (i = 0; i < n; i++) {
string input;
map<char, int> cnt;
cin >> input;
for (int j = 0; input[j]; j++) {
cnt[input[j]]++;
}
index[cnt]++;
}
int res = 0;
for (auto it = index.begin(); it != index.end(); it++) {
if (it->second > 1) {
res += ((it->second) * (it->second - 1)) / 2;
}
}
cout << res << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, i;
map<map<char, long int>, long int> index;
cin >> n;
for (i = 0; i < n; i++) {
string input;
map<char, long int> cnt;
cin >> input;
for (int j = 0; input[j]; j++) {
cnt[input[j]]++;
}
index[cnt]++;
}
long int res = 0;
for (auto it = index.begin(); it != index.end(); it++) {
if (it->second > 1) {
res += ((it->second) * (it->second - 1)) / 2;
}
}
cout << res << '\n';
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,381
| 746,380
|
u953471422
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S[N];
for (int i = 0; i < N; i++) {
cin >> S[i];
}
unordered_map<string, long long int> ans;
int a = 0;
for (int i = 0; i < N; i++) {
sort(S[i].begin(), S[i].end());
auto itr = ans.find(S[i]);
if (itr != ans.end()) {
itr->second++;
a += itr->second;
} else {
ans[S[i]] = 0;
}
}
cout << a << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S[N];
for (int i = 0; i < N; i++) {
cin >> S[i];
}
unordered_map<string, long long int> ans;
long long int a = 0;
for (int i = 0; i < N; i++) {
sort(S[i].begin(), S[i].end());
auto itr = ans.find(S[i]);
if (itr != ans.end()) {
itr->second++;
a += itr->second;
} else {
ans[S[i]] = 0;
}
}
cout << a << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,386
| 746,387
|
u759510609
|
cpp
|
p02947
|
#include <iostream>
#include <map>
#include <set>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
int n;
cin >> n;
map<char, int> mp[n];
map<map<char, int>, int> a;
string str;
rep(i, n) {
cin >> str;
rep(j, str.length())++ mp[i][str[j]];
}
// ll ans = 0;
// rep(i, n - 1) {
// if (mp[i] == mp[i + 1]) ++ans;
// }
// set<map<char, int>> s;
rep(i, n) {
// s.insert(mp[i]);
++a[mp[i]];
}
ll ans = 0;
for (auto p : a) {
ans += p.second * (p.second - 1) / 2;
}
// ll ans = n - s.size();
// for (int i = 0; i < n - 1; ++i) {
// for (int j = i + 1; j < n; ++j) {
// if (mp[i] == mp[j]) ++ans;
// }
// }
// rep(i, n) {
// for (auto p : mp[i]) { cout << " " << p.first << ":" << p.second; }
// cout << endl;
// }
cout << ans << endl;
return 0;
}
|
#include <iostream>
#include <map>
#include <set>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
int n;
cin >> n;
map<char, int> mp[n];
map<map<char, int>, ll> a;
string str;
rep(i, n) {
cin >> str;
rep(j, str.length()) { ++mp[i][str[j]]; }
}
rep(i, n) { ++a[mp[i]]; }
ll ans = 0;
for (auto p : a) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,388
| 746,389
|
u075775814
|
cpp
|
p02947
|
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
int m = p.second;
ans += m * (m - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
int main() {
int n;
cin >> n;
map<string, ll> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
ll m = p.second;
ans += m * (m - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,390
| 746,391
|
u168684371
|
cpp
|
p02947
|
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> map;
for (int i = 0; i < N; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
map[str]++;
}
long long ans = 0;
for (auto pair : map) {
ans += (pair.second * (pair.second - 1)) / 2;
}
cout << ans << endl;
}
|
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, long long> map;
for (int i = 0; i < N; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
map[str]++;
}
long long ans = 0;
for (auto pair : map) {
ans += (pair.second * (pair.second - 1)) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,392
| 746,393
|
u526365587
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> cnt;
rep(i, N) {
if (cnt.count(s[i]))
cnt[s[i]] += 1;
else
cnt[s[i]] = 1;
}
ll ans = 0;
for (auto p : cnt) {
int n = p.second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> cnt;
rep(i, N) {
if (cnt.count(s[i]))
cnt[s[i]]++;
else
cnt[s[i]] = 1;
}
ll ans = 0;
for (auto p : cnt) {
ll n = p.second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,398
| 746,399
|
u009414205
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long ans = 0;
unordered_map<string, int> a;
string s;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(&s[0], &s[9] + 1);
a[s] += 1;
}
for (auto itr = a.begin(); itr != a.end(); itr = next(itr, 1)) {
if (itr->second != 1)
ans += itr->second * (itr->second - 1) / 2;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
long ans = 0;
unordered_map<string, long> a;
string s;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(&s[0], &s[9] + 1);
a[s] += 1;
}
for (auto itr = a.begin(); itr != a.end(); itr = next(itr, 1)) {
if (itr->second != 1)
ans += itr->second * (itr->second - 1) / 2;
}
cout << ans;
return 0;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,400
| 746,401
|
u000770457
|
cpp
|
p02947
|
#define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define ll long long
#define all(v) v.begin(), v.end()
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) sort(all(s[i])); //, s[i]+s[i].size());
ll ans = 0;
sort(all(s));
map<string, int> mp;
rep(i, n) { mp[s[i]]++; }
for (auto x : mp) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
}
|
#define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define ll long long
#define all(v) v.begin(), v.end()
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) sort(all(s[i]));
ll ans = 0;
sort(all(s));
map<string, ll> mp;
rep(i, n) { mp[s[i]]++; }
for (auto x : mp) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
}
|
[] | 746,402
| 746,403
|
u942085302
|
cpp
|
p02947
|
#define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define ll long long
#define all(v) v.begin(), v.end()
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) sort(all(s[i])); //, s[i]+s[i].size());
int ans = 0;
sort(all(s));
map<string, int> mp;
rep(i, n) { mp[s[i]]++; }
for (auto x : mp) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
}
|
#define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define ll long long
#define all(v) v.begin(), v.end()
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) sort(all(s[i]));
ll ans = 0;
sort(all(s));
map<string, ll> mp;
rep(i, n) { mp[s[i]]++; }
for (auto x : mp) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,404
| 746,403
|
u942085302
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define sort_(a) sort(a.begin(), a.end())
#define sum(a) accumulate(a.begin(), a.end(), 0)
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long unsigned int ll;
const long mod = 1e9 + 7;
int main(void) {
#ifdef DEBUG
freopen(".testcase", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
map<string, int> S{};
string s;
rep(i, N) {
cin >> s;
sort_(s);
S[s] += 1;
}
long ans = 0;
int n = 0;
for (auto i = S.begin(); i != S.end(); ++i) {
n = i->second;
ans += (n * (n - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define sort_(a) sort(a.begin(), a.end())
#define sum(a) accumulate(a.begin(), a.end(), 0)
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long unsigned int ll;
const long mod = 1e9 + 7;
int main(void) {
#ifdef DEBUG
freopen(".testcase", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
map<string, int> S{};
string s;
rep(i, N) {
cin >> s;
sort_(s);
S[s] += 1;
}
ll ans = 0;
ll n = 0;
for (auto i = S.begin(); i != S.end(); ++i) {
n = i->second;
ans += (n * (n - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,405
| 746,406
|
u125205981
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define Rep(i, s, f) for (int i = (int)s; i < (int)f; i++)
using ll = long long int;
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> dict;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
dict[s]++;
}
ll ans = 0;
for (pair<string, int> p : dict) {
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 < (int)n; i++)
#define Rep(i, s, f) for (int i = (int)s; i < (int)f; i++)
using ll = long long int;
using namespace std;
int main() {
int N;
cin >> N;
map<string, ll> dict;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
dict[s]++;
}
ll ans = 0;
for (pair<string, ll> p : dict) {
ans += (p.second) * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,410
| 746,411
|
u415400221
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define Rep(i, s, f) for (int i = (int)s; i < (int)f; i++)
using ll = long long;
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> dict;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
dict[s]++;
}
ll ans = 0;
for (pair<string, int> p : dict) {
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 < (int)n; i++)
#define Rep(i, s, f) for (int i = (int)s; i < (int)f; i++)
using ll = long long int;
using namespace std;
int main() {
int N;
cin >> N;
map<string, ll> dict;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
dict[s]++;
}
ll ans = 0;
for (pair<string, ll> p : dict) {
ans += (p.second) * (p.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,412
| 746,411
|
u415400221
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout << d << endl;
#define coutd(d) cout << std::setprecision(10) << d << endl;
#define cinline(n) getline(cin, n);
#define replace_all(s, b, a) replace(s.begin(), s.end(), b, a);
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
template <class T, class C> void chmax(T &a, C b) { a > b ?: a = b; }
template <class T, class C> void chmin(T &a, C b) { a < b ?: a = b; }
const int mod = 1e9 + 7;
struct mint {
ll x;
mint(ll x = 0) : x(x % mod) {}
mint &operator+=(const mint a) {
if ((x += a.x) >= mod)
x -= mod;
return *this;
}
mint &operator-=(const mint a) {
if ((x += mod - a.x) >= mod)
x -= mod;
return *this;
}
mint &operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res += a;
}
mint operator-(const mint a) const {
mint res(*this);
return res -= a;
}
mint operator*(const mint a) const {
mint res(*this);
return res *= a;
}
};
mint c[4005][4005];
void init() {
c[0][0] = 1;
for (int i = 0; i <= 4000; i++) {
for (int j = 0; j <= i; j++) {
c[i + 1][j] += c[i][j];
c[i + 1][j + 1] += c[i][j];
}
}
}
mint comb(int n, int k) { return c[n][k]; }
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false;
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
return false;
}
}
return true;
}
map<ll, ll> primeFact(ll n) {
map<ll, ll> res;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
res[i]++;
n /= i;
}
}
if (n != 1)
res[n]++;
return res;
}
void printv(vi &v) {
rep(i, v.size()) cout << v[i] << " ";
cout << endl;
}
void printv(vll &v) {
rep(i, v.size()) cout << v[i] << " ";
cout << endl;
}
int vtotal(vi &v) {
int total = 0;
rep(i, v.size()) total += v[i];
return total;
}
int gcd(int a, int b) {
if (a < b) {
a ^= b;
b ^= a;
a ^= b;
}
return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
// init(); // mint初期化
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
// vs s;
priority_queue<string> s;
rep(i, n) {
string a;
cin >> a;
sort(all(a));
s.push(a);
// s.push_back(a);
}
// vsort(s);
int ans = 0;
int cnt = 0;
string s1 = s.top();
s.pop();
while (!s.empty()) {
string s2 = s.top();
// cout(s1+" "+s2);
s.pop();
if (s1 == s2) {
cnt++;
} else {
s1 = s2;
ans += (cnt * (cnt + 1)) / 2;
cnt = 0;
}
}
ans += (cnt * (cnt + 1)) / 2;
cout(ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout << d << endl;
#define coutd(d) cout << std::setprecision(10) << d << endl;
#define cinline(n) getline(cin, n);
#define replace_all(s, b, a) replace(s.begin(), s.end(), b, a);
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
template <class T, class C> void chmax(T &a, C b) { a > b ?: a = b; }
template <class T, class C> void chmin(T &a, C b) { a < b ?: a = b; }
const int mod = 1e9 + 7;
struct mint {
ll x;
mint(ll x = 0) : x(x % mod) {}
mint &operator+=(const mint a) {
if ((x += a.x) >= mod)
x -= mod;
return *this;
}
mint &operator-=(const mint a) {
if ((x += mod - a.x) >= mod)
x -= mod;
return *this;
}
mint &operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res += a;
}
mint operator-(const mint a) const {
mint res(*this);
return res -= a;
}
mint operator*(const mint a) const {
mint res(*this);
return res *= a;
}
};
mint c[4005][4005];
void init() {
c[0][0] = 1;
for (int i = 0; i <= 4000; i++) {
for (int j = 0; j <= i; j++) {
c[i + 1][j] += c[i][j];
c[i + 1][j + 1] += c[i][j];
}
}
}
mint comb(int n, int k) { return c[n][k]; }
bool IsPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false;
double sqrtNum = sqrt(num);
for (int i = 3; i <= sqrtNum; i += 2) {
if (num % i == 0) {
return false;
}
}
return true;
}
map<ll, ll> primeFact(ll n) {
map<ll, ll> res;
for (ll i = 2; i * i <= n; i++) {
while (n % i == 0) {
res[i]++;
n /= i;
}
}
if (n != 1)
res[n]++;
return res;
}
void printv(vi &v) {
rep(i, v.size()) cout << v[i] << " ";
cout << endl;
}
void printv(vll &v) {
rep(i, v.size()) cout << v[i] << " ";
cout << endl;
}
int vtotal(vi &v) {
int total = 0;
rep(i, v.size()) total += v[i];
return total;
}
int gcd(int a, int b) {
if (a < b) {
a ^= b;
b ^= a;
a ^= b;
}
return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
// init(); // mint初期化
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
priority_queue<string> s;
rep(i, n) {
string a;
cin >> a;
sort(all(a));
s.push(a);
}
ll ans = 0;
ll cnt = 0;
string s1 = s.top();
s.pop();
while (!s.empty()) {
string s2 = s.top();
s.pop();
// cout(s1+" "+s2);
if (s1 == s2) {
cnt++;
} else {
s1 = s2;
ans += (cnt * (cnt + 1)) / 2;
cnt = 0;
}
}
ans += (cnt * (cnt + 1)) / 2;
cout(ans);
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,413
| 746,414
|
u530107518
|
cpp
|
p02947
|
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e18;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W,
x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;
map<string, int> mp;
int main() {
cin >> N;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (mp.find(s) == mp.end())
mp[s] = 1;
else
mp[s]++;
}
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
ans += (itr->second) * (itr->second - 1) / 2;
}
cout << ans;
}
|
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e18;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W,
x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;
map<string, ll> mp;
int main() {
cin >> N;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (mp.find(s) == mp.end())
mp[s] = 1;
else
mp[s]++;
}
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
ans += (itr->second) * (itr->second - 1) / 2;
}
cout << ans;
}
|
[] | 746,415
| 746,416
|
u554988565
|
cpp
|
p02947
|
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// container util
#define all(x) (x).begin(), (x).end()
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
// conversion
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> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
//
long long memo[101010];
long long modpow(long long a, int p) {
if (p == 0)
return 1;
if (p % 2 == 0) {
int halfP = p / 2;
long long half = modpow(a, halfP);
return half * half;
} else {
return a * modpow(a, p - 1);
}
}
long long func(long long a) {
memo[0] = 0;
memo[1] = 1;
if (memo[a] != 0)
return memo[a];
return memo[a] = a * func(a - 1);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> s(n);
map<string, lint> mp;
rep(i, n) {
string t;
cin >> t;
sort(all(t));
mp[t]++;
}
auto it = mp.begin();
lint ans = 0;
while (it != mp.end()) {
// cout << it->second << endl;
ans += it->second * (it->second - 1);
it++;
}
cout << ans << endl;
return 0;
}
|
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// container util
#define all(x) (x).begin(), (x).end()
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
// conversion
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> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
//
long long memo[101010];
long long modpow(long long a, int p) {
if (p == 0)
return 1;
if (p % 2 == 0) {
int halfP = p / 2;
long long half = modpow(a, halfP);
return half * half;
} else {
return a * modpow(a, p - 1);
}
}
long long func(long long a) {
memo[0] = 0;
memo[1] = 1;
if (memo[a] != 0)
return memo[a];
return memo[a] = a * func(a - 1);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> s(n);
map<string, lint> mp;
rep(i, n) {
string t;
cin >> t;
sort(all(t));
mp[t]++;
}
auto it = mp.begin();
lint ans = 0;
while (it != mp.end()) {
// cout << it->second << endl;
ans += it->second * (it->second - 1) / 2;
it++;
}
cout << ans << endl;
return 0;
}
|
[
"assignment.change"
] | 746,419
| 746,420
|
u764228018
|
cpp
|
p02947
|
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// container util
#define all(x) (x).begin(), (x).end()
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
// conversion
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> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
//
long long memo[101010];
long long modpow(long long a, int p) {
if (p == 0)
return 1;
if (p % 2 == 0) {
int halfP = p / 2;
long long half = modpow(a, halfP);
return half * half;
} else {
return a * modpow(a, p - 1);
}
}
long long func(long long a) {
memo[0] = 0;
memo[1] = 1;
if (memo[a] != 0)
return memo[a];
return memo[a] = a * func(a - 1);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> s(n);
map<string, int> mp;
rep(i, n) {
string t;
cin >> t;
sort(all(t));
mp[t]++;
}
auto it = mp.begin();
lint ans = 0;
while (it != mp.end()) {
// cout << it->second << endl;
ans += it->second * (it->second - 1);
it++;
}
cout << ans << endl;
return 0;
}
|
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// container util
#define all(x) (x).begin(), (x).end()
// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) \
cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
// conversion
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> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
//
long long memo[101010];
long long modpow(long long a, int p) {
if (p == 0)
return 1;
if (p % 2 == 0) {
int halfP = p / 2;
long long half = modpow(a, halfP);
return half * half;
} else {
return a * modpow(a, p - 1);
}
}
long long func(long long a) {
memo[0] = 0;
memo[1] = 1;
if (memo[a] != 0)
return memo[a];
return memo[a] = a * func(a - 1);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<string> s(n);
map<string, lint> mp;
rep(i, n) {
string t;
cin >> t;
sort(all(t));
mp[t]++;
}
auto it = mp.begin();
lint ans = 0;
while (it != mp.end()) {
// cout << it->second << endl;
ans += it->second * (it->second - 1) / 2;
it++;
}
cout << ans << endl;
return 0;
}
|
[
"assignment.change"
] | 746,421
| 746,420
|
u764228018
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;
int main() {
int N;
cin >> N;
vector<string> S(N);
rep(i, N) cin >> S[i];
rep(i, N) sort(S[i].begin(), S[i].end());
ll ans = 0;
map<string, int> mp;
rep(i, N) mp[S[i]]++;
for (auto p : mp)
if (p.second != 1) {
int a = p.second - 1;
ans += a * (a + 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;
int main() {
int N;
cin >> N;
vector<string> S(N);
rep(i, N) cin >> S[i];
rep(i, N) sort(S[i].begin(), S[i].end());
ll ans = 0;
map<string, ll> mp;
rep(i, N) mp[S[i]]++;
for (auto p : mp)
if (p.second != 1) {
ll a = p.second - 1;
ans += a * (a + 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,422
| 746,423
|
u480938608
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i, m, n) for (int(i) = (int)(m); (i) < (int)(n); ++(i))
#define rREP(i, m, n) for (int(i) = (n)-1; (i) >= (m); --(i))
#define all(x) (x).begin(), (x).end()
#define out(y, x, h, w) (y) < 0 || (x) < 0 || (y) >= (h) || (x) >= (w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
cin.tie(nullptr);
cout.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
int main() {
init();
int N;
cin >> N;
vector<string> vec(N);
map<string, int> mp;
rep(i, 0, N) {
cin >> vec[i];
sort(all(vec[i]));
mp[vec[i]]++;
}
int ans = 0;
for (auto p : mp) {
ans += (p.second * (p.second - 1)) / 2;
}
cout << ans << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i, m, n) for (int(i) = (int)(m); (i) < (int)(n); ++(i))
#define rREP(i, m, n) for (int(i) = (n)-1; (i) >= (m); --(i))
#define all(x) (x).begin(), (x).end()
#define out(y, x, h, w) (y) < 0 || (x) < 0 || (y) >= (h) || (x) >= (w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
cin.tie(nullptr);
cout.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
int main() {
init();
int N;
cin >> N;
vector<string> vec(N);
map<string, ll> mp;
rep(i, 0, N) {
cin >> vec[i];
sort(all(vec[i]));
mp[vec[i]]++;
}
ll ans = 0;
for (auto p : mp) {
ans += (p.second * (p.second - 1)) / 2;
}
cout << ans << "\n";
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,424
| 746,425
|
u813559924
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto p : mp) {
int a = p.second;
ans += (long long)a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto p : mp) {
int a = p.second;
ans += (long long)a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,426
| 746,427
|
u813559924
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto p : mp) {
int a = p.second;
ans *= (long long)a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto p : mp) {
int a = p.second;
ans += (long long)a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"expression.operator.change"
] | 746,428
| 746,427
|
u813559924
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<char> s(10);
map<string, int> num;
for (int i = 0; i < n; i++) {
string temp;
cin >> temp;
for (int j = 0; j < 10; j++) {
s.at(j) = temp.at(j);
}
sort(s.begin(), s.end());
temp = "";
for (int j = 0; j < 10; j++) {
temp += s.at(j);
}
num[temp]++;
}
long long ans = 0;
for (auto p : num) {
ans += (p.second - 1) * p.second / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<char> s(10);
map<string, long long> num;
for (int i = 0; i < n; i++) {
string temp;
cin >> temp;
for (int j = 0; j < 10; j++) {
s.at(j) = temp.at(j);
}
sort(s.begin(), s.end());
temp = "";
for (int j = 0; j < 10; j++) {
temp += s.at(j);
}
num[temp]++;
}
long long ans = 0;
for (auto p : num) {
ans += (p.second - 1) * p.second / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,429
| 746,430
|
u718758485
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll num = 0;
for (auto p : mp) {
num += p.second * (p.second - 1) / 2;
}
cout << num << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll num = 0;
for (auto p : mp) {
num += p.second * (ll)(p.second - 1) / 2;
}
cout << num << endl;
}
|
[] | 746,431
| 746,432
|
u371149954
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define MAXN 200100
#define pii pair<int, int>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x < n and y >= 0 and y < n)
using namespace std;
const ll mod = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
map<string, int> st;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
st[s]++;
}
ll ans = 0;
for (auto it : st) {
if (it.ss > 1)
ans += (it.ss * (it.ss - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define MAXN 200100
#define pii pair<int, int>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x < n and y >= 0 and y < n)
using namespace std;
const ll mod = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
map<string, ll> st;
ll n;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
st[s]++;
}
ll ans = 0;
for (auto it : st) {
if (it.ss > 1)
ans += (it.ss * (it.ss - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,439
| 746,440
|
u009937643
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main() {
int N;
cin >> N;
string S;
unordered_map<string, int> list;
for (int i = 0; i < N; i++) {
cin >> S;
sort(S.begin(), S.end());
list[S]++;
}
int ans = 0;
for (auto pair : list) {
ans += pair.second * (pair.second - 1) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main() {
int N;
cin >> N;
string S;
unordered_map<string, int64_t> list;
for (int i = 0; i < N; i++) {
cin >> S;
sort(S.begin(), S.end());
list[S]++;
}
int64_t ans = 0;
for (auto pair : list) {
ans += pair.second * (pair.second - 1) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,441
| 746,442
|
u058742919
|
cpp
|
p02947
|
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using namespace std;
constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;
int main(void) {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; ++i) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
mp[tmp]++;
}
int ans = 0;
for (auto x : mp) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using namespace std;
constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;
int main(void) {
int n;
cin >> n;
map<string, ll> mp;
for (int i = 0; i < n; ++i) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
mp[tmp]++;
}
ll ans = 0;
for (auto x : mp) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,448
| 746,449
|
u835805357
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
#define PI 3.14159265359
#define MOD 1000000007
const int MAX = 510000;
int main() {
int N;
cin >> N;
vector<string> a(N);
map<string, int> mp;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
a[i] = s;
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
#define PI 3.14159265359
#define MOD 1000000007
const int MAX = 510000;
int main() {
int N;
cin >> N;
vector<string> a(N);
map<string, ll> mp;
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
a[i] = s;
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans;
}
|
[] | 746,452
| 746,453
|
u763976642
|
cpp
|
p02947
|
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repo(i, n) for (int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
#define pi acos(-1.0)
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// cout << fixed << setprecision (20); 小数点以下20桁まで
// intの最大値2147483647 ≒ 2×10^9
// long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16; で大文字に
//'大文字'+=32; で小文字に
// s[i]-'0'でchar文字→int数に;
// string s = to_string(int数);
// int n = stoi(string文字列)
//実行時間制約2秒では2×10^8回くらいまで計算できる
int main() {
int n;
cin >> n;
map<string, int> p;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
if (p.count(s))
p.at(s)++;
else
p[s] = 1;
}
int ans = 0;
for (auto x : p) {
auto t = x.se;
ans += t * (t - 1) / 2;
}
cout << ans << endl;
}
|
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repo(i, n) for (int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
#define pi acos(-1.0)
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// cout << fixed << setprecision (20); 小数点以下20桁まで
// intの最大値2147483647 ≒ 2×10^9
// long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16; で大文字に
//'大文字'+=32; で小文字に
// s[i]-'0'でchar文字→int数に;
// string s = to_string(int数);
// int n = stoi(string文字列)
//実行時間制約2秒では2×10^8回くらいまで計算できる
int main() {
int n;
cin >> n;
unordered_map<string, int> p;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
if (p.count(s))
p.at(s)++;
else
p[s] = 1;
}
ll ans = 0;
for (auto x : p) {
auto t = x.se;
ans += (ll)t * (t - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,454
| 746,455
|
u604329931
|
cpp
|
p02947
|
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repo(i, n) for (int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
#define pi acos(-1.0)
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// cout << fixed << setprecision (20); 小数点以下20桁まで
// intの最大値2147483647 ≒ 2×10^9
// long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16; で大文字に
//'大文字'+=32; で小文字に
// s[i]-'0'でchar文字→int数に;
// string s = to_string(int数);
// int n = stoi(string文字列)
//実行時間制約2秒では2×10^8回くらいまで計算できる
int main() {
int n;
cin >> n;
map<string, int> p;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
if (p.count(s))
p.at(s)++;
else
p[s] = 1;
}
int ans = 0;
for (auto x : p) {
auto t = x.se;
ans += t * (t - 1) / 2;
}
cout << ans << endl;
}
|
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repo(i, n) for (int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
#define pi acos(-1.0)
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// cout << fixed << setprecision (20); 小数点以下20桁まで
// intの最大値2147483647 ≒ 2×10^9
// long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16; で大文字に
//'大文字'+=32; で小文字に
// s[i]-'0'でchar文字→int数に;
// string s = to_string(int数);
// int n = stoi(string文字列)
//実行時間制約2秒では2×10^8回くらいまで計算できる
int main() {
int n;
cin >> n;
map<string, int> p;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
if (p.count(s))
p.at(s)++;
else
p[s] = 1;
}
ll ans = 0;
for (auto x : p) {
auto t = x.se;
ans += (ll)t * (t - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,454
| 746,456
|
u604329931
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
vector<string> s;
void solve() {
map<string, int> mp;
for (int i = 0; i < N; i++) {
sort(s[i].begin(), s[i].end());
mp[s[i]]++;
}
ll res = 0;
for (auto p : mp) {
if (p.second >= 2) {
res += p.second * (p.second - 1) / 2;
}
}
cout << res << '\n';
}
int main() {
cin >> N;
s.resize(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
}
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
vector<string> s;
void solve() {
map<string, ll> mp;
for (int i = 0; i < N; i++) {
sort(s[i].begin(), s[i].end());
mp[s[i]]++;
}
ll res = 0;
for (auto p : mp) {
if (p.second >= 2) {
res += p.second * (p.second - 1) / 2;
}
}
cout << res << '\n';
}
int main() {
cin >> N;
s.resize(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
}
solve();
return 0;
}
|
[] | 746,459
| 746,460
|
u319242216
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll, ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(), v.end())
#define ull unsigned long long
#define tell(a) cout << a << " "
#define el cout << endl
#define rev(v) reverse(v.begin(), v.end())
#define rep(i, a, n) for (int i = a; i < n; i++)
#define M 1000000007
ll power(ll x, ll y, ll p) {
ll res = 1;
x = x % p;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
int main() {
IOS;
int n;
cin >> n;
string s[n];
map<string, int> m;
rep(i, 0, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]]++;
}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); it++) {
ans = ans + ((it->ss) * ((it->ss) - 1)) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll, ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(), v.end())
#define ull unsigned long long
#define tell(a) cout << a << " "
#define el cout << endl
#define rev(v) reverse(v.begin(), v.end())
#define rep(i, a, n) for (int i = a; i < n; i++)
#define M 1000000007
ll power(ll x, ll y, ll p) {
ll res = 1;
x = x % p;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return res;
}
int main() {
IOS;
int n;
cin >> n;
string s[n];
map<string, long long> m;
rep(i, 0, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]]++;
}
ll ans = 0;
for (auto it = m.begin(); it != m.end(); it++) {
ans = ans + ((it->ss) * ((it->ss) - 1)) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,467
| 746,468
|
u845300227
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <vector>
void solve(int N, std::vector<std::string> S) {
for (auto &s : S) {
std::sort(s.begin(), s.end());
}
std::sort(S.begin(), S.end());
int anagram_count = 1;
long long combination_count = 0;
for (int i = 1; i < S.size(); i++) {
if (S[i] == S[i - 1]) {
anagram_count++;
}
if (S[i] != S[i - 1] || i == S.size() - 1) {
combination_count += anagram_count * (anagram_count - 1) / 2;
anagram_count = 1;
}
}
std::cout << combination_count << std::endl;
}
int main(void) {
int N;
std::cin >> N;
std::vector<std::string> s(N);
for (auto i0 = 0; i0 < N; ++i0) {
std::cin >> s[i0];
}
solve(N, s);
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <vector>
void solve(int N, std::vector<std::string> S) {
for (auto &s : S) {
std::sort(s.begin(), s.end());
}
std::sort(S.begin(), S.end());
long long anagram_count = 1;
long long combination_count = 0;
for (int i = 1; i < S.size(); i++) {
if (S[i] == S[i - 1]) {
anagram_count++;
}
if (S[i] != S[i - 1] || i == S.size() - 1) {
combination_count += anagram_count * (anagram_count - 1) / 2;
anagram_count = 1;
}
}
std::cout << combination_count << std::endl;
}
int main(void) {
int N;
std::cin >> N;
std::vector<std::string> s(N);
for (auto i0 = 0; i0 < N; ++i0) {
std::cin >> s[i0];
}
solve(N, s);
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,471
| 746,472
|
u083254278
|
cpp
|
p02947
|
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VL;
typedef vector<vector<ll>> VVL;
typedef vector<double> VD;
typedef vector<vector<double>> VVD;
const double PI = 3.14159265358979323846;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPLL1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())
#define ZERO(a) memset(a, 0, sizeof(a))
#define RAD(d) (PI * (d) / 180)
#define DEG(r) (180.0 * (r) / PI)
#define POPCOUNT(x) __builtin_popcount(x)
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template <class T> void dump(const vector<T> &v) {
REP(i, SZ(v) - 1) { cout << v[i] << " "; }
cout << v[SZ(v) - 1] << endl;
}
template <class T> void dump(int w, int h, const vector<T> &v) {
REP(j, h) {
REP(i, w - 1) { cout << v[j * w + i] << " "; }
cout << v[j * w + w - 1] << endl;
}
}
// 和
template <class T> T accumulate(const vector<T> &v) {
T sum = 0;
REP(i, SZ(v)) { sum += v[i]; }
return sum;
}
// 和(範囲指定)
template <class T> T accumulate(const vector<T> &v, int start, int length) {
T sum = 0;
REP(i, length) { sum += v[start + i]; }
return sum;
}
// 平均
template <class T> T average(const vector<T> &v) {
return accumulate(v) / SZ(v);
}
// 行列
template <class T> struct Matrix {
T w, h;
vector<T> A;
Matrix(T w_, T h_) : w(w_), h(h_), A(w * h) {}
T get(T x, T y) const { return A[y * w + x]; }
};
template <class T> void input(Matrix<T> &m) {
REP(j, m.h) {
REP(i, m.w) { cin >> m.A[j * m.w + i]; }
}
}
template <class T> Matrix<T> prod(const Matrix<T> &a, const Matrix<T> &b) {
Matrix<T> m(b.w, a.h);
REP(j, m.h) {
REP(i, m.w) {
ll c = 0;
REP(k, a.w) { c += a.A[j * a.w + k] * b.A[k * b.w + i]; }
m.A[j * m.w + i] = c;
}
}
return m;
}
void dump(const Matrix<ll> &m) {
REP(j, m.h) {
REP(i, m.w - 1) { printf("%lld ", m.A[j * m.w + i]); }
printf("%lld\n", m.A[j * m.w + m.w - 1]);
}
}
void dump(const Matrix<double> &m) {
REP(j, m.h) {
REP(i, m.w - 1) { printf("%f ", m.A[j * m.w + i]); }
printf("%f\n", m.A[j * m.w + m.w - 1]);
}
}
// 文字列の大文字化
string &to_upper(string &s) {
REP(i, s.length()) {
if ('a' <= s[i] && s[i] <= 'z') {
s[i] -= 32;
}
}
return s;
}
// 文字列の小文字化
string &to_lower(string &s) {
REP(i, s.length()) {
if ('A' <= s[i] && s[i] <= 'Z') {
s[i] += 32;
}
}
return s;
}
// すべての約数を列挙する
template <class T> vector<T> get_divisors(T n) {
vector<T> ret;
for (T i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(ALL(ret));
return ret;
}
// 1-sqrt(N)までの約数を列挙する
template <class T> vector<T> get_divisors2(T n) {
vector<T> ret;
for (T i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
}
}
return ret;
}
// 最大公約数(※ユークリッドの互除法)
template <class T> T gcd(T a, T b) {
if (a < b)
return gcd(b, a);
ll r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
// 3数の最大公約数(※ユークリッドの互除法)
template <class T> T gcd(T a, T b, T c) { return gcd(gcd(a, b), c); }
// 3数以上の最大公約数
template <class T> T gcd(const vector<T> v) {
if (SZ(v) == 0)
return 0;
if (SZ(v) == 1)
return v[0];
if (SZ(v) == 2)
return gcd(v[0], v[1]);
T g = v[0];
for (int i = 1; i < SZ(v); i++) {
g = gcd(g, v[i]);
}
return g;
}
// MOD計算
//
// modint 構造体を使ってみませんか? (C++) - noshi91のメモ
// https://noshi91.hatenablog.com/entry/2019/03/31/174006
//
// 使い方:
// const int MOD = 1000000007;
// using mint = modint<MOD>;
// mint a = 1234;
//
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
int main() {
int N;
cin >> N;
map<string, int> m;
int ans = 0;
REP(i, N) {
string s;
cin >> s;
sort(ALL(s));
ans += m[s]++;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VL;
typedef vector<vector<ll>> VVL;
typedef vector<double> VD;
typedef vector<vector<double>> VVD;
const double PI = 3.14159265358979323846;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPLL1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())
#define ZERO(a) memset(a, 0, sizeof(a))
#define RAD(d) (PI * (d) / 180)
#define DEG(r) (180.0 * (r) / PI)
#define POPCOUNT(x) __builtin_popcount(x)
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template <class T> void dump(const vector<T> &v) {
REP(i, SZ(v) - 1) { cout << v[i] << " "; }
cout << v[SZ(v) - 1] << endl;
}
template <class T> void dump(int w, int h, const vector<T> &v) {
REP(j, h) {
REP(i, w - 1) { cout << v[j * w + i] << " "; }
cout << v[j * w + w - 1] << endl;
}
}
// 和
template <class T> T accumulate(const vector<T> &v) {
T sum = 0;
REP(i, SZ(v)) { sum += v[i]; }
return sum;
}
// 和(範囲指定)
template <class T> T accumulate(const vector<T> &v, int start, int length) {
T sum = 0;
REP(i, length) { sum += v[start + i]; }
return sum;
}
// 平均
template <class T> T average(const vector<T> &v) {
return accumulate(v) / SZ(v);
}
// 行列
template <class T> struct Matrix {
T w, h;
vector<T> A;
Matrix(T w_, T h_) : w(w_), h(h_), A(w * h) {}
T get(T x, T y) const { return A[y * w + x]; }
};
template <class T> void input(Matrix<T> &m) {
REP(j, m.h) {
REP(i, m.w) { cin >> m.A[j * m.w + i]; }
}
}
template <class T> Matrix<T> prod(const Matrix<T> &a, const Matrix<T> &b) {
Matrix<T> m(b.w, a.h);
REP(j, m.h) {
REP(i, m.w) {
ll c = 0;
REP(k, a.w) { c += a.A[j * a.w + k] * b.A[k * b.w + i]; }
m.A[j * m.w + i] = c;
}
}
return m;
}
void dump(const Matrix<ll> &m) {
REP(j, m.h) {
REP(i, m.w - 1) { printf("%lld ", m.A[j * m.w + i]); }
printf("%lld\n", m.A[j * m.w + m.w - 1]);
}
}
void dump(const Matrix<double> &m) {
REP(j, m.h) {
REP(i, m.w - 1) { printf("%f ", m.A[j * m.w + i]); }
printf("%f\n", m.A[j * m.w + m.w - 1]);
}
}
// 文字列の大文字化
string &to_upper(string &s) {
REP(i, s.length()) {
if ('a' <= s[i] && s[i] <= 'z') {
s[i] -= 32;
}
}
return s;
}
// 文字列の小文字化
string &to_lower(string &s) {
REP(i, s.length()) {
if ('A' <= s[i] && s[i] <= 'Z') {
s[i] += 32;
}
}
return s;
}
// すべての約数を列挙する
template <class T> vector<T> get_divisors(T n) {
vector<T> ret;
for (T i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(ALL(ret));
return ret;
}
// 1-sqrt(N)までの約数を列挙する
template <class T> vector<T> get_divisors2(T n) {
vector<T> ret;
for (T i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
}
}
return ret;
}
// 最大公約数(※ユークリッドの互除法)
template <class T> T gcd(T a, T b) {
if (a < b)
return gcd(b, a);
ll r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
// 3数の最大公約数(※ユークリッドの互除法)
template <class T> T gcd(T a, T b, T c) { return gcd(gcd(a, b), c); }
// 3数以上の最大公約数
template <class T> T gcd(const vector<T> v) {
if (SZ(v) == 0)
return 0;
if (SZ(v) == 1)
return v[0];
if (SZ(v) == 2)
return gcd(v[0], v[1]);
T g = v[0];
for (int i = 1; i < SZ(v); i++) {
g = gcd(g, v[i]);
}
return g;
}
// MOD計算
//
// modint 構造体を使ってみませんか? (C++) - noshi91のメモ
// https://noshi91.hatenablog.com/entry/2019/03/31/174006
//
// 使い方:
// const int MOD = 1000000007;
// using mint = modint<MOD>;
// mint a = 1234;
//
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
int main() {
int N;
cin >> N;
map<string, int> m;
ll ans = 0;
REP(i, N) {
string s;
cin >> s;
sort(ALL(s));
ans += m[s]++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,477
| 746,478
|
u081029414
|
cpp
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.