problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k โ | fixed_code stringlengths 12 526k โ | labels listlengths 0 15 โ | buggy_submission_id int64 1 1.54M โ | fixed_submission_id int64 2 1.54M โ | user_id stringlengths 10 10 โ | language stringclasses 9 values |
|---|---|---|---|---|---|---|---|
p02947 | #pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 10;
typedef long long ll;
vector<int> ve[maxn];
int as[maxn];
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
map<string, int> mp;
for (int i = 1; i <= n; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto v = mp.begin(); v != mp.end(); v++) {
int a = v->second;
ans += (ll)a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
} | #pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 10;
typedef long long ll;
vector<int> ve[maxn];
int as[maxn];
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
map<string, int> mp;
for (int i = 1; i <= n; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto v = mp.begin(); v != mp.end(); v++) {
int a = v->second;
ans += (ll)a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 748,690 | 748,691 | u337233447 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, count = 1, kotae = 0;
cin >> n;
string s[n];
char x[10];
for (i = 0; i < n; i++) {
cin >> s[i];
for (j = 0; j < 10; j++) {
x[j] = s[i][j];
}
sort(x, x + 10);
for (j = 0; j < 10; j++) {
s[i][j] = x[j];
}
}
sort(s, s + n);
for (i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
count++;
} else {
kotae += (count * (count - 1)) / 2;
count = 1;
}
}
kotae += (count * (count - 1)) / 2;
count = 1;
cout << kotae;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j;
long int count = 1, kotae = 0;
cin >> n;
string s[n];
char x[10];
for (i = 0; i < n; i++) {
cin >> s[i];
for (j = 0; j < 10; j++) {
x[j] = s[i][j];
}
sort(x, x + 10);
for (j = 0; j < 10; j++) {
s[i][j] = x[j];
}
}
sort(s, s + n);
for (i = 1; i < n; i++) {
if (s[i] == s[i - 1]) {
count++;
} else {
kotae += (count * (count - 1)) / 2;
count = 1;
}
}
kotae += (count * (count - 1)) / 2;
count = 1;
cout << kotae;
}
| [
"variable_declaration.type.widen.change"
] | 748,692 | 748,693 | u016726316 | cpp |
p02947 | // JSD
#include <algorithm>
#include <iostream>
#include <map>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1) {
cout << 1;
return 0;
}
ll ans = 0;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (auto x : m) {
ans += ((x.second * (x.second - 1)) / 2);
}
cout << ans << "\n";
return 0;
} | // JSD
#include <algorithm>
#include <iostream>
#include <map>
#define ll long long
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1) {
cout << 1;
return 0;
}
ll ans = 0;
map<string, ll> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (auto x : m) {
ans += ((x.second * (x.second - 1)) / 2);
}
cout << ans << "\n";
return 0;
} | [] | 748,696 | 748,697 | u436019023 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int sum;
int n;
string a;
map<string, int> p;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a;
sort(a.begin(), a.end());
sum += p[a];
p[a]++;
}
cout << sum;
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
using namespace std;
long long sum;
int n;
string a;
map<string, int> p;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a;
sort(a.begin(), a.end());
sum += p[a];
p[a]++;
}
cout << sum;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,702 | 748,703 | u275358946 | cpp |
p02947 | // abc.cpp :
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define MOD 1000000007
#define rp(i, n) for (int i = 0; i < (n); i++)
#define irp(i, n) for (int i = (n); i >= 0; i--)
#define up(i, s, e, d) for (int i = (s); i < (e); i += (d))
#define dw(i, s, e, d) for (int i = (s); i > (e); i -= (d))
#define in(x) cin >> (x)
#define ot(x) cout << (x)
#define ote(x) cout << (x) << endl
void bye(auto x, int code = 0) {
cout << (x) << endl;
exit(code);
}
void p1(vi v) {
for (auto a : v) {
ot(a);
ot(",");
}
}
void p2(vvi &x) {
for (auto v : x) {
ot("[");
p1(v);
ot("]\n");
}
}
int main() {
int n;
cin >> n;
map<string, int> m;
rp(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto e : m) {
// ote(e.first);
// ote(e.second);
if (e.second > 1)
ans += e.second * (e.second - 1) / 2;
}
ote(ans);
} | // abc.cpp :
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define MOD 1000000007
#define rp(i, n) for (int i = 0; i < (n); i++)
#define irp(i, n) for (int i = (n); i >= 0; i--)
#define up(i, s, e, d) for (int i = (s); i < (e); i += (d))
#define dw(i, s, e, d) for (int i = (s); i > (e); i -= (d))
#define in(x) cin >> (x)
#define ot(x) cout << (x)
#define ote(x) cout << (x) << endl
void bye(auto x, int code = 0) {
cout << (x) << endl;
exit(code);
}
void p1(vi v) {
for (auto a : v) {
ot(a);
ot(",");
}
}
void p2(vvi &x) {
for (auto v : x) {
ot("[");
p1(v);
ot("]\n");
}
}
int main() {
int n;
cin >> n;
map<string, ll> m;
rp(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll ans = 0;
for (auto e : m) {
// ote(e.first);
// ote(e.second);
if (e.second > 1)
ans += e.second * (e.second - 1) / 2;
}
ote(ans);
} | [] | 748,706 | 748,707 | u525065967 | cpp |
p02947 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FASTIO \
ios::sync_with_stdio(0); \
cin.tie(0);
#define show(x) cout << #x << " = " << x << "\n"
#define mem(a, b) memset(a, b, sizeof a)
#define popcnt(x) __builtin_popcount(x)
#define all(x) x.begin(), x.end()
#define mod(x, m) ((x % m + m) % m)
#define SZ(a) (int)a.size()
#define ll long long
#define ld long double
#define vii vector<ll>
#define dqi deque<ll>
#define sii set<ll>
#define vpi vector<pii>
#define mii map<ll, ll>
#define pii pair<ll, ll>
#define pi pair<int, int>
#define pb push_back
#define F first
#define S second
#define L length()
#define OO (ll)1e18
#define lSOne(x) (x & -x)
#define EPS 1e-20
using namespace std;
using namespace __gnu_pbds;
void ONLINE__JUDGE();
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
pii swapii(pii pr) { return {pr.S, pr.F}; }
ll binEXP(ll x, ll pw, ll MOD = LLONG_MAX);
int dx[] = {0, 0, -1, +1, -1, +1, -1, +1};
int dy[] = {-1, +1, 0, 0, -1, +1, +1, -1};
const ll MOD = 1e9 + 7;
const ll MAX = 2e5 + 7;
ll x, cnt;
map<string, int> mp;
int main() {
FASTIO // ONLINE__JUDGE();
cin >>
x;
for (int i = 0; i < x; ++i) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
for (auto i : mp) {
cnt += ((i.S * (i.S - 1)) >> 1);
}
cout << cnt;
return 0;
}
void ONLINE__JUDGE() {
#ifndef ONLINE_JUDGE
freopen("inp.c", "r", stdin);
// freopen( "OutPut.txt" , "w" , stdout );
#endif // ONLINE_JUDGE
}
ll binEXP(ll x, ll pw, ll MOD) {
ll res = 1;
while (pw > 0) {
pw % 2 ? res *= x : 0;
x *= x;
x %= MOD;
pw /= 2;
res %= MOD;
}
return res %= MOD;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FASTIO \
ios::sync_with_stdio(0); \
cin.tie(0);
#define show(x) cout << #x << " = " << x << "\n"
#define mem(a, b) memset(a, b, sizeof a)
#define popcnt(x) __builtin_popcount(x)
#define all(x) x.begin(), x.end()
#define mod(x, m) ((x % m + m) % m)
#define SZ(a) (int)a.size()
#define ll long long
#define ld long double
#define vii vector<ll>
#define dqi deque<ll>
#define sii set<ll>
#define vpi vector<pii>
#define mii map<ll, ll>
#define pii pair<ll, ll>
#define pi pair<int, int>
#define pb push_back
#define F first
#define S second
#define L length()
#define OO (ll)1e18
#define lSOne(x) (x & -x)
#define EPS 1e-20
using namespace std;
using namespace __gnu_pbds;
void ONLINE__JUDGE();
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
pii swapii(pii pr) { return {pr.S, pr.F}; }
ll binEXP(ll x, ll pw, ll MOD = LLONG_MAX);
int dx[] = {0, 0, -1, +1, -1, +1, -1, +1};
int dy[] = {-1, +1, 0, 0, -1, +1, +1, -1};
const ll MOD = 1e9 + 7;
const ll MAX = 2e5 + 7;
ll x, cnt;
map<string, ll> mp;
int main() {
FASTIO // ONLINE__JUDGE();
cin >>
x;
for (int i = 0; i < x; ++i) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
for (auto i : mp) {
cnt += ((i.S * (i.S - 1)) >> 1);
}
cout << cnt;
return 0;
}
void ONLINE__JUDGE() {
#ifndef ONLINE_JUDGE
freopen("inp.c", "r", stdin);
// freopen( "OutPut.txt" , "w" , stdout );
#endif // ONLINE_JUDGE
}
ll binEXP(ll x, ll pw, ll MOD) {
ll res = 1;
while (pw > 0) {
pw % 2 ? res *= x : 0;
x *= x;
x %= MOD;
pw /= 2;
res %= MOD;
}
return res %= MOD;
}
| [] | 748,708 | 748,709 | u302539304 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
long long a, b = 0;
cin >> a;
map<string, int> mp;
for (int i = 0; i < a; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
b += ((it->second * (it->second - 1)) / 2);
// cout << it->first << ' ' << it->second << endl;
}
cout << b;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
long long a, b = 0;
cin >> a;
map<string, int> mp;
for (int i = 0; i < a; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
b += (((long long)it->second * (it->second - 1)) / 2);
// cout << it->first << ' ' << it->second << endl;
}
cout << b;
return 0;
} | [
"type_conversion.add"
] | 748,710 | 748,711 | u858440663 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
long double a, b = 0;
cin >> a;
map<string, int> mp;
for (int i = 0; i < a; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
b += ((it->second * (it->second - 1)) / 2);
// cout << it->first << ' ' << it->second << endl;
}
cout << b;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
long long a, b = 0;
cin >> a;
map<string, int> mp;
for (int i = 0; i < a; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
b += (((long long)it->second * (it->second - 1)) / 2);
// cout << it->first << ' ' << it->second << endl;
}
cout << b;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 748,712 | 748,711 | u858440663 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int a, b = 0;
cin >> a;
map<string, int> mp;
for (int i = 0; i < a; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
b += ((it->second * (it->second - 1)) / 2);
// cout << it->first << ' ' << it->second << endl;
}
cout << b;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
long long a, b = 0;
cin >> a;
map<string, int> mp;
for (int i = 0; i < a; i++) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (map<string, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
b += (((long long)it->second * (it->second - 1)) / 2);
// cout << it->first << ' ' << it->second << endl;
}
cout << b;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,713 | 748,711 | u858440663 | cpp |
p02947 | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int j = 0; j < N; j++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += s * (s - 1) / 2;
}
cout << ans << endl;
} | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int j = 0; j < N; j++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += (long long)s * (s - 1) / 2;
}
cout << ans << endl;
} | [
"type_conversion.add"
] | 748,717 | 748,718 | u964726243 | cpp |
p02947 | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int j = 0; j < N; j++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += s * (s - 1) / 2;
}
cout << ans << endl;
} | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> mp;
for (int j = 0; j < N; j++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += (long long)s * (s - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,719 | 748,718 | u964726243 | cpp |
p02947 | #include "bits/stdc++.h"
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> cnt;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(begin(s), end(s));
cnt[s]++;
}
long long ans = 0;
for (auto p : cnt) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
}
| #include "bits/stdc++.h"
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> cnt;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(begin(s), end(s));
cnt[s]++;
}
long long ans = 0;
for (auto p : cnt) {
ans += 1ll * p.second * (p.second - 1) / 2;
}
cout << ans << endl;
}
| [
"assignment.change"
] | 748,720 | 748,721 | u443010331 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame \
{ \
puts("-1"); \
return 0; \
}
#define yn \
{ puts("Yes"); } \
else { \
puts("No"); \
}
const int MAX_N = 100005;
string s[MAX_N];
int main() {
int n;
cin >> n;
rep(i, n) {
string ss;
cin >> ss;
int x[10];
rep(j, 10) { x[j] = (int)ss[j]; }
sort(x, x + 10);
rep(j, 10) { s[i] += (char)x[j]; }
}
sort(s, s + n);
ll ans = 0;
int count = 0;
rep(i, n) {
if (i == 0) {
count++;
} else {
if (s[i] == s[i - 1]) {
count++;
} else {
ans += (count - 1) * count / 2;
count = 1;
}
}
if (i == n - 1) {
ans += (count - 1) * count / 2;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame \
{ \
puts("-1"); \
return 0; \
}
#define yn \
{ puts("Yes"); } \
else { \
puts("No"); \
}
const int MAX_N = 100005;
string s[MAX_N];
int main() {
int n;
cin >> n;
rep(i, n) {
string ss;
cin >> ss;
int x[10];
rep(j, 10) { x[j] = (int)ss[j]; }
sort(x, x + 10);
rep(j, 10) { s[i] += (char)x[j]; }
}
sort(s, s + n);
ll ans = 0;
ll count = 0;
rep(i, n) {
if (i == 0) {
count++;
} else {
if (s[i] == s[i - 1]) {
count++;
} else {
ans += (count - 1) * count / 2;
count = 1;
}
}
if (i == n - 1) {
ans += (count - 1) * count / 2;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 748,722 | 748,723 | u791593901 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define SORT(c) sort((c).begin(), (c).end())
#define MOD 1000000007 // S.size() ้
ๅๅ.Length()
using namespace std;
typedef unsigned long long ll;
int main(void) {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
SORT(s);
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
int num = x.second;
ans += num * (num - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define SORT(c) sort((c).begin(), (c).end())
#define MOD 1000000007 // S.size() ้
ๅๅ.Length()
using namespace std;
typedef unsigned long long ll;
int main(void) {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
SORT(s);
mp[s]++;
}
ll ans = 0;
for (auto x : mp) {
int num = x.second;
ans += (ll)num * (num - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"type_conversion.add"
] | 748,724 | 748,725 | u174509352 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string s[100005], now;
int sum[100005];
int main() {
int N, c = 1;
cin >> N;
long long p = 0;
for (int i = 1; i <= N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s + 1, s + N + 1);
for (int i = 1; i <= N; i++) {
if (now != s[i]) {
now = s[i];
sum[c] = 1;
c++;
} else
sum[c - 1]++;
}
for (int i = 1; i < c; i++) {
if (sum[i] != 1) {
p = p + (sum[i] * (sum[i] - 1)) / 2;
}
}
printf("%lld", p);
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string s[100005], now;
long long sum[100005];
int main() {
int N, c = 1;
cin >> N;
long long p = 0;
for (int i = 1; i <= N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s + 1, s + N + 1);
for (int i = 1; i <= N; i++) {
if (now != s[i]) {
now = s[i];
sum[c] = 1;
c++;
} else
sum[c - 1]++;
}
for (int i = 1; i < c; i++) {
if (sum[i] != 1) {
p = p + (sum[i] * (sum[i] - 1)) / 2;
}
}
printf("%lld", p);
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,726 | 748,727 | u528036644 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string s[100005], now;
int sum[100005];
int main() {
int N, c = 1;
cin >> N;
long long p = 0;
for (int i = 1; i <= N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s + 1, s + N + 1);
for (int i = 1; i <= N; i++) {
if (now != s[i]) {
now = s[i];
sum[c] = 1;
c++;
} else
sum[c - 1]++;
}
for (int i = 1; i <= c; i++) {
if (sum[i] != 1) {
p = p + (sum[i] * (sum[i] - 1)) / 2;
}
}
printf("%lld", p);
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string s[100005], now;
long long sum[100005];
int main() {
int N, c = 1;
cin >> N;
long long p = 0;
for (int i = 1; i <= N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s + 1, s + N + 1);
for (int i = 1; i <= N; i++) {
if (now != s[i]) {
now = s[i];
sum[c] = 1;
c++;
} else
sum[c - 1]++;
}
for (int i = 1; i < c; i++) {
if (sum[i] != 1) {
p = p + (sum[i] * (sum[i] - 1)) / 2;
}
}
printf("%lld", p);
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 748,728 | 748,727 | u528036644 | cpp |
p02947 | //==================================================================================================
// Name : WinryRockbell.cpp
// Author : lotus.eater086
// Copyright : If you're reading this then this warning is for you. Every word
// you read of this
// useless fine print is another second of your life. Don't you've
// other things to do? Is your life so empty that you honestly
// can't think of a better way to spend these moments ? Or are you
// so impressed with authority that you give respect and credence
// to all who claim it ? Do you read everything you're supposed to
// read ? Do you think everything you're supposed to think ? Buy
// what you're told you should want ? Get out of your apartment .
// Meet a member of the opposite sex. Stop the excessive shopping
// and self-improvement . Quit your boring job. Start a fight.
// Prove you're alive. If you don't claim your humanity you'll
// become a statistic. You've been warned !
// Description :
// Date : 2019-08-11
// Time : 13:07:27
// Directory :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode FilePath :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode\WinryRockbell.cpp
//==================================================================================================
#include <bits/stdc++.h>
#define LL long long
#define endl "\n"
using namespace std;
//
template <typename T>
inline T read(T &x) {
x = 0;
int f = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
f |= (ch == '-'), ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
}
return x = f ? -x : x;
}
//
void solve(void) {
int n;
read(n);
vector<string> vs;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
vs.emplace_back(s);
}
map<string, LL> msi; // key_value , mapped_value
for (int i = 0; i < vs.size(); i++) {
msi[vs[i]]++;
}
LL ans = 0;
for (auto i = msi.begin(); i != msi.end(); i++) {
int x = i->second;
ans += (LL)((x * x - x) / 2);
}
cout << ans << endl;
}
int main(void)
{
// ios_base::sync_with_stdio( false ) ; cin.tie( NULL ) ; cout.tie( NULL ) ;
if (0) {
int t = 100;
for (int i = 1; i <= t; i++)
solve();
}
else {
solve();
}
return 0;
}
| //==================================================================================================
// Name : WinryRockbell.cpp
// Author : lotus.eater086
// Copyright : If you're reading this then this warning is for you. Every word
// you read of this
// useless fine print is another second of your life. Don't you've
// other things to do? Is your life so empty that you honestly
// can't think of a better way to spend these moments ? Or are you
// so impressed with authority that you give respect and credence
// to all who claim it ? Do you read everything you're supposed to
// read ? Do you think everything you're supposed to think ? Buy
// what you're told you should want ? Get out of your apartment .
// Meet a member of the opposite sex. Stop the excessive shopping
// and self-improvement . Quit your boring job. Start a fight.
// Prove you're alive. If you don't claim your humanity you'll
// become a statistic. You've been warned !
// Description :
// Date : 2019-08-11
// Time : 13:07:27
// Directory :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode FilePath :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode\WinryRockbell.cpp
//==================================================================================================
#include <bits/stdc++.h>
#define LL long long
#define endl "\n"
using namespace std;
//
template <typename T>
inline T read(T &x) {
x = 0;
int f = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
f |= (ch == '-'), ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
}
return x = f ? -x : x;
}
//
void solve(void) {
int n;
read(n);
vector<string> vs;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
vs.emplace_back(s);
}
map<string, LL> msi; // key_value , mapped_value
for (int i = 0; i < vs.size(); i++) {
msi[vs[i]]++;
}
LL ans = 0;
for (auto i = msi.begin(); i != msi.end(); i++) {
LL x = i->second;
ans += ((x * x - x) / 2);
}
cout << ans << endl;
}
int main(void)
{
// ios_base::sync_with_stdio( false ) ; cin.tie( NULL ) ; cout.tie( NULL ) ;
if (0) {
int t = 100;
for (int i = 1; i <= t; i++)
solve();
}
else {
solve();
}
return 0;
}
| [
"variable_declaration.type.change"
] | 748,733 | 748,734 | u507591519 | cpp |
p02947 | //==================================================================================================
// Name : WinryRockbell.cpp
// Author : lotus.eater086
// Copyright : If you're reading this then this warning is for you. Every word
// you read of this
// useless fine print is another second of your life. Don't you've
// other things to do? Is your life so empty that you honestly
// can't think of a better way to spend these moments ? Or are you
// so impressed with authority that you give respect and credence
// to all who claim it ? Do you read everything you're supposed to
// read ? Do you think everything you're supposed to think ? Buy
// what you're told you should want ? Get out of your apartment .
// Meet a member of the opposite sex. Stop the excessive shopping
// and self-improvement . Quit your boring job. Start a fight.
// Prove you're alive. If you don't claim your humanity you'll
// become a statistic. You've been warned !
// Description :
// Date : 2019-08-11
// Time : 13:07:27
// Directory :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode FilePath :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode\WinryRockbell.cpp
//==================================================================================================
#include <bits/stdc++.h>
#define LL long long
#define endl "\n"
using namespace std;
//
template <typename T>
inline T read(T &x) {
x = 0;
int f = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
f |= (ch == '-'), ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
}
return x = f ? -x : x;
}
//
void solve(void) {
int n;
read(n);
vector<string> vs;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
vs.emplace_back(s);
}
map<string, int> msi; // key_value , mapped_value
for (int i = 0; i < vs.size(); i++) {
msi[vs[i]]++;
}
LL ans = 0;
for (auto i = msi.begin(); i != msi.end(); i++) {
int x = i->second;
ans += (LL)((x * x - x) / 2);
}
cout << ans << endl;
}
int main(void)
{
// ios_base::sync_with_stdio( false ) ; cin.tie( NULL ) ; cout.tie( NULL ) ;
if (0) {
int t = 100;
for (int i = 1; i <= t; i++)
solve();
}
else {
solve();
}
return 0;
}
| //==================================================================================================
// Name : WinryRockbell.cpp
// Author : lotus.eater086
// Copyright : If you're reading this then this warning is for you. Every word
// you read of this
// useless fine print is another second of your life. Don't you've
// other things to do? Is your life so empty that you honestly
// can't think of a better way to spend these moments ? Or are you
// so impressed with authority that you give respect and credence
// to all who claim it ? Do you read everything you're supposed to
// read ? Do you think everything you're supposed to think ? Buy
// what you're told you should want ? Get out of your apartment .
// Meet a member of the opposite sex. Stop the excessive shopping
// and self-improvement . Quit your boring job. Start a fight.
// Prove you're alive. If you don't claim your humanity you'll
// become a statistic. You've been warned !
// Description :
// Date : 2019-08-11
// Time : 13:07:27
// Directory :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode FilePath :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode\WinryRockbell.cpp
//==================================================================================================
#include <bits/stdc++.h>
#define LL long long
#define endl "\n"
using namespace std;
//
template <typename T>
inline T read(T &x) {
x = 0;
int f = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
f |= (ch == '-'), ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
}
return x = f ? -x : x;
}
//
void solve(void) {
int n;
read(n);
vector<string> vs;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
vs.emplace_back(s);
}
map<string, LL> msi; // key_value , mapped_value
for (int i = 0; i < vs.size(); i++) {
msi[vs[i]]++;
}
LL ans = 0;
for (auto i = msi.begin(); i != msi.end(); i++) {
LL x = i->second;
ans += ((x * x - x) / 2);
}
cout << ans << endl;
}
int main(void)
{
// ios_base::sync_with_stdio( false ) ; cin.tie( NULL ) ; cout.tie( NULL ) ;
if (0) {
int t = 100;
for (int i = 1; i <= t; i++)
solve();
}
else {
solve();
}
return 0;
}
| [
"variable_declaration.type.change"
] | 748,735 | 748,734 | u507591519 | cpp |
p02947 | //==================================================================================================
// Name : WinryRockbell.cpp
// Author : lotus.eater086
// Copyright : If you're reading this then this warning is for you. Every word
// you read of this
// useless fine print is another second of your life. Don't you've
// other things to do? Is your life so empty that you honestly
// can't think of a better way to spend these moments ? Or are you
// so impressed with authority that you give respect and credence
// to all who claim it ? Do you read everything you're supposed to
// read ? Do you think everything you're supposed to think ? Buy
// what you're told you should want ? Get out of your apartment .
// Meet a member of the opposite sex. Stop the excessive shopping
// and self-improvement . Quit your boring job. Start a fight.
// Prove you're alive. If you don't claim your humanity you'll
// become a statistic. You've been warned !
// Description :
// Date : 2019-08-11
// Time : 13:07:27
// Directory :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode FilePath :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode\WinryRockbell.cpp
//==================================================================================================
#include <bits/stdc++.h>
#define LL long long
#define endl "\n"
using namespace std;
//
template <typename T>
inline T read(T &x) {
x = 0;
int f = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
f |= (ch == '-'), ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
}
return x = f ? -x : x;
}
//
void solve(void) {
int n;
read(n);
vector<string> vs;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
vs.emplace_back(s);
}
map<string, int> msi; // key_value , mapped_value
for (int i = 0; i < vs.size(); i++) {
msi[vs[i]]++;
}
int ans = 0;
for (auto i = msi.begin(); i != msi.end(); i++) {
int x = i->second;
ans += ((x * x - x) / 2);
}
cout << ans << endl;
}
int main(void)
{
// ios_base::sync_with_stdio( false ) ; cin.tie( NULL ) ; cout.tie( NULL ) ;
if (0) {
int t = 100;
for (int i = 1; i <= t; i++)
solve();
}
else {
solve();
}
return 0;
}
| //==================================================================================================
// Name : WinryRockbell.cpp
// Author : lotus.eater086
// Copyright : If you're reading this then this warning is for you. Every word
// you read of this
// useless fine print is another second of your life. Don't you've
// other things to do? Is your life so empty that you honestly
// can't think of a better way to spend these moments ? Or are you
// so impressed with authority that you give respect and credence
// to all who claim it ? Do you read everything you're supposed to
// read ? Do you think everything you're supposed to think ? Buy
// what you're told you should want ? Get out of your apartment .
// Meet a member of the opposite sex. Stop the excessive shopping
// and self-improvement . Quit your boring job. Start a fight.
// Prove you're alive. If you don't claim your humanity you'll
// become a statistic. You've been warned !
// Description :
// Date : 2019-08-11
// Time : 13:07:27
// Directory :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode FilePath :
// C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode\WinryRockbell.cpp
//==================================================================================================
#include <bits/stdc++.h>
#define LL long long
#define endl "\n"
using namespace std;
//
template <typename T>
inline T read(T &x) {
x = 0;
int f = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
f |= (ch == '-'), ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
}
return x = f ? -x : x;
}
//
void solve(void) {
int n;
read(n);
vector<string> vs;
while (n--) {
string s;
cin >> s;
sort(s.begin(), s.end());
vs.emplace_back(s);
}
map<string, LL> msi; // key_value , mapped_value
for (int i = 0; i < vs.size(); i++) {
msi[vs[i]]++;
}
LL ans = 0;
for (auto i = msi.begin(); i != msi.end(); i++) {
LL x = i->second;
ans += ((x * x - x) / 2);
}
cout << ans << endl;
}
int main(void)
{
// ios_base::sync_with_stdio( false ) ; cin.tie( NULL ) ; cout.tie( NULL ) ;
if (0) {
int t = 100;
for (int i = 1; i <= t; i++)
solve();
}
else {
solve();
}
return 0;
}
| [
"variable_declaration.type.change"
] | 748,736 | 748,734 | u507591519 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
std::vector<string> words(N);
for (int i = 0; i < N; i++) {
cin >> words.at(i);
}
std::map<std::string, int> counter;
string tmp_str;
long cnt = 0;
for (int i = 0; i < N; i++) {
tmp_str = words.at(i);
sort(tmp_str.begin(), tmp_str.end());
counter[tmp_str]++;
}
for (auto word : counter) {
cnt += word.second * (word.second - 1) / 2;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
std::vector<string> words(N);
for (int i = 0; i < N; i++) {
cin >> words.at(i);
}
std::map<std::string, long> counter;
string tmp_str;
long long cnt = 0;
for (int i = 0; i < N; i++) {
tmp_str = words.at(i);
sort(tmp_str.begin(), tmp_str.end());
// cnt += counter[tmp_str]; //ใใใ ใฃใใAC
counter[tmp_str]++;
}
for (auto word : counter) {
cnt += word.second * (word.second - 1) / 2; //ใใใ ใฃใใb11ใWA
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,737 | 748,738 | u578276786 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
std::vector<string> words(N);
for (int i = 0; i < N; i++) {
cin >> words.at(i);
}
std::map<std::string, int> counter;
string tmp_str;
int cnt = 0;
for (int i = 0; i < N; i++) {
tmp_str = words.at(i);
sort(tmp_str.begin(), tmp_str.end());
counter[tmp_str]++;
}
for (auto word : counter) {
cnt += word.second * (word.second - 1) / 2;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
std::vector<string> words(N);
for (int i = 0; i < N; i++) {
cin >> words.at(i);
}
std::map<std::string, long> counter;
string tmp_str;
long long cnt = 0;
for (int i = 0; i < N; i++) {
tmp_str = words.at(i);
sort(tmp_str.begin(), tmp_str.end());
// cnt += counter[tmp_str]; //ใใใ ใฃใใAC
counter[tmp_str]++;
}
for (auto word : counter) {
cnt += word.second * (word.second - 1) / 2; //ใใใ ใฃใใb11ใWA
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,739 | 748,738 | u578276786 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> words(N);
for (int i = 0; i < N; ++i) {
cin >> words[i];
}
map<string, int> counter;
string tmp_str;
long long cnt = 0;
for (int i = 0; i < N; ++i) {
tmp_str = words[i];
sort(tmp_str.begin(), tmp_str.end());
// cnt += counter[tmp_str];
++counter[tmp_str];
}
for (auto word : counter) {
cnt += word.second * (word.second - 1) / 2;
}
cout << cnt << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> words(N);
for (int i = 0; i < N; ++i) {
cin >> words[i];
}
map<string, long> counter;
string tmp_str;
long long cnt = 0;
for (int i = 0; i < N; ++i) {
tmp_str = words[i];
sort(tmp_str.begin(), tmp_str.end());
// cnt += counter[tmp_str];
++counter[tmp_str];
// cout << tmp_str << ':' << counter[tmp_str] << endl;
}
for (auto word : counter) {
cnt += word.second * (word.second - 1) / 2;
// cout << word.first << ':' << word.second << endl;
}
cout << cnt << endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 748,742 | 748,743 | u002386242 | cpp |
p02947 | //#pragma GCC optimize(3)
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define lowbit(x) x &(-x)
typedef long long ll;
typedef long double lb;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const int maxn = 1000;
int read();
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
std::vector<string> v(maxn);
map<string, int> mp;
string str;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
v.at(i) = str;
mp[str]++;
}
ll ans = 0;
for (int i = 0; i < n; i++) {
string s = v.at(i);
if (mp[s] > 0)
ans += mp[s] - 1;
mp[s]--;
}
cout << ans << endl;
return 0;
}
inline int read() {
int x = 0, w = 0;
char ch = 0;
while (!isdigit(ch)) {
w |= (ch == '-');
ch = getchar();
}
while (isdigit(ch)) {
x = (x << 3) + (x << 1) + (ch ^ 48);
ch = getchar();
}
return w ? -x : x;
}
| //#pragma GCC optimize(3)
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define lowbit(x) x &(-x)
typedef long long ll;
typedef long double lb;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const int maxn = 100005;
int read();
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
std::vector<string> v(maxn);
map<string, int> mp;
string str;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
v.at(i) = str;
mp[str]++;
}
ll ans = 0;
for (int i = 0; i < n; i++) {
string s = v.at(i);
if (mp[s] > 0)
ans += mp[s] - 1;
mp[s]--;
}
cout << ans << endl;
return 0;
}
inline int read() {
int x = 0, w = 0;
char ch = 0;
while (!isdigit(ch)) {
w |= (ch == '-');
ch = getchar();
}
while (isdigit(ch)) {
x = (x << 3) + (x << 1) + (ch ^ 48);
ch = getchar();
}
return w ? -x : x;
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 748,744 | 748,745 | u930838529 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define vl vector<long long int>
#define vi vector<int>
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define _ << " " <<
#define forn(x, n) for (int x = 0; x < n; ++x)
#define forn1(x, n) for (int x = 1; x <= n; ++x)
#define IOS \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
void scan() {}
template <typename F, typename... R> void scan(F &f, R &...r) {
cin >> f;
scan(r...);
}
int di_;
string dnms_, co_ = ",";
void debug_() { cout << endl; }
template <typename F, typename... R> void debug_(F &f, R &...r) {
while (dnms_[di_] != ',')
cout << dnms_[di_++];
di_++;
cout << ": " << f << ",";
debug_(r...);
}
#define debug(...) dnms_ = #__VA_ARGS__ + co_, di_ = 0, debug_(__VA_ARGS__)
template <class A, class B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
return out << "(" << a.first << "," << a.second << ")";
}
template <class A> ostream &operator<<(ostream &out, const vector<A> &a) {
out << "";
for (auto it = a.begin(); it != a.end(); it++) {
if (it != a.begin())
out << " ";
out << *it;
}
out << "";
return out;
}
template <class A, class B> istream &operator>>(istream &in, pair<A, B> &a) {
in >> a.first >> a.second;
return in;
}
template <class A> istream &operator>>(istream &in, vector<A> &a) {
for (A &i : a)
in >> i;
return in;
}
int main() {
IOS
int n;
cin >> n;
std::vector<string> v;
string s;
forn(i, n) {
cin >> s;
sort(s.begin(), s.end());
v.push_back(s);
}
sort(v.begin(), v.end());
int c = 0;
ll total = 0;
for (int i = 0; i < n;) {
s = v[i];
c = 0;
while (i < n && (v[i] == s)) {
c++;
i++;
}
total += ((c * (c - 1)) / 2);
}
cout << total;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define vl vector<long long int>
#define vi vector<int>
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define _ << " " <<
#define forn(x, n) for (int x = 0; x < n; ++x)
#define forn1(x, n) for (int x = 1; x <= n; ++x)
#define IOS \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
void scan() {}
template <typename F, typename... R> void scan(F &f, R &...r) {
cin >> f;
scan(r...);
}
int di_;
string dnms_, co_ = ",";
void debug_() { cout << endl; }
template <typename F, typename... R> void debug_(F &f, R &...r) {
while (dnms_[di_] != ',')
cout << dnms_[di_++];
di_++;
cout << ": " << f << ",";
debug_(r...);
}
#define debug(...) dnms_ = #__VA_ARGS__ + co_, di_ = 0, debug_(__VA_ARGS__)
template <class A, class B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
return out << "(" << a.first << "," << a.second << ")";
}
template <class A> ostream &operator<<(ostream &out, const vector<A> &a) {
out << "";
for (auto it = a.begin(); it != a.end(); it++) {
if (it != a.begin())
out << " ";
out << *it;
}
out << "";
return out;
}
template <class A, class B> istream &operator>>(istream &in, pair<A, B> &a) {
in >> a.first >> a.second;
return in;
}
template <class A> istream &operator>>(istream &in, vector<A> &a) {
for (A &i : a)
in >> i;
return in;
}
int main() {
IOS
int n;
cin >> n;
std::vector<string> v;
string s;
forn(i, n) {
cin >> s;
sort(s.begin(), s.end());
v.push_back(s);
}
sort(v.begin(), v.end());
ll c = 0;
ll total = 0;
for (int i = 0; i < n;) {
s = v[i];
c = 0;
while (i < n && (v[i] == s)) {
c++;
i++;
}
total += ((c * (c - 1)) >> 1);
}
cout << total;
return 0;
} | [
"variable_declaration.type.change"
] | 748,746 | 748,747 | u678053360 | cpp |
p02947 | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
string s[100010];
int tab[100000][26] = {};
int skip[100000] = {};
int main() {
int N;
cin >> N;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
unordered_map<string, int> dict;
int cnt = 0;
int c = 0;
rep(i, N) {
cnt += dict[s[i]];
dict[s[i]]++;
}
cout << cnt << endl;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
string s[100010];
int tab[100000][26] = {};
int skip[100000] = {};
int main() {
int N;
cin >> N;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
unordered_map<string, int> dict;
long long cnt = 0;
int c = 0;
rep(i, N) {
cnt += dict[s[i]];
dict[s[i]]++;
}
cout << cnt << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,750 | 748,751 | u601256797 | cpp |
p02947 | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
string s[100000];
int tab[100000][26] = {};
int skip[100000] = {};
int main() {
int N;
cin >> N;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
unordered_map<string, int> dict;
int cnt = 0;
int c = 0;
rep(i, N) {
cnt += dict[s[i]];
dict[s[i]]++;
}
cout << cnt << endl;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
string s[100010];
int tab[100000][26] = {};
int skip[100000] = {};
int main() {
int N;
cin >> N;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
unordered_map<string, int> dict;
long long cnt = 0;
int c = 0;
rep(i, N) {
cnt += dict[s[i]];
dict[s[i]]++;
}
cout << cnt << endl;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,752 | 748,751 | u601256797 | cpp |
p02947 | //#include "SaveFuncs.cpp"
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(ๆกๆฐ);
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <stdexcept>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rrep1(i, n) for (int i = (n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr int DIV = 1000000007; // 10e9+7
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> T divUp(T a, T b) {
if (a % b == 0) {
return a / b;
}
return a / b + 1;
}
std::string strMulti(std::string t, int n) {
std::string out = "";
for (int i = 0; i < n; i++) {
out += t;
}
return out;
}
template <class T> T mathP(T m, T n) {
int ret = 1;
for (int i = m; i > m - n; i--) {
ret *= i;
}
return ret;
}
template <class T> T mathC(T m, T n) {
int ret = mathP(m, n);
for (int i = 2; i <= n; i++) {
ret /= i;
}
return ret;
}
/*****/
int Main() {
int N;
cin >> N;
vector<string> S(N);
rep(i, N) {
string txt;
cin >> txt;
sort(all(txt));
S.at(i) = txt;
}
sort(all(S));
ll ret = 0;
int end = 0;
for (int i = 0; i < N; i++) {
if (S.at(end) != S.at(i)) {
ret += mathC((ll)(i - end), 2ll);
end = i;
}
}
ret += mathC((ll)(N - end), 2ll);
cout << ret;
return 0;
}
/*****/
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
Main();
return 0;
}
| //#include "SaveFuncs.cpp"
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(ๆกๆฐ);
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <stdexcept>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rrep1(i, n) for (int i = (n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr int DIV = 1000000007; // 10e9+7
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> T divUp(T a, T b) {
if (a % b == 0) {
return a / b;
}
return a / b + 1;
}
std::string strMulti(std::string t, int n) {
std::string out = "";
for (int i = 0; i < n; i++) {
out += t;
}
return out;
}
template <class T> T mathP(T m, T n) {
T ret = 1;
for (T i = m; i > m - n; i--) {
ret *= i;
}
return ret;
}
template <class T> T mathC(T m, T n) {
T ret = mathP(m, n);
for (T i = 2; i <= n; i++) {
ret /= i;
}
return ret;
}
/*****/
int Main() {
int N;
cin >> N;
vector<string> S(N);
rep(i, N) {
string txt;
cin >> txt;
sort(all(txt));
S.at(i) = txt;
}
sort(all(S));
ll ret = 0;
int end = 0;
for (int i = 0; i < N; i++) {
if (S.at(end) != S.at(i)) {
ret += mathC((ll)i - (ll)end, 2ll);
end = i;
}
}
ret += mathC((ll)N - (ll)end, 2ll);
cout << ret;
return 0;
}
/*****/
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
Main();
return 0;
}
| [
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 748,756 | 748,757 | u588369531 | cpp |
p02947 | //#include "SaveFuncs.cpp"
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(ๆกๆฐ);
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <stdexcept>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rrep1(i, n) for (int i = (n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr int DIV = 1000000007; // 10e9+7
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> T divUp(T a, T b) {
if (a % b == 0) {
return a / b;
}
return a / b + 1;
}
std::string strMulti(std::string t, int n) {
std::string out = "";
for (int i = 0; i < n; i++) {
out += t;
}
return out;
}
template <class T> T mathP(T m, T n) {
int ret = 1;
for (int i = m; i > m - n; i--) {
ret *= i;
}
return ret;
}
template <class T> T mathC(T m, T n) {
int ret = mathP(m, n);
for (int i = 2; i <= n; i++) {
ret /= i;
}
return ret;
}
/*****/
int Main() {
int N;
cin >> N;
vector<string> S(N);
rep(i, N) {
string txt;
cin >> txt;
sort(all(txt));
S.at(i) = txt;
}
sort(all(S));
ll ret = 0;
int end = 0;
for (int i = 0; i < N; i++) {
if (S.at(end) != S.at(i)) {
ret += mathC(i - end, 2);
end = i;
}
}
ret += mathC(N - end, 2);
cout << ret;
return 0;
}
/*****/
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
Main();
return 0;
}
| //#include "SaveFuncs.cpp"
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(ๆกๆฐ);
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <stdexcept>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define rrep1(i, n) for (int i = (n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr int DIV = 1000000007; // 10e9+7
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> T divUp(T a, T b) {
if (a % b == 0) {
return a / b;
}
return a / b + 1;
}
std::string strMulti(std::string t, int n) {
std::string out = "";
for (int i = 0; i < n; i++) {
out += t;
}
return out;
}
template <class T> T mathP(T m, T n) {
T ret = 1;
for (T i = m; i > m - n; i--) {
ret *= i;
}
return ret;
}
template <class T> T mathC(T m, T n) {
T ret = mathP(m, n);
for (T i = 2; i <= n; i++) {
ret /= i;
}
return ret;
}
/*****/
int Main() {
int N;
cin >> N;
vector<string> S(N);
rep(i, N) {
string txt;
cin >> txt;
sort(all(txt));
S.at(i) = txt;
}
sort(all(S));
ll ret = 0;
int end = 0;
for (int i = 0; i < N; i++) {
if (S.at(end) != S.at(i)) {
ret += mathC((ll)i - (ll)end, 2ll);
end = i;
}
}
ret += mathC((ll)N - (ll)end, 2ll);
cout << ret;
return 0;
}
/*****/
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
Main();
return 0;
}
| [
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 748,758 | 748,757 | u588369531 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, y, sum = 0;
string str;
map<string, int> mp;
cin >> n;
while (n--) {
cin >> str;
sort(str.begin(), str.end());
mp[str]++;
}
map<string, int>::iterator it;
for (it = mp.begin(); it != mp.end(); it++) {
x = (it->second) - 1;
y = (x * (x + 1)) / 2;
sum += y;
}
cout << sum << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, x, y, sum = 0;
string str;
map<string, long long int> mp;
cin >> n;
while (n--) {
cin >> str;
sort(str.begin(), str.end());
mp[str]++;
}
map<string, long long int>::iterator it;
for (it = mp.begin(); it != mp.end(); it++) {
x = (it->second) - 1;
y = (x * (x + 1)) / 2;
sum += y;
}
cout << sum << endl;
return 0;
}
| [
"variable_declaration.type.widen.change"
] | 748,759 | 748,760 | u052071180 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric> //xใจyใฎๆๅคงๅ
ฌ็ดๆฐใฏ__gcd(x,y),xใจyใฎๆๅฐๅ
ฌๅๆฐใฏ(x*y)/__gcd
#include <string>
#include <vector>
#include <map>
#include <set>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
// map,setใฎใใๆน่ฆใใ
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
ll ans = 0;
// set<string> st,pre;
map<string, int> mp;
rep(i, n) { mp[s[i]]++; }
for (auto itr : mp) {
ans += itr.second * (itr.second - 1) / 2;
}
cout << ans;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric> //xใจyใฎๆๅคงๅ
ฌ็ดๆฐใฏ__gcd(x,y),xใจyใฎๆๅฐๅ
ฌๅๆฐใฏ(x*y)/__gcd
#include <string>
#include <vector>
#include <map>
#include <set>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
// map,setใฎใใๆน่ฆใใ
int main() {
ll n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
ll ans = 0;
// set<string> st,pre;
map<string, int> mp;
rep(i, n) { mp[s[i]]++; }
for (auto itr : mp) {
ans += (ll)itr.second * (itr.second - 1) / 2;
}
cout << ans;
return 0;
}
| [
"type_conversion.add"
] | 748,761 | 748,762 | u667375816 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long int ll;
int N;
string s[100000];
int main(void) {
cin >> N;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + N);
ll count = 0;
int i = 0, j = 1;
while (i < N) {
int a = 0;
if (j == N - 1) {
if (s[i] != s[j])
a = j - i;
else
a = j - i + 1;
j++;
} else if (s[i] != s[j]) {
a = j - i;
i = j;
j++;
} else {
j++;
continue;
}
if (a > 1) {
count += a * (a - 1) / 2;
}
if (j > N - 1)
break;
}
cout << count << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long int ll;
int N;
string s[100000];
int main(void) {
cin >> N;
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + N);
ll count = 0;
int i = 0, j = 1;
while (i < N) {
ll a = 0;
if (j == N - 1) {
if (s[i] != s[j])
a = j - i;
else
a = j - i + 1;
j++;
} else if (s[i] != s[j]) {
a = j - i;
i = j;
j++;
} else {
j++;
continue;
}
if (a > 1) {
count += a * (a - 1) / 2;
}
if (j > N - 1)
break;
}
cout << count << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 748,763 | 748,764 | u097408484 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long cnt = 0;
for (auto &kv : mp) {
cnt += kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long cnt = 0;
for (auto &kv : mp) {
cnt += kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,772 | 748,773 | u539914590 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int cnt = 0;
for (auto &kv : mp) {
cnt += (long long)kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long cnt = 0;
for (auto &kv : mp) {
cnt += kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,774 | 748,773 | u539914590 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int cnt = 0;
for (auto &kv : mp) {
cnt += kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long cnt = 0;
for (auto &kv : mp) {
cnt += kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,775 | 748,773 | u539914590 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int cnt = 0;
for (auto &kv : mp) {
cnt += (long long)kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long cnt = 0;
for (auto &kv : mp) {
cnt += (long long)kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,774 | 748,776 | u539914590 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int cnt = 0;
for (auto &kv : mp) {
cnt += kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
int main() {
int n;
cin >> n;
map<string, long> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long cnt = 0;
for (auto &kv : mp) {
cnt += (long long)kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,775 | 748,776 | u539914590 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int calcNumOfCombination(int n, int r) {
int num = 1;
for (int i = 1; i <= r; i++) {
num = num * (n - i + 1) / i;
}
return num;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s.at(i);
map<string, int> b;
rep(i, n) {
sort(s.at(i).begin(), s.at(i).end());
string key = s.at(i);
if (b.find(key) == b.end()) {
b[key] = 1;
} else {
b[key]++;
}
}
int cnt = 0;
for (auto &kv : b) {
cnt += kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int calcNumOfCombination(long n, long r) {
long num = 1;
for (long i = 1; i <= r; i++) {
num = num * (n - i + 1) / i;
}
return num;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s.at(i);
map<string, long> b;
rep(i, n) {
sort(s.at(i).begin(), s.at(i).end());
string key = s.at(i);
if (b.find(key) == b.end()) {
b[key] = 1;
} else {
b[key]++;
}
}
long cnt = 0;
for (auto &kv : b) {
cnt += kv.second * (kv.second - 1) / 2;
}
cout << cnt << endl;
}
| [
"variable_declaration.type.primitive.change",
"control_flow.loop.for.initializer.change"
] | 748,777 | 748,778 | u539914590 | cpp |
p02947 | #include <bits/stdc++.h>
#define INF 1e9
using namespace std;
using ll = long long;
int main() {
ll N;
cin >> N;
map<string, int> s;
for (int i = 0; i < N; ++i) {
string str;
cin >> str;
sort(str.begin(), str.end());
if (s.count(str) == 1) {
s[str] += 1;
} else {
s[str] = 1;
}
}
ll ans = 0;
for (auto item : s) {
ans += (item.second * (item.second - 1)) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define INF 1e9
using namespace std;
using ll = long long;
int main() {
ll N;
cin >> N;
map<string, ll> s;
for (int i = 0; i < N; ++i) {
string str;
cin >> str;
sort(str.begin(), str.end());
if (s.count(str) == 1) {
s[str] += 1;
} else {
s[str] = 1;
}
}
ll ans = 0;
for (auto item : s) {
ans += (item.second * (item.second - 1)) / 2;
}
cout << ans << endl;
} | [] | 748,779 | 748,780 | u701556979 | cpp |
p02947 | #define _USE_MATH_DEFINES
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(a) (a).begin(), (a).end()
const int MOD = 1000000007;
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 (a > b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
VS s(n);
rep(i, n) cin >> s.at(i);
rep(i, n) { sort(all(s.at(i))); }
LL ans = 0;
map<string, int> mp;
rep(i, n) { mp[s.at(i)]++; }
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
int m = itr->second;
ans += m * (m - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #define _USE_MATH_DEFINES
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(a) (a).begin(), (a).end()
const int MOD = 1000000007;
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 (a > b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
VS s(n);
rep(i, n) cin >> s.at(i);
rep(i, n) { sort(all(s.at(i))); }
LL ans = 0;
map<string, int> mp;
rep(i, n) { mp[s.at(i)]++; }
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
LL m = itr->second;
ans += m * (m - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 748,781 | 748,782 | u662614053 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int n;
string s[100010];
int main() {
scanf("%d", &n);
cin >> ws;
for (int i = 0; i < n; i++)
getline(cin, s[i]), sort(s[i].begin(), s[i].end());
sort(s, s + n);
long long ans = 0;
int ct = 1;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1])
ct++;
else {
ans += (long long)ct * (ct - 1) / 2;
ct = 1;
}
}
ans += ct * (ct - 1) / 2;
printf("%lld\n", ans);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int n;
string s[100010];
int main() {
scanf("%d", &n);
cin >> ws;
for (int i = 0; i < n; i++)
getline(cin, s[i]), sort(s[i].begin(), s[i].end());
sort(s, s + n);
long long ans = 0;
int ct = 1;
for (int i = 1; i < n; i++) {
if (s[i] == s[i - 1])
ct++;
else {
ans += (long long)ct * (ct - 1) / 2;
ct = 1;
}
}
ans += (long long)ct * (ct - 1) / 2;
printf("%lld\n", ans);
return 0;
} | [
"type_conversion.add"
] | 748,783 | 748,784 | u272347605 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; ++i)
#define FORR(i, a, n) for (int i = a; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
// int in() { int x; scanf("%d", &x); return x; }
// ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a) {
int n = a.size();
FOR(i, n) cout << a[i] << " ";
}
int main() {
ll n;
cin >> n;
vector<string> vs(n);
for (ll i = 0; i < n; i++)
cin >> vs[i];
map<string, int> cnt;
int ans = 0;
for (auto s : vs) {
sort(s.begin(), s.end());
ans += cnt[s];
cnt[s]++;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; ++i)
#define FORR(i, a, n) for (int i = a; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
// int in() { int x; scanf("%d", &x); return x; }
// ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a) {
int n = a.size();
FOR(i, n) cout << a[i] << " ";
}
int main() {
ll n;
cin >> n;
vector<string> vs(n);
for (ll i = 0; i < n; i++)
cin >> vs[i];
map<string, int> cnt;
ll ans = 0;
for (auto s : vs) {
sort(s.begin(), s.end());
ans += cnt[s];
cnt[s]++;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 748,785 | 748,786 | u522598953 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; ++i)
#define FORR(i, a, n) for (int i = a; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
// int in() { int x; scanf("%d", &x); return x; }
// ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a) {
int n = a.size();
FOR(i, n) cout << a[i] << " ";
}
int main() {
ll n;
cin >> n;
vector<string> vs(n);
for (int i = 0; i < n; i++)
cin >> vs[i];
map<string, int> cnt;
int ans = 0;
for (auto s : vs) {
sort(s.begin(), s.end());
ans += cnt[s];
cnt[s]++;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; ++i)
#define FORR(i, a, n) for (int i = a; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
// int in() { int x; scanf("%d", &x); return x; }
// ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a) {
int n = a.size();
FOR(i, n) cout << a[i] << " ";
}
int main() {
ll n;
cin >> n;
vector<string> vs(n);
for (ll i = 0; i < n; i++)
cin >> vs[i];
map<string, int> cnt;
ll ans = 0;
for (auto s : vs) {
sort(s.begin(), s.end());
ans += cnt[s];
cnt[s]++;
}
cout << ans << endl;
return 0;
}
| [
"control_flow.loop.for.initializer.change",
"variable_declaration.type.change"
] | 748,787 | 748,786 | u522598953 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; ++i)
#define FORR(i, a, n) for (int i = a; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
// int in() { int x; scanf("%d", &x); return x; }
// ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a) {
int n = a.size();
FOR(i, n) cout << a[i] << " ";
}
int main() {
int n;
cin >> n;
vector<string> vs(n);
for (int i = 0; i < n; i++)
cin >> vs[i];
map<string, int> cnt;
int ans = 0;
for (auto s : vs) {
sort(s.begin(), s.end());
ans += cnt[s];
cnt[s]++;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for (int i = 0; i < n; ++i)
#define FORR(i, a, n) for (int i = a; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
// int in() { int x; scanf("%d", &x); return x; }
// ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a) {
int n = a.size();
FOR(i, n) cout << a[i] << " ";
}
int main() {
ll n;
cin >> n;
vector<string> vs(n);
for (ll i = 0; i < n; i++)
cin >> vs[i];
map<string, int> cnt;
ll ans = 0;
for (auto s : vs) {
sort(s.begin(), s.end());
ans += cnt[s];
cnt[s]++;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 748,788 | 748,786 | u522598953 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low, high, i) for (i = low; i < high; i++)
#define forrev(high, low, i) for (i = high; i >= low; i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) \
for (auto x : a) \
cout << x << ' '; \
cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a, b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';
typedef unordered_map<int, int> umi;
typedef unordered_map<ll, ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;
clock_t time_p = clock();
void ktj() {
time_p = clock() - time_p;
cerr << "Time elapsed : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
int main() {
fastio
int n;
cin >> n;
map<string, int> cnt;
while (n--) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
ll ans = 0;
for (auto c : cnt) {
ans += ((c.ss) * (c.ss - 1)) / 2;
}
cout << ans << '\n';
ktj();
}
| #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low, high, i) for (i = low; i < high; i++)
#define forrev(high, low, i) for (i = high; i >= low; i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) \
for (auto x : a) \
cout << x << ' '; \
cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a, b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';
typedef unordered_map<int, int> umi;
typedef unordered_map<ll, ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;
clock_t time_p = clock();
void ktj() {
time_p = clock() - time_p;
cerr << "Time elapsed : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
int main() {
fastio
int n;
cin >> n;
map<string, ll> cnt;
while (n--) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
ll ans = 0;
for (auto c : cnt) {
ans += ((c.ss) * (c.ss - 1)) / 2;
}
cout << ans << '\n';
ktj();
}
| [] | 748,789 | 748,790 | u707524027 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define ppi pair<int, int>
#define ppl pair<ll, ll>
#define all(x) x.begin(), x.end()
#define ii int, int
#define mm map<ii>
#define ff first
#define ss second
#define forn(i, a, b) for (int i = a; i < b; i++)
#define forr(i, a, b) for (int i = a; i >= b; i--)
#define forv(i, m) for (auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define sze size()
#define rvs reverse
#define itr iterator
/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/
/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a =
a*a;b = b>>1;} return product;} ll power(ll a,ll b,ll md) {ll product = 1;
while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;}
return product%md;} ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);} ll LCM(ll
a,ll b) {return (a/GCD(a,b))*b; }
*/
int main() {
fast
int n;
cin >> n;
unordered_map<string, ll> m;
string str;
for (int i = 0; i < n; i++) {
cin >> str;
sort(all(str));
m[str]++;
}
ll total = 0;
for (auto i : m) {
total = (i.ss * (i.ss - 1)) / 2;
}
cout << total;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define ppi pair<int, int>
#define ppl pair<ll, ll>
#define all(x) x.begin(), x.end()
#define ii int, int
#define mm map<ii>
#define ff first
#define ss second
#define forn(i, a, b) for (int i = a; i < b; i++)
#define forr(i, a, b) for (int i = a; i >= b; i--)
#define forv(i, m) for (auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define sze size()
#define rvs reverse
#define itr iterator
/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/
/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a =
a*a;b = b>>1;} return product;} ll power(ll a,ll b,ll md) {ll product = 1;
while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;}
return product%md;} ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);} ll LCM(ll
a,ll b) {return (a/GCD(a,b))*b; }
*/
int main() {
fast
int n;
cin >> n;
unordered_map<string, ll> m;
string str;
for (int i = 0; i < n; i++) {
cin >> str;
sort(all(str));
m[str]++;
}
ll total = 0;
for (auto i : m) {
total += (i.ss * (i.ss - 1)) / 2;
}
cout << total;
return 0;
} | [
"assignment.value.change"
] | 748,791 | 748,792 | u460819600 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
bool anagram(string a, string b) {
sort(a.begin(), a.end());
sort(b.begin(), b.end());
return a == b;
}
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());
string current = s[0];
int current_count = 1;
ll count = 0;
for (int i = 1; i <= N; i++) {
if (i == N) {
count += (current_count - 1) * (current_count);
break;
}
if (s[i] == current) {
current_count++;
} else {
count += (current_count - 1) * (current_count);
current_count = 1;
current = s[i];
}
}
cout << (count + 1) / 2 << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
bool anagram(string a, string b) {
sort(a.begin(), a.end());
sort(b.begin(), b.end());
return a == b;
}
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());
string current = s[0];
ll current_count = 1;
ll count = 0;
for (int i = 1; i <= N; i++) {
if (i == N) {
count += (current_count - 1) * (current_count);
break;
}
if (s[i] == current) {
current_count++;
} else {
count += (current_count - 1) * (current_count);
current_count = 1;
current = s[i];
}
}
cout << (ll)((count + 1) / 2) << endl;
return 0;
} | [
"variable_declaration.type.change",
"call.add",
"call.arguments.change"
] | 748,793 | 748,794 | u119477929 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> s;
s.resize(N);
for (int i = 0; i < N; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
std::string prev = "";
long long ans = 0;
int count = 1;
for (int i = 0; i < N; ++i) {
if (i < (N - 1) && s[i + 1] == s[i])
count++;
else {
if (count > 1) {
ans += (count * (count - 1)) / 2;
}
count = 1;
}
prev = s[i];
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> s;
s.resize(N);
for (int i = 0; i < N; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
std::string prev = "";
long long ans = 0;
long long count = 1;
for (int i = 0; i < N; ++i) {
if (i < (N - 1) && s[i + 1] == s[i])
count++;
else {
if (count > 1) {
ans += (count * (count - 1)) / 2;
}
count = 1;
}
prev = s[i];
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,797 | 748,798 | u423405217 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
string s[100010];
int pd[100010][26];
int c[100010];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s[i];
char array[10];
for (int j = 0; j < 10; ++j) {
array[j] = s[i][j];
}
sort(array, array + 10);
for (int j = 0; j < 10; ++j) {
s[i][j] = array[j];
}
// cout << s[i] << endl;
c[i] = 1;
}
map<string, int> m;
for (int i = 0; i < n; ++i) {
m[s[i]]++;
}
long long int ans = 0;
for (auto i = m.begin(); i != m.end(); ++i) {
// std::cout << i->first << " " << i->second << "\n";
int tmp = (i->second);
ans += (tmp - 1) * ((tmp - 1) + 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
string s[100010];
int pd[100010][26];
int c[100010];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s[i];
char array[10];
for (int j = 0; j < 10; ++j) {
array[j] = s[i][j];
}
sort(array, array + 10);
for (int j = 0; j < 10; ++j) {
s[i][j] = array[j];
}
// cout << s[i] << endl;
c[i] = 1;
}
map<string, long long int> m;
for (int i = 0; i < n; ++i) {
m[s[i]]++;
}
long long int ans = 0;
for (auto i = m.begin(); i != m.end(); ++i) {
// std::cout << i->first << " " << i->second << "\n";
long long int tmp = (i->second);
ans += (tmp - 1) * ((tmp - 1) + 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.widen.change"
] | 748,799 | 748,800 | u837190376 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
string s[100010];
int pd[100010][26];
int c[100010];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s[i];
char array[10];
for (int j = 0; j < 10; ++j) {
array[j] = s[i][j];
}
sort(array, array + 10);
for (int j = 0; j < 10; ++j) {
s[i][j] = array[j];
}
// cout << s[i] << endl;
c[i] = 1;
}
map<string, int> m;
for (int i = 0; i < n; ++i) {
m[s[i]]++;
}
int ans = 0;
for (auto i = m.begin(); i != m.end(); ++i) {
// std::cout << i->first << " " << i->second << "\n";
int tmp = (i->second);
ans += (tmp - 1) * ((tmp - 1) + 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
string s[100010];
int pd[100010][26];
int c[100010];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s[i];
char array[10];
for (int j = 0; j < 10; ++j) {
array[j] = s[i][j];
}
sort(array, array + 10);
for (int j = 0; j < 10; ++j) {
s[i][j] = array[j];
}
// cout << s[i] << endl;
c[i] = 1;
}
map<string, long long int> m;
for (int i = 0; i < n; ++i) {
m[s[i]]++;
}
long long int ans = 0;
for (auto i = m.begin(); i != m.end(); ++i) {
// std::cout << i->first << " " << i->second << "\n";
long long int tmp = (i->second);
ans += (tmp - 1) * ((tmp - 1) + 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.widen.change"
] | 748,801 | 748,800 | u837190376 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
using namespace std;
int N;
const int INT_MAX = 100100;
string s[INT_MAX];
std::set<string> c;
std::map<std::string, int> res;
int main() {
cin >> N;
long long int ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
std::sort(s.begin(), s.end());
if (res.find(s) == res.end()) { // not found
res.insert(std::make_pair(s, 0));
} else {
res[s]++;
}
}
for (auto itr = res.begin(); itr != res.end(); ++itr) {
if (itr->second != 0) {
long long int temp = itr->second * (itr->second + 1) / 2;
ans += temp;
} else if (itr->second == 1) {
ans += 1;
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
using namespace std;
int N;
const int INT_MAX = 100100;
string s[INT_MAX];
std::set<string> c;
std::map<std::string, long long int> res;
int main() {
cin >> N;
long long int ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
std::sort(s.begin(), s.end());
if (res.find(s) == res.end()) { // not found
res.insert(std::make_pair(s, 0));
} else {
res[s]++;
}
}
for (auto itr = res.begin(); itr != res.end(); ++itr) {
if (itr->second != 0) {
long long int temp = itr->second * (itr->second + 1) / 2;
ans += temp;
} else if (itr->second == 1) {
ans += 1;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 748,805 | 748,806 | u767785562 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i < n; i++) {
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
// for(int i = 0; i < n; i++) cout << s[i] << endl;
long int ans = 0;
for (int i = 0; i < n - 1; i++) {
int j = i + 1;
int cnt = 1;
while (s[i] == s[j]) {
cnt++;
if (j < n - 1)
j++;
else
break;
}
i = j - 1;
// cout << "cnt: " << cnt << endl;
if (cnt != 1)
ans += cnt * (cnt - 1) / 2;
}
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i < n; i++) {
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
// for(int i = 0; i < n; i++) cout << s[i] << endl;
long long int ans = 0;
for (int i = 0; i < n - 1; i++) {
int j = i + 1;
long long int cnt = 1;
while (s[i] == s[j]) {
cnt++;
if (j < n - 1)
j++;
else
break;
}
i = j - 1;
// cout << "cnt: " << cnt << endl;
if (cnt != 1)
ans += cnt * (cnt - 1) / 2;
}
cout << ans << endl;
}
| [
"variable_declaration.type.widen.change"
] | 748,811 | 748,812 | u927804708 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long int64;
int main() {
int n;
scanf("%d", &n);
vector<string> s(n);
for (int i = 0; i < s.size(); i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int64 cnt = 0;
int a = 0;
size_t size = s.size();
string tmp = s[0];
int tmp_cnt = 0;
for (string str : s) {
if (tmp == str) {
tmp_cnt++;
} else {
tmp = str;
cnt += tmp_cnt * (tmp_cnt - 1) / 2;
tmp_cnt = 1;
}
}
if (tmp_cnt) {
cnt += tmp_cnt * (tmp_cnt - 1) / 2;
}
cout << cnt << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long int64;
int main() {
int n;
scanf("%d", &n);
vector<string> s(n);
for (int i = 0; i < s.size(); i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int64 cnt = 0;
int a = 0;
size_t size = s.size();
string tmp = s[0];
int64 tmp_cnt = 0;
for (string str : s) {
if (tmp == str) {
tmp_cnt++;
} else {
tmp = str;
cnt += tmp_cnt * (tmp_cnt - 1) / 2;
tmp_cnt = 1;
}
}
if (tmp_cnt) {
cnt += tmp_cnt * (tmp_cnt - 1) / 2;
}
cout << cnt << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 748,818 | 748,819 | u220152525 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int N;
using namespace std;
int main() {
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
string s;
vector<char> A(10);
cin >> s;
for (int j = 0; j < 10; j++) {
A[j] = s[j];
}
sort(A.begin(), A.end());
for (int j = 0; j < 10; j++) {
s[j] = A[j];
}
S[i] = s;
}
sort(S.begin(), S.end());
long int totalcount = 0;
vector<int> count;
count.push_back(1);
for (int i = 1; i < N; i++) {
if (S[i - 1] == S[i]) {
count.back() += 1;
} else {
count.push_back(1);
}
}
for (int i = 0; i < count.size(); i++) {
totalcount += count[i] * (count[i] - 1) / 2;
}
cout << totalcount << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int N;
using namespace std;
int main() {
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
string s;
vector<char> A(10);
cin >> s;
for (int j = 0; j < 10; j++) {
A[j] = s[j];
}
sort(A.begin(), A.end());
for (int j = 0; j < 10; j++) {
s[j] = A[j];
}
S[i] = s;
}
sort(S.begin(), S.end());
long int totalcount = 0;
vector<long int> count;
count.push_back(1);
for (int i = 1; i < N; i++) {
if (S[i - 1] == S[i]) {
count.back() += 1;
} else {
count.push_back(1);
}
}
for (int i = 0; i < count.size(); i++) {
totalcount += count[i] * (count[i] - 1) / 2;
}
cout << totalcount << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 748,824 | 748,825 | u238786149 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int N;
using namespace std;
int main() {
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
string s;
vector<char> A(10);
cin >> s;
for (int j = 0; j < 10; j++) {
A[j] = s[j];
}
sort(A.begin(), A.end());
for (int j = 0; j < 10; j++) {
s[j] = A[j];
}
S[i] = s;
}
sort(S.begin(), S.end());
int totalcount = 0;
vector<int> count;
count.push_back(1);
for (int i = 1; i < N; i++) {
if (S[i - 1] == S[i]) {
count.back() += 1;
} else {
count.push_back(1);
}
}
for (int i = 0; i < count.size(); i++) {
totalcount += count[i] * (count[i] - 1) / 2;
}
cout << totalcount << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int N;
using namespace std;
int main() {
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
string s;
vector<char> A(10);
cin >> s;
for (int j = 0; j < 10; j++) {
A[j] = s[j];
}
sort(A.begin(), A.end());
for (int j = 0; j < 10; j++) {
s[j] = A[j];
}
S[i] = s;
}
sort(S.begin(), S.end());
long int totalcount = 0;
vector<long int> count;
count.push_back(1);
for (int i = 1; i < N; i++) {
if (S[i - 1] == S[i]) {
count.back() += 1;
} else {
count.push_back(1);
}
}
for (int i = 0; i < count.size(); i++) {
totalcount += count[i] * (count[i] - 1) / 2;
}
cout << totalcount << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 748,826 | 748,825 | u238786149 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int a, b;
int n;
char s[123456][31];
string ss[123456];
string str;
bool cmp(char a, char b) { return a < b; }
bool cmp1(string a, string b) { return a < b; }
int main() {
cin >> n;
int k = 0, sum = 0, t = 1;
for (int i = 1; i <= n; i++) {
cin >> s[i];
}
for (int i = 1; i <= n; i++) {
sort(s[i], s[i] + 10, cmp);
ss[i] += s[i];
}
sort(ss + 1, ss + n + 1, cmp1);
// for(int i=1;i<=n;i++)
//{
// cout<<ss[i]<<endl;
//}
for (int i = 1; i <= n; i++) {
if (ss[i] == ss[i + 1]) {
t++;
}
if (ss[i] != ss[i + 1]) {
sum += t * (t - 1) / 2;
t = 1;
}
}
cout << sum << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int a, b;
int n;
char s[123456][31];
string ss[123456];
string str;
bool cmp(char a, char b) { return a < b; }
bool cmp1(string a, string b) { return a < b; }
int main() {
cin >> n;
long long k = 0, sum = 0, t = 1;
for (int i = 1; i <= n; i++) {
cin >> s[i];
}
for (int i = 1; i <= n; i++) {
sort(s[i], s[i] + 10, cmp);
ss[i] += s[i];
}
sort(ss + 1, ss + n + 1, cmp1);
// for(int i=1;i<=n;i++)
//{
// cout<<ss[i]<<endl;
//}
for (int i = 1; i <= n; i++) {
if (ss[i] == ss[i + 1]) {
t++;
}
if (ss[i] != ss[i + 1]) {
sum += t * (t - 1) / 2;
t = 1;
}
}
cout << sum << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,827 | 748,828 | u250046233 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
// Your code here!
int N;
unsigned long num = 0;
string str;
vector<string> s;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> str;
sort(str.begin(), str.end());
s.push_back(str);
}
sort(s.begin(), s.end());
int cnt = 0;
for (int i = 1; i < N; i++) {
cnt++;
if (s[i - 1].compare(s[i]) != 0) {
num += cnt * (cnt - 1) / 2;
cnt = 0;
}
}
cnt++;
num += cnt * (cnt - 1) / 2;
cout << num << endl;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void) {
// Your code here!
int N;
unsigned long num = 0;
string str;
vector<string> s;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> str;
sort(str.begin(), str.end());
s.push_back(str);
}
sort(s.begin(), s.end());
unsigned long cnt = 0;
for (int i = 1; i < N; i++) {
cnt++;
if (s[i - 1].compare(s[i]) != 0) {
num += cnt * (cnt - 1) / 2;
cnt = 0;
}
}
cnt++;
num += cnt * (cnt - 1) / 2;
cout << num << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,836 | 748,837 | u868390752 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for (int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for (int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14Eยฑ9 lli 9.2Eยฑ18 double 1.7Eยฑ380
int main() {
cout << fixed << setprecision(10);
int N;
cin >> N;
vector<string> v(N);
REP(i, N) {
cin >> v[i];
SORT(v[i]);
}
SORT(v);
v.push_back("");
LLI cnt = 0;
int p = 0;
FOR(i, 1, N + 1) {
if (v[p] != v[i]) {
int l = i - p;
p = i;
if (l < 2)
continue;
if (l % 2 == 1) {
cnt += l / 2 * (l);
} else {
cnt += l / 2 * (l - 1);
}
}
}
cout << cnt;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for (int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for (int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14Eยฑ9 lli 9.2Eยฑ18 double 1.7Eยฑ380
int main() {
cout << fixed << setprecision(10);
int N;
cin >> N;
vector<string> v(N);
REP(i, N) {
cin >> v[i];
SORT(v[i]);
}
SORT(v);
v.push_back("");
LLI cnt = 0;
int p = 0;
FOR(i, 0, N + 1) {
if (v[p] != v[i]) {
LLI l = i - p;
p = i;
if (l < 2)
continue;
if (l % 2 == 1) {
cnt += l / 2 * (l);
} else {
cnt += l / 2 * (l - 1);
}
}
}
cout << cnt;
return 0;
} | [
"literal.number.change",
"call.arguments.change",
"variable_declaration.type.change"
] | 748,838 | 748,839 | u840105874 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for (int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for (int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14Eยฑ9 lli 9.2Eยฑ18 double 1.7Eยฑ380
int main() {
cout << fixed << setprecision(10);
int N;
cin >> N;
vector<string> v(N);
REP(i, N) {
cin >> v[i];
SORT(v[i]);
}
SORT(v);
v.push_back("");
LLI cnt = 0;
int p = 0;
FOR(i, 1, N + 1) {
if (v[p] != v[i]) {
int l = i - p;
p = i;
if (l < 2)
continue;
if (l % 2 == 1) {
cnt += (l - 1) / 2 * (l);
} else {
cnt += l / 2 * (l - 1);
}
}
}
cout << cnt;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for (int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for (int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14Eยฑ9 lli 9.2Eยฑ18 double 1.7Eยฑ380
int main() {
cout << fixed << setprecision(10);
int N;
cin >> N;
vector<string> v(N);
REP(i, N) {
cin >> v[i];
SORT(v[i]);
}
SORT(v);
v.push_back("");
LLI cnt = 0;
int p = 0;
FOR(i, 0, N + 1) {
if (v[p] != v[i]) {
LLI l = i - p;
p = i;
if (l < 2)
continue;
if (l % 2 == 1) {
cnt += l / 2 * (l);
} else {
cnt += l / 2 * (l - 1);
}
}
}
cout << cnt;
return 0;
} | [
"literal.number.change",
"call.arguments.change",
"variable_declaration.type.change"
] | 748,840 | 748,839 | u840105874 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
double comb(int n) { return (double)n * (double)(n - 1) / 2.0; }
int main(void) {
int n;
cin >> n;
string key;
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> key;
sort(key.begin(), key.end());
if (mp.find(key) == mp.end()) {
mp[key] = 1;
} else {
mp[key] += 1;
}
}
double count = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
int n = itr->second;
count += n > 1 ? comb(n) : 0;
}
cout << count << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
using namespace std;
long comb(int n) { return (long)n * (long)(n - 1) / 2.0; }
int main(void) {
int n;
cin >> n;
string key;
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> key;
sort(key.begin(), key.end());
if (mp.find(key) == mp.end()) {
mp[key] = 1;
} else {
mp[key] += 1;
}
}
long count = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
int n = itr->second;
count += n > 1 ? comb(n) : 0;
}
cout << count << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,841 | 748,842 | u469842862 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
long int count;
cin >> N;
count = 0;
string S[N];
for (int i = 0; i < N; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
// cout << S[i] << endl;
}
sort(S, S + N);
for (int i = 0; i < N; i++) {
if (S[i] == S[i + 1]) {
count++;
for (int k = i + 1; k < N; k++) {
if (S[i] == S[k + 1])
count = count + k - i + 1;
if (S[i] != S[k + 1]) {
i = k + 1;
break;
}
}
}
}
cout << count << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
long int count;
cin >> N;
count = 0;
string S[N];
for (int i = 0; i < N; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
// cout << S[i] << endl;
}
sort(S, S + N);
for (int i = 0; i < N; i++) {
if (S[i] == S[i + 1]) {
count++;
for (int k = i + 1; k < N; k++) {
if (S[i] == S[k + 1])
count = count + k - i + 1;
if (S[i] != S[k + 1]) {
i = k;
break;
}
}
}
}
cout << count << endl;
return 0;
} | [
"expression.operation.binary.remove"
] | 748,845 | 748,846 | u085481334 | cpp |
p02947 | #include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define forn(i, n, m) for (int(i) = (n); i <= (int)(m); (i)++)
#define push_back pb
#define make_pair mp
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 1e5 + 10;
int n, sum;
char a[N][10];
map<string, int> mp;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%s", a[i]);
sort(a[i], a[i] + 10);
mp[a[i]]++;
sum += mp[a[i]] - 1;
}
cout << sum;
return 0;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define forn(i, n, m) for (int(i) = (n); i <= (int)(m); (i)++)
#define push_back pb
#define make_pair mp
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 1e5 + 10;
ll n, sum;
char a[N][10];
map<string, int> mp;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%s", a[i]);
sort(a[i], a[i] + 10);
mp[a[i]]++;
sum += mp[a[i]] - 1;
}
cout << sum;
return 0;
} | [
"variable_declaration.type.change"
] | 748,847 | 748,848 | u730153732 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
typedef long long ll;
int main() {
int n;
ll ans = 0;
cin >> n;
map<string, int> s;
string str;
REP(i, n) {
cin >> str;
sort(str.begin(), str.end());
s[str] = s[str] ? s[str] + 1 : 1;
}
map<string, int>::iterator itr;
for (itr = s.begin(); itr != s.end(); ++itr) {
if (itr->second > 1) {
ans += itr->second * (itr->second - 1) / 2;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
typedef long long ll;
int main() {
int n;
ll ans = 0;
cin >> n;
map<string, ll> s;
string str;
REP(i, n) {
cin >> str;
sort(str.begin(), str.end());
s[str] = s[str] ? s[str] + 1 : 1;
}
map<string, ll>::iterator itr;
for (itr = s.begin(); itr != s.end(); ++itr) {
if (itr->second > 1) {
ans += itr->second * (itr->second - 1) / 2;
}
}
cout << ans << endl;
} | [] | 748,849 | 748,850 | u303884911 | cpp |
p02947 | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
char a[100005][15];
char *p[100005];
int cmp(char c, char b) { return c < b; }
int cmp1(char *c, char *b) {
if (strcmp(c, b) < 0)
return 1;
else
return 0;
}
long long s = 0;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
int len = strlen(a[i]);
sort(a[i], a[i] + len, cmp);
p[i] = a[i];
}
sort(p, p + n, cmp1);
int m = 1;
string c;
c = p[0];
for (int i = 1; i < n; i++) {
if (c == p[i])
m++;
else {
s += (m - 1) * m / 2;
m = 1;
c = p[i];
}
}
s += (m - 1) * m / 2;
// if(m<2) ;
// else s+=jie(m);
// cout <<jie(2)<<endl;
cout << s << endl;
return 0;
} | #include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
char a[100005][15];
char *p[100005];
int cmp(char c, char b) { return c < b; }
int cmp1(char *c, char *b) {
if (strcmp(c, b) < 0)
return 1;
else
return 0;
}
long long s = 0;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
int len = strlen(a[i]);
sort(a[i], a[i] + len, cmp);
p[i] = a[i];
}
sort(p, p + n, cmp1);
long long m = 1;
string c;
c = p[0];
for (int i = 1; i < n; i++) {
if (c == p[i])
m++;
else {
s += (m - 1) * m / 2;
m = 1;
c = p[i];
}
}
s += (m - 1) * m / 2;
cout << s << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,857 | 748,858 | u808738521 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
bool equal(map<char, int> m1, map<char, int> m2) {
string alphabet = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < alphabet.size(); i++) {
if (m1[alphabet[i]] != m2[alphabet[i]]) {
return false;
}
}
return true;
}
bool equal(string s1, string s2) {
for (int i = 0; i < s1.size(); i++) {
if (s1[i] != s2[i]) {
return false;
}
}
return true;
}
ll combi2(int n) { return n * (n - 1) / 2; }
// int main() {
// string s;
// ll N;
// cin >> N;
// vector<map<char, int> > map_vector;
// string alphabet = "abcdefghijklmnopqrstuvwxyz";
// for (ll i = 0; i < N; i++) {
// cin >> s;
// map<char, int> m;
// for (ll i = 0; i < alphabet.size(); i++) {
// m[alphabet[i]] = 0;
// for (ll j = 0; j < s.size(); j++) {
// if (alphabet[i] == s[j]) {
// m[alphabet[i]]++;
// }
// }
// }
// map_vector.push_back(m);
// }
// ll ans = 0;
// for (ll i = 0; i < map_vector.size(); i++) {
// for (ll j = i + 1; j < map_vector.size(); j++) {
// if (equal(map_vector[i], map_vector[j])) ans++;
// }
// }
// cout << ans << endl;
//}
// int main() {
// string s;
// vector<string> sv;
// int N; cin >> N;
// for (int i = 0; i < N; i++) {
// cin >> s;
// sort(s.begin(), s.end());
// sv.push_back(s);
// }
//
// int ans = 0;
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
// cout << ans << endl;
//}
int main() {
string s;
vector<string> sv;
map<string, int> m;
int N;
cin >> N;
ll ans = 0;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m[s] > 0) {
m[s]++;
} else {
m[s] = 1;
sv.push_back(s);
}
}
for (const auto e : sv) {
if (m[e] > 1) {
ans += combi2(m[e]);
}
}
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
bool equal(map<char, int> m1, map<char, int> m2) {
string alphabet = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < alphabet.size(); i++) {
if (m1[alphabet[i]] != m2[alphabet[i]]) {
return false;
}
}
return true;
}
bool equal(string s1, string s2) {
for (int i = 0; i < s1.size(); i++) {
if (s1[i] != s2[i]) {
return false;
}
}
return true;
}
ll combi2(ll n) { return n * (n - 1) / 2; }
// int main() {
// string s;
// ll N;
// cin >> N;
// vector<map<char, int> > map_vector;
// string alphabet = "abcdefghijklmnopqrstuvwxyz";
// for (ll i = 0; i < N; i++) {
// cin >> s;
// map<char, int> m;
// for (ll i = 0; i < alphabet.size(); i++) {
// m[alphabet[i]] = 0;
// for (ll j = 0; j < s.size(); j++) {
// if (alphabet[i] == s[j]) {
// m[alphabet[i]]++;
// }
// }
// }
// map_vector.push_back(m);
// }
// ll ans = 0;
// for (ll i = 0; i < map_vector.size(); i++) {
// for (ll j = i + 1; j < map_vector.size(); j++) {
// if (equal(map_vector[i], map_vector[j])) ans++;
// }
// }
// cout << ans << endl;
//}
// int main() {
// string s;
// vector<string> sv;
// int N; cin >> N;
// for (int i = 0; i < N; i++) {
// cin >> s;
// sort(s.begin(), s.end());
// sv.push_back(s);
// }
//
// int ans = 0;
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
// cout << ans << endl;
//}
int main() {
string s;
vector<string> sv;
map<string, ll> m;
int N;
cin >> N;
ll ans = 0;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m[s] > 0) {
m[s]++;
} else {
m[s] = 1;
sv.push_back(s);
}
}
for (const auto e : sv) {
if (m[e] > 1) {
ans += combi2(m[e]);
}
}
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
cout << ans << endl;
}
| [] | 748,863 | 748,864 | u439303935 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
bool equal(map<char, int> m1, map<char, int> m2) {
string alphabet = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < alphabet.size(); i++) {
if (m1[alphabet[i]] != m2[alphabet[i]]) {
return false;
}
}
return true;
}
bool equal(string s1, string s2) {
for (int i = 0; i < s1.size(); i++) {
if (s1[i] != s2[i]) {
return false;
}
}
return true;
}
int combi2(int n) { return n * (n - 1) / 2; }
// int main() {
// string s;
// ll N;
// cin >> N;
// vector<map<char, int> > map_vector;
// string alphabet = "abcdefghijklmnopqrstuvwxyz";
// for (ll i = 0; i < N; i++) {
// cin >> s;
// map<char, int> m;
// for (ll i = 0; i < alphabet.size(); i++) {
// m[alphabet[i]] = 0;
// for (ll j = 0; j < s.size(); j++) {
// if (alphabet[i] == s[j]) {
// m[alphabet[i]]++;
// }
// }
// }
// map_vector.push_back(m);
// }
// ll ans = 0;
// for (ll i = 0; i < map_vector.size(); i++) {
// for (ll j = i + 1; j < map_vector.size(); j++) {
// if (equal(map_vector[i], map_vector[j])) ans++;
// }
// }
// cout << ans << endl;
//}
// int main() {
// string s;
// vector<string> sv;
// int N; cin >> N;
// for (int i = 0; i < N; i++) {
// cin >> s;
// sort(s.begin(), s.end());
// sv.push_back(s);
// }
//
// int ans = 0;
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
// cout << ans << endl;
//}
int main() {
string s;
vector<string> sv;
map<string, int> m;
int N;
cin >> N;
ll ans = 0;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m[s] > 0) {
m[s]++;
} else {
m[s] = 1;
sv.push_back(s);
}
}
for (const auto e : sv) {
if (m[e] > 1) {
ans += combi2(m[e]);
}
}
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
bool equal(map<char, int> m1, map<char, int> m2) {
string alphabet = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < alphabet.size(); i++) {
if (m1[alphabet[i]] != m2[alphabet[i]]) {
return false;
}
}
return true;
}
bool equal(string s1, string s2) {
for (int i = 0; i < s1.size(); i++) {
if (s1[i] != s2[i]) {
return false;
}
}
return true;
}
ll combi2(ll n) { return n * (n - 1) / 2; }
// int main() {
// string s;
// ll N;
// cin >> N;
// vector<map<char, int> > map_vector;
// string alphabet = "abcdefghijklmnopqrstuvwxyz";
// for (ll i = 0; i < N; i++) {
// cin >> s;
// map<char, int> m;
// for (ll i = 0; i < alphabet.size(); i++) {
// m[alphabet[i]] = 0;
// for (ll j = 0; j < s.size(); j++) {
// if (alphabet[i] == s[j]) {
// m[alphabet[i]]++;
// }
// }
// }
// map_vector.push_back(m);
// }
// ll ans = 0;
// for (ll i = 0; i < map_vector.size(); i++) {
// for (ll j = i + 1; j < map_vector.size(); j++) {
// if (equal(map_vector[i], map_vector[j])) ans++;
// }
// }
// cout << ans << endl;
//}
// int main() {
// string s;
// vector<string> sv;
// int N; cin >> N;
// for (int i = 0; i < N; i++) {
// cin >> s;
// sort(s.begin(), s.end());
// sv.push_back(s);
// }
//
// int ans = 0;
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
// cout << ans << endl;
//}
int main() {
string s;
vector<string> sv;
map<string, ll> m;
int N;
cin >> N;
ll ans = 0;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m[s] > 0) {
m[s]++;
} else {
m[s] = 1;
sv.push_back(s);
}
}
for (const auto e : sv) {
if (m[e] > 1) {
ans += combi2(m[e]);
}
}
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
cout << ans << endl;
}
| [] | 748,865 | 748,864 | u439303935 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
bool equal(map<char, int> m1, map<char, int> m2) {
string alphabet = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < alphabet.size(); i++) {
if (m1[alphabet[i]] != m2[alphabet[i]]) {
return false;
}
}
return true;
}
bool equal(string s1, string s2) {
for (int i = 0; i < s1.size(); i++) {
if (s1[i] != s2[i]) {
return false;
}
}
return true;
}
int combi2(int n) { return n * (n - 1) / 2; }
// int main() {
// string s;
// ll N;
// cin >> N;
// vector<map<char, int> > map_vector;
// string alphabet = "abcdefghijklmnopqrstuvwxyz";
// for (ll i = 0; i < N; i++) {
// cin >> s;
// map<char, int> m;
// for (ll i = 0; i < alphabet.size(); i++) {
// m[alphabet[i]] = 0;
// for (ll j = 0; j < s.size(); j++) {
// if (alphabet[i] == s[j]) {
// m[alphabet[i]]++;
// }
// }
// }
// map_vector.push_back(m);
// }
// ll ans = 0;
// for (ll i = 0; i < map_vector.size(); i++) {
// for (ll j = i + 1; j < map_vector.size(); j++) {
// if (equal(map_vector[i], map_vector[j])) ans++;
// }
// }
// cout << ans << endl;
//}
// int main() {
// string s;
// vector<string> sv;
// int N; cin >> N;
// for (int i = 0; i < N; i++) {
// cin >> s;
// sort(s.begin(), s.end());
// sv.push_back(s);
// }
//
// int ans = 0;
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
// cout << ans << endl;
//}
int main() {
string s;
vector<string> sv;
map<string, int> m;
int N;
cin >> N;
ll ans = 0;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m[s] > 0) {
m[s]++;
} else {
m[s] = 1;
sv.push_back(s);
}
}
for (const auto e : sv) {
if (m[e] > 0) {
ans += combi2(m[e]);
}
}
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
bool equal(map<char, int> m1, map<char, int> m2) {
string alphabet = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < alphabet.size(); i++) {
if (m1[alphabet[i]] != m2[alphabet[i]]) {
return false;
}
}
return true;
}
bool equal(string s1, string s2) {
for (int i = 0; i < s1.size(); i++) {
if (s1[i] != s2[i]) {
return false;
}
}
return true;
}
ll combi2(ll n) { return n * (n - 1) / 2; }
// int main() {
// string s;
// ll N;
// cin >> N;
// vector<map<char, int> > map_vector;
// string alphabet = "abcdefghijklmnopqrstuvwxyz";
// for (ll i = 0; i < N; i++) {
// cin >> s;
// map<char, int> m;
// for (ll i = 0; i < alphabet.size(); i++) {
// m[alphabet[i]] = 0;
// for (ll j = 0; j < s.size(); j++) {
// if (alphabet[i] == s[j]) {
// m[alphabet[i]]++;
// }
// }
// }
// map_vector.push_back(m);
// }
// ll ans = 0;
// for (ll i = 0; i < map_vector.size(); i++) {
// for (ll j = i + 1; j < map_vector.size(); j++) {
// if (equal(map_vector[i], map_vector[j])) ans++;
// }
// }
// cout << ans << endl;
//}
// int main() {
// string s;
// vector<string> sv;
// int N; cin >> N;
// for (int i = 0; i < N; i++) {
// cin >> s;
// sort(s.begin(), s.end());
// sv.push_back(s);
// }
//
// int ans = 0;
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
// cout << ans << endl;
//}
int main() {
string s;
vector<string> sv;
map<string, ll> m;
int N;
cin >> N;
ll ans = 0;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (m[s] > 0) {
m[s]++;
} else {
m[s] = 1;
sv.push_back(s);
}
}
for (const auto e : sv) {
if (m[e] > 1) {
ans += combi2(m[e]);
}
}
// for (int i = 0; i < N; i++) {
// for (int j = i + 1; j < N; j++) {
// if (equal(sv[i], sv[j])) {
// ans++;
// }
// }
// }
cout << ans << endl;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 748,866 | 748,864 | u439303935 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
long long co(int x) {
long long y = 0;
for (int i = 1; i <= x - 1; i++) {
y += i;
}
return y;
}
int main() {
int n;
map<string, int> ma;
string s[10000];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
cin >> s[i];
getchar();
sort(s[i].begin(), s[i].end());
ma[s[i]]++;
}
map<string, int>::iterator it;
long long t = 0;
for (it = ma.begin(); it != ma.end(); it++) {
if (it->second > 1)
t += co(it->second);
}
printf("%lld", t);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
long long co(int x) {
long long y = 0;
for (int i = 1; i <= x - 1; i++) {
y += i;
}
return y;
}
int main() {
int n;
map<string, int> ma;
string s[100001];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
cin >> s[i];
getchar();
sort(s[i].begin(), s[i].end());
ma[s[i]]++;
}
map<string, int>::iterator it;
long long t = 0;
for (it = ma.begin(); it != ma.end(); it++) {
if (it->second > 1)
t += co(it->second);
}
printf("%lld", t);
return 0;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 748,867 | 748,868 | u058609859 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<string> s(n + 1);
for (ll i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
s[n] = "wwwwwwwwwww";
sort(s.begin(), s.end());
string memo = s[0];
ll count = 1, ans = 0;
for (ll i = 1; i < n + 1; i++) {
// cout<<s[i]<<endl;
if (s[i] == memo)
count++;
else {
ll memo2 = 1;
if (count > 1) {
memo2 = (count * (count - 1)) / 2;
ans += memo2;
}
// cout<<ans<<endl;
memo = s[i];
count = 1;
}
}
cout << ans - 1 << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<string> s(n + 1);
for (ll i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
s[n] = "wwwwwwwwww";
sort(s.begin(), s.end());
string memo = s[0];
ll count = 1, ans = 0;
for (ll i = 1; i < n + 1; i++) {
// cout<<s[i]<<endl;
if (s[i] == memo)
count++;
else {
ll memo2 = 1;
if (count > 1) {
memo2 = (count * (count - 1)) / 2;
ans += memo2;
}
// cout<<ans<<endl;
memo = s[i];
count = 1;
}
}
cout << ans << endl;
}
| [
"literal.string.change",
"assignment.value.change",
"expression.operation.binary.remove"
] | 748,869 | 748,870 | u330689597 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<string> s(n + 1);
for (ll i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
s[n] = "wwwwwwwwwww";
sort(s.begin(), s.end());
string memo = s[0];
ll count = 1, ans = 0;
for (ll i = 1; i < n + 1; i++) {
// cout<<s[i]<<endl;
if (s[i] == memo)
count++;
else {
ll memo2 = 1;
if (count > 1) {
memo2 = (count * (count - 1)) / 2;
ans += memo2;
}
// cout<<ans<<endl;
memo = s[i];
count = 1;
}
}
cout << ans + 1 << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n;
vector<string> s(n + 1);
for (ll i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
s[n] = "wwwwwwwwww";
sort(s.begin(), s.end());
string memo = s[0];
ll count = 1, ans = 0;
for (ll i = 1; i < n + 1; i++) {
// cout<<s[i]<<endl;
if (s[i] == memo)
count++;
else {
ll memo2 = 1;
if (count > 1) {
memo2 = (count * (count - 1)) / 2;
ans += memo2;
}
// cout<<ans<<endl;
memo = s[i];
count = 1;
}
}
cout << ans << endl;
}
| [
"literal.string.change",
"assignment.value.change",
"expression.operation.binary.remove"
] | 748,871 | 748,870 | u330689597 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> v;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
v.push_back(s);
sort(s.begin(), s.end());
if (m[s] >= 1)
m[s]++;
else
m[s] = 1;
}
long long sm = 0;
for (map<string, int>::iterator it = m.begin(); it != m.end(); ++it) {
if (it->second > 1) {
// cout << it->second << " ";
long long ss = (it->second * (it->second - 1)) / 2;
// cout << ss << "\n";
sm += ss;
}
}
cout << sm;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> v;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
v.push_back(s);
sort(s.begin(), s.end());
if (m[s] >= 1)
m[s]++;
else
m[s] = 1;
}
long long sm = 0;
for (map<string, int>::iterator it = m.begin(); it != m.end(); ++it) {
if (it->second > 1) {
// cout << it->second << " ";
long long ss = (it->second * 1LL * (it->second - 1)) / 2;
// cout << ss << "\n";
sm += ss;
}
}
cout << sm;
return 0;
} | [
"assignment.change"
] | 748,873 | 748,874 | u254663986 | cpp |
p02947 | #include <bits/stdc++.h>
#include <iostream>
#define ll long long
#define ull unsigned long long
#define pb push_back
const int MAX = 2e5 + 9;
const long long mod = 1e9 + 7;
using namespace std;
vector<int> adj[MAX];
ll dp[MAX][10][13];
int main() {
int n;
cin >> n;
int cnt = 0;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
cnt = cnt + mp[str];
mp[str]++;
}
cout << cnt;
} | #include <bits/stdc++.h>
#include <iostream>
#define ll long long
#define ull unsigned long long
#define pb push_back
const int MAX = 2e5 + 9;
const long long mod = 1e9 + 7;
using namespace std;
vector<int> adj[MAX];
ll dp[MAX][10][13];
int main() {
int n;
cin >> n;
ll cnt = 0;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
cnt = cnt + mp[str];
mp[str]++;
}
cout << cnt;
} | [
"variable_declaration.type.change"
] | 748,875 | 748,876 | u356157756 | cpp |
p02947 | #include <bits/stdc++.h>
#include <map>
using namespace std;
map<string, int> m;
int nb(long long);
long long v[500005];
int main() {
int a;
cin >> a;
for (int i = 0; i < a; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
m[str]++;
// cout << m[str];
}
// cout << m[str];
long long b = 0;
map<string, int>::iterator it;
for (it = m.begin(); it != m.end(); it++) {
b += nb(it->second);
}
cout << b;
return 0;
}
int nb(long long n) {
// cout << n;
if (!v[n]) {
long long t = n * (n - 1) / 2;
v[n] = t;
return t;
} else {
return v[n];
}
} | #include <bits/stdc++.h>
#include <map>
using namespace std;
map<string, int> m;
long long nb(long long);
long long v[500005];
int main() {
int a;
cin >> a;
for (int i = 0; i < a; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
m[str]++;
// cout << m[str];
}
// cout << m[str];
long long b = 0;
map<string, int>::iterator it;
for (it = m.begin(); it != m.end(); it++) {
b += nb(it->second);
}
cout << b;
return 0;
}
long long nb(long long n) {
// cout << n;
if (!v[n]) {
long long t = n * (n - 1) / 2;
v[n] = t;
return t;
} else {
return v[n];
}
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,879 | 748,880 | u382002817 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
sort(s.begin(), s.end());
int64_t ans = 0;
int re = 1;
for (int i = 0; i < n - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
re++;
} else {
ans += re * (re - 1) / 2;
re = 1;
}
}
ans += re * (re - 1) / 2;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
sort(s.begin(), s.end());
int64_t ans = 0;
int64_t re = 1;
for (int i = 0; i < n - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
re++;
} else {
ans += re * (re - 1) / 2;
re = 1;
}
}
ans += re * (re - 1) / 2;
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,881 | 748,882 | u621374073 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
sort(s.begin(), s.end());
int ans = 0;
int re = 1;
for (int i = 0; i < n - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
re++;
} else {
ans += re * (re - 1) / 2;
re = 1;
}
}
ans += re * (re - 1) / 2;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
sort(s.begin(), s.end());
int64_t ans = 0;
int64_t re = 1;
for (int i = 0; i < n - 1; i++) {
if (s.at(i) == s.at(i + 1)) {
re++;
} else {
ans += re * (re - 1) / 2;
re = 1;
}
}
ans += re * (re - 1) / 2;
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,883 | 748,882 | u621374073 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < n; i++)
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
const ll MOD = 1e9 + 7;
// string S[100100];
int main() {
int N;
cin >> N;
map<ll, int> ma;
REP(i, N) {
string S;
cin >> S;
priority_queue<ll> tmp;
REP(k, 10) {
char c = S[k];
int n = c - 'a' + 1;
tmp.push(n);
}
ll num = 0;
REP(k, 10) {
ll x = tmp.top();
tmp.pop();
num += pow(100, k) * x;
}
ma[num]++;
}
ll ans = 0;
for (auto &&p : ma) {
ll cnt = p.second;
ans += cnt * (cnt - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < n; i++)
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
const ll MOD = 1e9 + 7;
// string S[100100];
int main() {
int N;
cin >> N;
map<ll, int> ma;
REP(i, N) {
string S;
cin >> S;
priority_queue<ll> tmp;
REP(k, 10) {
char c = S[k];
int n = c - 'a';
tmp.push(n);
}
ll num = 0;
REP(k, 10) {
ll x = tmp.top();
tmp.pop();
num += (ll)pow(100, k) * x;
}
ma[num]++;
}
ll ans = 0;
for (auto &&p : ma) {
ll cnt = p.second;
ans += cnt * (cnt - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 748,892 | 748,893 | u666394517 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < n; i++)
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
const ll MOD = 1e9 + 7;
// string S[100100];
int main() {
int N;
cin >> N;
map<ll, int> ma;
REP(i, N) {
string S;
cin >> S;
priority_queue<ll> tmp;
REP(k, 10) {
char c = S[k];
int n = c - 'a';
tmp.push(n);
}
ll num = 0;
REP(k, 10) {
ll x = tmp.top();
tmp.pop();
num += pow(100, k) * x;
}
ma[num]++;
}
ll ans = 0;
for (auto &&p : ma) {
int cnt = p.second;
ans += cnt * (cnt - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int i = 0; i < n; i++)
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, const T &b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
const ll MOD = 1e9 + 7;
// string S[100100];
int main() {
int N;
cin >> N;
map<ll, int> ma;
REP(i, N) {
string S;
cin >> S;
priority_queue<ll> tmp;
REP(k, 10) {
char c = S[k];
int n = c - 'a';
tmp.push(n);
}
ll num = 0;
REP(k, 10) {
ll x = tmp.top();
tmp.pop();
num += (ll)pow(100, k) * x;
}
ma[num]++;
}
ll ans = 0;
for (auto &&p : ma) {
ll cnt = p.second;
ans += cnt * (cnt - 1) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 748,894 | 748,893 | u666394517 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
unordered_map<string, int> mp;
typedef long long lli;
int main() {
int n;
cin >> n;
for (int kase = 1; kase <= n; kase++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
lli ans = 0;
for (auto it : mp) {
ans += (long long)((it.second - 1) * (it.second));
}
cout << (ans >> 1) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
unordered_map<string, int> mp;
typedef long long lli;
int main() {
int n;
cin >> n;
for (int kase = 1; kase <= n; kase++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
lli ans = 0;
for (auto it : mp) {
ans += (long long)((it.second - 1ll) * (it.second));
// cout<<it.first<<" "<<it.second<<endl;
}
cout << (ans >> 1) << endl;
}
| [] | 748,897 | 748,898 | u383034220 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <stdlib.h>
#include <vector>
using namespace std;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
uint32_t N, *A;
cin >> N;
A = new uint32_t[N];
vector<string> S(N);
for (uint32_t i = 0; i < N; ++i) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
S[i] = tmp;
A[i] = 0;
}
sort(S.begin(), S.end());
uint64_t res = 0;
uint32_t count = 0;
string tmp = S[0];
for (uint32_t i = 1; i < N; ++i) {
if (S[i] == tmp) {
++count;
} else {
res += count * (count + 1) / 2;
tmp = S[i];
count = 0;
}
}
if (count)
res += count * (count + 1) / 2;
cout << res << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <stdlib.h>
#include <vector>
using namespace std;
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
if (a.second != b.second) {
return a.second < b.second;
} else {
return a.first < b.first;
}
}
int main() {
uint32_t N, *A;
cin >> N;
A = new uint32_t[N];
vector<string> S(N);
for (uint32_t i = 0; i < N; ++i) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
S[i] = tmp;
A[i] = 0;
}
sort(S.begin(), S.end());
uint64_t res = 0;
uint64_t count = 0;
string tmp = S[0];
for (uint32_t i = 1; i < N; ++i) {
if (S[i] == tmp) {
++count;
} else {
res += count * (count + 1) / 2;
tmp = S[i];
count = 0;
}
}
if (count)
res += count * (count + 1) / 2;
cout << res << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 748,899 | 748,900 | u846796522 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int K;
cin >> K;
vector<string> v(K);
long long ans = 0;
for (int i = 0; i < K; i++) {
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
sort(v.begin(), v.end());
int num = 0;
for (int i = 1; i < K; i++) {
if (v[i] != v[i - 1]) {
ans += ((num + 1) * num) / 2;
num = 0;
} else if (i != K - 1) {
num++;
} else {
num++;
ans += ((num + 1) * num) / 2;
}
}
cout << ans << endl;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int K;
cin >> K;
vector<string> v(K);
long long ans = 0;
for (int i = 0; i < K; i++) {
cin >> v[i];
sort(v[i].begin(), v[i].end());
}
sort(v.begin(), v.end());
long long num = 0;
for (int i = 1; i < K; i++) {
if (v[i] != v[i - 1]) {
ans += ((num + 1) * num) / 2;
num = 0;
} else if (i != K - 1) {
num++;
} else { // i == K-1 && v[i] == v[i-1]
num++;
ans += ((num + 1) * num) / 2;
}
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,901 | 748,902 | u570417673 | cpp |
p02947 | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(void) {
int n;
long long ans = 0;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
int x = 0;
for (int i = 1; i < n; i++) {
if (s[i - 1] == s[i]) {
x++;
if (i == n - 1) {
ans += (x * (x + 1)) / 2;
break;
}
} else {
ans += (x * (x + 1)) / 2;
x = 0;
}
}
cout << ans;
}
| #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(void) {
int n;
long long ans = 0;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long x = 0;
for (int i = 1; i < n; i++) {
if (s[i - 1] == s[i]) {
x++;
if (i == n - 1) {
ans += (x * (x + 1)) / 2;
break;
}
} else {
ans += (x * (x + 1)) / 2;
x = 0;
}
}
cout << ans;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,905 | 748,906 | u675509234 | cpp |
p02947 | #include <algorithm>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
int main() {
int N;
char str[11];
priority_queue<string> pque;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> str;
sort(str, str + 10);
pque.push(string(str));
}
int cnt = 1;
long long sum = 0;
string str1, str2;
str1 = pque.top();
pque.pop();
while (!pque.empty()) {
str2 = pque.top();
pque.pop();
if (strcmp(str1.c_str(), str2.c_str()) == 0)
cnt++;
else {
sum += cnt * (cnt - 1) / 2;
cnt = 1;
str1 = str2;
}
}
sum += cnt * (cnt - 1) / 2;
cout << sum << endl;
} | #include <algorithm>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
int main() {
int N;
char str[11];
priority_queue<string> pque;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> str;
sort(str, str + 10);
pque.push(string(str));
}
long long cnt = 1;
long long sum = 0;
string str1, str2;
str1 = pque.top();
pque.pop();
while (!pque.empty()) {
str2 = pque.top();
pque.pop();
if (strcmp(str1.c_str(), str2.c_str()) == 0)
cnt++;
else {
sum += cnt * (cnt - 1) / 2;
cnt = 1;
str1 = str2;
}
}
sum += cnt * (cnt - 1) / 2;
cout << sum << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,907 | 748,908 | u979960743 | cpp |
p02947 | #include <algorithm>
#include <iostream>
using namespace std;
string s[50000 + 5];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long cnt = 1;
long long sum = 0;
for (long long i = 0; i < n; i++) {
if (s[i] != s[i + 1] && cnt != 1) {
sum += (cnt * (cnt - 1)) / 2;
cnt = 1;
} else if (s[i] != s[i + 1] && cnt == 1) {
cnt = 1;
} else
cnt++;
}
sum += (cnt * (cnt - 1)) / 2;
cout << sum << endl;
} | #include <algorithm>
#include <iostream>
using namespace std;
string s[5000000 + 5];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long cnt = 1;
long long sum = 0;
for (long long i = 0; i < n; i++) {
if (s[i] != s[i + 1] && cnt != 1) {
sum += (cnt * (cnt - 1)) / 2;
cnt = 1;
} else if (s[i] != s[i + 1] && cnt == 1) {
cnt = 1;
} else
cnt++;
}
sum += (cnt * (cnt - 1)) / 2;
cout << sum << endl;
} | [
"literal.number.change",
"expression.operation.binary.change"
] | 748,909 | 748,910 | u191117799 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
s.at(i) = str;
}
sort(s.begin(), s.end());
int wk_ans = 0;
long long ans = 0;
string tmp;
for (int i = 0; i < n; i++) {
if (tmp == s.at(i))
wk_ans++;
else {
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
wk_ans = 0;
}
}
tmp = s.at(i);
}
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
}
cout << ans;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
s.at(i) = str;
}
sort(s.begin(), s.end());
int64_t ans = 0, wk_ans = 0;
string tmp;
for (int i = 0; i < n; i++) {
if (tmp == s.at(i))
wk_ans++;
else {
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
wk_ans = 0;
}
}
tmp = s.at(i);
}
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
}
cout << ans;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.add",
"variable_declaration.remove"
] | 748,911 | 748,912 | u282835662 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
s.at(i) = str;
}
sort(s.begin(), s.end());
int wk_ans = 0;
long ans = 0;
string tmp;
for (int i = 0; i < n; i++) {
if (tmp == s.at(i))
wk_ans++;
else {
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
wk_ans = 0;
}
}
tmp = s.at(i);
}
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
}
cout << ans;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
s.at(i) = str;
}
sort(s.begin(), s.end());
int64_t ans = 0, wk_ans = 0;
string tmp;
for (int i = 0; i < n; i++) {
if (tmp == s.at(i))
wk_ans++;
else {
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
wk_ans = 0;
}
}
tmp = s.at(i);
}
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
}
cout << ans;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.add",
"variable_declaration.remove"
] | 748,913 | 748,912 | u282835662 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
s.at(i) = str;
}
sort(s.begin(), s.end());
int wk_ans = 0;
double ans = 0;
string tmp;
for (int i = 0; i < n; i++) {
if (tmp == s.at(i))
wk_ans++;
else {
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
wk_ans = 0;
}
}
tmp = s.at(i);
}
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
}
cout << ans;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
s.at(i) = str;
}
sort(s.begin(), s.end());
int64_t ans = 0, wk_ans = 0;
string tmp;
for (int i = 0; i < n; i++) {
if (tmp == s.at(i))
wk_ans++;
else {
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
wk_ans = 0;
}
}
tmp = s.at(i);
}
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
}
cout << ans;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.add",
"variable_declaration.remove"
] | 748,914 | 748,912 | u282835662 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
s.at(i) = str;
}
sort(s.begin(), s.end());
int ans = 0, wk_ans = 0;
string tmp;
for (int i = 0; i < n; i++) {
if (tmp == s.at(i))
wk_ans++;
else {
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
wk_ans = 0;
}
}
tmp = s.at(i);
}
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
}
cout << ans;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string str;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> str;
sort(str.begin(), str.end());
s.at(i) = str;
}
sort(s.begin(), s.end());
int64_t ans = 0, wk_ans = 0;
string tmp;
for (int i = 0; i < n; i++) {
if (tmp == s.at(i))
wk_ans++;
else {
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
wk_ans = 0;
}
}
tmp = s.at(i);
}
if (wk_ans != 0) {
wk_ans++;
ans += (wk_ans) * (wk_ans - 1) / 2;
}
cout << ans;
} | [
"variable_declaration.type.primitive.change"
] | 748,915 | 748,912 | u282835662 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, cnt = 1, ans = 0;
cin >> n;
string s;
vector<string> sv(n);
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
sv[i] = s;
}
sort(sv.begin(), sv.end());
for (int i = 0; i < n - 1; i++) {
if (sv[i] != sv[i + 1]) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
} else
cnt++;
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, cnt = 1, ans = 0;
cin >> n;
string s;
vector<string> sv(n);
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
sv[i] = s;
}
sort(sv.begin(), sv.end());
for (int i = 0; i < n - 1; i++) {
if (sv[i] != sv[i + 1]) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
} else
cnt++;
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,918 | 748,919 | u501163846 | cpp |
p02947 | /*
g++ -std=c++14 -O2 -Wall a.cpp -o a && a
*/
// io
#include <iostream>
//#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/
//#include <cstdio>
//#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
// util
#include <string>
//#include <cstring>
#include <algorithm>
//#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
//#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
// containers https://en.cppreference.com/w/cpp/container
#include <vector>
//#include <queue>
//#include <set>
#include <map>
//#include <unordered_set>
//#include <unordered_map>
// time
//#include <ctime>
//#include <chrono>
// https://en.cppreference.com/w/cpp/header/chrono
// http://www.cplusplus.com/reference/chrono/
using namespace std;
typedef vector<int> arri;
typedef vector<float> arrf;
typedef pair<int, int> pairi;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;
// int modadd(int a, int b) { return ((a += b) < mod) ? a : (a - mod); }
// int modmult(int a, int b) { return (int)((a * b) % mod) }
// file input routed to stdinout
/*
std::ifstream inFile("input.txt");
std::ofstream outFile("output.txt");
std::cin.rdbuf(inFile.rdbuf());
std::cout.rdbuf(outFile.rdbuf());
*/
int bestforDay[100005];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
map<string, int> strs;
int pairs = 0;
for (int i = 0; i < n; i++) {
string in;
cin >> in;
sort(in.begin(), in.end());
auto ret = strs.insert({in, 0});
if (!ret.second) {
(ret.first->second)++;
pairs += ret.first->second;
}
}
cout << pairs;
}
| /*
g++ -std=c++14 -O2 -Wall a.cpp -o a && a
*/
// io
#include <iostream>
//#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/
//#include <cstdio>
//#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
// util
#include <string>
//#include <cstring>
#include <algorithm>
//#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
//#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
// containers https://en.cppreference.com/w/cpp/container
#include <vector>
//#include <queue>
//#include <set>
#include <map>
//#include <unordered_set>
//#include <unordered_map>
// time
//#include <ctime>
//#include <chrono>
// https://en.cppreference.com/w/cpp/header/chrono
// http://www.cplusplus.com/reference/chrono/
using namespace std;
typedef vector<int> arri;
typedef vector<float> arrf;
typedef pair<int, int> pairi;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;
// int modadd(int a, int b) { return ((a += b) < mod) ? a : (a - mod); }
// int modmult(int a, int b) { return (int)((a * b) % mod) }
// file input routed to stdinout
/*
std::ifstream inFile("input.txt");
std::ofstream outFile("output.txt");
std::cin.rdbuf(inFile.rdbuf());
std::cout.rdbuf(outFile.rdbuf());
*/
int bestforDay[100005];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
map<string, int> strs;
ll pairs = 0;
for (int i = 0; i < n; i++) {
string in;
cin >> in;
sort(in.begin(), in.end());
auto ret = strs.insert({in, 0});
if (!ret.second) {
(ret.first->second)++;
pairs += ret.first->second;
}
}
cout << pairs;
}
| [
"variable_declaration.type.change"
] | 748,920 | 748,921 | u027395921 | cpp |
p02947 | #include <algorithm>
#include <complex>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
long long fact(int n) {
if (n <= 0) {
return 0;
} else {
return (n + 1) * n / 2;
}
}
int main() {
int s_len = 10;
int N;
cin >> N;
vector<vector<char>> s(N);
for (int i = 0; i < N; i++) {
vector<char> new_s(s_len);
for (int j = 0; j < s_len; j++) {
cin >> new_s[j];
}
sort(new_s.begin(), new_s.end());
s[i] = new_s;
}
sort(s.begin(), s.end());
vector<char> dummy(1, '0');
s.push_back(dummy);
int l = 0;
int r = 0;
long long cnt = 0;
for (int i = 0; i <= N; i++) {
if (s[l] == s[i]) {
r = i;
} else {
cnt += fact(r - l);
l = i;
r = i;
}
}
// cout<<r<<l<<endl;
cout << cnt << endl;
} | #include <algorithm>
#include <complex>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
long long fact(long long n) {
if (n <= 0) {
return 0;
} else {
return (n + 1) * n / 2;
}
}
int main() {
int s_len = 10;
int N;
cin >> N;
vector<vector<char>> s(N);
for (int i = 0; i < N; i++) {
vector<char> new_s(s_len);
for (int j = 0; j < s_len; j++) {
cin >> new_s[j];
}
sort(new_s.begin(), new_s.end());
s[i] = new_s;
}
sort(s.begin(), s.end());
vector<char> dummy(1, '0');
s.push_back(dummy);
int l = 0;
int r = 0;
long long cnt = 0;
for (int i = 0; i <= N; i++) {
if (s[l] == s[i]) {
r = i;
} else {
cnt += fact(r - l);
l = i;
r = i;
}
}
// cout<<r<<l<<endl;
cout << cnt << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,922 | 748,923 | u545206239 | cpp |
p02947 | #include <algorithm>
#include <bits/stdc++.h>
#include <functional>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i, n) for (int i = 0; i < n; i++)
#define fro(i, j, n) for (int i = j; i < n; i++)
#define ifr(i, n) for (int i = n - 1; i >= 0; i--)
int main() {
int n;
ll ans = 0;
cin >> n;
string s[n];
fr(i, n) {
cin >> s[i];
string a[10];
fr(j, 10) { a[j] = s[i].substr(j, 1); }
sort(a, a + 10);
string b;
fr(j, 10) { b += a[j]; }
s[i] = b;
}
sort(s, s + n);
int kai = 1;
fr(i, n - 1) {
if (s[i] == s[i + 1]) {
kai++;
}
if (s[i] != s[i + 1]) {
ans += kai * (kai - 1) / 2;
kai = 1;
}
if (i == n - 2) {
ans += kai * (kai - 1) / 2;
}
}
cout << ans << endl;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <functional>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i, n) for (int i = 0; i < n; i++)
#define fro(i, j, n) for (int i = j; i < n; i++)
#define ifr(i, n) for (int i = n - 1; i >= 0; i--)
int main() {
int n;
ll ans = 0;
cin >> n;
string s[n];
fr(i, n) {
cin >> s[i];
string a[10];
fr(j, 10) { a[j] = s[i].substr(j, 1); }
sort(a, a + 10);
string b;
fr(j, 10) { b += a[j]; }
s[i] = b;
}
sort(s, s + n);
ll kai = 1;
fr(i, n - 1) {
if (s[i] == s[i + 1]) {
kai++;
}
if (s[i] != s[i + 1]) {
ans += kai * (kai - 1) / 2;
kai = 1;
}
if (i == n - 2) {
ans += kai * (kai - 1) / 2;
}
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 748,924 | 748,925 | u806159048 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
map<string, long long> map;
for (int i = 0; i < n; i++) {
cin >> s[i];
vector<char> c;
for (int j = 0; j < s[i].size(); j++) {
c.push_back(s[i][j]);
}
sort(c.begin(), c.end());
string sorted = "";
for (int j = 0; j < s[i].size(); j++) {
sorted = c[j];
}
if (map.count(sorted) == 0) {
map[sorted] = 1;
} else {
map[sorted]++;
}
}
long long ans = 0;
for (auto i = map.begin(); i != map.end(); ++i) {
long long a = i->second;
ans += a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
map<string, long long> map;
for (int i = 0; i < n; i++) {
cin >> s[i];
vector<char> c;
for (int j = 0; j < s[i].size(); j++) {
c.push_back(s[i][j]);
}
sort(c.begin(), c.end());
string sorted = "";
for (int j = 0; j < c.size(); j++) {
sorted += c[j];
}
if (map.count(sorted) == 0) {
map[sorted] = 1;
} else {
map[sorted]++;
}
}
long long ans = 0;
for (auto i = map.begin(); i != map.end(); ++i) {
long long a = i->second;
ans += a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"assignment.value.change"
] | 748,926 | 748,927 | u355911860 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 99999999
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
int kai(int i) {
if (i == 2)
return 1;
else
return kai(i - 1) + i - 1;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
rep(i, N) sort(all(s[i]));
sort(all(s));
ll ans = 0;
ll tmp = 0;
rep(i, N - 1) {
if (s[i] == s[i + 1])
tmp++;
else {
if (tmp != 0)
ans += kai(tmp + 1);
tmp = 0;
}
}
if (tmp != 0) {
ans += kai(tmp + 1);
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 99999999
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
ll kai(ll i) {
if (i == 2)
return 1;
else
return kai(i - 1) + i - 1;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
rep(i, N) sort(all(s[i]));
sort(all(s));
ll ans = 0;
ll tmp = 0;
rep(i, N - 1) {
if (s[i] == s[i + 1])
tmp++;
else {
if (tmp != 0)
ans += kai(tmp + 1);
tmp = 0;
}
}
if (tmp != 0) {
ans += kai(tmp + 1);
}
cout << ans << endl;
}
| [] | 748,928 | 748,929 | u730271001 | cpp |
p02947 | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ll long long
using namespace std;
const int M = 1000000007;
ll n, a, sol;
string c, h[10];
set<string> s;
map<string, ll> m;
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> c;
for (int i = 0; i < 10; i++)
h[i] = c.substr(i, 1);
sort(h, h + 10);
c = "";
for (int i = 0; i < n; i++)
c += h[i];
s.insert(c);
m[c]++;
}
for (set<string>::iterator it = s.begin(); it != s.end(); it++) {
a = m[*it];
if (a == 2)
sol++;
if (a > 2)
sol += (a * (a - 3)) / 2 + a;
}
cout << sol;
return 0;
}
| #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ll long long
using namespace std;
const int M = 1000000007;
ll n, a, sol;
string c, h[10];
set<string> s;
map<string, ll> m;
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> c;
for (int i = 0; i < 10; i++)
h[i] = c.substr(i, 1);
sort(h, h + 10);
c = "";
for (int i = 0; i < 10; i++)
c += h[i];
s.insert(c);
m[c]++;
}
for (set<string>::iterator it = s.begin(); it != s.end(); it++) {
a = m[*it];
if (a == 2)
sol++;
if (a > 2)
sol += (a * (a - 3)) / 2 + a;
}
cout << sol;
return 0;
}
| [
"identifier.replace.remove",
"literal.replace.add",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 748,936 | 748,937 | u395707260 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < n; i++)
ll mod = 1e9 + 7;
// ้ไน
ll factorial(ll a) {
if (a == 1) {
return 1;
}
return a * (factorial(a - 1));
}
//็ตใฟๅใใใฎๆฐ
ll nCr(ll n, ll r) { return factorial(n) / (factorial(r) * factorial(n - r)); }
//้่คใใ็ตใฟๅใใใฎๆฐ
ll nHr(ll n, ll r) { return factorial(n + r - 1) / factorial(r); }
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());
}
long ans = 0;
map<string, int> str;
for (int i = 0; i < n; i++) {
if (str[s[i]] != 0) {
str[s[i]]++;
} else {
str[s[i]] = 1;
}
}
for (auto ss = str.begin(); ss != str.end(); ss++) {
if (ss->second > 1) {
ans += (ss->second * (ss->second - 1)) / 2;
}
}
cout << ans << endl;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < n; i++)
ll mod = 1e9 + 7;
// ้ไน
ll factorial(ll a) {
if (a == 1) {
return 1;
}
return a * (factorial(a - 1));
}
//็ตใฟๅใใใฎๆฐ
ll nCr(ll n, ll r) { return factorial(n) / (factorial(r) * factorial(n - r)); }
//้่คใใ็ตใฟๅใใใฎๆฐ
ll nHr(ll n, ll r) { return factorial(n + r - 1) / factorial(r); }
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());
}
long ans = 0;
map<string, ll> str;
for (int i = 0; i < n; i++) {
if (str[s[i]] != 0) {
str[s[i]]++;
} else {
str[s[i]] = 1;
}
}
for (auto ss = str.begin(); ss != str.end(); ss++) {
if (ss->second > 1) {
ans += (ss->second * (ss->second - 1)) / 2;
}
}
cout << ans << endl;
}
| [] | 748,938 | 748,939 | u807028974 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
}
//ใฝใผใ
vector<string> S2(N);
for (int i = 0; i < N; i++) {
vector<char> C(S.at(i).length());
for (int j = 0; j < S.at(i).length(); j++) {
C.at(j) = S.at(i)[j];
}
sort(C.begin(), C.end());
S2.at(i) = "";
for (int j = 0; j < S.at(i).length(); j++) {
S2.at(i) += C.at(j);
}
}
sort(S2.begin(), S2.end());
long long int cnt = 0;
string s = "";
int same = 0;
for (int i = 0; i < N; i++) {
if (s == S2.at(i)) {
same++;
} else {
cnt += (same * (same + 1)) / 2;
same = 0;
s = S2.at(i);
}
}
cnt += (same * (same + 1)) / 2;
cout << cnt << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
}
//ใฝใผใ
vector<string> S2(N);
for (int i = 0; i < N; i++) {
vector<char> C(S.at(i).length());
for (int j = 0; j < S.at(i).length(); j++) {
C.at(j) = S.at(i)[j];
}
sort(C.begin(), C.end());
S2.at(i) = "";
for (int j = 0; j < S.at(i).length(); j++) {
S2.at(i) += C.at(j);
}
}
sort(S2.begin(), S2.end());
long cnt = 0;
string s = "";
long same = 0;
for (int i = 0; i < N; i++) {
if (s == S2.at(i)) {
same++;
} else {
cnt += (same * (same + 1)) / 2;
same = 0;
s = S2.at(i);
}
}
cnt += (same * (same + 1)) / 2;
cout << cnt << endl;
return 0;
}
| [
"variable_declaration.type.narrow.change",
"variable_declaration.type.primitive.change"
] | 748,943 | 748,944 | u628134373 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
}
//ใฝใผใ
vector<string> S2(N);
for (int i = 0; i < N; i++) {
vector<char> C(S.at(i).length());
for (int j = 0; j < S.at(i).length(); j++) {
C.at(j) = S.at(i)[j];
}
sort(C.begin(), C.end());
S2.at(i) = "";
for (int j = 0; j < S.at(i).length(); j++) {
S2.at(i) += C.at(j);
}
}
sort(S2.begin(), S2.end());
long long int cnt = 0;
string s = "";
int same = 0;
for (int i = 0; i < N; i++) {
if (s == S2.at(i)) {
same++;
} else {
cnt += (same * (same + 1)) / 2;
same = 0;
s = S2.at(i);
}
}
cnt += (same + (same + 1)) / 2;
cout << cnt << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
}
//ใฝใผใ
vector<string> S2(N);
for (int i = 0; i < N; i++) {
vector<char> C(S.at(i).length());
for (int j = 0; j < S.at(i).length(); j++) {
C.at(j) = S.at(i)[j];
}
sort(C.begin(), C.end());
S2.at(i) = "";
for (int j = 0; j < S.at(i).length(); j++) {
S2.at(i) += C.at(j);
}
}
sort(S2.begin(), S2.end());
long cnt = 0;
string s = "";
long same = 0;
for (int i = 0; i < N; i++) {
if (s == S2.at(i)) {
same++;
} else {
cnt += (same * (same + 1)) / 2;
same = 0;
s = S2.at(i);
}
}
cnt += (same * (same + 1)) / 2;
cout << cnt << endl;
return 0;
}
| [
"variable_declaration.type.narrow.change",
"variable_declaration.type.primitive.change",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 748,945 | 748,944 | u628134373 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i <= (n); i++)
#define LL long long int
using namespace std;
LL lcm(LL n, LL m) {
LL u;
LL ansl = 0;
for (u = m; u >= m; u++) {
if (u % n == 0) {
if (u % m == 0) {
ansl = u;
break;
}
}
}
return ansl;
}
int main(void) {
int n;
cin >> n;
vector<string> s(n);
string w;
rep(i, n) {
cin >> w;
sort(w.begin(), w.end());
s[i] = w;
}
sort(s.begin(), s.end());
w = "";
LL ans = 0;
int flag = 1;
LL wa = 1;
vector<LL> aa(n);
aa[0] = 0;
aa[1] = 0;
for (int i = 2; i < n; i++) {
aa[i] = i - 1 + aa[i - 1];
}
rep(i, n) {
if (s[i] == w) {
wa++;
}
if (s[i] != w) {
w = s[i];
ans += aa[wa];
wa = 1;
}
}
w = s[n - 1];
ans += aa[wa];
wa = 1;
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i <= (n); i++)
#define LL long long int
using namespace std;
LL lcm(LL n, LL m) {
LL u;
LL ansl = 0;
for (u = m; u >= m; u++) {
if (u % n == 0) {
if (u % m == 0) {
ansl = u;
break;
}
}
}
return ansl;
}
int main(void) {
int n;
cin >> n;
vector<string> s(n);
string w;
rep(i, n) {
cin >> w;
sort(w.begin(), w.end());
s[i] = w;
}
sort(s.begin(), s.end());
w = "";
LL ans = 0;
int flag = 1;
LL wa = 1;
vector<LL> aa(n + 1);
aa[0] = 0;
aa[1] = 0;
for (int i = 2; i < n + 1; i++) {
aa[i] = i - 1 + aa[i - 1];
}
rep(i, n) {
if (s[i] == w) {
wa++;
}
if (s[i] != w) {
w = s[i];
ans += aa[wa];
wa = 1;
}
}
w = s[n - 1];
ans += aa[wa];
wa = 1;
cout << ans << endl;
return 0;
} | [
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 748,946 | 748,947 | u473092610 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i <= (n); i++)
#define LL long long int
using namespace std;
LL lcm(LL n, LL m) {
LL u;
LL ansl = 0;
for (u = m; u >= m; u++) {
if (u % n == 0) {
if (u % m == 0) {
ansl = u;
break;
}
}
}
return ansl;
}
int main(void) {
int n;
cin >> n;
vector<string> s(n);
string w;
rep(i, n) {
cin >> w;
sort(w.begin(), w.end());
s[i] = w;
}
sort(s.begin(), s.end());
w = "";
LL ans = 0;
int flag = 1;
LL wa = 1;
vector<int> aa(n);
aa[0] = 0;
aa[1] = 0;
for (int i = 2; i < n; i++) {
aa[i] = i - 1 + aa[i - 1];
}
rep(i, n) {
if (s[i] == w) {
wa++;
}
if (s[i] != w) {
w = s[i];
ans += aa[wa];
wa = 1;
}
}
w = s[n - 1];
ans += aa[wa];
wa = 1;
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i <= (n); i++)
#define LL long long int
using namespace std;
LL lcm(LL n, LL m) {
LL u;
LL ansl = 0;
for (u = m; u >= m; u++) {
if (u % n == 0) {
if (u % m == 0) {
ansl = u;
break;
}
}
}
return ansl;
}
int main(void) {
int n;
cin >> n;
vector<string> s(n);
string w;
rep(i, n) {
cin >> w;
sort(w.begin(), w.end());
s[i] = w;
}
sort(s.begin(), s.end());
w = "";
LL ans = 0;
int flag = 1;
LL wa = 1;
vector<LL> aa(n + 1);
aa[0] = 0;
aa[1] = 0;
for (int i = 2; i < n + 1; i++) {
aa[i] = i - 1 + aa[i - 1];
}
rep(i, n) {
if (s[i] == w) {
wa++;
}
if (s[i] != w) {
w = s[i];
ans += aa[wa];
wa = 1;
}
}
w = s[n - 1];
ans += aa[wa];
wa = 1;
cout << ans << endl;
return 0;
} | [
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 748,948 | 748,947 | u473092610 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int n;
string s;
map<string, int> m;
int main() {
cin >> n;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ans += m[s];
m[s]++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int n;
string s;
map<string, int> m;
int main() {
cin >> n;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ans += m[s];
m[s]++;
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,954 | 748,955 | u471585927 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
string a[N];
map<string, long long> p;
int main() {
int n;
cin >> n;
getchar();
for (int i = 0; i < n; i++) {
// getchar();
cin >> a[i];
// int len=a[i].size();
sort(a[i].begin(), a[i].end());
if (!p.count(a[i]))
p[a[i]] = 1;
else
p[a[i]]++;
}
long long cnt = 0;
map<string, long long>::iterator it;
for (it = p.begin(); it != p.end(); it++) {
int k = it->second;
if (k > 1)
cnt = cnt + (k - 1) * k / 2;
}
cout << cnt << endl;
} | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
string a[N];
map<string, long long> p;
int main() {
int n;
cin >> n;
getchar();
for (int i = 0; i < n; i++) {
// getchar();
cin >> a[i];
// int len=a[i].size();
sort(a[i].begin(), a[i].end());
if (!p.count(a[i]))
p[a[i]] = 1;
else
p[a[i]]++;
}
long long cnt = 0;
map<string, long long>::iterator it;
for (it = p.begin(); it != p.end(); it++) {
long long k = it->second;
if (k > 1)
cnt = cnt + (k - 1) * k / 2;
}
cout << cnt << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,956 | 748,957 | u002122093 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.