problem_id
stringlengths 6
6
| buggy_code
stringlengths 8
526k
| fixed_code
stringlengths 12
526k
| labels
listlengths 0
15
⌀ | buggy_submission_id
int64 1
1.54M
| fixed_submission_id
int64 2
1.54M
| user_id
stringlengths 10
10
| language
stringclasses 8
values |
|---|---|---|---|---|---|---|---|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> Vec(N);
for (int i = 0; i < N; i++) {
cin >> Vec.at(i);
sort(Vec.at(i).begin(), Vec.at(i).end());
}
sort(Vec.begin(), Vec.end());
/*for(int i=0; i<3; i++){
cout<<Vec.at(i)<<" ";
}*/
int Sum = 0;
int Count = 0;
for (int i = 0; i < N - 1; i++) {
bool X = true;
for (int j = 0; j < 10; j++) {
if (Vec.at(i).at(j) == Vec.at(i + 1).at(j)) {
continue;
} else {
X = false;
break;
}
}
Sum += Count;
if (X) {
Count++;
} else {
Count = 0;
}
}
Sum += Count;
cout << Sum << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> Vec(N);
for (int i = 0; i < N; i++) {
cin >> Vec.at(i);
sort(Vec.at(i).begin(), Vec.at(i).end());
}
sort(Vec.begin(), Vec.end());
/*for(int i=0; i<3; i++){
cout<<Vec.at(i)<<" ";
}*/
long long Sum = 0;
long long Count = 0;
for (int i = 0; i < N - 1; i++) {
bool X = true;
for (int j = 0; j < 10; j++) {
if (Vec.at(i).at(j) == Vec.at(i + 1).at(j)) {
continue;
} else {
X = false;
break;
}
}
Sum += Count;
if (X) {
Count++;
} else {
Count = 0;
}
}
Sum += Count;
cout << Sum << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,500
| 747,501
|
u196629968
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
unordered_map<string, int> Words;
int Sum = 0;
for (int i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
Sum += Words[S];
Words[S]++;
}
cout << Sum << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
unordered_map<string, int> Words;
long long Sum = 0;
for (int i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
Sum += Words[S];
Words[S]++;
}
cout << Sum << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,502
| 747,503
|
u196629968
|
cpp
|
p02947
|
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 998244353;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int main() {
int n;
cin >> n;
map<string, int> a;
while (n--) {
string s;
cin >> s;
sort(all(s));
a[s]++;
}
int sol = 0;
for (auto &x : a) {
sol += ((x.second - 1) * (x.second)) / 2;
}
cout << sol;
}
|
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 998244353;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int main() {
int n;
cin >> n;
map<string, ll> a;
while (n--) {
string s;
cin >> s;
sort(all(s));
a[s]++;
}
ll sol = 0;
for (auto &x : a) {
sol += ((x.second - 1) * (x.second)) / 2;
}
cout << sol;
}
|
[
"variable_declaration.type.change"
] | 747,504
| 747,505
|
u788461451
|
cpp
|
p02947
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iostream>
#include <list> //双方向リスト
#include <map> //連想配列
#include <numeric>
#include <queue>
#include <set> //集合
#include <stack>
#include <string>
#include <tuple>
#include <vector> //動的配列
typedef long long ll;
using namespace std;
typedef pair<int, int> P;
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
ll fast_pow(ll x, ll n, ll mod) {
if (n == 0)
return 1;
ll res = fast_pow(x * x % mod, n / 2, mod);
if (n & 1)
res = res * x % mod;
return res;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &v) {
o << "{";
for (int i = 0; i < (int)v.size(); i++)
o << (i > 0 ? ", " : "") << v[i];
o << "}";
return o;
}
// n次元配列の初期化。第2引数の型のサイズごとに初期化していく。
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
//小さい順から取り出すヒープ
// priority_queue<ll, vector<ll>, greater<ll> > pque1;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
int a = (*itr).second;
ans += a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iostream>
#include <list> //双方向リスト
#include <map> //連想配列
#include <numeric>
#include <queue>
#include <set> //集合
#include <stack>
#include <string>
#include <tuple>
#include <vector> //動的配列
typedef long long ll;
using namespace std;
typedef pair<int, int> P;
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
ll fast_pow(ll x, ll n, ll mod) {
if (n == 0)
return 1;
ll res = fast_pow(x * x % mod, n / 2, mod);
if (n & 1)
res = res * x % mod;
return res;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &v) {
o << "{";
for (int i = 0; i < (int)v.size(); i++)
o << (i > 0 ? ", " : "") << v[i];
o << "}";
return o;
}
// n次元配列の初期化。第2引数の型のサイズごとに初期化していく。
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
std::fill((T *)array, (T *)(array + N), val);
}
//小さい順から取り出すヒープ
// priority_queue<ll, vector<ll>, greater<ll> > pque1;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
int a = (*itr).second;
ans += (ll)a * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 747,508
| 747,509
|
u652150585
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int N;
cin >> N;
string strings[N];
string input;
getline(cin, input);
for (int i = 0; i < N; i++) {
getline(cin, input);
strings[i] = input;
sort(strings[i].begin(), strings[i].end());
}
sort(strings, strings + N);
int in_a_row = 1, pairs = 0;
for (int i = 0; i < N - 1; i++) {
if (strings[i] == strings[i + 1]) {
pairs += in_a_row;
in_a_row++;
} else {
in_a_row = 1;
}
}
cout << pairs;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int N;
cin >> N;
string strings[N];
string input;
getline(cin, input);
for (int i = 0; i < N; i++) {
getline(cin, input);
strings[i] = input;
sort(strings[i].begin(), strings[i].end());
}
sort(strings, strings + N);
long long int in_a_row = 1, pairs = 0;
for (int i = 0; i < N - 1; i++) {
if (strings[i] == strings[i + 1]) {
pairs += in_a_row;
in_a_row++;
} else {
in_a_row = 1;
}
}
cout << pairs;
}
|
[
"variable_declaration.type.widen.change"
] | 747,510
| 747,511
|
u837542104
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int N;
cin >> N;
string strings[N];
string input;
getline(cin, input);
for (int i = 0; i < N; i++) {
getline(cin, input);
strings[i] = input;
sort(strings[i].begin(), strings[i].end());
}
sort(strings, strings + N);
int in_a_row = 1, pairs = 0;
for (int i = 1; i < N; i++) {
if (strings[i] == strings[i - 1]) {
pairs += in_a_row;
in_a_row++;
} else {
in_a_row = 1;
}
}
cout << pairs;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int N;
cin >> N;
string strings[N];
string input;
getline(cin, input);
for (int i = 0; i < N; i++) {
getline(cin, input);
strings[i] = input;
sort(strings[i].begin(), strings[i].end());
}
sort(strings, strings + N);
long long int in_a_row = 1, pairs = 0;
for (int i = 0; i < N - 1; i++) {
if (strings[i] == strings[i + 1]) {
pairs += in_a_row;
in_a_row++;
} else {
in_a_row = 1;
}
}
cout << pairs;
}
|
[
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 747,512
| 747,511
|
u837542104
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define REPI(i, n) for (int i = 0; i < n; i++)
#define REPJ(j, n) for (int j = 0; j < n; j++)
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
string array[n];
REPI(i, n) cin >> array[i];
REPI(i, n) sort(array[i].begin(), array[i].end());
sort(array, array + n);
int ans = 0, count = 0;
REPI(i, n - 1) {
if (array[i] == array[i + 1]) {
count++;
ans += count;
} else
count = 0;
}
cout << ans;
}
|
#include <bits/stdc++.h>
#define REPI(i, n) for (int i = 0; i < n; i++)
#define REPJ(j, n) for (int j = 0; j < n; j++)
using ll = long long;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
string array[n];
REPI(i, n) cin >> array[i];
REPI(i, n) sort(array[i].begin(), array[i].end());
sort(array, array + n);
ll ans = 0, count = 0;
REPI(i, n - 1) {
if (array[i] == array[i + 1]) {
count++;
ans += count;
} else
count = 0;
}
cout << ans;
}
|
[
"variable_declaration.type.change"
] | 747,515
| 747,516
|
u505466816
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n;
cin >> n;
priority_queue<string> pq;
REP(i, n) {
string x;
cin >> x;
sort(x.begin(), x.end());
pq.push(x);
}
int ans = 0;
int count = 1;
string x = pq.top();
pq.pop();
REP(i, n - 1) {
string y = pq.top();
pq.pop();
if (x == y) {
ans += count;
count++;
} else
count = 1;
x = y;
}
cout << ans;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
int n;
cin >> n;
priority_queue<string> pq;
REP(i, n) {
string x;
cin >> x;
sort(x.begin(), x.end());
pq.push(x);
}
long long ans = 0;
int count = 1;
string x = pq.top();
pq.pop();
REP(i, n - 1) {
string y = pq.top();
pq.pop();
if (x == y) {
ans += count;
count++;
} else
count = 1;
x = y;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,517
| 747,518
|
u505466816
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;
using namespace std;
int main(int argc, char *argv[]) {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
}
sort(all(s));
int sum = 0;
int count = 0;
for (int i = 1; i < n; i++) {
if (s[i - 1] == s[i]) {
count++;
sum += count;
} else {
count = 0;
}
}
cout << sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;
using namespace std;
int main(int argc, char *argv[]) {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(all(s[i]));
}
sort(all(s));
ll sum = 0;
ll count = 0;
for (int i = 1; i < n; i++) {
if (s[i - 1] == s[i]) {
count++;
sum += count;
} else {
count = 0;
}
}
cout << sum << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,523
| 747,524
|
u732817215
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#define int long long
signed main() {
int N, ans, tv;
std::cin >> N;
std::string temp;
std::map<std::string, int> dictionary;
for (int i = 0; i < N; i++) {
std::cin >> temp;
std::sort(temp.begin(), temp.end());
dictionary[temp]++;
}
for (auto itr = dictionary.begin(); itr != dictionary.end(); ++itr) {
tv = itr->second;
ans += tv * (tv - 1) / 2;
}
std::cout << ans << std::endl;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#define int long long
signed main() {
int N, ans = 0, tv;
std::cin >> N;
std::string temp;
std::map<std::string, int> dictionary;
for (int i = 0; i < N; i++) {
std::cin >> temp;
std::sort(temp.begin(), temp.end());
dictionary[temp]++;
}
for (auto itr = dictionary.begin(); itr != dictionary.end(); ++itr) {
tv = itr->second;
ans += tv * (tv - 1) / 2;
}
std::cout << ans << std::endl;
}
|
[
"variable_declaration.value.change"
] | 747,525
| 747,526
|
u425830382
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main(void) {
int n;
std::cin >> n;
std::map<std::string, int> mp;
for (int i = 0; i < n; i++) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
mp.at(s)++;
}
long long ans = 0;
for (auto &p : mp) {
int temp = p.second;
ans += (long long)temp * (temp - 1) / 2;
}
std::cout << ans << std::endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main(void) {
int n;
std::cin >> n;
std::map<std::string, int> mp;
for (int i = 0; i < n; i++) {
std::string s;
std::cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int temp = p.second;
ans += (long long)temp * (temp - 1) / 2;
}
std::cout << ans << std::endl;
return 0;
}
|
[
"call.remove",
"call.arguments.change"
] | 747,531
| 747,532
|
u477343425
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main(void) {
int n;
std::cin >> n;
std::map<std::string, int> mp;
for (int i = 0; i < n; i++) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
mp.at(s)++;
}
long long ans = 0;
for (auto &p : mp) {
int temp = p.second;
ans += (long long)temp * (temp - 1) / 2;
}
std::cout << ans << std::endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main(void) {
int n;
std::cin >> n;
std::map<std::string, int> mp;
for (int i = 0; i < n; i++) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int temp = p.second;
ans += (long long)temp * (temp - 1) / 2;
}
std::cout << ans << std::endl;
return 0;
}
|
[
"call.remove",
"call.arguments.change"
] | 747,531
| 747,533
|
u477343425
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int>>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
map<string, int> freq;
string s;
rep(i, N) {
cin >> s;
sort(s.begin(), s.end());
freq[s]++;
}
ll ans = 0;
for (auto v : freq) {
int num = v.second;
if (num > 1) {
ans += (num * (num - 1)) / 2;
}
}
cout << ans << endl;
// system("pause");
return 0;
}
|
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int>>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
map<string, int> freq;
string s;
rep(i, N) {
cin >> s;
sort(s.begin(), s.end());
freq[s]++;
}
ll ans = 0;
for (auto v : freq) {
ll num = v.second;
if (num > 1) {
ans += (num * (num - 1)) / 2;
}
}
cout << ans << endl;
// system("pause");
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,534
| 747,535
|
u438265890
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string tmp;
vector<string> vec(N);
for (int i = 0; i < N; i++) {
cin >> tmp;
sort(tmp.begin(), tmp.end());
vec.at(i) = tmp;
// cout << vec.at(i) << endl;
}
sort(vec.begin(), vec.end());
vec.push_back("-1");
string str_tmp = vec.at(0);
long long int ans = 0;
int cnt = 1;
long long int ans_tmp;
for (int i = 1; i <= N; i++) {
if (str_tmp == vec.at(i)) {
cnt += 1;
} else {
str_tmp = vec.at(i);
ans_tmp = cnt * (cnt - 1);
ans += ans_tmp;
cnt = 1;
}
}
cout << ans / 2 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string tmp;
vector<string> vec(N);
for (int i = 0; i < N; i++) {
cin >> tmp;
sort(tmp.begin(), tmp.end());
vec.at(i) = tmp;
// cout << vec.at(i) << endl;
}
sort(vec.begin(), vec.end());
vec.push_back("-1");
string str_tmp = vec.at(0);
long long int ans = 0;
long long int cnt = 1;
long long int ans_tmp;
for (int i = 1; i <= N; i++) {
if (str_tmp == vec.at(i)) {
cnt += 1;
} else {
str_tmp = vec.at(i);
ans_tmp = cnt * (cnt - 1);
ans += ans_tmp;
cnt = 1;
}
}
cout << ans / 2 << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 747,542
| 747,543
|
u190875453
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < int(a); ++i)
#define REP(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int main() {
int N;
cin >> N;
string s[N];
rep(i, N) cin >> s[i];
rep(i, N) sort(s[i].begin(), s[i].end());
map<string, int> kumi;
rep(i, N) kumi[s[i]]++;
int ans = 0;
for (auto i = kumi.begin(); i != kumi.end(); i++) {
ll as = (i->second);
ans += (as * (as - 1)) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < int(a); ++i)
#define REP(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int main() {
int N;
cin >> N;
string s[N];
rep(i, N) cin >> s[i];
rep(i, N) sort(s[i].begin(), s[i].end());
map<string, int> kumi;
rep(i, N) kumi[s[i]]++;
ll ans = 0;
for (auto i = kumi.begin(); i != kumi.end(); i++) {
ll as = (i->second);
ans += (as * (as - 1)) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.change"
] | 747,546
| 747,547
|
u089885969
|
cpp
|
p02947
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <stack>
#include <unordered_map>
#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];
}
unordered_map<string, int> mp;
for (auto &string : s) {
sort(string.begin(), string.end());
mp[string]++;
}
int answer = 0;
for (auto &factor : mp) {
answer += factor.second * (factor.second - 1) / 2;
}
cout << answer << endl;
return 0;
}
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <stack>
#include <unordered_map>
#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];
}
unordered_map<string, long long> mp;
for (auto &string : s) {
sort(string.begin(), string.end());
mp[string]++;
}
long long answer = 0;
for (auto &factor : mp) {
answer += factor.second * (factor.second - 1) / 2;
}
cout << answer << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,552
| 747,553
|
u762677575
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
void solve() {
int N;
cin >> N;
map<string, int> m;
REP(i, N) {
string str;
cin >> str;
sort(ALL(str));
if (m.find(str) == m.end())
m.insert(make_pair(str, 1));
else
m[str]++;
}
ll ans = 0;
for (auto itr = m.begin(); itr != m.end(); itr++) {
int n = itr->second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
}
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(20);
solve();
return 0;
}
|
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP1(i, n) for (int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
void solve() {
ll N;
cin >> N;
map<string, int> m;
REP(i, N) {
string str;
cin >> str;
sort(ALL(str));
if (m.find(str) == m.end())
m.insert(make_pair(str, 1));
else
m[str]++;
}
ll ans = 0;
for (auto itr = m.begin(); itr != m.end(); itr++) {
ll n = itr->second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
}
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(20);
solve();
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,554
| 747,555
|
u952289831
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
map<string, int> ns;
string s;
for (int i = 0; i < N; ++i) {
cin >> s;
sort(s.begin(), s.end());
ns[s]++;
}
ll ans = 0;
for (auto n : ns) {
ans += (n.second * (n.second - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
map<string, ll> ns;
string s;
for (int i = 0; i < N; ++i) {
cin >> s;
sort(s.begin(), s.end());
ns[s]++;
}
ll ans = 0;
for (auto n : ns) {
ans += (n.second * (n.second - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 747,556
| 747,557
|
u231541008
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> num{};
for (int i = 0; i < n; i++) {
num[s[i]]++;
}
ll ans = 0;
for (auto p : num) {
ll comb = (p.second) * (p.second - 1) / 2;
ans += comb;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, ll> num{};
for (int i = 0; i < n; i++) {
num[s[i]]++;
}
ll ans = 0;
for (auto p : num) {
ll comb = (p.second) * (p.second - 1) / 2;
ans += comb;
}
cout << ans << endl;
}
|
[] | 747,558
| 747,559
|
u893584578
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> vs(n);
for (int i = 0; i < n; i++)
cin >> vs[i];
map<string, int> mp;
for (int i = 0; i < n; i++) {
sort(vs[i].begin(), vs[i].end());
mp[vs[i]]++;
}
long long ans = 0;
for (auto i : mp)
ans += (i.second * (i.second - 1)) / 2;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> vs(n);
for (int i = 0; i < n; i++)
cin >> vs[i];
map<string, long long> mp;
for (int i = 0; i < n; i++) {
sort(vs[i].begin(), vs[i].end());
mp[vs[i]]++;
}
long long ans = 0;
for (auto i : mp)
ans += (i.second * (i.second - 1)) / 2;
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,560
| 747,561
|
u150376070
|
cpp
|
p02947
|
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
typedef long long ll;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) \
rep(i, 0, v.size()) { \
p(v[i]); \
p(" ") \
} \
pl("")
#define p(s) std::cout << s;
#define pl(s) std::cout << s << endl;
using namespace std;
// 素数判定 O(√n)
bool is_prime(int n) {
for (int i = 2; i * i <= n; i++) {
if (n % i == 0)
return false;
}
return true;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int N;
cin >> N;
// vector<vector<int>> data(3, vector<int>(4));
//初期値0
// vector<int> data(i, 0);
vector<string> a(N);
rep(i, 0, N) { cin >> a[i]; }
int res = 0;
unordered_map<string, int> mp(N);
rep(i, 0, N) {
sort(a[i].begin(), a[i].end());
if (mp[a[i]] != 0) {
res += mp[a[i]];
}
mp[a[i]]++;
}
cout << res << endl;
return 0;
}
|
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
typedef long long ll;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) \
rep(i, 0, v.size()) { \
p(v[i]); \
p(" ") \
} \
pl("")
#define p(s) std::cout << s;
#define pl(s) std::cout << s << endl;
using namespace std;
// 素数判定 O(√n)
bool is_prime(int n) {
for (int i = 2; i * i <= n; i++) {
if (n % i == 0)
return false;
}
return true;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int N;
cin >> N;
vector<string> a(N);
rep(i, 0, N) { cin >> a[i]; }
ll res = 0;
unordered_map<string, int> mp(N);
rep(i, 0, N) {
sort(a[i].begin(), a[i].end());
if (mp[a[i]] != 0) {
res += mp[a[i]];
}
mp[a[i]]++;
}
cout << res << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,566
| 747,567
|
u452512115
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
unordered_map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int t = p.second;
ans += (ll)(t * (t - 1) / 2);
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int t = p.second;
ans += (ll)t * (t - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"call.arguments.change"
] | 747,568
| 747,569
|
u115838990
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int t = p.second;
ans += (ll)(t * (t - 1) / 2);
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int t = p.second;
ans += (ll)t * (t - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"call.arguments.change"
] | 747,570
| 747,569
|
u115838990
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
const int MOD = 1e9 + 7;
// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}
int main() {
// cin.tie(0);
// ios::sync_with_stdio(false);
int N;
cin >> N;
vector<string> s(N);
REP(i, N) {
cin >> s.at(i);
sort(ALL(s[i]));
}
sort(ALL(s));
// REP(i, N) { cout << s[i] << endl; }
ll ans = 0;
int now = 1;
REP(i, N - 1) {
if (s[i] == s[i + 1]) {
now++;
} else {
if (now > 1) {
ans += now * (now - 1) / 2;
}
now = 1;
}
}
if (now > 1) {
ans += now * (now - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
const int MOD = 1e9 + 7;
// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}
int main() {
// cin.tie(0);
// ios::sync_with_stdio(false);
int N;
cin >> N;
vector<string> s(N);
REP(i, N) {
cin >> s.at(i);
sort(ALL(s[i]));
}
sort(ALL(s));
// REP(i, N) { cout << s[i] << endl; }
ll ans = 0;
ll now = 1;
REP(i, N - 1) {
if (s[i] == s[i + 1]) {
now++;
} else {
if (now > 1) {
ans += now * (now - 1) / 2;
}
now = 1;
}
}
if (now > 1) {
ans += now * (now - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,573
| 747,574
|
u571173211
|
cpp
|
p02947
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define repf(i, m, n) for (int i = (m); 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;
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////
int main() {
int n;
cin >> n;
vector<string> s(n);
int ans = 0;
map<string, int> m;
rep(i, n) {
cin >> s[i], sort(s[i].begin(), s[i].end());
ans += m[s[i]];
m[s[i]]++;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define repf(i, m, n) for (int i = (m); 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;
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////
int main() {
int n;
cin >> n;
vector<string> s(n);
ll ans = 0;
map<string, ll> m;
rep(i, n) {
cin >> s[i], sort(s[i].begin(), s[i].end());
ans += m[s[i]];
m[s[i]]++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,579
| 747,580
|
u374929478
|
cpp
|
p02947
|
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
ll mySigma(ll n) {
int result = 0;
for (int i = 0; i < n; i++) {
result += (i + 1);
}
return result;
}
int s[100000][10];
int main() {
int N;
ll ss[100000];
scanf("%d", &N);
for (int i = 0; i < N; i++) {
char c[10 + 1];
scanf("%s", c);
for (int j = 0; j < 10; j++) {
s[i][j] = (int)c[j] - 97;
}
sort(s[i], s[i] + 10);
ss[i] = 0;
for (int j = 0; j < 10; j++) {
ll sss = s[i][j];
ss[i] = ss[i] | (sss << 5 * j);
}
}
sort(ss, ss + N);
ll count = 0;
for (int i = 0; i < N - 1; i++) {
for (int j = i + 1; j < N; j++) {
if (ss[i] != ss[j]) {
count += mySigma(j - i - 1);
i += j - i - 1;
break;
} else if (j == N - 1) {
count += mySigma(j - i);
i = N;
break;
}
}
}
printf("%lld\n", count);
return 0;
}
|
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
ll mySigma(ll n) {
ll result = 0;
for (int i = 0; i < n; i++) {
result += (i + 1);
}
return result;
}
int s[100000][10];
int main() {
int N;
ll ss[100000];
scanf("%d", &N);
for (int i = 0; i < N; i++) {
char c[10 + 1];
scanf("%s", c);
for (int j = 0; j < 10; j++) {
s[i][j] = (int)c[j] - 97;
}
sort(s[i], s[i] + 10);
ss[i] = 0;
for (int j = 0; j < 10; j++) {
ll sss = s[i][j];
ss[i] = ss[i] | (sss << 5 * j);
}
}
sort(ss, ss + N);
ll count = 0;
for (int i = 0; i < N - 1; i++) {
for (int j = i + 1; j < N; j++) {
if (ss[i] != ss[j]) {
count += mySigma(j - i - 1);
i += j - i - 1;
break;
} else if (j == N - 1) {
count += mySigma(j - i);
i = N;
break;
}
}
}
printf("%lld\n", count);
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,583
| 747,584
|
u915389871
|
cpp
|
p02947
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <vector>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
//----------------------------------------
int main(void) {
int n;
cin >> n;
int ans = 0;
unordered_map<string, int> moji;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += moji[s];
moji[s]++;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <vector>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
//----------------------------------------
int main(void) {
int n;
cin >> n;
ll ans = 0;
map<string, ll> moji;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += moji[s];
moji[s]++;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 747,585
| 747,586
|
u118340517
|
cpp
|
p02947
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <vector>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
//----------------------------------------
int main(void) {
int n;
cin >> n;
int ans = 0;
unordered_map<string, int> moji;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += moji[s];
moji[s]++;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <unordered_map>
#include <vector>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
//----------------------------------------
int main(void) {
int n;
cin >> n;
ll ans = 0;
unordered_map<string, ll> moji;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += moji[s];
moji[s]++;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 747,585
| 747,587
|
u118340517
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
ll a;
string s;
cin >> n;
map<int, int> mp;
for (int i = 0; i < n; i++) {
int tmp[26] = {};
cin >> s;
for (char c : s) {
tmp[c - 'a']++;
}
a = 0;
for (int j = 0; j < 26; j++) {
a = a * 26LL + tmp[j];
}
mp[a]++;
}
ll ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
int s = it->second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
ll a;
string s;
cin >> n;
map<ll, ll> mp;
for (int i = 0; i < n; i++) {
int tmp[26] = {};
cin >> s;
for (char c : s) {
tmp[c - 'a']++;
}
a = 0;
for (int j = 0; j < 26; j++) {
a = a * 11LL + tmp[j];
}
mp[a]++;
}
ll ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
int s = it->second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans;
return 0;
}
|
[
"literal.number.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 747,588
| 747,589
|
u983711104
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, a;
string s;
cin >> n;
map<int, int> mp;
for (int i = 0; i < n; i++) {
int tmp[26] = {};
cin >> s;
for (char c : s) {
tmp[c - 'a']++;
}
a = 0;
for (int j = 0; j < 26; j++) {
a = a * 26LL + tmp[j];
}
mp[a]++;
}
ll ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
int s = it->second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
ll a;
string s;
cin >> n;
map<ll, ll> mp;
for (int i = 0; i < n; i++) {
int tmp[26] = {};
cin >> s;
for (char c : s) {
tmp[c - 'a']++;
}
a = 0;
for (int j = 0; j < 26; j++) {
a = a * 11LL + tmp[j];
}
mp[a]++;
}
ll ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
int s = it->second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans;
return 0;
}
|
[
"literal.number.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 747,590
| 747,589
|
u983711104
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
ll a;
string s;
cin >> n;
map<int, int> mp;
for (int i = 0; i < n; i++) {
int tmp[26] = {};
cin >> s;
for (char c : s) {
tmp[c - 'a']++;
}
a = 0;
for (int j = 0; j < 26; j++) {
a = a * 26LL + tmp[j];
}
mp[a]++;
}
ll ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
int s = it->second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
ll a;
string s;
cin >> n;
map<ll, ll> mp;
for (int i = 0; i < n; i++) {
int tmp[26] = {};
cin >> s;
for (char c : s) {
tmp[c - 'a']++;
}
a = 0;
for (int j = 0; j < 26; j++) {
a = a * 26LL + tmp[j];
}
mp[a]++;
}
ll ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
int s = it->second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans;
return 0;
}
|
[] | 747,588
| 747,591
|
u983711104
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, a;
string s;
cin >> n;
map<int, int> mp;
for (int i = 0; i < n; i++) {
int tmp[26] = {};
cin >> s;
for (char c : s) {
tmp[c - 'a']++;
}
a = 0;
for (int j = 0; j < 26; j++) {
a = a * 26LL + tmp[j];
}
mp[a]++;
}
ll ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
int s = it->second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
ll a;
string s;
cin >> n;
map<ll, ll> mp;
for (int i = 0; i < n; i++) {
int tmp[26] = {};
cin >> s;
for (char c : s) {
tmp[c - 'a']++;
}
a = 0;
for (int j = 0; j < 26; j++) {
a = a * 26LL + tmp[j];
}
mp[a]++;
}
ll ans = 0;
for (auto it = mp.begin(); it != mp.end(); it++) {
int s = it->second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans;
return 0;
}
|
[] | 747,590
| 747,591
|
u983711104
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
signed main() {
int n;
cin >> n;
map<string, int> cnt;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
ll ans = 0;
for (auto i : cnt) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
int n;
cin >> n;
map<string, long long> cnt;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
ll ans = 0;
for (auto i : cnt) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"function.return_type.change",
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,592
| 747,593
|
u876386943
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
int n;
cin >> n;
map<string, int> cnt;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
ll ans = 0;
for (auto i : cnt) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
int n;
cin >> n;
map<string, long long> cnt;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(all(s));
cnt[s]++;
}
ll ans = 0;
for (auto i : cnt) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,594
| 747,593
|
u876386943
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
#define NINF -1e17
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
sort(s.begin(), s.end());
string str = "&";
long cnt = 0;
long ans = 0;
rep(i, n + 1) {
if (i == n) {
ans += (cnt - 1) * cnt / 2;
break;
}
if (s.at(i) == str)
cnt++;
else {
ans += (cnt - 1) * cnt / 2;
cnt = 0;
}
str = s.at(i);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
#define NINF -1e17
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
sort(s.begin(), s.end());
string str = "&";
long cnt = 1;
long ans = 0;
rep(i, n + 1) {
if (i == n) {
ans += (cnt - 1) * cnt / 2;
break;
}
if (s.at(i) == str)
cnt++;
else {
ans += (cnt - 1) * cnt / 2;
cnt = 1;
}
str = s.at(i);
}
cout << ans << endl;
}
|
[
"literal.number.change",
"variable_declaration.value.change",
"assignment.value.change"
] | 747,595
| 747,596
|
u184335045
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
#define NINF -1e17
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
sort(s.begin(), s.end());
string str = "&";
long cnt = 0;
long ans = 0;
rep(i, n + 1) {
if (i == n) {
ans += (cnt - 1) * cnt / 2;
break;
}
if (s.at(i) == str)
cnt++;
else {
ans += (cnt - 1) * cnt / 2;
}
str = s.at(i);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
#define NINF -1e17
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
sort(s.begin(), s.end());
string str = "&";
long cnt = 1;
long ans = 0;
rep(i, n + 1) {
if (i == n) {
ans += (cnt - 1) * cnt / 2;
break;
}
if (s.at(i) == str)
cnt++;
else {
ans += (cnt - 1) * cnt / 2;
cnt = 1;
}
str = s.at(i);
}
cout << ans << endl;
}
|
[
"literal.number.change",
"variable_declaration.value.change",
"assignment.add"
] | 747,597
| 747,596
|
u184335045
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define veci(x, n) vector<int> x((int)(n))
#define vecs(x, n) vector<string> x((int)(n))
#define vecbf(x, n) vector<bool> x((int)(n), false)
long comb(int a) { return (a * (a - 1)) / 2; }
int main() {
int n;
cin >> n;
vector<vector<char>> data(n, vector<char>(10));
rep(i, n) {
rep(j, 10) { cin >> data.at(i).at(j); }
}
rep(i, n) { sort(data.at(i).begin(), data.at(i).end()); }
sort(data.begin(), data.end());
long answer = 0;
int tmp = 0;
int count = 1;
for (int i = 1; i < n; i++) {
if (data.at(i) == data.at(tmp)) {
count++;
} else {
answer += comb(count);
count = 1;
tmp = i;
}
}
answer += comb(count);
cout << answer << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define veci(x, n) vector<int> x((int)(n))
#define vecs(x, n) vector<string> x((int)(n))
#define vecbf(x, n) vector<bool> x((int)(n), false)
long comb(long a) { return (a * (a - 1)) / 2; }
int main() {
int n;
cin >> n;
vector<vector<char>> data(n, vector<char>(10));
rep(i, n) {
rep(j, 10) { cin >> data.at(i).at(j); }
}
rep(i, n) { sort(data.at(i).begin(), data.at(i).end()); }
sort(data.begin(), data.end());
/*
rep(i,n){
rep(j,10){
cout << data.at(i).at(j);
}
cout << endl;
}
*/
long answer = 0;
int tmp = 0;
long count = 1;
for (int i = 1; i < n; i++) {
if (data.at(i) == data.at(tmp)) {
count++;
} else {
answer += comb(count);
count = 1;
tmp = i;
}
}
answer += comb(count);
cout << answer << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 747,598
| 747,599
|
u184335045
|
cpp
|
p02947
|
// C
#include <cassert>
//#include <cctype>
#include <ccomplex>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdalign>
#include <cstdarg>
#include <cstdbool>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctgmath>
#include <ctime>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <chrono>
#include <complex>
#include <condition_variable>
#include <deque>
#include <exception>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
//ここまで標準include
using namespace std;
long aCb(long a, long b) {
long out = 1;
for (long i = 1; i <= b; i++) {
out = out * (a + 1 - i) / i;
}
return out;
}
int main() {
int N;
cin >> N;
vector<string> data(N);
for (int i = 0; i < N; i++) {
vector<char> c(10);
for (int j = 0; j < 10; j++) {
cin >> c.at(j);
}
sort(c.begin(), c.end());
for (int j = 0; j < 10; j++) {
data.at(i) = data.at(i) + c.at(j);
}
}
sort(data.begin(), data.end());
int ans = 0;
for (int i = 0; i < N;) {
int count = 1;
string last = data.at(i);
while (i >= 0) {
if (i < N - 1 && last == data.at(i + 1)) {
count++;
i++;
} else {
i++;
break;
}
}
ans += aCb(count, 2);
}
cout << ans << endl;
}
|
// C
#include <cassert>
//#include <cctype>
#include <ccomplex>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdalign>
#include <cstdarg>
#include <cstdbool>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctgmath>
#include <ctime>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <chrono>
#include <complex>
#include <condition_variable>
#include <deque>
#include <exception>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
//ここまで標準include
using namespace std;
long aCb(long a, long b) {
long out = 1;
for (long i = 1; i <= b; i++) {
out = out * (a + 1 - i) / i;
}
return out;
}
int main() {
int N;
cin >> N;
vector<string> data(N);
for (int i = 0; i < N; i++) {
vector<char> c(10);
for (int j = 0; j < 10; j++) {
cin >> c.at(j);
}
sort(c.begin(), c.end());
for (int j = 0; j < 10; j++) {
data.at(i) = data.at(i) + c.at(j);
}
}
sort(data.begin(), data.end());
long ans = 0;
for (int i = 0; i < N;) {
int count = 1;
string last = data.at(i);
while (i >= 0) {
if (i < N - 1 && last == data.at(i + 1)) {
count++;
i++;
} else {
i++;
break;
}
}
ans += aCb(count, 2);
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 747,602
| 747,603
|
u685346012
|
cpp
|
p02947
|
// C
#include <cassert>
//#include <cctype>
#include <ccomplex>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdalign>
#include <cstdarg>
#include <cstdbool>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctgmath>
#include <ctime>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <chrono>
#include <complex>
#include <condition_variable>
#include <deque>
#include <exception>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
//ここまで標準include
using namespace std;
long aCb(long a, long b) {
long out = 1;
for (long i = 1; i <= b; i++) {
out = out * (a + 1 - i) / i;
}
return out;
}
int main() {
int N;
cin >> N;
vector<string> data(N);
for (int i = 0; i < N; i++) {
vector<char> c(10);
for (int j = 0; j < 10; j++) {
cin >> c.at(j);
}
sort(c.begin(), c.end());
for (int j = 0; j < 10; j++) {
data.at(i) += data.at(i) + c.at(j);
}
}
sort(data.begin(), data.end());
int ans = 0;
for (int i = 0; i < N;) {
int count = 1;
string last = data.at(i);
while (i >= 0) {
if (i < N - 1 && last == data.at(i + 1)) {
count++;
i++;
} else {
i++;
break;
}
}
ans += aCb(count, 2);
}
cout << ans << endl;
}
|
// C
#include <cassert>
//#include <cctype>
#include <ccomplex>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdalign>
#include <cstdarg>
#include <cstdbool>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctgmath>
#include <ctime>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <chrono>
#include <complex>
#include <condition_variable>
#include <deque>
#include <exception>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
//ここまで標準include
using namespace std;
long aCb(long a, long b) {
long out = 1;
for (long i = 1; i <= b; i++) {
out = out * (a + 1 - i) / i;
}
return out;
}
int main() {
int N;
cin >> N;
vector<string> data(N);
for (int i = 0; i < N; i++) {
vector<char> c(10);
for (int j = 0; j < 10; j++) {
cin >> c.at(j);
}
sort(c.begin(), c.end());
for (int j = 0; j < 10; j++) {
data.at(i) = data.at(i) + c.at(j);
}
}
sort(data.begin(), data.end());
long ans = 0;
for (int i = 0; i < N;) {
int count = 1;
string last = data.at(i);
while (i >= 0) {
if (i < N - 1 && last == data.at(i + 1)) {
count++;
i++;
} else {
i++;
break;
}
}
ans += aCb(count, 2);
}
cout << ans << endl;
}
|
[
"assignment.value.change",
"variable_declaration.type.primitive.change"
] | 747,604
| 747,603
|
u685346012
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod = 1000000007;
constexpr int mod1 = 998244353;
vector<int> dx = {0, 1, 0, -1}, dy = {-1, 0, 1, 0};
bool inside(int y, int x, int h, int w) {
if (y < h && y >= 0 && x < w && x >= 0)
return true;
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> m;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
ll ans = 0;
for (auto i : m) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod = 1000000007;
constexpr int mod1 = 998244353;
vector<int> dx = {0, 1, 0, -1}, dy = {-1, 0, 1, 0};
bool inside(int y, int x, int h, int w) {
if (y < h && y >= 0 && x < w && x >= 0)
return true;
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, ll> m;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
ll ans = 0;
for (auto i : m) {
ans += i.second * (i.second - 1) / 2;
}
cout << ans << endl;
}
|
[] | 747,605
| 747,606
|
u480831358
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
ll N, sum = 0;
;
cin >> N;
unordered_map<string, ll> mp;
rep(i, N) {
string t;
cin >> t;
sort(t.begin(), t.end());
if (mp.empty()) {
mp[t] = 0;
continue;
}
if (mp.find(t) != mp.end()) {
if (mp[t] == 0)
mp[t] = 1;
else
mp[t] *= 2;
} else {
mp[t] = 0;
}
sum += mp[t];
}
cout << sum << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
ll N, sum = 0;
;
cin >> N;
unordered_map<string, ll> mp;
rep(i, N) {
string t;
cin >> t;
sort(t.begin(), t.end());
if (mp.empty()) {
mp[t] = 0;
continue;
}
if (mp.find(t) != mp.end()) {
if (mp[t] == 0)
mp[t] = 1;
else
mp[t]++;
} else {
mp[t] = 0;
}
sum += mp[t];
}
cout << sum << endl;
}
|
[] | 747,607
| 747,608
|
u579754454
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
sort(A.at(i).begin(), A.at(i).end());
}
map<string, int> mp;
for (int i = 0; i < N; i++) {
string s = A.at(i);
mp[s]++;
}
int ans = 0;
for (auto e : mp) {
ans += e.second * (e.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
sort(A.at(i).begin(), A.at(i).end());
}
map<string, long long> mp;
for (int i = 0; i < N; i++) {
string s = A.at(i);
mp[s]++;
}
long long ans = 0;
for (auto e : mp) {
ans += e.second * (e.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,611
| 747,612
|
u868205915
|
cpp
|
p02947
|
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rrep(i, n) for (ll i##_len = (n), i = i##_len - 1; i >= 0; --i)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define printd(val) std::cout << #val " = " << val << "\n";
#include <bits/stdc++.h>
using ll = long long;
using pii = std::pair<int, int>;
using namespace std;
template <class T> T chmin(T a, T b) {
if (a > b) {
a ^= b;
b ^= a;
a ^= b;
return 1;
}
return 0;
}
template <class T> T chmax(T b, T a) {
if (a < b) {
a ^= b;
b ^= a;
a ^= b;
return 1;
}
return 0;
}
map<string, int> memory_count;
int n;
string s;
void input() { cin >> n; }
void src() {
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
memory_count[s]++;
}
ll sum = 0;
for (auto i : memory_count)
if (i.second > 1)
sum += i.second * (i.second - 1) / 2ll;
cout << sum;
return;
}
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
// ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
input();
src();
return 0;
}
|
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rrep(i, n) for (ll i##_len = (n), i = i##_len - 1; i >= 0; --i)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define printd(val) std::cout << #val " = " << val << "\n";
#include <bits/stdc++.h>
using ll = long long;
using pii = std::pair<int, int>;
using namespace std;
template <class T> T chmin(T a, T b) {
if (a > b) {
a ^= b;
b ^= a;
a ^= b;
return 1;
}
return 0;
}
template <class T> T chmax(T b, T a) {
if (a < b) {
a ^= b;
b ^= a;
a ^= b;
return 1;
}
return 0;
}
map<string, ll> memory_count;
int n;
string s;
void input() { cin >> n; }
void src() {
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
memory_count[s]++;
}
ll sum = 0;
for (auto i : memory_count)
if (i.second > 1)
sum += i.second * (i.second - 1) / 2ll;
cout << sum;
return;
}
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
// ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
input();
src();
return 0;
}
|
[] | 747,613
| 747,614
|
u954176652
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += s * (s - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
int s = p.second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans << endl;
}
|
[
"type_conversion.add"
] | 747,615
| 747,616
|
u147556624
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans = (ll)s * (s - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
int s = p.second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans << endl;
}
|
[
"assignment.value.change"
] | 747,617
| 747,616
|
u147556624
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans = (ll)s * (s - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans << endl;
}
|
[
"assignment.value.change"
] | 747,617
| 747,618
|
u147556624
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <fstream>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>
using namespace std;
const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
template <typename T>
void printV(const std::vector<T> &v, const char *const separator = " ") {
if (!v.empty()) {
std::copy(v.begin(), --v.end(),
std::ostream_iterator<T>(std::cout, separator));
std::cout << v.back() << "\n";
}
}
Int gcd(Int a, Int b) { return b != 0 ? gcd(b, a % b) : a; }
Int lcm(Int a, Int b) {
return a / gcd(a, b) * b;
// a*bは64bit integer overflow
}
int Max(int a, int b, int c) {
int temp = max(a, b);
return max(temp, c);
}
int Min(int a, int b, int c) {
int temp = min(a, b);
return min(temp, c);
}
bool integer(double num) { return floor(num) == num; }
Int fact(int num) {
if (num == 0)
return 1;
else
return num * fact(num - 1);
}
void y() {
cout << "Yes" << endl;
exit(0);
}
void n() {
cout << "No" << endl;
exit(0);
}
void Y() {
cout << "YES" << endl;
exit(0);
}
void N() {
cout << "NO" << endl;
exit(0);
}
Int yakusu(int n) {
int cnt = 0;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
cnt++;
if (i * i != n)
cnt++;
}
}
return cnt;
}
/* kokomade */
int cnt = 0;
bool is_prime[50000 + 1];
vector<int> P;
void Eratosthenes(const int N) {
for (int i = 0; i <= N; i++) {
is_prime[i] = true; //初期化
}
for (int i = 2; i <= N; i++) {
if (is_prime[i]) {
for (int j = 2 * i; j <= N; j += i) {
is_prime[j] = false;
}
P.emplace_back(i);
}
}
}
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;
}
}
vector<int64_t> divisor(int64_t n) {
vector<int64_t> ret;
for (int64_t i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(begin(ret), end(ret));
return (ret);
}
void euclid(Int N, Int a, Int b) {
for (Int d = a + b; d <= N; d += b) {
// cout << b << ", " << d << endl;
euclid(N, b, d);
}
}
int main() {
IOS;
prec;
int a, b, n, k, x, ans = 0;
string str, s, t;
cin >> n;
vector<string> get(n);
map<string, int> mp;
for (int j = 0; j < n; ++j) {
cin >> str;
ssort(str);
mp[str] = mp[str] + 1;
}
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
int val = itr->second;
ans += (val) * (val - 1) / 2;
}
cout << ans;
cout << endl;
return 0;
}
/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/
|
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <fstream>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>
using namespace std;
const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
template <typename T>
void printV(const std::vector<T> &v, const char *const separator = " ") {
if (!v.empty()) {
std::copy(v.begin(), --v.end(),
std::ostream_iterator<T>(std::cout, separator));
std::cout << v.back() << "\n";
}
}
Int gcd(Int a, Int b) { return b != 0 ? gcd(b, a % b) : a; }
Int lcm(Int a, Int b) {
return a / gcd(a, b) * b;
// a*bは64bit integer overflow
}
int Max(int a, int b, int c) {
int temp = max(a, b);
return max(temp, c);
}
int Min(int a, int b, int c) {
int temp = min(a, b);
return min(temp, c);
}
bool integer(double num) { return floor(num) == num; }
Int fact(int num) {
if (num == 0)
return 1;
else
return num * fact(num - 1);
}
void y() {
cout << "Yes" << endl;
exit(0);
}
void n() {
cout << "No" << endl;
exit(0);
}
void Y() {
cout << "YES" << endl;
exit(0);
}
void N() {
cout << "NO" << endl;
exit(0);
}
Int yakusu(int n) {
int cnt = 0;
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
cnt++;
if (i * i != n)
cnt++;
}
}
return cnt;
}
/* kokomade */
int cnt = 0;
bool is_prime[50000 + 1];
vector<int> P;
void Eratosthenes(const int N) {
for (int i = 0; i <= N; i++) {
is_prime[i] = true; //初期化
}
for (int i = 2; i <= N; i++) {
if (is_prime[i]) {
for (int j = 2 * i; j <= N; j += i) {
is_prime[j] = false;
}
P.emplace_back(i);
}
}
}
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;
}
}
vector<int64_t> divisor(int64_t n) {
vector<int64_t> ret;
for (int64_t i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n)
ret.push_back(n / i);
}
}
sort(begin(ret), end(ret));
return (ret);
}
void euclid(Int N, Int a, Int b) {
for (Int d = a + b; d <= N; d += b) {
// cout << b << ", " << d << endl;
euclid(N, b, d);
}
}
int main() {
IOS;
prec;
Int a, b, n, k, x, ans = 0;
string str, s, t;
cin >> n;
vector<string> get(n);
map<string, Int> mp;
for (Int j = 0; j < n; ++j) {
cin >> str;
ssort(str);
mp[str] = mp[str] + 1;
}
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
Int val = itr->second;
ans += (val) * (val - 1) / 2;
}
cout << ans;
cout << endl;
return 0;
}
/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/
|
[
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 747,619
| 747,620
|
u565624841
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
using ll = long long;
int main() {
int n, ans = 0;
cin >> n;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto &e : mp) {
ans += e.second * (e.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
using ll = long long;
int main() {
ll n, ans = 0;
cin >> n;
map<string, ll> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto &e : mp) {
ans += e.second * (e.second - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 747,621
| 747,622
|
u720483676
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
ll count = p.second;
ans += count * (count - 1) / 2; // ACになる
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,633
| 747,634
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * ((count - 1) / 2);
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
ll count = p.second;
ans += count * (count - 1) / 2; // ACになる
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,635
| 747,634
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)(count * (count - 1) / 2);
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
ll count = p.second;
ans += count * (count - 1) / 2; // ACになる
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"call.remove",
"call.arguments.change"
] | 747,636
| 747,634
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
// ans +=(ll)count * (count-1)/2;
ans += (ll)(count * (count - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
ll count = p.second;
ans += count * (count - 1) / 2; // ACになる
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"call.remove",
"call.arguments.change"
] | 747,637
| 747,634
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)(count * (count - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
ll count = p.second;
ans += count * (count - 1) / 2; // ACになる
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"call.remove",
"call.arguments.change"
] | 747,638
| 747,634
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (count * (count - 1)) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
ll count = p.second;
ans += count * (count - 1) / 2; // ACになる
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 747,639
| 747,634
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
ll count = (ll)p.second;
ans += count * (count - 1) / 2; // ACになる
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,633
| 747,641
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 747,633
| 747,642
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * ((count - 1) / 2);
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[] | 747,635
| 747,642
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)(count * (count - 1) / 2);
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"call.arguments.change"
] | 747,636
| 747,642
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)((count * (count - 1)) / 2);
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"call.arguments.change"
] | 747,643
| 747,642
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
// ans +=(ll)count * (count-1)/2;
ans += (ll)(count * (count - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"call.arguments.change"
] | 747,637
| 747,642
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)(count * (count - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"call.arguments.change"
] | 747,638
| 747,642
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (count * (count - 1)) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
// ans +=(ll) (count * (count-1))/2; //WAになる
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add",
"control_flow.return.add",
"control_flow.return.0.add"
] | 747,639
| 747,642
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)(count * (count - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"call.arguments.change"
] | 747,638
| 747,647
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)(count * (count - 1)) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"call.arguments.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 747,644
| 747,647
|
u021755470
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (count * (count - 1)) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
// string w;
map<string, int> mp;
rep(i, N) {
string w;
cin >> w;
sort(w.begin(), w.end());
mp[w]++;
}
ll ans = 0;
for (auto &p : mp) {
int count = p.second;
ans += (ll)count * (count - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add",
"control_flow.return.add",
"control_flow.return.0.add"
] | 747,639
| 747,647
|
u021755470
|
cpp
|
p02947
|
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a, b, c, x, ...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__, rep3, rep2, loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__, rrep3, rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, begin, end) \
for (int i = (int)(begin), i##_end = (int)(end); i < i##_end; ++i)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, begin, end) \
for (int i = (int)(end - 1), i##_end = (int)(begin); i >= i##_end; --i)
#define foreach(x, a) for (auto &x : a)
#define each(x, a) for (auto &x : a)
struct IoSetup {
IoSetup() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setprecision(10);
};
} ioSetup;
using ll = long long;
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U> &j) {
o << "{" << j.first << ", " << j.second << "}";
return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const set<T> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const multiset<T> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &j) {
o << "{";
for (int i = 0; i < (int)j.size(); ++i)
o << (i > 0 ? ", " : "") << j[i];
o << "}";
return o;
}
#ifdef LOCAL
inline void dump(void) { cerr << endl; }
template <class Head, class... Tail>
inline void dump(Head &&head, Tail &&...tail) {
cerr << head << " ";
dump(tail...);
}
#define debug(...) \
do { \
cerr << "[L." << __LINE__ << "]\t" << #__VA_ARGS__ << "="; \
dump(__VA_ARGS__); \
} while (0)
#else
#define dump(...)
#define debug(...)
#endif
template <class T> inline void Sort(T &a) { sort(a.begin(), a.end()); }
template <class T, class Compare> inline void Sort(T &a, Compare comp) {
sort(a.begin(), a.end(), comp);
}
template <class T> inline void rSort(T &a) { sort(a.rbegin(), a.rend()); }
template <class T> inline void Reverse(T &a) { reverse(a.begin(), a.end()); }
template <class T> inline T Sum(vector<T> &a) {
return accumulate(a.begin(), a.end(), (T)0);
}
template <class T> inline T max(vector<T> &a) {
return *max_element(a.begin(), a.end());
}
template <class T> inline T min(vector<T> &a) {
return *min_element(a.begin(), a.end());
}
template <class T, class U> inline bool chmax(T &a, const U &b) {
return (b > a) ? (a = b, true) : false;
}
template <class T, class U> inline bool chmin(T &a, const U &b) {
return (b < a) ? (a = b, true) : false;
}
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
class in {
int n;
public:
in() { n = -1; }
in(int n_) : n(n_){};
template <class T> operator T() {
T ret;
cin >> ret;
return ret;
}
template <class T> operator vector<T>() {
assert(n >= 0);
vector<T> ret(n);
for (int i = 0; i < n; ++i)
cin >> ret[i];
return ret;
}
};
template <class T> void print(const T &a) { cout << a; }
int out() {
cout << '\n';
return 0;
}
template <class T> int out(const T &t) {
print(t);
cout << '\n';
return 0;
}
template <class Head, class... Tail>
int out(const Head &head, const Tail &...tail) {
print(head);
cout << " ";
out(tail...);
return 0;
}
template <std::uint_fast64_t Mod> class Modular {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr Modular(const u64 x = 0) noexcept : a(x % Mod) {}
constexpr u64 val() const noexcept { return a; }
constexpr Modular operator+(const Modular rhs) const noexcept {
return Modular(*this) += rhs;
}
constexpr Modular operator-(const Modular rhs) const noexcept {
return Modular(*this) -= rhs;
}
constexpr Modular operator*(const Modular rhs) const noexcept {
return Modular(*this) *= rhs;
}
constexpr Modular operator/(const Modular rhs) const noexcept {
return Modular(*this) /= rhs;
}
constexpr bool operator==(const Modular rhs) const noexcept {
return Modular(*this).val() == rhs.val();
}
Modular &operator+=(const Modular rhs) noexcept {
a += rhs.a;
if (a >= Mod)
a -= Mod;
return *this;
}
Modular &operator-=(const Modular rhs) noexcept {
if (a < rhs.a)
a += Mod;
a -= rhs.a;
return *this;
}
Modular &operator++() noexcept { return *this += 1; }
Modular &operator--() noexcept { return *this -= 1; }
Modular &operator*=(const Modular rhs) noexcept {
a = a * rhs.a % Mod;
return *this;
}
Modular &operator/=(Modular rhs) noexcept {
u64 exp = Mod - 2;
while (exp) {
if (exp % 2)
*this *= rhs;
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
template <std::uint_fast64_t Mod>
ostream &operator<<(ostream &os, const Modular<Mod> &m) {
return os << m.a;
}
const double pi = acos(-1);
const double eps = 1e-9;
const ll inf = 1001001001;
const ll mod = (ll)1e9 + 7;
using mint = Modular<mod>;
//}}}
int main() {
int n = in();
map<string, int> mp;
rep(i, n) {
string s = in();
Sort(s);
mp[s]++;
}
int ans = 0;
each(x, mp) { ans += x.second * (x.second - 1) / 2; }
out(ans);
}
|
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a, b, c, x, ...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__, rep3, rep2, loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__, rrep3, rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, begin, end) \
for (int i = (int)(begin), i##_end = (int)(end); i < i##_end; ++i)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, begin, end) \
for (int i = (int)(end - 1), i##_end = (int)(begin); i >= i##_end; --i)
#define foreach(x, a) for (auto &x : a)
#define each(x, a) for (auto &x : a)
struct IoSetup {
IoSetup() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setprecision(10);
};
} ioSetup;
using ll = long long;
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U> &j) {
o << "{" << j.first << ", " << j.second << "}";
return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const set<T> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const multiset<T> &j) {
o << "{";
for (auto t = j.begin(); t != j.end(); ++t)
o << (t != j.begin() ? ", " : "") << *t;
o << "}";
return o;
}
template <class T> ostream &operator<<(ostream &o, const vector<T> &j) {
o << "{";
for (int i = 0; i < (int)j.size(); ++i)
o << (i > 0 ? ", " : "") << j[i];
o << "}";
return o;
}
#ifdef LOCAL
inline void dump(void) { cerr << endl; }
template <class Head, class... Tail>
inline void dump(Head &&head, Tail &&...tail) {
cerr << head << " ";
dump(tail...);
}
#define debug(...) \
do { \
cerr << "[L." << __LINE__ << "]\t" << #__VA_ARGS__ << "="; \
dump(__VA_ARGS__); \
} while (0)
#else
#define dump(...)
#define debug(...)
#endif
template <class T> inline void Sort(T &a) { sort(a.begin(), a.end()); }
template <class T, class Compare> inline void Sort(T &a, Compare comp) {
sort(a.begin(), a.end(), comp);
}
template <class T> inline void rSort(T &a) { sort(a.rbegin(), a.rend()); }
template <class T> inline void Reverse(T &a) { reverse(a.begin(), a.end()); }
template <class T> inline T Sum(vector<T> &a) {
return accumulate(a.begin(), a.end(), (T)0);
}
template <class T> inline T max(vector<T> &a) {
return *max_element(a.begin(), a.end());
}
template <class T> inline T min(vector<T> &a) {
return *min_element(a.begin(), a.end());
}
template <class T, class U> inline bool chmax(T &a, const U &b) {
return (b > a) ? (a = b, true) : false;
}
template <class T, class U> inline bool chmin(T &a, const U &b) {
return (b < a) ? (a = b, true) : false;
}
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
class in {
int n;
public:
in() { n = -1; }
in(int n_) : n(n_){};
template <class T> operator T() {
T ret;
cin >> ret;
return ret;
}
template <class T> operator vector<T>() {
assert(n >= 0);
vector<T> ret(n);
for (int i = 0; i < n; ++i)
cin >> ret[i];
return ret;
}
};
template <class T> void print(const T &a) { cout << a; }
int out() {
cout << '\n';
return 0;
}
template <class T> int out(const T &t) {
print(t);
cout << '\n';
return 0;
}
template <class Head, class... Tail>
int out(const Head &head, const Tail &...tail) {
print(head);
cout << " ";
out(tail...);
return 0;
}
template <std::uint_fast64_t Mod> class Modular {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr Modular(const u64 x = 0) noexcept : a(x % Mod) {}
constexpr u64 val() const noexcept { return a; }
constexpr Modular operator+(const Modular rhs) const noexcept {
return Modular(*this) += rhs;
}
constexpr Modular operator-(const Modular rhs) const noexcept {
return Modular(*this) -= rhs;
}
constexpr Modular operator*(const Modular rhs) const noexcept {
return Modular(*this) *= rhs;
}
constexpr Modular operator/(const Modular rhs) const noexcept {
return Modular(*this) /= rhs;
}
constexpr bool operator==(const Modular rhs) const noexcept {
return Modular(*this).val() == rhs.val();
}
Modular &operator+=(const Modular rhs) noexcept {
a += rhs.a;
if (a >= Mod)
a -= Mod;
return *this;
}
Modular &operator-=(const Modular rhs) noexcept {
if (a < rhs.a)
a += Mod;
a -= rhs.a;
return *this;
}
Modular &operator++() noexcept { return *this += 1; }
Modular &operator--() noexcept { return *this -= 1; }
Modular &operator*=(const Modular rhs) noexcept {
a = a * rhs.a % Mod;
return *this;
}
Modular &operator/=(Modular rhs) noexcept {
u64 exp = Mod - 2;
while (exp) {
if (exp % 2)
*this *= rhs;
rhs *= rhs;
exp /= 2;
}
return *this;
}
};
template <std::uint_fast64_t Mod>
ostream &operator<<(ostream &os, const Modular<Mod> &m) {
return os << m.a;
}
const double pi = acos(-1);
const double eps = 1e-9;
const ll inf = 1001001001;
const ll mod = (ll)1e9 + 7;
using mint = Modular<mod>;
//}}}
int main() {
int n = in();
map<string, ll> mp;
rep(i, n) {
string s = in();
Sort(s);
mp[s]++;
}
ll ans = 0;
each(x, mp) { ans += x.second * (x.second - 1) / 2; }
out(ans);
}
|
[
"variable_declaration.type.change"
] | 747,648
| 747,649
|
u899220667
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
unordered_map<string, int> T;
long long sum = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
T[s]++;
}
for (const auto &p : T) {
sum += p.second * (p.second - 1) / 2;
}
cout << sum << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
unordered_map<string, long> T;
long sum = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
T[s]++;
}
for (const auto &p : T) {
sum += p.second * (p.second - 1) / 2;
}
cout << sum << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.narrow.change"
] | 747,650
| 747,651
|
u423656246
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
unordered_map<string, int> T;
int sum = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
T[s] += 1;
}
for (const auto &p : T) {
sum += p.second * (p.second - 1) / 2;
}
cout << sum << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
unordered_map<string, long> T;
long sum = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
T[s]++;
}
for (const auto &p : T) {
sum += p.second * (p.second - 1) / 2;
}
cout << sum << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 747,652
| 747,651
|
u423656246
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
const int INF = 1 << 30;
int combination(int x) { return x * (x - 1) / 2; }
int main() {
int n;
cin >> n;
vector<string> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
sort(ALL(a[i]));
}
sort(ALL(a));
int x = 1;
ll ans = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
x++;
} else {
ans += combination(x);
x = 1;
}
}
ans += combination(x);
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
const int INF = 1 << 30;
ll combination(ll x) { return x * (x - 1) / 2; }
int main() {
int n;
cin >> n;
vector<string> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
sort(ALL(a[i]));
}
sort(ALL(a));
ll x = 1;
ll ans = 0;
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) {
x++;
} else {
ans += combination(x);
x = 1;
}
}
ans += combination(x);
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,653
| 747,654
|
u471212175
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)
long long INF = 1LL << 60;
long long dp[100010];
int h[100010];
int n;
ll fact(int x) {
ll ret = 1;
while (x) {
ret *= x;
x--;
}
return ret;
}
ll choose(int n, int r) {
ll ret = 0;
ret = fact(n) / (fact(n - r) * fact(r));
return ret;
}
int main() {
int n;
cin >> n;
string s[n + 5];
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
unordered_map<string, int> count;
for (int i = 0; i < n; i++) {
count[s[i]]++;
}
ll ans = 0;
for (auto iter = count.begin(); iter != count.end(); iter++) {
pair<string, int> elem = *iter;
ans += elem.second * (elem.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)
long long INF = 1LL << 60;
long long dp[100010];
int h[100010];
int n;
ll fact(int x) {
ll ret = 1;
while (x) {
ret *= x;
x--;
}
return ret;
}
ll choose(int n, int r) {
ll ret = 0;
ret = fact(n) / (fact(n - r) * fact(r));
return ret;
}
int main() {
int n;
cin >> n;
string s[n + 5];
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
unordered_map<string, ll> count;
for (int i = 0; i < n; i++) {
count[s[i]]++;
}
ll ans = 0;
for (auto iter = count.begin(); iter != count.end(); iter++) {
pair<string, ll> elem = *iter;
ans += elem.second * (elem.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 747,657
| 747,658
|
u410506856
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int64_t comb2(int n) { return n * (n - 1) / 2; }
int main() {
int n;
cin >> n;
vector<vector<char>> character(n, vector<char>(10));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 10; ++j) {
cin >> character.at(i).at(j);
}
sort(character.at(i).begin(), character.at(i).end());
}
sort(character.begin(), character.end());
int64_t sum = 0;
for (int i = 0; i < n - 1; ++i) {
static int count = 1;
if (character.at(i) == character.at(i + 1)) {
++count;
if (i == n - 2) {
sum += comb2(count);
}
} else {
sum += comb2(count);
count = 1;
}
}
cout << sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int64_t comb2(int64_t n) { return n * (n - 1) / 2; }
int main() {
int n;
cin >> n;
vector<vector<char>> character(n, vector<char>(10));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 10; ++j) {
cin >> character.at(i).at(j);
}
sort(character.at(i).begin(), character.at(i).end());
}
sort(character.begin(), character.end());
int64_t sum = 0;
for (int i = 0; i < n - 1; ++i) {
static int64_t count = 1;
if (character.at(i) == character.at(i + 1)) {
++count;
if (i == n - 2) {
sum += comb2(count);
}
} else {
sum += comb2(count);
count = 1;
}
}
cout << sum << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change"
] | 747,659
| 747,660
|
u294683729
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main() {
ll N;
cin >> N;
map<string, ll> A; // map<キー型,値型> 変数名
rep(i, N) {
string a;
cin >> a;
sort(a.begin(), a.end());
A[a]++;
}
ll ans = 0;
for (auto i : A) { //キー値を文字列にした場合使う!
int x = i.second; // i.secondで値を参照できる
ans += x * (x - 1) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
map<string, ll> A;
rep(i, N) {
string a;
cin >> a;
sort(a.begin(), a.end());
A[a]++;
}
ll ans = 0;
for (auto i : A) {
ll x = i.second;
ans += x * (x - 1) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.change"
] | 747,663
| 747,664
|
u764860452
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main() {
ll N;
cin >> N;
map<string, ll> A; // map<キー型,値型> 変数名
rep(i, N) {
string a;
cin >> a;
sort(a.begin(), a.end());
A[a]++;
}
ll ans = 0;
for (auto i : A) { //キー値を文字列にした場合使う!
int x = i.second; // i.secondで値を参照できる
ans += x * (x - 1) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main() {
ll N;
cin >> N;
map<string, ll> A; // map<キー型,値型> 変数名
rep(i, N) {
string a;
cin >> a;
sort(a.begin(), a.end());
A[a]++;
}
ll ans = 0;
for (auto i : A) { //キー値を文字列にした場合使う!
ll x = i.second; // i.secondで値を参照できる
ans += x * (x - 1) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.change"
] | 747,663
| 747,665
|
u764860452
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans = (ll)s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"assignment.value.change"
] | 747,668
| 747,669
|
u681559222
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ull> vu;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;
int n;
map<string, int> mp;
void read() { cin >> n; }
void solve() {
for (int i = 0; i < n; ++i) {
char s[11];
cin >> s;
sort(s, s + strlen(s));
++mp[s];
}
int sol = 0;
for (auto x : mp)
if (x.second > 1)
sol += x.se * (x.se - 1) / 2;
cout << sol << "\n";
}
int main() {
ios ::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t; // PLEASE REMOVE IT IF NEEDED
while (t) {
--t;
read();
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ull> vu;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;
int n;
map<string, int> mp;
void read() { cin >> n; }
void solve() {
for (int i = 0; i < n; ++i) {
char s[11];
cin >> s;
sort(s, s + strlen(s));
++mp[s];
}
ll sol = 0;
for (auto x : mp)
if (x.se > 1)
sol += 1ll * x.se * (x.se - 1) / 2;
cout << sol << "\n";
}
int main() {
ios ::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t; // PLEASE REMOVE IT IF NEEDED
while (t) {
--t;
read();
solve();
}
return 0;
}
|
[
"variable_declaration.type.change",
"control_flow.branch.if.condition.change",
"assignment.change"
] | 747,676
| 747,677
|
u519883882
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define Abs(x) ((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y)-1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y)-1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) \
for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define repit2(x) \
for (__typeof((x).begin()) it2 = (x).begin(); it2 != (x).end(); it2++)
#define nepit(x) \
for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(), (x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
// can be applied to string type
#define Unique(v) v.resize(unique(All(v)) - v.begin())
#define peq(p0, p1) (p0.first == p1.first && p0.second == p1.second)
#define End '\n'
#define Out(x) cout << (x) << End
#define YES cout << "YES" << End
#define NO cout << "NO" << End
#define Yes cout << "Yes" << End
#define No cout << "No" << End
template <typename T> void Outln(const string &sep, const T &val) {
cout << val << End;
}
template <typename T, typename... Args>
void Outln(const string &sep, const T &val, Args... args) {
cout << val << sep;
Outln(sep, std::forward<Args>(args)...);
}
template <typename T> void Outln(const char &ch, const T &val) {
cout << val << End;
}
template <typename T, typename... Args>
void Outln(const char &ch, const T &val, Args... args) {
cout << val << ch;
Outln(ch, std::forward<Args>(args)...);
}
// container output function
template <typename T> inline void OutN(T x) {
size_t i, len = x.size() - 1;
for (i = 0; i < len; i++)
cout << x[i] << " ";
cout << x[len] << '\n';
}
// array output function
template <typename T> inline void OutaN(T x[], const size_t &n) {
size_t i, len = n - 1;
for (i = 0; i < len; i++)
cout << x[i] << " ";
cout << x[len] << '\n';
}
// iterator output function
template <typename T> inline void Outit(T x) {
auto end = x.end();
end--;
for (auto it = x.begin(); it != end; it++)
cout << *it << " ";
cout << *end << '\n';
}
template <typename T> void Debug(const T &val) { cerr << val << End; }
template <typename T, typename... Args> void Debug(const T &val, Args... args) {
cerr << val << ' ';
Debug(std::forward<Args>(args)...);
}
template <typename T> inline bool Max(T &x, const T &y) {
return x < y ? x = y, 1 : 0;
}
template <typename T> inline bool Min(T &x, const T &y) {
return x > y ? x = y, 1 : 0;
}
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
// can be applied to string type
#define Sort(v) sort(All(v))
#define SortR(v) sort(All(v), std::greater<__typeof(v[0])>())
// array sorters
#define Sart(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])));
#define SartR(a) \
sort(a, a + sizeof(a) / sizeof(__typeof(a[0])), \
std::greater<__typeof(a[0])>())
#define pf push_front
#define pb push_back
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define mt make_tuple
#define a first
#define b second
#define lb std::lower_bound
#define ub std::upper_bound
#define lbi(v, x) lb(All(v), (x)) - v.begin()
#define ubi(v, x) ub(All(v), (x)) - v.begin()
inline bool isSame(const string &a, const string &b) {
return a.compare(b) == 0;
}
inline bool isLess(const string &a, const string &b) {
return a.compare(b) < 0;
}
inline bool isGreater(const string &a, const string &b) {
return a.compare(b) > 0;
}
inline string Str(const char &ch, const int &n) { return string(n, ch); }
inline string Str(const int &n, const char &ch) { return string(n, ch); }
vector<string> getStrLine() {
vector<string> v;
string str;
getline(cin, str);
istringstream iss(str);
for (string word; iss >> word;)
v.push_back(word);
return v;
}
static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;
inline double rad2deg(const double &rad) { return rad * (180.0 / PI); }
inline double deg2rad(const double °) { return deg * (PI / 180.0); }
/*** ATCODER, CODECHEF and TOPCODER ***/
// -2147483648 <= INT <= 2147483647
// -9223372036854775808 <= LONG <= 9223372036854775807
// -9223372036854775808 <= LLONG <= 9223372036854775807
/*** END ***/
/*** CODEFORCES ***/
// -2147483648 <= INT <= 2147483647
// -2147483648 <= LONG <= 2147483647
// -9223372036854775808 <= LLONG <= 9223372036854775807
/*** END ***/
// [C-f5] 'reload
// [C-f6] 'getready
// [C-f7] 'copy
// [C-f8] 'compile
// [C-f9] 'make
#define LOCAL 0
int main() {
#if LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
freopen("debug.txt", "w", stderr);
#endif
cin.tie(0);
ios::sync_with_stdio(false);
// std::cout.precision(18);
int n;
cin >> n;
map<string, int> table;
string s;
int ans = 0;
int i;
rep(i, n) {
cin >> s;
Sort(s);
table[s]++;
}
repit(table) nep(i, it->b) ans += i;
Out(ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define Abs(x) ((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y)-1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y)-1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) \
for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define repit2(x) \
for (__typeof((x).begin()) it2 = (x).begin(); it2 != (x).end(); it2++)
#define nepit(x) \
for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)
#define All(x) (x).begin(), (x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
// can be applied to string type
#define Unique(v) v.resize(unique(All(v)) - v.begin())
#define peq(p0, p1) (p0.first == p1.first && p0.second == p1.second)
#define End '\n'
#define Out(x) cout << (x) << End
#define YES cout << "YES" << End
#define NO cout << "NO" << End
#define Yes cout << "Yes" << End
#define No cout << "No" << End
template <typename T> void Outln(const string &sep, const T &val) {
cout << val << End;
}
template <typename T, typename... Args>
void Outln(const string &sep, const T &val, Args... args) {
cout << val << sep;
Outln(sep, std::forward<Args>(args)...);
}
template <typename T> void Outln(const char &ch, const T &val) {
cout << val << End;
}
template <typename T, typename... Args>
void Outln(const char &ch, const T &val, Args... args) {
cout << val << ch;
Outln(ch, std::forward<Args>(args)...);
}
// container output function
template <typename T> inline void OutN(T x) {
size_t i, len = x.size() - 1;
for (i = 0; i < len; i++)
cout << x[i] << " ";
cout << x[len] << '\n';
}
// array output function
template <typename T> inline void OutaN(T x[], const size_t &n) {
size_t i, len = n - 1;
for (i = 0; i < len; i++)
cout << x[i] << " ";
cout << x[len] << '\n';
}
// iterator output function
template <typename T> inline void Outit(T x) {
auto end = x.end();
end--;
for (auto it = x.begin(); it != end; it++)
cout << *it << " ";
cout << *end << '\n';
}
template <typename T> void Debug(const T &val) { cerr << val << End; }
template <typename T, typename... Args> void Debug(const T &val, Args... args) {
cerr << val << ' ';
Debug(std::forward<Args>(args)...);
}
template <typename T> inline bool Max(T &x, const T &y) {
return x < y ? x = y, 1 : 0;
}
template <typename T> inline bool Min(T &x, const T &y) {
return x > y ? x = y, 1 : 0;
}
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
// can be applied to string type
#define Sort(v) sort(All(v))
#define SortR(v) sort(All(v), std::greater<__typeof(v[0])>())
// array sorters
#define Sart(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])));
#define SartR(a) \
sort(a, a + sizeof(a) / sizeof(__typeof(a[0])), \
std::greater<__typeof(a[0])>())
#define pf push_front
#define pb push_back
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define mt make_tuple
#define a first
#define b second
#define lb std::lower_bound
#define ub std::upper_bound
#define lbi(v, x) lb(All(v), (x)) - v.begin()
#define ubi(v, x) ub(All(v), (x)) - v.begin()
inline bool isSame(const string &a, const string &b) {
return a.compare(b) == 0;
}
inline bool isLess(const string &a, const string &b) {
return a.compare(b) < 0;
}
inline bool isGreater(const string &a, const string &b) {
return a.compare(b) > 0;
}
inline string Str(const char &ch, const int &n) { return string(n, ch); }
inline string Str(const int &n, const char &ch) { return string(n, ch); }
vector<string> getStrLine() {
vector<string> v;
string str;
getline(cin, str);
istringstream iss(str);
for (string word; iss >> word;)
v.push_back(word);
return v;
}
static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;
inline double rad2deg(const double &rad) { return rad * (180.0 / PI); }
inline double deg2rad(const double °) { return deg * (PI / 180.0); }
/*** ATCODER, CODECHEF and TOPCODER ***/
// -2147483648 <= INT <= 2147483647
// -9223372036854775808 <= LONG <= 9223372036854775807
// -9223372036854775808 <= LLONG <= 9223372036854775807
/*** END ***/
/*** CODEFORCES ***/
// -2147483648 <= INT <= 2147483647
// -2147483648 <= LONG <= 2147483647
// -9223372036854775808 <= LLONG <= 9223372036854775807
/*** END ***/
// [C-f5] 'reload
// [C-f6] 'getready
// [C-f7] 'copy
// [C-f8] 'compile
// [C-f9] 'make
#define LOCAL 0
int main() {
#if LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
freopen("debug.txt", "w", stderr);
#endif
cin.tie(0);
ios::sync_with_stdio(false);
// std::cout.precision(18);
long n;
cin >> n;
map<string, long> table;
string s;
long ans = 0;
long i;
rep(i, n) {
cin >> s;
Sort(s);
table[s]++;
}
repit(table) nep(i, it->b) ans += i;
Out(ans);
return 0;
}
|
[
"variable_declaration.type.primitive.change"
] | 747,678
| 747,679
|
u518883877
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> p(N);
for (int i = 0; i < N; i++) {
cin >> p.at(i);
sort(p.at(i).begin(), p.at(i).end());
}
sort(p.begin(), p.end());
long long int c = 0;
int t = 0;
while (t < N - 1) {
int a = 1;
for (int i = t + 1; i < N; i++) {
if (p.at(t) == p.at(i)) {
a++;
} else {
t = i;
c += a * (a - 1) / 2;
break;
}
if (i == N - 1) {
c += a * (a - 1) / 2;
t = N - 1;
}
}
}
printf("%lld\n", c);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> p(N);
for (int i = 0; i < N; i++) {
cin >> p.at(i);
sort(p.at(i).begin(), p.at(i).end());
}
sort(p.begin(), p.end());
long long int c = 0;
int t = 0;
while (t < N - 1) {
long long int a = 1;
for (int i = t + 1; i < N; i++) {
if (p.at(t) == p.at(i)) {
a++;
} else {
t = i;
c += a * (a - 1) / 2;
break;
}
if (i == N - 1) {
c += a * (a - 1) / 2;
t = N - 1;
}
}
}
printf("%lld\n", c);
}
|
[
"variable_declaration.type.widen.change"
] | 747,680
| 747,681
|
u985686845
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> p(N);
for (int i = 0; i < N; i++) {
cin >> p.at(i);
sort(p.at(i).begin(), p.at(i).end());
}
sort(p.begin(), p.end());
long long int c = 0;
int t = 0;
while (t < N - 1) {
int a = 1;
for (int i = t + 1; i < N; i++) {
if (p.at(t) == p.at(i)) {
a++;
} else {
t = i;
c += a * (a - 1) / 2;
break;
}
if (i == N - 1) {
c += a * (a - 1) / 2;
t = N - 1;
}
}
}
printf("%lld\n", c);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> p(N);
for (int i = 0; i < N; i++) {
cin >> p.at(i);
sort(p.at(i).begin(), p.at(i).end());
}
sort(p.begin(), p.end());
long long int c = 0;
long long int t = 0;
while (t < N - 1) {
long long int a = 1;
for (int i = t + 1; i < N; i++) {
if (p.at(t) == p.at(i)) {
a++;
} else {
t = i;
c += a * (a - 1) / 2;
break;
}
if (i == N - 1) {
c += a * (a - 1) / 2;
t = N - 1;
}
}
}
printf("%lld\n", c);
}
|
[
"variable_declaration.type.widen.change"
] | 747,680
| 747,682
|
u985686845
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define __dist_rep(a1, a2, a3, f, ...) f
#define __rep2(i, n) for (int i = 0; i < n; ++i)
#define __rep3(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) __dist_rep(__VA_ARGS__, __rep3, __rep2)(__VA_ARGS__)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fore(a, x) for (auto &(a) : (x))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = 1e9;
const ll LINF = 1LL << 60;
int n;
string s[100000];
int main() {
cin >> n;
map<string, int> mp;
map<string, int> mp2;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
mp[s[i]] = mp2[s[i]] = 0;
}
rep(i, n) {
mp[s[i]] += mp2[s[i]];
mp2[s[i]]++;
}
ll ans = 0;
fore(v, mp) { ans += v.second; }
cout << ans << '\n';
return 0;
}
|
#include <bits/stdc++.h>
#define __dist_rep(a1, a2, a3, f, ...) f
#define __rep2(i, n) for (int i = 0; i < n; ++i)
#define __rep3(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) __dist_rep(__VA_ARGS__, __rep3, __rep2)(__VA_ARGS__)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fore(a, x) for (auto &(a) : (x))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
template <class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int INF = 1e9;
const ll LINF = 1LL << 60;
int n;
string s[100000];
int main() {
cin >> n;
map<string, ll> mp;
map<string, ll> mp2;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
mp[s[i]] = mp2[s[i]] = 0;
}
rep(i, n) {
mp[s[i]] += mp2[s[i]];
mp2[s[i]]++;
}
ll ans = 0;
fore(v, mp) { ans += v.second; }
cout << ans << '\n';
return 0;
}
|
[] | 747,683
| 747,684
|
u936392950
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<vector<char>> a(n, vector<char>(10));
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < 10; j++) {
a.at(i).at(j) = s.at(j);
}
sort(a.at(i).begin(), a.at(i).end());
}
sort(a.begin(), a.end());
int p = 0;
long long int q = 0;
for (int i = 0; i < n - 1; i++) {
if (a.at(i) == a.at(i + 1)) {
p++;
} else {
q += p * (p + 1) / 2;
p = 0;
}
}
cout << q + p * (p + 1) / 2 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<vector<char>> a(n, vector<char>(10));
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < 10; j++) {
a.at(i).at(j) = s.at(j);
}
sort(a.at(i).begin(), a.at(i).end());
}
sort(a.begin(), a.end());
long long int p = 0;
long long int q = 0;
for (int i = 0; i < n - 1; i++) {
if (a.at(i) == a.at(i + 1)) {
p++;
} else {
q += p * (p + 1) / 2;
p = 0;
}
}
cout << q + p * (p + 1) / 2 << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 747,685
| 747,686
|
u356701928
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::cout;
int main(int argc, char *argv[]) {
int n;
cin >> n;
std::vector<std::string> s(n);
for (int i = 0; i < n; ++i) {
std::string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
s[i] = tmp;
}
sort(s.begin(), s.end());
std::string prev = s[0];
int c = 1;
unsigned long total = 0;
for (int i = 1; i < n; ++i) {
if (s[i] == prev) {
++c;
} else {
total += c * (c - 1) / 2;
c = 1;
prev = s[i];
}
}
total += c * (c - 1) / 2;
cout << total;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::cout;
int main(int argc, char *argv[]) {
int n;
cin >> n;
std::vector<std::string> s(n);
for (int i = 0; i < n; ++i) {
std::string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
s[i] = tmp;
}
sort(s.begin(), s.end());
std::string prev = s[0];
unsigned long c = 1;
unsigned long total = 0;
for (int i = 1; i < n; ++i) {
if (s[i] == prev) {
++c;
} else {
total += c * (c - 1) / 2;
c = 1;
prev = s[i];
}
}
total += c * (c - 1) / 2;
cout << total;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,687
| 747,688
|
u494904204
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
long long ans;
int n;
unordered_map<string, int> m;
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (m.find(s) != m.end()) {
m[s]++;
} else {
m.emplace(s, 1);
}
}
for (auto itr = m.begin(); itr != m.end(); ++itr) {
ans += itr->second * (itr->second - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
long long ans;
int n;
unordered_map<string, int> m;
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (m.find(s) != m.end()) {
m[s]++;
} else {
m.emplace(s, 1);
}
}
for (auto itr = m.begin(); itr != m.end(); ++itr) {
ans += 1LL * itr->second * (itr->second - 1) / 2;
}
cout << ans << endl;
}
|
[
"assignment.change"
] | 747,689
| 747,690
|
u694951525
|
cpp
|
p02947
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> vec(n);
for (int i = 0; i < n; i++) {
cin >> vec[i];
sort(vec[i].begin(), vec[i].end());
}
sort(vec.begin(), vec.end());
long long int ans = 0;
int i = 0;
int j = 0;
while (j < n) {
while (j < n && vec[i] == vec[j]) {
j++;
}
// cout << i << " " << j << endl;
ans += (j - i) * (j - i - 1) / 2;
i = j;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> vec(n);
for (int i = 0; i < n; i++) {
cin >> vec[i];
sort(vec[i].begin(), vec[i].end());
}
sort(vec.begin(), vec.end());
long long int ans = 0;
int i = 0;
int j = 0;
while (j < n) {
while (j < n && vec[i] == vec[j]) {
j++;
}
// cout << i << " " << j << endl;
ans += (long long)(j - i) * (j - i - 1) / 2;
i = j;
}
cout << ans << endl;
}
|
[
"type_conversion.add"
] | 747,691
| 747,692
|
u428132025
|
cpp
|
p02947
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> vec(n);
for (int i = 0; i < n; i++) {
cin >> vec[i];
sort(vec[i].begin(), vec[i].end());
}
sort(vec.begin(), vec.end());
long long int ans = 0;
int i = 0;
int j = 0;
while (i < n) {
while (j < n && vec[i] == vec[j]) {
j++;
}
// cout << i << " " << j << endl;
ans += (j - i) * (j - i - 1) / 2;
i = j;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> vec(n);
for (int i = 0; i < n; i++) {
cin >> vec[i];
sort(vec[i].begin(), vec[i].end());
}
sort(vec.begin(), vec.end());
long long int ans = 0;
int i = 0;
int j = 0;
while (j < n) {
while (j < n && vec[i] == vec[j]) {
j++;
}
// cout << i << " " << j << endl;
ans += (long long)(j - i) * (j - i - 1) / 2;
i = j;
}
cout << ans << endl;
}
|
[
"identifier.change",
"control_flow.loop.condition.change"
] | 747,693
| 747,692
|
u428132025
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename T> void out(T x) {
cout << x << endl;
exit(0);
}
#define watch(x) cout << (#x) << " is " << (x) << endl
const int maxn = 1e6 + 5;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed << setprecision(12);
int n;
cin >> n;
map<map<char, int>, int> mp;
ll ans = 0;
for (int i = 0; i < n; i++) {
string s;
map<char, int> freq;
for (char c : s)
freq[c]++;
ans += mp[freq];
mp[freq]++;
}
out(ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename T> void out(T x) {
cout << x << endl;
exit(0);
}
#define watch(x) cout << (#x) << " is " << (x) << endl
const int maxn = 1e6 + 5;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed << setprecision(12);
int n;
cin >> n;
map<map<char, int>, int> mp;
ll ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
map<char, int> freq;
for (char c : s)
freq[c]++;
ans += mp[freq];
mp[freq]++;
}
out(ans);
return 0;
}
|
[] | 747,696
| 747,697
|
u774417629
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S[i] = s;
}
sort(S.begin(), S.end());
int res = 0, cnt = 0;
string prev;
for (int i = 0; i < N; i++) {
if (S[i] == prev) {
cnt++;
} else {
res += cnt * (cnt - 1) / 2;
cnt = 1;
}
prev = S[i];
}
res += cnt * (cnt - 1) / 2;
cout << res << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S[i] = s;
}
sort(S.begin(), S.end());
long long res = 0, cnt = 0;
string pre;
for (int i = 0; i < N; i++) {
if (S[i] == pre) {
cnt++;
} else {
res += cnt * (cnt - 1) / 2;
cnt = 1;
}
pre = S[i];
}
res += cnt * (cnt - 1) / 2;
cout << res << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"identifier.change",
"control_flow.branch.if.condition.change",
"assignment.variable.change"
] | 747,698
| 747,699
|
u188117876
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (int i = 0; i < n; i++) {
sort(s[i].begin(), s[i].end());
// cout << s[i] << endl;
}
unordered_map<string, long long int> table;
int answer = 0;
for (int i = 0; i < n; i++) {
if (table.find(s[i]) == table.end()) {
table.insert({s[i], 1});
} else {
answer += table[s[i]];
table[s[i]] += 1;
}
}
cout << answer << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (int i = 0; i < n; i++) {
sort(s[i].begin(), s[i].end());
// cout << s[i] << endl;
}
unordered_map<string, long long int> table;
long long int answer = 0;
for (int i = 0; i < n; i++) {
if (table.find(s[i]) == table.end()) {
table.insert({s[i], 1});
} else {
answer += table[s[i]];
table[s[i]] += 1;
}
}
cout << answer << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 747,700
| 747,701
|
u180716041
|
cpp
|
p02947
|
#include <iostream>
using namespace std;
#include <algorithm>
#include <string>
#include <unordered_map>
unordered_map<string, int> m;
int main() {
int i, j, n, k, l, count = 0;
cin >> n;
string s;
// sort(s[0].begin(),s[0].end());
for (i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
count = count + m[s];
m[s]++;
}
/*int count=0;
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(s[i]==s[j])
count++;
}
}*/
cout << count;
return 0;
}
|
#include <iostream>
using namespace std;
#include <algorithm>
#include <string>
#include <unordered_map>
unordered_map<string, long long int> m;
int main() {
long long int i, j, n, k, l, count = 0;
cin >> n;
string s;
// sort(s[0].begin(),s[0].end());
for (i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
count = count + m[s];
m[s]++;
}
/*int count=0;
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(s[i]==s[j])
count++;
}
}*/
cout << count;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 747,713
| 747,714
|
u476054945
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> m;
unsigned long long ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
auto itr = m.find(s);
if (itr == m.end())
m[s] = 1;
else
m[s] += 1;
}
for (auto itr = m.begin(); itr != m.end(); ++itr) {
if (itr->second > 1)
ans += itr->second * (itr->second - 1) / 2;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, unsigned long long> m;
unsigned long long ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
auto itr = m.find(s);
if (itr == m.end())
m[s] = 1;
else
m[s] += 1;
}
for (auto itr = m.begin(); itr != m.end(); ++itr) {
if (itr->second > 1)
ans += itr->second * (itr->second - 1) / 2;
}
cout << ans;
return 0;
}
|
[
"variable_declaration.type.primitive.change"
] | 747,715
| 747,716
|
u068586753
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int i, j, cnt = 0;
int n;
cin >> n;
char c[n][10];
for (i = 0; i < n; i++) {
for (j = 0; j < 10; j++)
cin >> c[i][j];
}
for (i = 0; i < n; i++)
sort(c[i], c[i] + 10);
string s[n];
for (i = 0; i < n; i++) {
s[i] = "";
for (j = 0; j < 10; j++) {
s[i] += c[i][j];
}
}
sort(s, s + n);
int a[n];
for (i = 0; i < n; i++)
a[i] = 1;
for (i = 1; i < n; i++) {
if (s[i - 1] == s[i]) {
a[cnt]++;
} else
cnt++;
}
ll sum = 0;
for (i = 0; i <= cnt; i++) {
sum += a[i] * (a[i] - 1) / 2;
}
cout << sum;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int i, j, cnt = 0;
int n;
cin >> n;
char c[n][10];
for (i = 0; i < n; i++) {
for (j = 0; j < 10; j++)
cin >> c[i][j];
}
for (i = 0; i < n; i++)
sort(c[i], c[i] + 10);
string s[n];
for (i = 0; i < n; i++) {
s[i] = "";
for (j = 0; j < 10; j++) {
s[i] += c[i][j];
}
}
sort(s, s + n);
ll a[n];
for (i = 0; i < n; i++)
a[i] = 1;
for (i = 1; i < n; i++) {
if (s[i - 1] == s[i]) {
a[cnt]++;
} else
cnt++;
}
ll sum = 0;
for (i = 0; i <= cnt; i++) {
sum += a[i] * (a[i] - 1) / 2;
}
cout << sum;
}
|
[
"variable_declaration.type.change"
] | 747,717
| 747,718
|
u952130512
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
long long N, ans = 0;
cin >> N;
vector<vector<char>> s(N, vector<char>(10));
map<vector<char>, int> M;
for (int i = 0; i < N; i++) {
for (int j = 0; j < 10; j++) {
cin >> s[i][j];
}
}
for (int i = 0; i < N; i++) {
sort(s[i].begin(), s[i].end());
auto itr = M.find(s[i]);
if (itr == M.end()) //キーとしてs[i]が存在しないなら
{
M[s[i]] = 1;
// ans++;
} else {
M[s[i]]++;
}
}
// int max = (*max_element(M.begin(),M.end())).second;
for (auto i = M.begin(); i != M.end(); i++) {
int a = i->second;
ans += (a * (a - 1)) / 2;
}
cout << ans;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
long long N, ans = 0;
cin >> N;
vector<vector<char>> s(N, vector<char>(10));
map<vector<char>, long long> M;
for (int i = 0; i < N; i++) {
for (int j = 0; j < 10; j++) {
cin >> s[i][j];
}
}
for (int i = 0; i < N; i++) {
sort(s[i].begin(), s[i].end());
auto itr = M.find(s[i]);
if (itr == M.end()) //キーとしてs[i]が存在しないなら
{
M[s[i]] = 1;
// ans++;
} else {
M[s[i]]++;
}
}
// int max = (*max_element(M.begin(),M.end())).second;
for (auto i = M.begin(); i != M.end(); i++) {
long long a = i->second;
ans += (a * (a - 1)) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,724
| 747,725
|
u987913144
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath> // abs() for float, and fabs()
#include <cstdlib> // abs() for integer 絶対値求めやつ
#include <iomanip> //浮動小数点数を出力する制度の指定
#include <string>
#include <vector>
//使い方 数値をnumとして cout<<setprecision(n)<<num ;nは桁数
#define rep(i, n) for (int i = 0; i < (n); i++)
#define SORT(a) sort((a).begin(), (a).end())
#define REV(a) reverse((a).begin(), (a).end())
using namespace std;
using ll = long long;
#define INF 2000000000
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
#define che(a, string) cout << "//" << string << "==" << (a) << "//" << endl;
bool IsInt(double a) {
int b = a / 1;
if (a == b) {
return true;
} else {
return false;
}
}
/*覚えてないことメモ
数値型から文字列に変換 to_string(number);これは簡単
文字列から数値型に変換 stoi(number)
文字列からllに変換 stoll(number)*/
//ここから書き始める
int main() {
int n;
cin >> n;
vector<string> S(n);
rep(i, n) {
string s;
cin >> s;
SORT(s);
S[i] = s;
}
SORT(S);
// rep(i,n){
// che(S[i],"si");
// }
ll ans = 0;
int count = 1;
rep(i, n - 1) {
if (S[i + 1] == S[i]) {
count++;
} else {
ans += count * (count - 1) / 2;
count = 1;
}
}
ans += count * (count - 1) / 2;
cout << ans << endl;
}
|
#include <algorithm>
#include <bits/stdc++.h>
#include <cmath> // abs() for float, and fabs()
#include <cstdlib> // abs() for integer 絶対値求めやつ
#include <iomanip> //浮動小数点数を出力する制度の指定
#include <string>
#include <vector>
//使い方 数値をnumとして cout<<setprecision(n)<<num ;nは桁数
#define rep(i, n) for (int i = 0; i < (n); i++)
#define SORT(a) sort((a).begin(), (a).end())
#define REV(a) reverse((a).begin(), (a).end())
using namespace std;
using ll = long long;
#define INF 2000000000
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
#define che(a, string) cout << "//" << string << "==" << (a) << "//" << endl;
bool IsInt(double a) {
int b = a / 1;
if (a == b) {
return true;
} else {
return false;
}
}
/*覚えてないことメモ
数値型から文字列に変換 to_string(number);これは簡単
文字列から数値型に変換 stoi(number)
文字列からllに変換 stoll(number)*/
//ここから書き始める
int main() {
int n;
cin >> n;
vector<string> S(n);
rep(i, n) {
string s;
cin >> s;
SORT(s);
S[i] = s;
}
SORT(S);
// rep(i,n){
// che(S[i],"si");
// }
ll ans = 0;
ll count = 1;
rep(i, n - 1) {
if (S[i + 1] == S[i]) {
count++;
} else {
ans += count * (count - 1) / 2;
count = 1;
}
}
ans += count * (count - 1) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 747,726
| 747,727
|
u298620933
|
cpp
|
p02947
|
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <functional>
typedef long long ll;
using namespace std;
#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
out << "{" << p.first << ", " << p.second << "}";
return out;
}
template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
out << '{';
for (const T &item : v)
out << item << ", ";
out << "\b\b}";
return out;
}
#endif
#define mod 1000000007 // 1e9+7(prime number)
#define INF 1000000000 // 1e9
#define LLINF 2000000000000000000LL // 2e18
#define SIZE 200010
int main() {
int N;
map<string, int> counter;
cin >> N;
int ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += counter[s];
counter[s]++;
}
cout << ans << endl;
return 0;
}
|
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <functional>
typedef long long ll;
using namespace std;
#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
out << "{" << p.first << ", " << p.second << "}";
return out;
}
template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
out << '{';
for (const T &item : v)
out << item << ", ";
out << "\b\b}";
return out;
}
#endif
#define mod 1000000007 // 1e9+7(prime number)
#define INF 1000000000 // 1e9
#define LLINF 2000000000000000000LL // 2e18
#define SIZE 200010
int main() {
int N;
map<string, int> counter;
cin >> N;
ll ans = 0;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += counter[s];
counter[s]++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,728
| 747,729
|
u378419207
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<string, int> mp;
int ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
auto itr = mp.find(s);
if (itr != mp.end()) {
mp[s]++;
ans += mp[s];
} else
mp[s] = 0;
}
printf("%d\n", ans);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<string, long int> mp;
long int ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
auto itr = mp.find(s);
if (itr != mp.end()) {
mp[s]++;
ans += mp[s];
} else
mp[s] = 0;
}
printf("%ld\n", ans);
}
|
[
"variable_declaration.type.widen.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 747,732
| 747,733
|
u224590796
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
long long n;
std::cin >> n;
std::map<string, int> ma;
int ans = 0;
for (int i = 0; i < n; i++) {
string s;
std::cin >> s;
sort(s.begin(), s.end());
if (ma[s] != 0) {
ans += ma[s];
}
ma[s]++;
}
std::cout << ans << '\n';
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
long long n;
std::cin >> n;
std::map<string, int> ma;
long long ans = 0;
for (int i = 0; i < n; i++) {
string s;
std::cin >> s;
sort(s.begin(), s.end());
if (ma[s] != 0) {
ans += ma[s];
}
ma[s]++;
}
std::cout << ans << '\n';
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,734
| 747,735
|
u280097533
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N;
cin >> N;
vector<string> S(N);
rep(i, N) {
cin >> S.at(i);
sort(S.at(i).begin(), S.at(i).end());
}
long long ans = 0;
sort(S.begin(), S.end());
int i = 1, sum = 0;
rep(i, N - 1) {
if (S.at(i) == S.at(i + 1)) {
sum++;
} else {
ans += sum * (sum + 1) / 2;
sum = 0;
}
}
ans += sum * (sum + 1) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N;
cin >> N;
vector<string> S(N);
rep(i, N) {
cin >> S.at(i);
sort(S.at(i).begin(), S.at(i).end());
}
long long ans = 0;
sort(S.begin(), S.end());
int i = 1;
long long sum = 0;
rep(i, N - 1) {
if (S.at(i) == S.at(i + 1)) {
sum++;
} else {
ans += sum * (sum + 1) / 2;
sum = 0;
}
}
ans += sum * (sum + 1) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 747,736
| 747,737
|
u347057617
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main() {
int n;
ll ans = 0;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) { sort(s[i].begin(), s[i].end()); }
sort(s.begin(), s.end());
string a = s[0];
int count = 0;
vector<int> q;
rep(i, n) {
if (a == s[i])
count++;
else {
q.push_back(count);
count = 1;
a = s[i];
}
}
q.push_back(count);
rep(i, q.size()) {
int c = q[i];
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main() {
int n;
ll ans = 0;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) { sort(s[i].begin(), s[i].end()); }
sort(s.begin(), s.end());
string a = s[0];
ll count = 0;
vector<ll> q;
rep(i, n) {
if (a == s[i])
count++;
else {
q.push_back(count);
count = 1;
a = s[i];
}
}
q.push_back(count);
rep(i, q.size()) {
ll c = q[i];
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,740
| 747,741
|
u199343957
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main() {
int n;
ll ans = 0;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) { sort(s[i].begin(), s[i].end()); }
sort(s.begin(), s.end());
string a = s[0];
ll count = 0;
vector<ll> q;
rep(i, n) {
if (a == s[i])
count++;
else {
q.push_back(count);
count = 0;
a = s[i];
}
}
q.push_back(++count);
rep(i, q.size()) {
ll c = q[i];
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main() {
int n;
ll ans = 0;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) { sort(s[i].begin(), s[i].end()); }
sort(s.begin(), s.end());
string a = s[0];
ll count = 0;
vector<ll> q;
rep(i, n) {
if (a == s[i])
count++;
else {
q.push_back(count);
count = 1;
a = s[i];
}
}
q.push_back(count);
rep(i, q.size()) {
ll c = q[i];
ans += c * (c - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"literal.number.change",
"assignment.value.change",
"call.arguments.change"
] | 747,743
| 747,741
|
u199343957
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
map<string, int> p;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ans += p[s];
p[s]++;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
map<string, int> p;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ans += p[s];
p[s]++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 747,744
| 747,745
|
u305141544
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int INF = 1001001001;
ll combination(int x, int y) {
if (x < y)
return 0;
ll a = 1;
ll b = 1;
rep(i, y) {
a *= i + 1;
b *= x - i;
}
return b / a;
}
int main() {
int n;
cin >> n;
vector<string> s(n + 1);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end() - 1);
int ans = 0, count = 1;
string tmp = "nyo";
s[n] = "nyo";
rep(i, n + 1) {
if (tmp == s[i]) {
count++;
} else {
tmp = s[i];
ans += combination(count, 2);
count = 1;
}
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
int INF = 1001001001;
ll combination(int x, int y) {
if (x < y)
return 0;
ll a = 1;
ll b = 1;
rep(i, y) {
a *= i + 1;
b *= x - i;
}
return b / a;
}
int main() {
int n;
cin >> n;
vector<string> s(n + 1);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end() - 1);
ll ans = 0, count = 1;
string tmp = "nyo";
s[n] = "nyo";
rep(i, n + 1) {
if (tmp == s[i]) {
count++;
} else {
tmp = s[i];
ans += combination(count, 2);
count = 1;
}
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 747,754
| 747,755
|
u405620865
|
cpp
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.