problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k ⌀ | fixed_code stringlengths 12 526k ⌀ | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M ⌀ | fixed_submission_id int64 2 1.54M ⌀ | user_id stringlengths 10 10 ⌀ | language stringclasses 9 values |
|---|---|---|---|---|---|---|---|
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll sum = 0;
for (auto it : mp) {
sum += (it.second) * (it.second - 1) / 2;
}
cout << sum << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, long> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll sum = 0;
for (auto it : mp) {
sum += (it.second) * (it.second - 1) / 2;
}
cout << sum << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,066 | 748,065 | u374190629 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<int> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007, INF = 1e18;
template <typename T1, typename T2>
bool pairCompare(const pair<T1, T2> &firstElof,
const pair<T1, T2> &secondElof) {
return firstElof.second > secondElof.second;
}
int mapMaxValue(std::map<ll, int> m) {
int max = 0;
for (std::map<ll, int>::iterator it = m.begin(); it != m.end(); it++) {
if (max < it->second)
max = it->second;
}
return max;
}
int main(void) {
int n;
cin >> n;
vector<string> s(n);
vi anagram_count;
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll cnt = 1;
string prev_str = "";
for (int i = 0; i < n; ++i) {
if (s[i] != prev_str) {
if (cnt > 1) {
anagram_count.pb(cnt);
cnt = 1;
}
} else {
cnt++;
if (i == n - 1 && cnt > 1)
anagram_count.pb(cnt);
}
prev_str = s[i];
}
ll ans = 0;
for (auto ana_count : anagram_count) {
ans += (ll)(ana_count == 1 ? 1 : ana_count * (ana_count - 1) / 2);
}
cout << ans << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007, INF = 1e18;
template <typename T1, typename T2>
bool pairCompare(const pair<T1, T2> &firstElof,
const pair<T1, T2> &secondElof) {
return firstElof.second > secondElof.second;
}
int mapMaxValue(std::map<ll, int> m) {
int max = 0;
for (std::map<ll, int>::iterator it = m.begin(); it != m.end(); it++) {
if (max < it->second)
max = it->second;
}
return max;
}
int main(void) {
int n;
cin >> n;
vector<string> s(n);
vll anagram_count;
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll cnt = 1;
string prev_str = "";
for (int i = 0; i < n; ++i) {
if (s[i] != prev_str) {
if (cnt > 1) {
anagram_count.pb(cnt);
cnt = 1;
}
} else {
cnt++;
if (i == n - 1 && cnt > 1)
anagram_count.pb(cnt);
}
prev_str = s[i];
}
ll ans = 0;
for (auto ana_count : anagram_count) {
ans += (ll)(ana_count == 1 ? 1 : ana_count * (ana_count - 1) / 2);
}
cout << ans << endl;
} | [
"variable_declaration.type.change"
] | 748,067 | 748,068 | u998980702 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<int> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007, INF = 1e18;
template <typename T1, typename T2>
bool pairCompare(const pair<T1, T2> &firstElof,
const pair<T1, T2> &secondElof) {
return firstElof.second > secondElof.second;
}
int mapMaxValue(std::map<ll, int> m) {
int max = 0;
for (std::map<ll, int>::iterator it = m.begin(); it != m.end(); it++) {
if (max < it->second)
max = it->second;
}
return max;
}
int main(void) {
int n;
cin >> n;
vector<string> s(n);
vi anagram_count;
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll cnt = 1;
string prev_str = "";
for (int i = 0; i < n; ++i) {
if (s[i] != prev_str) {
if (cnt > 1) {
anagram_count.pb(cnt);
cnt = 1;
}
} else {
cnt++;
if (i == n - 1 && cnt > 1)
anagram_count.pb(cnt);
}
prev_str = s[i];
}
ll ans = 0;
for (auto ana_count : anagram_count) {
ans += (ana_count == 1 ? 1 : ana_count * (ana_count - 1) / 2);
}
cout << ans << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007, INF = 1e18;
template <typename T1, typename T2>
bool pairCompare(const pair<T1, T2> &firstElof,
const pair<T1, T2> &secondElof) {
return firstElof.second > secondElof.second;
}
int mapMaxValue(std::map<ll, int> m) {
int max = 0;
for (std::map<ll, int>::iterator it = m.begin(); it != m.end(); it++) {
if (max < it->second)
max = it->second;
}
return max;
}
int main(void) {
int n;
cin >> n;
vector<string> s(n);
vll anagram_count;
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll cnt = 1;
string prev_str = "";
for (int i = 0; i < n; ++i) {
if (s[i] != prev_str) {
if (cnt > 1) {
anagram_count.pb(cnt);
cnt = 1;
}
} else {
cnt++;
if (i == n - 1 && cnt > 1)
anagram_count.pb(cnt);
}
prev_str = s[i];
}
ll ans = 0;
for (auto ana_count : anagram_count) {
ans += (ll)(ana_count == 1 ? 1 : ana_count * (ana_count - 1) / 2);
}
cout << ans << endl;
} | [
"variable_declaration.type.change",
"call.add"
] | 748,069 | 748,068 | u998980702 | cpp |
p02947 | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
// your code goes here
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> m;
for (int i = 0; i < n; i++)
m[s[i]]++;
long long ans = 0;
for (auto x : m) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
// your code goes here
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
map<string, long> m;
for (int i = 0; i < n; i++)
m[s[i]]++;
long long ans = 0;
for (auto x : m) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 748,070 | 748,071 | u978141770 | cpp |
p02947 | #include <iostream>
#include <map>
#include <string>
using namespace std;
void ReplaceStr(char str[]) {
for (int i = 0; str[i] != 0; i++) {
for (int j = i + 1; str[j] != 0; j++) {
if (str[i] > str[j]) {
char tmp = str[i];
str[i] = str[j];
str[j] = tmp;
}
}
}
}
int main() {
int n;
cin >> n;
char str[20];
map<string, int> m;
for (int i = 0; i < n; i++) {
cin >> str;
ReplaceStr(str);
string s(str);
auto itr = m.find(s);
if (itr != m.end()) {
m[str] = m[str] + 1;
} else {
m[str] = 1;
}
}
long long counter = 0;
for (auto x : m) {
if (x.second > 1) {
int num = x.second;
counter += num * (num - 1) / 2;
}
}
cout << counter << endl;
;
}
| #include <iostream>
#include <map>
#include <string>
using namespace std;
void ReplaceStr(char str[]) {
for (int i = 0; str[i] != 0; i++) {
for (int j = i + 1; str[j] != 0; j++) {
if (str[i] > str[j]) {
char tmp = str[i];
str[i] = str[j];
str[j] = tmp;
}
}
}
}
int main() {
int n;
cin >> n;
char str[20];
map<string, long> m;
for (int i = 0; i < n; i++) {
cin >> str;
ReplaceStr(str);
string s(str);
auto itr = m.find(s);
if (itr != m.end()) {
m[str] = m[str] + 1;
} else {
m[str] = 1;
}
}
long long counter = 0;
for (auto x : m) {
if (x.second > 1) {
long num = x.second;
counter += num * (num - 1) / 2;
}
}
cout << counter << endl;
;
}
| [
"variable_declaration.type.primitive.change"
] | 748,072 | 748,073 | u340267240 | cpp |
p02947 | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author TM
*/
#include <bits/stdc++.h>
using namespace std;
class CGreenBin {
public:
void solve(std::istream &cin, std::ostream &cout) {
int n;
cin >> n;
vector<string> s_vec(n);
for (int i = 0; i < n; ++i) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
s_vec[i] = tmp;
}
sort(s_vec.begin(), s_vec.end());
string start = s_vec[0];
long same = 1;
long ans = 0;
for (int j = 1; j < n; ++j) {
if (s_vec[j] == start) {
same += 1;
} else {
ans += (same * (same - 1)) / 2;
same = 1;
start = s_vec[j];
}
}
ans += (same * same - 1) / 2;
cout << ans << endl;
}
};
int main() {
CGreenBin solver;
std::istream &in(std::cin);
std::ostream &out(std::cout);
solver.solve(in, out);
return 0;
}
| /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author TM
*/
#include <bits/stdc++.h>
using namespace std;
class CGreenBin {
public:
void solve(std::istream &cin, std::ostream &cout) {
int n;
cin >> n;
vector<string> s_vec(n);
for (int i = 0; i < n; ++i) {
string tmp;
cin >> tmp;
sort(tmp.begin(), tmp.end());
s_vec[i] = tmp;
}
sort(s_vec.begin(), s_vec.end());
string start = s_vec[0];
long same = 1;
long ans = 0;
for (int j = 1; j < n; ++j) {
if (s_vec[j] == start) {
same += 1;
} else {
ans += (same * (same - 1)) / 2;
same = 1;
start = s_vec[j];
}
}
ans += (same * (same - 1)) / 2;
cout << ans << endl;
}
};
int main() {
CGreenBin solver;
std::istream &in(std::cin);
std::ostream &out(std::cout);
solver.solve(in, out);
return 0;
}
| [] | 748,074 | 748,075 | u136090046 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string strlist[n];
string tmp_str;
for (int i = 0; i < n; i++) {
cin >> tmp_str;
sort(tmp_str.begin(), tmp_str.end());
strlist[i] = tmp_str;
}
sort(strlist, strlist + n);
// check anagram
int anagram_cnt = 0;
int total = 0;
string check = strlist[0];
for (int i = 1; i < n; i++) {
if (check == strlist[i]) {
total++;
} else {
anagram_cnt = anagram_cnt + (total * (total + 1) / 2);
check = strlist[i];
total = 0;
}
}
cout << anagram_cnt + (total * (total + 1) / 2) << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
string strlist[n];
string tmp_str;
for (int i = 0; i < n; i++) {
cin >> tmp_str;
sort(tmp_str.begin(), tmp_str.end());
strlist[i] = tmp_str;
}
sort(strlist, strlist + n);
// check anagram
long long anagram_cnt = 0;
long long total = 0;
string check = strlist[0];
for (int i = 1; i < n; i++) {
if (check == strlist[i]) {
total++;
} else {
anagram_cnt = anagram_cnt + (total * (total + 1) / 2);
check = strlist[i];
total = 0;
}
}
cout << anagram_cnt + (total * (total + 1) / 2) << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,080 | 748,081 | u524142273 | 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];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
long long ans = 0LL;
int l = 1;
string ss = s[0];
for (int i = 1; i < n; ++i) {
if (ss == s[i])
++l;
else {
ans += l * (l - 1) / 2;
ss = s[i];
l = 1;
}
}
ans += l * (l - 1) / 2;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
long long ans = 0LL;
long long l = 1LL;
string ss = s[0];
for (int i = 1; i < n; ++i) {
if (ss == s[i])
++l;
else {
ans += l * (l - 1) / 2;
ss = s[i];
l = 1;
}
}
ans += l * (l - 1) / 2;
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"literal.number.type.widen.change"
] | 748,084 | 748,085 | u640800420 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1E9 + 9;
const int INF = 1 << 29;
int main() {
int ans = 0;
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
map<string, int> cnt;
rep(i, N) {
sort(s[i].begin(), s[i].end());
cnt[s[i]]++;
}
for (int i = 0; i < N; i++) {
// cout << &cnt[s[i]] << endl;
ans += (cnt[s[i]] - 1);
}
cout << ans / 2 << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1E9 + 9;
const int INF = 1 << 29;
int main() {
int64_t ans = 0;
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
map<string, int> cnt;
rep(i, N) {
sort(s[i].begin(), s[i].end());
cnt[s[i]]++;
}
for (int i = 0; i < N; i++) {
// cout << &cnt[s[i]] << endl;
ans += cnt[s[i]] - 1;
}
cout << ans / 2 << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,086 | 748,087 | u994910167 | cpp |
p02947 | #include <algorithm>.
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1E9 + 9;
const int INF = 1 << 29;
int main() {
int ans = 0;
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
map<string, int> cnt;
rep(i, N) {
sort(s[i].begin(), s[i].end());
cnt[s[i]]++;
}
for (int i = 0; i < N; i++) {
// cout << &cnt[s[i]] << endl;
ans += (cnt[s[i]] - 1);
}
cout << ans / 2 << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1E9 + 9;
const int INF = 1 << 29;
int main() {
int64_t ans = 0;
int N;
cin >> N;
vector<string> s(N);
rep(i, N) cin >> s[i];
map<string, int> cnt;
rep(i, N) {
sort(s[i].begin(), s[i].end());
cnt[s[i]]++;
}
for (int i = 0; i < N; i++) {
// cout << &cnt[s[i]] << endl;
ans += cnt[s[i]] - 1;
}
cout << ans / 2 << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,088 | 748,087 | u994910167 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int main() {
int N;
cin >> N;
map<string, ll> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int cnt = 0;
for (auto x : mp) {
cnt += x.second * (x.second - 1) / 2;
}
cout << cnt;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int main() {
int N;
cin >> N;
map<string, ll> mp;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll cnt = 0;
for (auto x : mp) {
cnt += x.second * (x.second - 1) / 2;
}
cout << cnt;
} | [
"variable_declaration.type.change"
] | 748,089 | 748,090 | u591779169 | cpp |
p02947 | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
while (!s.size()) {
cin >> s;
}
sort(s.begin(), s.end());
if (mp.find(s) != mp.end()) {
// cout<<"incrementing ="<<s<<endl;
mp[s]++;
} else { // cout<<"inserting s="<<s<<endl;
mp.insert(make_pair(s, 0));
}
}
long long int val = 0;
for (auto s : mp) {
val += (s.second * (s.second + 1) * .5);
}
cout << val << endl;
}
/*
1
5
3 2 1 2 10
2 3 5 5 5
*/
| #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main() {
long long int n;
cin >> n;
map<string, long long int> mp;
for (long long int i = 0; i < n; i++) {
string s;
while (!s.size()) {
cin >> s;
}
sort(s.begin(), s.end());
if (mp.find(s) != mp.end()) {
// cout<<"incrementing ="<<s<<endl;
mp[s]++;
} else { // cout<<"inserting s="<<s<<endl;
mp.insert(make_pair(s, 0));
}
}
long long int val = 0;
for (auto s : mp) {
val += (s.second * (s.second + 1) * .5);
}
cout << val << endl;
}
/*
1
5
3 2 1 2 10
2 3 5 5 5
*/
| [
"control_flow.loop.for.initializer.change"
] | 748,093 | 748,094 | u119271498 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n;
x = n;
map<string, int> mp;
cin.ignore();
int cnt = 0;
while (n--) {
string s;
getline(cin, s);
sort(s.begin(), s.end());
cnt += mp[s];
mp[s]++;
}
cout << cnt;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int n, x;
cin >> n;
x = n;
map<string, int> mp;
cin.ignore();
ll cnt = 0;
while (n--) {
string s;
getline(cin, s);
sort(s.begin(), s.end());
cnt += mp[s];
mp[s]++;
}
cout << cnt;
return 0;
}
| [
"variable_declaration.type.change"
] | 748,095 | 748,096 | u324706690 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
long long ans = 0;
for (auto i : m) {
int j = i.second;
if (j <= 1)
ans += 0;
else if (j == 2)
ans++;
else {
ans += j * (j - 1) / 2;
}
}
cout << ans << "\n";
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
long long ans = 0;
for (auto i : m) {
// cout << i.first << " " << i.second << "\n";
long long j = i.second;
if (j <= 1)
ans += 0;
else if (j == 2)
ans++;
else {
ans += j * (j - 1) / 2;
}
}
cout << ans << "\n";
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,097 | 748,098 | u742437982 | 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];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int count = 0;
long long int ans = 0;
//
for (int i = 0; i < n; i++) {
if (s[i - 1] == s[i]) {
count++;
ans += count;
}
else
count = 0;
}
cout << ans << 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];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int count = 0;
long long int ans = 0;
//
for (int i = 1; i < n; i++) {
if (s[i - 1] == s[i]) {
count++;
ans += count;
}
else
count = 0;
}
cout << ans << endl;
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 748,101 | 748,102 | u843292252 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int p[26] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101};
int n;
cin >> n;
long long product[n];
char temp;
for (int i = 0; i < n; i++) {
product[i] = 1;
for (int j = 0; j < 10; j++) {
cin >> temp;
product[i] = product[i] * p[((int)temp) - 97];
}
}
sort(product, product + n);
int sum = 1, ans = 0;
for (int i = 1; i < n; i++) {
if (product[i - 1] == product[i]) {
sum++;
} else {
ans = ans + (sum * (sum - 1)) / 2;
sum = 1;
}
}
ans = ans + (sum * (sum - 1)) / 2;
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int p[26] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101};
int n;
cin >> n;
long long product[n];
char temp;
for (int i = 0; i < n; i++) {
product[i] = 1;
for (int j = 0; j < 10; j++) {
cin >> temp;
product[i] = product[i] * p[((int)temp) - 97];
}
}
sort(product, product + n);
long sum = 1, ans = 0;
for (int i = 1; i < n; i++) {
if (product[i - 1] == product[i]) {
sum++;
} else {
ans = ans + (sum * (sum - 1)) / 2;
sum = 1;
}
}
ans = ans + (sum * (sum - 1)) / 2;
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change"
] | 748,108 | 748,109 | u694243276 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int p[26] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101};
int n;
cin >> n;
long product[n];
char temp;
for (int i = 0; i < n; i++) {
product[i] = 1;
for (int j = 0; j < 10; j++) {
cin >> temp;
product[i] = product[i] * p[((int)temp) - 97];
}
}
sort(product, product + n);
int sum = 1, ans = 0;
for (int i = 1; i < n; i++) {
if (product[i - 1] == product[i]) {
sum++;
} else {
ans = ans + (sum * (sum - 1)) / 2;
sum = 1;
}
}
ans = ans + (sum * (sum - 1)) / 2;
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int p[26] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101};
int n;
cin >> n;
long long product[n];
char temp;
for (int i = 0; i < n; i++) {
product[i] = 1;
for (int j = 0; j < 10; j++) {
cin >> temp;
product[i] = product[i] * p[((int)temp) - 97];
}
}
sort(product, product + n);
long sum = 1, ans = 0;
for (int i = 1; i < n; i++) {
if (product[i - 1] == product[i]) {
sum++;
} else {
ans = ans + (sum * (sum - 1)) / 2;
sum = 1;
}
}
ans = ans + (sum * (sum - 1)) / 2;
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.widen.change",
"variable_declaration.type.primitive.change"
] | 748,110 | 748,109 | u694243276 | cpp |
p02947 | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
#define pi pair<int32, int32>
#define pl pair<int64, int64>
#define chmax(a, b) (a < b ? a = b : 0)
#define chmin(a, b) (a > b ? a = b : 0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM + 7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, 1, -1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template <typename T> T GCD(T u, T v) { return v ? GCD(v, u % v) : u; }
template <typename T> T LCM(T x, T y) {
T gc = GCD(x, y);
return x * y / gc;
}
int main() {
int N;
cin >> N;
vector<string> s(0);
map<string, int> mp;
for (int i = 0; i < N; i++) {
string t;
cin >> t;
sort(t.begin(), t.end());
s.push_back(t);
}
int ans = 0;
sort(s.begin(), s.end());
for (int i = 1; i < N; i++) {
if (s[i - 1] == s[i])
mp[s[i]]++;
}
for (int i = 1; i < N; i++) {
if (mp[s[i]] > 0) {
// cout << "mp[s[i] = " << mp[s[i]] << s[i] << endl;
ans += mp[s[i]] * (mp[s[i]] + 1) / 2;
mp[s[i]] = 0;
}
}
cout << ans << endl;
} | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
#define pi pair<int32, int32>
#define pl pair<int64, int64>
#define chmax(a, b) (a < b ? a = b : 0)
#define chmin(a, b) (a > b ? a = b : 0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM + 7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, 1, -1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template <typename T> T GCD(T u, T v) { return v ? GCD(v, u % v) : u; }
template <typename T> T LCM(T x, T y) {
T gc = GCD(x, y);
return x * y / gc;
}
int main() {
int N;
cin >> N;
vector<string> s(0);
map<string, long long> mp;
for (int i = 0; i < N; i++) {
string t;
cin >> t;
sort(t.begin(), t.end());
s.push_back(t);
}
long long ans = 0;
sort(s.begin(), s.end());
for (int i = 1; i < N; i++) {
if (s[i - 1] == s[i])
mp[s[i]]++;
}
for (int i = 1; i < N; i++) {
if (mp[s[i]] > 0) {
// cout << "mp[s[i] = " << mp[s[i]] << s[i] << endl;
ans += mp[s[i]] * (mp[s[i]] + 1) / 2;
mp[s[i]] = 0;
}
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,111 | 748,112 | u342051078 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
long long int num = 0;
vector<string> str(100001);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> str.at(i);
sort(str.at(i).begin(), str.at(i).end());
}
map<string, int> list_str;
for (int i = 0; i < n; i++) {
list_str[str.at(i)] = 0;
}
for (int i = 0; i < n; i++) {
list_str[str.at(i)]++;
}
for (int i = 0; i < n; i++) {
num += list_str[str.at(i)] * (list_str[str.at(i)] - 1) / 2;
list_str[str.at(i)] = 0;
}
cout << num << endl;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
long long int num = 0;
vector<string> str(100001);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> str.at(i);
sort(str.at(i).begin(), str.at(i).end());
}
map<string, long long int> list_str;
for (int i = 0; i < n; i++) {
list_str[str.at(i)] = 0;
}
for (int i = 0; i < n; i++) {
list_str[str.at(i)]++;
}
for (int i = 0; i < n; i++) {
num += list_str[str.at(i)] * (list_str[str.at(i)] - 1) / 2;
list_str[str.at(i)] = 0;
}
cout << num << endl;
} | [
"variable_declaration.type.widen.change"
] | 748,115 | 748,116 | u755310927 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
#define rep(i, n) for (int i = 0; i < n; i++)
#define fogg(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define test \
int t; \
cin >> t; \
while (t--)
#define debug(x) cout << '>' << #x << ':' << x << "\n";
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
int main() {
int n;
cin >> n;
string a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
map<string, int> str;
for (int i = 0; i < n; i++) {
sort(a[i].begin(), a[i].end());
}
rep(i, n) { str[a[i]] = 0; }
rep(i, n) { str[a[i]]++; }
long long int ans = 0;
for (int i = 0; i < n; i++) {
if (str[a[i]] > 1) {
ans += (str[a[i]]) * (str[a[i]] - 1) / 2;
str[a[i]] = 0;
}
}
cout << ans;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
#define rep(i, n) for (int i = 0; i < n; i++)
#define fogg(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define test \
int t; \
cin >> t; \
while (t--)
#define debug(x) cout << '>' << #x << ':' << x << "\n";
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
int main() {
int n;
cin >> n;
string a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
map<string, int> str;
for (int i = 0; i < n; i++) {
sort(a[i].begin(), a[i].end());
}
rep(i, n) { str[a[i]] = 0; }
rep(i, n) { str[a[i]]++; }
long long int ans = 0;
for (int i = 0; i < n; i++) {
if (str[a[i]] > 1) {
ans += (long long)(str[a[i]]) * (str[a[i]] - 1) / 2;
str[a[i]] = 0;
}
}
cout << ans;
return 0;
} | [
"type_conversion.add"
] | 748,117 | 748,118 | u391494739 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
vector<string> s;
int main() {
int N, tmp;
ll sum, count;
string ss;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> ss;
sort(ss.begin(), ss.end());
s.push_back(ss);
}
sort(s.begin(), s.end());
ss = s[0];
count = 1;
sum = 0;
for (int i = 1; i <= N; i++) {
if (ss == s[i]) {
count++;
} else {
if (count <= 1) {
ss = s[i];
count = 1;
} else {
sum += count * (count - 1) / 2;
ss = s[i];
count = 1;
}
}
}
if (count > 1) {
sum += count * (count - 1) / 2;
}
cout << sum << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
vector<string> s;
int main() {
int N, tmp;
ll sum, count;
string ss;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> ss;
sort(ss.begin(), ss.end());
s.push_back(ss);
}
sort(s.begin(), s.end());
// cout << s[0] << endl;
ss = s[0];
count = 1;
sum = 0;
for (int i = 1; i < N; i++) {
if (ss == s[i]) {
count++;
} else {
if (count <= 1) {
ss = s[i];
count = 1;
} else {
sum += count * (count - 1) / 2;
ss = s[i];
count = 1;
}
}
}
if (count > 1) {
sum += count * (count - 1) / 2;
}
cout << sum << endl;
return 0;
} | [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 748,121 | 748,122 | u235231201 | cpp |
p02947 | #include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
using P = pair<int, int>;
using T = tuple<long, long, long>;
long long MOD = 1000000007;
long long dp[100005][4];
long long Calc(int count) { return (count * (count - 1)) / 2; }
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());
string before = S[0];
long long count = 1;
long long ans = 0;
for (int i = 1; i < N; ++i) {
if (before == S[i])
count++;
else {
ans += Calc(count);
count = 1;
}
if (i == N - 1 && 2 <= count) {
ans += Calc(count);
}
before = S[i];
}
cout << ans << endl;
}
| #include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
using P = pair<int, int>;
using T = tuple<long, long, long>;
long long MOD = 1000000007;
long long dp[100005][4];
long long Calc(long long count) { return (count * (count - 1)) / 2LL; }
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());
string before = S[0];
long long count = 1;
long long ans = 0;
for (int i = 1; i < N; ++i) {
if (before == S[i])
count++;
else {
ans += Calc(count);
count = 1;
}
if (i == N - 1 && 2 <= count) {
ans += Calc(count);
}
before = S[i];
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"literal.number.type.widen.change"
] | 748,123 | 748,124 | u168621426 | 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[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> m;
rep(i, N) { //比較の部分はVectorだとTLEになる。メモリ節約でmapを使う!
m[s[i]]++;
}
int64_t ans = 0;
for (auto x : m) {
int s = x.second;
ans += s * (s - 1) / 2ll;
}
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[i];
sort(s[i].begin(), s[i].end());
}
map<string, int> m;
rep(i, N) { //比較の部分はVectorだとTLEになる。メモリ節約でmapを使う!
m[s[i]]++;
}
int64_t ans = 0;
for (auto x : m) {
uint64_t s = x.second;
ans += s * (s - 1) / 2ll;
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,127 | 748,128 | u319179101 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
long long count = 0;
set<string> v;
map<string, int> map;
for (int i = 0; i < N; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
v.insert(str);
map[str]++;
}
for (auto x : v) {
int y = map[x];
count += (y * (y - 1)) / 2;
}
cout << count << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
long long count = 0;
set<string> v;
map<string, int> map;
for (int i = 0; i < N; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
v.insert(str);
map[str]++;
}
for (auto x : v) {
long long y = map[x];
count += (y * (y - 1)) / 2;
}
cout << count << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,129 | 748,130 | u859209662 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int64_t count = 0;
set<string> v;
map<string, int> map;
for (int i = 0; i < N; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
v.insert(str);
map[str]++;
}
for (auto x : v) {
int y = map[x];
count += (y * (y - 1)) / 2;
}
cout << count << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
long long count = 0;
set<string> v;
map<string, int> map;
for (int i = 0; i < N; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
v.insert(str);
map[str]++;
}
for (auto x : v) {
long long y = map[x];
count += (y * (y - 1)) / 2;
}
cout << count << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,131 | 748,130 | u859209662 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> strings;
for (int idx = 1; idx <= N; ++idx) {
string s;
cin >> s;
sort(s.begin(), s.end());
strings[s] += 1;
}
long long int ans = 0LL;
for (auto iter = strings.begin(); iter != strings.end(); ++iter) {
int n = iter->second;
ans += n * (n - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> strings;
for (int idx = 1; idx <= N; ++idx) {
string s;
cin >> s;
sort(s.begin(), s.end());
strings[s] += 1;
}
long long int ans = 0LL;
for (auto iter = strings.begin(); iter != strings.end(); ++iter) {
long long int n = iter->second;
ans += (n * (n - 1LL)) / 2LL;
}
cout << ans << endl;
return 0;
}
| [
"literal.number.type.widen.change"
] | 748,134 | 748,135 | u737840172 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
long long sum, part;
string s[100001];
cin >> N;
for (int i = 0; i < N; ++i)
cin >> s[i];
for (int i = 0; i < N; ++i)
sort(s[i].begin(), s[i].end());
sort(s, s + N);
sum = 0;
{
int i = 1;
while (i < N) {
if (s[i - 1] == s[i]) {
part = 1;
++i;
for (int j = 3; s[i - 1] == s[i] && i < N;) {
part *= j;
++i, ++j;
}
sum += part;
} else
++i;
}
}
cout << sum << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
long sum, part;
string s[100001];
cin >> N;
for (int i = 0; i < N; ++i)
cin >> s[i];
for (int i = 0; i < N; ++i)
sort(s[i].begin(), s[i].end());
sort(s, s + N);
sum = 0;
{
int i = 1;
while (i < N) {
if (s[i - 1] == s[i]) {
part = 1;
++i;
for (int j = 2; s[i - 1] == s[i] && i < N;) {
part += j;
++i, ++j;
}
sum += part;
} else
++i;
}
}
cout << sum << endl;
return 0;
} | [
"variable_declaration.type.narrow.change",
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.change"
] | 748,140 | 748,141 | u205975249 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
long sum, part;
string s[100001];
cin >> N;
for (int i = 0; i < N; ++i)
cin >> s[i];
for (int i = 0; i < N; ++i)
sort(s[i].begin(), s[i].end());
sort(s, s + N);
sum = 0;
{
int i = 1;
while (i < N) {
if (s[i - 1] == s[i]) {
part = 1;
++i;
for (int j = 3; s[i - 1] == s[i] && i < N;) {
part *= j;
++i, ++j;
}
sum += part;
} else
++i;
}
}
cout << sum << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
long sum, part;
string s[100001];
cin >> N;
for (int i = 0; i < N; ++i)
cin >> s[i];
for (int i = 0; i < N; ++i)
sort(s[i].begin(), s[i].end());
sort(s, s + N);
sum = 0;
{
int i = 1;
while (i < N) {
if (s[i - 1] == s[i]) {
part = 1;
++i;
for (int j = 2; s[i - 1] == s[i] && i < N;) {
part += j;
++i, ++j;
}
sum += part;
} else
++i;
}
}
cout << sum << endl;
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.change"
] | 748,142 | 748,141 | u205975249 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
int main() {
int n;
cin >> n;
map<string, int> m;
string s;
rep(i, 0, n) {
cin >> s;
sort(all(s));
m[s] += 1;
}
ll ans = 0;
for (auto mm : m) {
ans += mm.second * (mm.second - 1) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
int main() {
ll n;
cin >> n;
map<string, ll> m;
string s;
rep(i, 0, n) {
cin >> s;
sort(all(s));
m[s] += 1;
}
ll ans = 0;
for (auto mm : m) {
ans += mm.second * (mm.second - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.change"
] | 748,143 | 748,144 | u655975843 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
vector<string> S(N);
string s;
for (int n = 0; n < N; n++) {
cin >> s;
sort(s.begin(), s.end());
S[n] = s;
}
sort(S.begin(), S.end());
int count = 0;
int ans = 0;
for (int n = 0; n < N - 1; n++) {
if (S[n] == S[n + 1]) {
count++;
ans += count;
} else {
count = 0;
}
}
cout << ans << "\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
vector<string> S(N);
string s;
for (int n = 0; n < N; n++) {
cin >> s;
sort(s.begin(), s.end());
S[n] = s;
}
sort(S.begin(), S.end());
int count = 0;
long ans = 0;
for (int n = 0; n < N - 1; n++) {
if (S[n] == S[n + 1]) {
count++;
ans += count;
} else {
count = 0;
}
}
cout << ans << "\n";
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 748,145 | 748,146 | u518623219 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
long long n;
map<string, int> mm;
string s[500000];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> 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());
for (int i = 0; i < n; i++)
mm[s[i]]++;
long long ans = 0;
for (auto it : mm) {
ans = ans + (it.second * (it.second - 1)) / 2;
}
cout << ans;
}
| #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
long long n;
map<string, long long> mm;
string s[500000];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> 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());
for (int i = 0; i < n; i++)
mm[s[i]]++;
long long ans = 0;
for (auto it : mm) {
ans = ans + (it.second * (it.second - 1)) / 2;
}
cout << ans;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,147 | 748,148 | u798339690 | cpp |
p02947 | // #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define REP(i, a, b) for (int i = a; i < (b); i++)
#define sz(t) int(t.size())
using namespace std;
typedef long long ll;
vector<string> s;
map<string, int> m;
int main(void) {
int n;
cin >> n;
REP(i, 0, n) {
char tmp_str[11];
REP(j, 0, 10) {
char c;
cin >> c;
tmp_str[j] = c;
}
sort(tmp_str, tmp_str + 10);
string tmp = string(tmp_str);
s.push_back(tmp);
}
sort(s.begin(), s.end());
REP(i, 0, n) {
// cout << s[i] << endl;
if (!m[s[i]]) {
m[s[i]] = 1;
} else {
m[s[i]]++;
}
}
ll ans = 0;
for (auto u : m) {
// cout << u.second << endl;
if (u.second < 2)
continue;
ans += (u.second * (u.second - 1)) / 2;
}
cout << ans << endl;
} | // #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define REP(i, a, b) for (int i = a; i < (b); i++)
#define sz(t) int(t.size())
using namespace std;
typedef long long ll;
vector<string> s;
map<string, ll> m;
int main(void) {
int n;
cin >> n;
REP(i, 0, n) {
char tmp_str[11];
REP(j, 0, 10) {
char c;
cin >> c;
tmp_str[j] = c;
}
sort(tmp_str, tmp_str + 10);
string tmp = string(tmp_str);
s.push_back(tmp);
}
sort(s.begin(), s.end());
REP(i, 0, n) {
if (!m[s[i]]) {
m[s[i]] = 1;
} else {
m[s[i]]++;
}
}
ll ans = 0;
for (auto u : m) {
if (u.second < 2)
continue;
ans += (u.second * (u.second - 1)) / 2;
}
cout << ans << endl;
} | [] | 748,149 | 748,150 | u036104576 | cpp |
p02947 | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, cnt = 0;
map<string, int> mp;
queue<string> que;
string s;
cin >> n;
rep(i, n) {
cin >> s;
sort(all(s));
mp[s]++;
if (mp[s] == 1) {
que.push(s);
++cnt;
}
}
int ans = 0;
while (que.size()) {
for (int j = mp[que.front()] - 1; j > 0; --j) {
ans += j;
}
que.pop();
}
cout << ans << '\n';
return 0;
} | #include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, cnt = 0;
map<string, ll> mp;
queue<string> que;
string s;
cin >> n;
rep(i, n) {
cin >> s;
sort(all(s));
mp[s]++;
if (mp[s] == 1) {
que.push(s);
++cnt;
}
}
ll ans = 0;
while (que.size()) {
for (int j = mp[que.front()] - 1; j > 0; --j) {
ans += j;
}
que.pop();
}
cout << ans << '\n';
return 0;
} | [
"variable_declaration.type.change"
] | 748,153 | 748,154 | u527486806 | cpp |
p02947 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
#define IO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
int main() {
IO;
int n;
cin >> n;
string s;
map<string, int> all;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
all[s]++;
}
long long ans = 0;
for (auto &e : all)
ans += e.second * (e.second - 1) / 2;
cout << ans;
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
#define IO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
int main() {
IO;
int n;
cin >> n;
string s;
map<string, unsigned long long> all;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
all[s]++;
}
unsigned long long ans = 0;
for (auto &e : all)
ans += e.second * (e.second - 1) / 2;
cout << ans;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,161 | 748,162 | u933476247 | cpp |
p02947 | //*137_C問題
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main() {
long long int sum = 0;
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]++;
}
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
sum = sum + ((itr->second) * ((itr->second) - 1) / 2);
}
std::cout << sum << std::endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main() {
long long int sum = 0;
int n;
std::cin >> n;
std::map<std::string, long long int> mp;
for (int i = 0; i < n; i++) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
mp[s]++;
}
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
sum = sum + ((itr->second) * ((itr->second) - 1) / 2);
}
std::cout << sum << std::endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 748,163 | 748,164 | u210398438 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main() {
long long int sum = 0;
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]++;
}
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
sum = sum + (itr->second) * ((itr->second) - 1) / 2;
}
std::cout << sum << std::endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main() {
long long int sum = 0;
int n;
std::cin >> n;
std::map<std::string, long long int> mp;
for (int i = 0; i < n; i++) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
mp[s]++;
}
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
sum = sum + ((itr->second) * ((itr->second) - 1) / 2);
}
std::cout << sum << std::endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 748,165 | 748,164 | u210398438 | cpp |
p02947 | //*137_C問題
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main() {
long long int sum = 0;
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]++;
}
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
sum = sum + (itr->second) * (itr->second - 1) / 2;
}
std::cout << sum << std::endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <string>
int main() {
long long int sum = 0;
int n;
std::cin >> n;
std::map<std::string, long long int> mp;
for (int i = 0; i < n; i++) {
std::string s;
std::cin >> s;
std::sort(s.begin(), s.end());
mp[s]++;
}
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
sum = sum + ((itr->second) * ((itr->second) - 1) / 2);
}
std::cout << sum << std::endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 748,166 | 748,164 | u210398438 | 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);
map<string, int> m;
rep(i, N) {
string t;
cin >> t;
sort(t.begin(), t.end());
s.at(i) = t;
m[t]++;
}
int64_t ans = 0;
for (auto val : m) {
int x = val.second;
ans += (x - 1) * x / 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);
map<string, int64_t> m;
rep(i, N) {
string t;
cin >> t;
sort(t.begin(), t.end());
s.at(i) = t;
m[t]++;
}
int64_t ans = 0;
for (auto val : m) {
int64_t x = val.second;
ans += (x - 1) * x / 2;
}
cout << ans << endl;
}
| [
"variable_declaration.type.primitive.change"
] | 748,167 | 748,168 | u073486874 | cpp |
p02947 | #include <bits/stdc++.h>
typedef long long ll;
typedef long long int lld;
using namespace std;
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF = 1e9;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define sum(v) accumulate(ALL(v), 0)
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) {
return s << "(" << p.first << ", " << p.second << ")";
}
// vector
template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) {
int len = v.size();
for (int i = 0; i < len; ++i) {
s << v[i];
if (i < len - 1)
s << " ";
}
return s;
}
// 2 dimentional vector
template <typename T>
ostream &operator<<(ostream &s, const vector<vector<T>> &vv) {
int len = vv.size();
for (int i = 0; i < len; ++i) {
s << vv[i] << endl;
}
return s;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
map<string, ll> mp;
cin >> n;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
mp[s] += 1;
}
ll ans = 0;
// for (auto i = mp.begin(); i != mp.end(); ++i) {
// cout << i->first << "=>" << i->second <<endl;
// }
for (auto i = mp.begin(); i != mp.end(); ++i) {
int c = i->second;
if (c > 1) {
ans += c * (c - 1) / 2;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
typedef long long ll;
typedef long long int lld;
using namespace std;
#define REP(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF = 1e9;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define sum(v) accumulate(ALL(v), 0)
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) {
return s << "(" << p.first << ", " << p.second << ")";
}
// vector
template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) {
int len = v.size();
for (int i = 0; i < len; ++i) {
s << v[i];
if (i < len - 1)
s << " ";
}
return s;
}
// 2 dimentional vector
template <typename T>
ostream &operator<<(ostream &s, const vector<vector<T>> &vv) {
int len = vv.size();
for (int i = 0; i < len; ++i) {
s << vv[i] << endl;
}
return s;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
map<string, ll> mp;
cin >> n;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
mp[s] += 1;
}
ll ans = 0;
// for (auto i = mp.begin(); i != mp.end(); ++i) {
// cout << i->first << "=>" << i->second <<endl;
// }
for (auto i = mp.begin(); i != mp.end(); ++i) {
ll c = i->second;
if (c > 1) {
ans += c * (c - 1) / 2;
}
}
cout << ans << endl;
return 0;
}
| [
"preprocessor.define.value.change",
"variable_declaration.type.change"
] | 748,171 | 748,172 | u592686932 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(), x.end()
typedef long long int lld;
typedef pair<int, int> pii;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.precision(15);
cout << fixed;
int n = 0;
cin >> n;
map<multiset<char>, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
multiset<char> mt(s.begin(), s.end());
mp[mt]++;
}
int ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(), x.end()
typedef long long int lld;
typedef pair<int, int> pii;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.precision(15);
cout << fixed;
int n = 0;
cin >> n;
map<multiset<char>, lld> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
multiset<char> mt(s.begin(), s.end());
mp[mt]++;
}
lld ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.change"
] | 748,177 | 748,178 | u835820697 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long int
#define rep(i, x, y) for (int i = x; i < y; i++)
#define rel(i, x, y) for (int i = x - 1; i >= y; i--)
#define all(x) x.begin(), x.end()
using namespace std;
vector<char> copp(vector<char> b) {
vector<char> a(10);
rep(i, 0, 10) { a[i] = b[i]; }
return a;
}
bool compare(vector<char> a, vector<char> b) {
rep(i, 0, 10) {
if (a[i] != b[i])
return false;
}
return true;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<vector<char>> s(n, vector<char>(10));
rep(i, 0, n) {
rep(j, 0, 10) cin >> s[i][j];
sort(all(s[i]));
}
sort(all(s));
vector<char> tmp(10);
tmp = copp(s[0]);
vector<int> comp;
ll ans = 0;
bool cont = false;
rep(i, 1, n) {
bool br = compare(tmp, s[i]);
if (br && (!cont)) {
comp.push_back(2);
cont = true;
} else if (br && cont) {
*(comp.end() - 1) += 1;
} else {
tmp = copp(s[i]);
cont = false;
}
}
for (auto itr = comp.begin(); itr != comp.end(); ++itr) {
ans += (ll)((*itr) * (*itr - 1)) / 2;
}
cout << ans << endl;
}
| #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long int
#define rep(i, x, y) for (int i = x; i < y; i++)
#define rel(i, x, y) for (int i = x - 1; i >= y; i--)
#define all(x) x.begin(), x.end()
using namespace std;
vector<char> copp(vector<char> b) {
vector<char> a(10);
rep(i, 0, 10) { a[i] = b[i]; }
return a;
}
bool compare(vector<char> a, vector<char> b) {
rep(i, 0, 10) {
if (a[i] != b[i])
return false;
}
return true;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<vector<char>> s(n, vector<char>(10));
rep(i, 0, n) {
rep(j, 0, 10) cin >> s[i][j];
sort(all(s[i]));
}
sort(all(s));
vector<char> tmp(10);
tmp = copp(s[0]);
vector<int> comp;
ll ans = 0;
bool cont = false;
rep(i, 1, n) {
bool br = compare(tmp, s[i]);
if (br && (!cont)) {
comp.push_back(2);
cont = true;
} else if (br && cont) {
*(comp.end() - 1) += 1;
} else {
tmp = copp(s[i]);
cont = false;
}
}
for (auto itr = comp.begin(); itr != comp.end(); ++itr) {
ans += (ll)((*itr)) * (ll)((*itr - 1)) / 2;
}
cout << ans << endl;
}
| [
"call.arguments.change",
"call.add"
] | 748,183 | 748,184 | u352200121 | cpp |
p02947 | #include <bits/stdc++.h>
#include <cstdlib>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int n;
unordered_map<string, int> mp;
int cnt = 0;
cin >> n;
string str[n];
for (int i = 0; i < n; i++) {
cin >> str[i];
}
for (int i = 0; i < n; i++) {
sort(str[i].begin(), str[i].end());
if (mp.find(str[i]) != mp.end()) {
cnt += mp[str[i]];
mp[str[i]] += 1;
} else {
mp[str[i]] = 1;
}
}
cout << cnt << endl;
return 0;
}
| #include <bits/stdc++.h>
#include <cstdlib>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int n;
unordered_map<string, int> mp;
long long cnt = 0;
cin >> n;
string str[n];
for (int i = 0; i < n; i++) {
cin >> str[i];
}
for (int i = 0; i < n; i++) {
sort(str[i].begin(), str[i].end());
if (mp.find(str[i]) != mp.end()) {
// cout << str[i] << endl;
// cout << "hit" << endl;
cnt += mp[str[i]];
mp[str[i]] += 1;
} else {
mp[str[i]] = 1;
// cout << "new" << endl;
}
}
cout << cnt;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"expression.operation.binary.remove"
] | 748,185 | 748,186 | u571364079 | cpp |
p02947 | #include <bits/stdc++.h>
#include <cstdlib>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int n;
unordered_map<string, int> mp;
long long cnt = 0;
cin >> n;
string str[n];
for (int i = 0; i < n; i++) {
cin >> str[i];
}
for (int i = 0; i < n; i++) {
sort(str[i].begin(), str[i].end());
if (mp.count(str[i])) {
mp[str[i]] += 1;
} else {
mp[str[i]] = 1;
}
}
for (auto &i : mp) {
if (i.second > 1) {
long long s = (i.second) * (i.second - 1) / 2;
cnt += s;
}
}
cout << cnt;
return 0;
}
| #include <bits/stdc++.h>
#include <cstdlib>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int n;
unordered_map<string, long long> mp;
long long cnt = 0;
cin >> n;
string str[n];
for (int i = 0; i < n; i++) {
cin >> str[i];
}
for (int i = 0; i < n; i++) {
sort(str[i].begin(), str[i].end());
if (mp.count(str[i])) {
mp[str[i]] += 1;
} else {
mp[str[i]] = 1;
}
}
for (auto &i : mp) {
if (i.second > 1) {
long long s = (i.second) * (i.second - 1) / 2;
cnt += s;
}
}
cout << cnt;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,188 | 748,189 | u571364079 | cpp |
p02947 | #include <bits/stdc++.h>
#include <cstdlib>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int n;
unordered_map<string, int> mp;
long long cnt = 0;
cin >> n;
string str[n];
for (int i = 0; i < n; i++) {
cin >> str[i];
}
for (int i = 0; i < n; i++) {
sort(str[i].begin(), str[i].end());
if (mp.count(str[i])) {
mp[str[i]] += 1;
} else {
mp[str[i]] = 1;
}
}
for (auto &i : mp) {
if (i.second > 1) {
long long s = (i.second) * (i.second - 1) / 2;
cnt += s;
}
}
cout << cnt << endl;
return 0;
}
| #include <bits/stdc++.h>
#include <cstdlib>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int n;
unordered_map<string, long long> mp;
long long cnt = 0;
cin >> n;
string str[n];
for (int i = 0; i < n; i++) {
cin >> str[i];
}
for (int i = 0; i < n; i++) {
sort(str[i].begin(), str[i].end());
if (mp.count(str[i])) {
mp[str[i]] += 1;
} else {
mp[str[i]] = 1;
}
}
for (auto &i : mp) {
if (i.second > 1) {
long long s = (i.second) * (i.second - 1) / 2;
cnt += s;
}
}
cout << cnt;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"expression.operation.binary.remove"
] | 748,190 | 748,189 | u571364079 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define FAST_IO \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr)
#define ws(x) cerr << #x << " is " << x << endl;
#define pb(x) push_back(x)
#define ats(x) cout << x << "\n";
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
const int INF = INT_MAX;
map<string, int> as;
int main() {
FAST_IO;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
as[s]++;
}
ll ans = 0;
for (auto a : as) {
int sk = a.second;
if (sk >= 2) {
ans += ((sk - 1) * sk) / 2;
}
}
ats(ans);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FAST_IO \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr)
#define ws(x) cerr << #x << " is " << x << endl;
#define pb(x) push_back(x)
#define ats(x) cout << x << "\n";
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
const int INF = INT_MAX;
map<string, ll> as;
int main() {
FAST_IO;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
as[s]++;
}
ll ans = 0;
for (auto a : as) {
ll sk = a.second;
if (sk >= 2) {
ans += ((sk - 1) * sk) / 2;
}
}
ats(ans);
return 0;
}
| [
"variable_declaration.type.change"
] | 748,191 | 748,192 | u404338281 | cpp |
p02947 | /*****************Bismillahir Rahmanir Rahim***********************/
#include <bits/stdc++.h>
using namespace std;
/************************Start Of Template*************************/
/******** Mahin Shefat - GhOstMan *************/
#define pb push_back
#define popb pop_back
#define ll long long int
#define ull unsigned long long int
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(max3(a, b, c), d)
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(a, min3(b, c, d))
#define MOD 1000000007
#define f first
#define s second
#define mem(a, v) memset(a, v, sizeof(a))
#define mp make_pair
#define check printf("check")
#define sqr(x) (x) * (x)
#define all(v) v.begin(), v.end()
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0)
#define pii pair<int, int>
#define Pair pair<ll, ll>
#define MAX 1000000000000014
#define MIN -1000000000000014
#define endl '\n'
#define Fread freopen("inputdur.txt", "r", stdin)
#define Fwrite freopen("output.txt", "w", stdout)
/************************End Of Template*************************/
string st[100005];
set<string> ss;
map<string, int> Map;
int main() {
fast;
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> st[i];
sort(all(st[i]));
ss.insert(st[i]);
Map[st[i]]++;
}
ll ans = 0;
for (auto x : ss) {
int cnt = Map[x];
ans += (cnt * (cnt - 1)) / 2;
}
cout << ans << endl;
return 0;
}
| /*****************Bismillahir Rahmanir Rahim***********************/
#include <bits/stdc++.h>
using namespace std;
/************************Start Of Template*************************/
/******** Mahin Shefat - GhOstMan *************/
#define pb push_back
#define popb pop_back
#define ll long long int
#define ull unsigned long long int
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(max3(a, b, c), d)
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(a, min3(b, c, d))
#define MOD 1000000007
#define f first
#define s second
#define mem(a, v) memset(a, v, sizeof(a))
#define mp make_pair
#define check printf("check")
#define sqr(x) (x) * (x)
#define all(v) v.begin(), v.end()
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0)
#define pii pair<int, int>
#define Pair pair<ll, ll>
#define MAX 1000000000000014
#define MIN -1000000000000014
#define endl '\n'
#define Fread freopen("inputdur.txt", "r", stdin)
#define Fwrite freopen("output.txt", "w", stdout)
/************************End Of Template*************************/
string st[100005];
set<string> ss;
map<string, int> Map;
int main() {
fast;
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> st[i];
sort(all(st[i]));
ss.insert(st[i]);
Map[st[i]]++;
}
ll ans = 0;
for (auto x : ss) {
ll cnt = Map[x];
ans += ((ll)cnt * (cnt - 1)) / 2;
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.change"
] | 748,197 | 748,198 | u429120546 | cpp |
p02947 | #include <algorithm>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
int main() {
int n;
std::cin >> n;
std::map<std::string, int> counter;
for (auto i = 0; i < n; ++i) {
std::string str;
std::cin >> str;
std::sort(str.begin(), str.end());
counter[str]++;
}
long long int result = 0;
for (const auto p : counter) {
result += p.second * (p.second - 1) / 2;
}
std::cout << result << std::endl;
}
| #include <algorithm>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
int main() {
int n;
std::cin >> n;
std::map<std::string, long long int> counter;
for (auto i = 0; i < n; ++i) {
std::string str;
std::cin >> str;
std::sort(str.begin(), str.end());
counter[str]++;
}
long long int result = 0;
for (const auto p : counter) {
result += p.second * (p.second - 1) / 2;
}
std::cout << result << std::endl;
}
| [
"variable_declaration.type.widen.change"
] | 748,199 | 748,200 | u419330815 | cpp |
p02947 | #include <bits/stdc++.h>
#include <cmath>
#include <math.h>
using namespace std;
bool is_int_lround(double x) { return std::lround(x) == x; }
int ketasuu(int x) {
int n = 0;
while (x > 0) {
x /= 10;
n++;
}
return n;
}
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
sort(S.at(i).begin(), S.at(i).end());
}
sort(S.begin(), S.end());
int ans = 0, tmp = 1;
for (int i = 1; i < N; i++) {
if (S.at(i) == S.at(i - 1)) {
tmp++;
} else {
ans += tmp * (tmp - 1) / 2;
tmp = 1;
}
}
ans += (tmp * (tmp - 1)) / 2;
cout << ans << endl;
} | #include <bits/stdc++.h>
#include <cmath>
#include <math.h>
using namespace std;
bool is_int_lround(double x) { return std::lround(x) == x; }
int ketasuu(int x) {
int n = 0;
while (x > 0) {
x /= 10;
n++;
}
return n;
}
int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; i++) {
cin >> S.at(i);
sort(S.at(i).begin(), S.at(i).end());
}
sort(S.begin(), S.end());
long long ans = 0, tmp = 1;
for (int i = 1; i < N; i++) {
if (S.at(i) == S.at(i - 1)) {
tmp++;
} else {
ans += tmp * (tmp - 1) / 2;
tmp = 1;
}
}
ans += (tmp * (tmp - 1)) / 2;
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,205 | 748,206 | u776056110 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto ch : mp) {
if (ch.second > 1) {
int s = ch.second;
long long val = (s * (s - 1)) / 2;
ans += val;
}
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, long long> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto ch : mp) {
if (ch.second > 1) {
long long s = ch.second;
long long val = (s * (s - 1)) / 2;
ans += val;
}
}
cout << ans << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,209 | 748,210 | u345631412 | cpp |
p02947 | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> X(N);
for (int i = 0; i < N; ++i) {
cin >> X[i];
sort(X[i].begin(), X[i].end());
}
int cnt = 1;
int ans = 0;
sort(X.begin(), X.end());
for (int i = 1; i < N; ++i) {
if (X[i] == X[i - 1]) {
ans += cnt;
++cnt;
} else
cnt = 1;
}
// for(int i=0; i<N; ++i) cout << X[i] << endl;
cout << ans << endl;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
long long N;
cin >> N;
vector<string> X(N);
for (int i = 0; i < N; ++i) {
cin >> X[i];
sort(X[i].begin(), X[i].end());
}
long long cnt = 1;
long long ans = 0;
sort(X.begin(), X.end());
for (int i = 1; i < N; ++i) {
if (X[i] == X[i - 1]) {
ans += cnt;
++cnt;
} else
cnt = 1;
}
// for(int i=0; i<N; ++i) cout << X[i] << endl;
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,211 | 748,212 | u431929942 | cpp |
p02947 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i != n; ++i)
#define REPR(i, n) for (int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for (int i = a; i != b; ++i)
#define RBF(i, n) for (auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
int main() {
int N;
ll count = 0;
int j = 1;
IN(N);
vector<string> s(N);
REP(i, N) {
IN(s[i]);
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
REP(i, N - 1) {
if (s[i] == s[i + 1]) {
count += j;
j *= 2;
} else
j = 1;
}
OUT(count);
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i != n; ++i)
#define REPR(i, n) for (int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for (int i = a; i != b; ++i)
#define RBF(i, n) for (auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
int main() {
int N;
ll count = 0;
int j = 1;
IN(N);
vector<string> s(N);
REP(i, N) {
IN(s[i]);
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
REP(i, N - 1) {
if (s[i] == s[i + 1]) {
count += j;
j++;
} else
j = 1;
}
OUT(count);
} | [] | 748,213 | 748,214 | u127348287 | cpp |
p02947 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i != n; ++i)
#define REPR(i, n) for (int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for (int i = a; i != b; ++i)
#define RBF(i, n) for (auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
int main() {
int N;
ll count = 0;
int j = 1;
IN(N);
vector<string> s(N);
REP(i, N) {
IN(s[i]);
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
REP(i, N - 1) {
if (s[i] == s[i + 1]) {
count += j;
j *= 2;
} else
j = 1;
}
OUT(count);
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i != n; ++i)
#define REPR(i, n) for (int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for (int i = a; i != b; ++i)
#define RBF(i, n) for (auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
int main() {
int N;
ll count = 0;
int j = 1;
IN(N);
vector<string> s(N);
REP(i, N) {
IN(s[i]);
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
REP(i, N - 1) {
if (s[i] == s[i + 1]) {
count += j;
j++;
} else {
j = 1;
}
}
OUT(count);
} | [] | 748,213 | 748,215 | u127348287 | cpp |
p02947 | #include <algorithm>
#include <assert.h>
#include <cstring>
#include <iterator>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#pragma warning(disable : 4996)
typedef long long ll;
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<string, int> z;
int i;
for (i = 0; i < n; i++) {
char str[11] = {0};
scanf("%s", str);
sort(str + 0, str + strlen(str));
z[string(str)]++;
}
ll ans = 0;
auto it = z.begin();
for (; it != z.end(); ++it) {
ans += (ll)(it->second) * (it->second - 1) / 2;
}
printf("%d\n", ans);
return 0;
}
| #include <algorithm>
#include <assert.h>
#include <cstring>
#include <iterator>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#pragma warning(disable : 4996)
typedef long long ll;
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<string, int> z;
int i;
for (i = 0; i < n; i++) {
char str[11] = {0};
scanf("%s", str);
sort(str + 0, str + 10);
z[string(str)]++;
}
ll ans = 0;
auto it = z.begin();
for (; it != z.end(); ++it) {
ans += (ll)(it->second) * (it->second - 1) / 2;
}
printf("%lld\n", ans);
return 0;
}
| [
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change",
"expression.operation.binary.change",
"literal.string.change",
"io.output.change"
] | 748,216 | 748,217 | u209713918 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
map<string, int> mp;
int ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += mp[s];
mp[s]++;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
map<string, int> mp;
ll ans = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += mp[s];
mp[s]++;
}
cout << ans << endl;
} | [
"variable_declaration.type.change"
] | 748,223 | 748,224 | u272105488 | cpp |
p02947 | #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define debug(x) cout << #x << " = " << (x) << endl;
using namespace std;
using LL = long long int;
using ULL = unsigned long long;
int main() {
int n;
cin >> n;
map<string, int> ans;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans[s]++;
}
LL sum = 0;
for (auto e : ans) {
int tmp = e.second * (e.second - 1) / 2;
sum += tmp;
}
cout << sum << endl;
}
| #include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define loop(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define debug(x) cout << #x << " = " << (x) << endl;
using namespace std;
using LL = long long int;
using ULL = unsigned long long;
int main() {
int n;
cin >> n;
map<string, LL> ans;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans[s]++;
}
LL sum = 0;
for (auto e : ans) {
LL tmp = e.second * (e.second - 1) / 2;
sum += tmp;
}
cout << sum << endl;
return 0;
}
| [
"variable_declaration.type.change",
"control_flow.return.add",
"control_flow.return.0.add"
] | 748,225 | 748,226 | u614063956 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<vector<char>> vvcStr;
multimap<vector<char>, int> mapvStr;
long long cnt = 0;
for (int i = 0; i != N; i++) {
string strin;
cin >> strin;
vector<char> vcStr;
for (int j = 0; j != 10; j++) {
vcStr.push_back(strin[j]);
}
sort(vcStr.begin(), vcStr.end());
vvcStr.push_back(vcStr);
multimap<vector<char>, int>::iterator itr = mapvStr.find(vcStr);
if (itr != mapvStr.end()) {
itr->second += 1;
} else {
pair<vector<char>, int> pairStr;
pairStr.first = vcStr;
pairStr.second = 1;
mapvStr.insert(pairStr);
}
}
int nOverlap = 0;
for (multimap<vector<char>, int>::iterator itr = mapvStr.begin();
itr != mapvStr.end(); ++itr) {
int iElem = itr->second;
nOverlap += iElem * (iElem - 1) / 2;
}
cout << nOverlap << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<vector<char>> vvcStr;
multimap<vector<char>, int> mapvStr;
long long cnt = 0;
for (int i = 0; i != N; i++) {
string strin;
cin >> strin;
vector<char> vcStr;
for (int j = 0; j != 10; j++) {
vcStr.push_back(strin[j]);
}
sort(vcStr.begin(), vcStr.end());
vvcStr.push_back(vcStr);
multimap<vector<char>, int>::iterator itr = mapvStr.find(vcStr);
if (itr != mapvStr.end()) {
itr->second += 1;
} else {
pair<vector<char>, int> pairStr;
pairStr.first = vcStr;
pairStr.second = 1;
mapvStr.insert(pairStr);
}
}
long nOverlap = 0;
for (multimap<vector<char>, int>::iterator itr = mapvStr.begin();
itr != mapvStr.end(); ++itr) {
long iElem = itr->second;
nOverlap += iElem * (iElem - 1) / 2;
}
cout << nOverlap << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 748,227 | 748,228 | u468440945 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<vector<char>> vvcStr;
multimap<vector<char>, int> mapvStr;
long cnt = 0;
for (int i = 0; i != N; i++) {
string strin;
cin >> strin;
vector<char> vcStr;
for (int j = 0; j != 10; j++) {
vcStr.push_back(strin[j]);
}
sort(vcStr.begin(), vcStr.end());
vvcStr.push_back(vcStr);
multimap<vector<char>, int>::iterator itr = mapvStr.find(vcStr);
if (itr != mapvStr.end()) {
itr->second += 1;
} else {
pair<vector<char>, int> pairStr;
pairStr.first = vcStr;
pairStr.second = 1;
mapvStr.insert(pairStr);
}
}
int nOverlap = 0;
for (multimap<vector<char>, int>::iterator itr = mapvStr.begin();
itr != mapvStr.end(); ++itr) {
int iElem = itr->second;
nOverlap += iElem * (iElem - 1) / 2;
}
cout << nOverlap << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main(void) {
int N;
cin >> N;
vector<vector<char>> vvcStr;
multimap<vector<char>, int> mapvStr;
long long cnt = 0;
for (int i = 0; i != N; i++) {
string strin;
cin >> strin;
vector<char> vcStr;
for (int j = 0; j != 10; j++) {
vcStr.push_back(strin[j]);
}
sort(vcStr.begin(), vcStr.end());
vvcStr.push_back(vcStr);
multimap<vector<char>, int>::iterator itr = mapvStr.find(vcStr);
if (itr != mapvStr.end()) {
itr->second += 1;
} else {
pair<vector<char>, int> pairStr;
pairStr.first = vcStr;
pairStr.second = 1;
mapvStr.insert(pairStr);
}
}
long nOverlap = 0;
for (multimap<vector<char>, int>::iterator itr = mapvStr.begin();
itr != mapvStr.end(); ++itr) {
long iElem = itr->second;
nOverlap += iElem * (iElem - 1) / 2;
}
cout << nOverlap << endl;
return 0;
}
| [
"variable_declaration.type.widen.change",
"variable_declaration.type.primitive.change"
] | 748,229 | 748,228 | u468440945 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main(void) {
int n;
long int count = 0;
string s;
unordered_map<string, int> um;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
um[s]++;
}
for (auto &a : um) {
int x = a.second;
count += x * (x - 1) / 2;
}
cout << count << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main(void) {
int n;
long int count = 0;
string s;
unordered_map<string, int> um;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
um[s]++;
}
for (auto &a : um) {
int x = a.second;
count += (long int)x * (x - 1) / 2;
}
cout << count << endl;
return 0;
} | [
"type_conversion.add"
] | 748,230 | 748,231 | u282366139 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
string *s = new string[N];
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + N);
int j = 0;
long long num = 0;
for (int i = 0; i < N - 1; i++) {
if (s[i] == s[i + 1])
j++;
else {
num += (1 + j) * j / 2;
j = 0;
}
}
cout << num + (1 + j) * j / 2 << '\n';
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
string *s = new string[N];
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + N);
long long j = 0, num = 0;
for (int i = 0; i < N - 1; i++) {
if (s[i] == s[i + 1])
j++;
else {
num += (1 + j) * j / 2;
j = 0;
}
}
cout << num + (1 + j) * j / 2 << '\n';
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,237 | 748,238 | u475008359 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
string *s = new string[N];
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + N);
int j = 0, num = 0;
for (int i = 0; i < N - 1; i++) {
if (s[i] == s[i + 1])
j++;
else {
num += (1 + j) * j / 2;
j = 0;
}
}
cout << num + (1 + j) * j / 2 << '\n';
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
string *s = new string[N];
for (int i = 0; i < N; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + N);
long long j = 0, num = 0;
for (int i = 0; i < N - 1; i++) {
if (s[i] == s[i + 1])
j++;
else {
num += (1 + j) * j / 2;
j = 0;
}
}
cout << num + (1 + j) * j / 2 << '\n';
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,239 | 748,238 | u475008359 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>
using namespace std;
void solve(map<string, int> m) {
long long ans = 0;
for (auto item : m) {
ans += item.second * (item.second - 1) / 2;
}
printf("%lld\n", ans);
}
int main() {
int n;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s] += 1;
}
solve(m);
return 0;
} | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>
using namespace std;
void solve(map<string, long long> m) {
long long ans = 0;
for (auto item : m) {
ans += item.second * (item.second - 1) / 2;
}
printf("%lld\n", ans);
}
int main() {
int n;
cin >> n;
map<string, long long> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s] += 1;
}
solve(m);
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,240 | 748,241 | u910756197 | cpp |
p02947 |
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
#define REP(i, n) for (i = 0; i < (n); ++i)
#define FOR(i, l, h) for (i = (l); i <= (h); ++i)
#define FORD(i, h, l) for (i = (h); i >= (l); --i)
#define max(a, b) a > b ? a : b
#define min(a, b) a > b ? b : a
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
map<string, int> mp;
int n;
cin >> n;
string s[n + 2];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
mp[s[i]]++;
}
int sum = 0, k;
map<string, int>::iterator it;
for (it = mp.begin(); it != mp.end(); it++) {
k = it->second;
sum += k * (k - 1) / 2;
}
cout << sum;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
#define REP(i, n) for (i = 0; i < (n); ++i)
#define FOR(i, l, h) for (i = (l); i <= (h); ++i)
#define FORD(i, h, l) for (i = (h); i >= (l); --i)
#define max(a, b) a > b ? a : b
#define min(a, b) a > b ? b : a
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
map<string, ll int> mp;
ll int n;
cin >> n;
string s[n + 2];
for (ll int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
mp[s[i]]++;
}
ll int sum = 0, k;
map<string, ll int>::iterator it;
for (it = mp.begin(); it != mp.end(); it++) {
k = it->second;
sum += k * (k - 1) / 2;
}
cout << sum;
return 0;
} | [] | 748,246 | 748,247 | u172654033 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define INPUT_OUTPUT \
{ \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout); \
}
#define ll long long
int main() {
// INPUT_OUTPUT;
int n, ans = 0;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (m[s] == 0)
m[s]++;
else {
ans += m[s];
m[s]++;
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define INPUT_OUTPUT \
{ \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout); \
}
#define ll long long
int main() {
// INPUT_OUTPUT;
ll n, ans = 0;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (m[s] == 0)
m[s]++;
else {
ans += m[s];
m[s]++;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 748,259 | 748,260 | u808454282 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
int main() {
int ans = 0;
int n;
map<string, int> table;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
//計算
sort(s.begin(), s.end());
if (table.count(s) == 0) {
table[s] = 1;
} else {
ans += table[s];
table[s]++;
}
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
int main() {
long long int ans = 0;
int n;
map<string, int> table;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
//計算
sort(s.begin(), s.end());
if (table.count(s) == 0) {
table[s] = 1;
} else {
ans += table[s];
table[s]++;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 748,268 | 748,269 | u294829559 | cpp |
p02947 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
int main() {
int ans = 0;
int n;
map<string, int> table;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
//計算
sort(s.begin(), s.end());
if (table.count(s) == 0) {
table[s] = 1;
}
ans += table[s];
table[s]++;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
int main() {
long long int ans = 0;
int n;
map<string, int> table;
cin >> n;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
//計算
sort(s.begin(), s.end());
if (table.count(s) == 0) {
table[s] = 1;
} else {
ans += table[s];
table[s]++;
}
}
cout << ans << endl;
return 0;
} | [
"control_flow.branch.else.add"
] | 748,270 | 748,269 | u294829559 | cpp |
p02947 | #include <bits/stdc++.h>
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define INF 1e9
using namespace std;
typedef long long ll;
signed main() {
// std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
int n;
cin >> n;
map<string, int> counter;
REP(i, n) {
string s;
cin >> s;
sort(ALL(s));
counter[s]++;
}
ll ans = 0;
for (auto x : counter) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define INF 1e9
using namespace std;
typedef long long ll;
signed main() {
// std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
int n;
cin >> n;
map<string, ll> counter;
REP(i, n) {
string s;
cin >> s;
sort(ALL(s));
counter[s]++;
}
ll ans = 0;
for (auto x : counter) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
}
| [] | 748,271 | 748,272 | u653807637 | cpp |
p02947 | #include <bits/stdc++.h>
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define INF 1e9
using namespace std;
typedef long long ll;
signed main() {
// std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
int n;
cin >> n;
map<string, int> counter;
REP(i, n) {
string s;
cin >> s;
sort(ALL(s));
counter[s]++;
}
int ans = 0;
for (auto x : counter) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define INF 1e9
using namespace std;
typedef long long ll;
signed main() {
// std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
int n;
cin >> n;
map<string, ll> counter;
REP(i, n) {
string s;
cin >> s;
sort(ALL(s));
counter[s]++;
}
ll ans = 0;
for (auto x : counter) {
ans += x.second * (x.second - 1) / 2;
}
cout << ans << endl;
}
| [
"variable_declaration.type.change"
] | 748,273 | 748,272 | u653807637 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
mp[s.at(i)]++;
}
long long pattern = 0;
for (auto x : mp) {
pattern += x.second * (x.second - 1) / 2;
}
cout << pattern << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
map<string, int> mp;
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
mp[s.at(i)]++;
}
long long pattern = 0;
for (auto x : mp) {
pattern += x.second * (long long)(x.second - 1) / 2;
}
cout << pattern << endl;
}
| [
"type_conversion.add"
] | 748,274 | 748,275 | u752904037 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int main() {
int N;
cin >> N;
vector<string> S(N);
unordered_map<string, int> mp;
rep(i, N) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
if (mp.find(S[i]) == mp.end())
mp[S[i]] = 1;
else
mp[S[i]]++;
}
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++)
ans += itr->second * (itr->second - 1) / 2;
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int main() {
int N;
cin >> N;
vector<string> S(N);
unordered_map<string, ll> mp;
rep(i, N) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
if (mp.find(S[i]) == mp.end())
mp[S[i]] = 1;
else
mp[S[i]]++;
}
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); itr++)
ans += itr->second * (itr->second - 1) / 2;
cout << ans << endl;
return 0;
}
| [] | 748,276 | 748,277 | u137747137 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int s = p.second;
/* cout << "p.second = " << s << endl;
string D = p.first;
cout << "p.first = " << D << endl; */
ans += s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto &p : mp) {
int s = p.second;
/* cout << "p.second = " << s << endl;
string D = p.first;
cout << "p.first = " << D << endl; */
ans += (long long)s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
} | [
"type_conversion.add"
] | 748,278 | 748,279 | u214547877 | cpp |
p02947 | #include "algorithm"
#include "cstdio"
#include "iostream"
using namespace std;
const int maxm = 1e5 + 10;
int N;
string S[maxm];
int main() {
register int i, Now, Ans;
scanf("%d", &N);
for (i = 1; i <= N; i++)
cin >> S[i], sort(S[i].begin(), S[i].end());
sort(S + 1, S + 1 + N);
Now = 1, Ans = 0;
for (i = 2; i <= N + 1; i++) {
if (S[i] == S[i - 1])
Now++;
else
Ans += ((Now - 1) * Now) >> 1, Now = 1;
}
printf("%d", Ans);
return 0;
} | #include "algorithm"
#include "cstdio"
#include "iostream"
using namespace std;
const int maxm = 1e5 + 10;
int N;
string S[maxm];
int main() {
register int i;
register long long Now, Ans;
scanf("%d", &N);
for (i = 1; i <= N; i++)
cin >> S[i], sort(S[i].begin(), S[i].end());
sort(S + 1, S + 1 + N);
Now = 1, Ans = 0;
for (i = 2; i <= N + 1; i++) {
if (S[i] == S[i - 1])
Now++;
else
Ans += ((Now - 1) * Now) >> 1ll, Now = 1;
}
printf("%lld", Ans);
return 0;
} | [
"variable_declaration.add",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 748,284 | 748,285 | u733133434 | cpp |
p02947 | #include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
cout << setprecision(30);
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
ll n;
cin >> n;
vs ss(n);
for (int i = 0; i < n; ++i) {
cin >> ss[i];
sort(ss[i].begin(), ss[i].end());
}
sort(ss.begin(), ss.end());
ll ans = 0;
for (int i = 0; i < n; ++i) {
int j = i;
while (j < n && ss[i] == ss[j])
++j;
ans += (j - i) * (j - i - 1) / 2;
i = j - 1;
}
cout << ans << endl;
return 0;
} | #include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
cout << setprecision(30);
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
ll n;
cin >> n;
vs ss(n);
for (int i = 0; i < n; ++i) {
cin >> ss[i];
sort(ss[i].begin(), ss[i].end());
}
sort(ss.begin(), ss.end());
ll ans = 0;
for (ll i = 0; i < n; ++i) {
ll j = i;
while (j < n && ss[i] == ss[j])
++j;
ans += (j - i) * (j - i - 1) / 2;
i = j - 1;
}
cout << ans << endl;
return 0;
}
| [
"control_flow.loop.for.initializer.change",
"variable_declaration.type.change"
] | 748,288 | 748,289 | u651764969 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define M 1000000007
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {
cerr << str << " : " << t << "\n";
}
template <class T, class... S> void dbs(string str, T t, S... s) {
int idx = str.find(',');
cerr << str.substr(0, idx) << " : " << t << ", ";
dbs(str.substr(idx + 1), s...);
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &p) {
return os << "(" << p.first << ", " << p.second << ")";
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &p) {
os << "[ ";
for (auto &it : p)
os << it << " ";
return os << "]";
}
template <class T> ostream &operator<<(ostream &os, const set<T> &p) {
os << "[ ";
for (auto &it : p)
os << it << " ";
return os << "]";
}
template <class S, class T>
ostream &operator<<(ostream &os, const map<S, T> &p) {
os << "[ ";
for (auto &it : p)
os << it << " ";
return os << "]";
}
template <class T> void prc(T a, T b) {
cerr << "[";
for (T i = a; i != b; ++i) {
if (i != a)
cerr << ", ";
cerr << *i;
}
cerr << "]\n";
}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
int32_t main() {
fastio;
int t, i, j, k, n, m, q;
int x, y, l, r;
cin >> n;
map<string, int> mp;
string s;
for (i = 0; i < n; i++) {
cin >> s;
sort(all(s));
mp[s]++;
}
int ans = 0;
for (auto &x : mp) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(), (c).end()
#define M 1000000007
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {
cerr << str << " : " << t << "\n";
}
template <class T, class... S> void dbs(string str, T t, S... s) {
int idx = str.find(',');
cerr << str.substr(0, idx) << " : " << t << ", ";
dbs(str.substr(idx + 1), s...);
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &p) {
return os << "(" << p.first << ", " << p.second << ")";
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &p) {
os << "[ ";
for (auto &it : p)
os << it << " ";
return os << "]";
}
template <class T> ostream &operator<<(ostream &os, const set<T> &p) {
os << "[ ";
for (auto &it : p)
os << it << " ";
return os << "]";
}
template <class S, class T>
ostream &operator<<(ostream &os, const map<S, T> &p) {
os << "[ ";
for (auto &it : p)
os << it << " ";
return os << "]";
}
template <class T> void prc(T a, T b) {
cerr << "[";
for (T i = a; i != b; ++i) {
if (i != a)
cerr << ", ";
cerr << *i;
}
cerr << "]\n";
}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
int32_t main() {
fastio;
int t, i, j, k, n, m, q;
int x, y, l, r;
cin >> n;
map<string, int> mp;
string s;
for (i = 0; i < n; i++) {
cin >> s;
sort(all(s));
mp[s]++;
}
int ans = 0;
for (auto &x : mp) {
ans += (x.second * (x.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | [] | 748,290 | 748,291 | u149453212 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> S(N);
unordered_map<string, int> MP;
for (int i = 0; i < N; i++)
cin >> S[i];
for (int i = 0; i < N; i++) {
sort(S[i].begin(), S[i].end());
MP[S[i]]++;
}
long long ans = 0;
for (auto e : MP) {
ans += e.second * (e.second - 1) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N;
cin >> N;
vector<string> S(N);
unordered_map<string, long long> MP;
for (int i = 0; i < N; i++)
cin >> S[i];
for (int i = 0; i < N; i++) {
sort(S[i].begin(), S[i].end());
MP[S[i]]++;
}
long long ans = 0;
for (auto e : MP) {
ans += e.second * (e.second - 1) / 2;
}
cout << ans << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,292 | 748,293 | u839397805 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define LD long double
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
string s;
map<string, int> mapa;
int w = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
auto it = mapa.find(s);
if (it != mapa.end()) {
w += it->second;
mapa[s] = it->second + 1;
} else {
mapa[s] = 1;
}
}
cout << w;
}
| #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define LD long double
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
string s;
map<string, LL> mapa;
LL w = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
auto it = mapa.find(s);
if (it != mapa.end()) {
w += it->second;
mapa[s] = it->second + 1;
} else {
mapa[s] = 1;
}
}
cout << w;
}
| [
"variable_declaration.type.change"
] | 748,296 | 748,297 | u321786655 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define watch(x) cout << #x << " is " << x << endl;
#define print(a, l, r) \
for (int i = l; i < r; i++) \
cout << a[i] << (i == (r - 1) ? endl : " ");
const long long M = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
int ans = 0;
for (auto p : mp) {
ans += ((p.second) * (p.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define watch(x) cout << #x << " is " << x << endl;
#define print(a, l, r) \
for (int i = l; i < r; i++) \
cout << a[i] << (i == (r - 1) ? endl : " ");
const long long M = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
map<string, long long> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto p : mp) {
ans += ((p.second) * (p.second - 1)) / 2;
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,298 | 748,299 | u089783041 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool sortAsc(char c, char d) { return c < d; }
int main() {
long int N;
cin >> N;
vector<string> words(N);
for (int i = 0; i < N; ++i) {
string str;
cin >> str;
words[i] = str;
}
for (int i = 0; i < N; ++i) {
sort(words[i].begin(), words[i].end(), sortAsc);
}
sort(words.begin(), words.end());
/*
for(int i = 0; i < N; ++i){
cout << words[i] << endl;
}
*/
long int answer = 0;
long int i = 0;
while (i < N - 1) {
int count = 0;
for (int j = i + 1; j < N; ++j) {
if (words[i] == words[j]) {
count += 1;
} else {
break;
}
}
answer += count * (count + 1) / 2;
i = i + count + 1;
}
cout << answer << endl;
}
| #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool sortAsc(char c, char d) { return c < d; }
int main() {
long int N;
cin >> N;
vector<string> words(N);
for (int i = 0; i < N; ++i) {
string str;
cin >> str;
words[i] = str;
}
for (int i = 0; i < N; ++i) {
sort(words[i].begin(), words[i].end(), sortAsc);
}
sort(words.begin(), words.end());
/*
for(int i = 0; i < N; ++i){
cout << words[i] << endl;
}
*/
long int answer = 0;
long int i = 0;
while (i < N - 1) {
long int count = 1;
for (int j = i + 1; j < N; ++j) {
if (words[i] == words[j]) {
count += 1;
} else {
break;
}
}
answer += count * (count - 1) / 2;
i = i + count;
}
cout << answer << endl;
}
| [
"variable_declaration.type.widen.change",
"literal.number.change",
"variable_declaration.value.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 748,300 | 748,301 | u077117247 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define popb pop_back
#define mem(a, b) memset(a, b, sizeof(a))
#define i first
#define j second
#define inf 2e9
#define MOD 1000000007
#define M 100007
void FAST() {
std::ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
void solve() {}
bool cmp(string s, string t) {
int x = s.compare(t);
if (x <= 0)
return 1;
return 0;
}
int main() {
FAST();
ll n;
cin >> n;
string arr[n + 1];
for (int i = 0; i < n; ++i) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr, arr + n, cmp);
ll ans = 0;
int i = 0;
while (i < n) {
int j = i + 1;
while (j < n && arr[i].compare(arr[j]) == 0) {
++j;
}
// cout<<i<<" "<<j<<"\n";
ans += ((j - i) * 1LL * (j - i - 1)) / 2;
i = j;
}
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define popb pop_back
#define mem(a, b) memset(a, b, sizeof(a))
#define i first
#define j second
#define inf 2e9
#define MOD 1000000007
#define M 100007
void FAST() {
std::ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
void solve() {}
bool cmp(string s, string t) {
int x = s.compare(t);
if (x <= 0)
return 1;
return 0;
}
int main() {
FAST();
ll n;
cin >> n;
string arr[n + 1];
for (int i = 0; i < n; ++i) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr, arr + n);
ll ans = 0;
int i = 0;
while (i < n) {
int j = i + 1;
while (j < n && arr[i].compare(arr[j]) == 0) {
++j;
}
// cout<<i<<" "<<j<<"\n";
ans += ((j - i) * 1LL * (j - i - 1)) / 2;
i = j;
}
cout << ans << "\n";
return 0;
} | [
"call.arguments.change"
] | 748,302 | 748,303 | u040711752 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define popb pop_back
#define mem(a, b) memset(a, b, sizeof(a))
#define i first
#define j second
#define inf 2e9
#define MOD 1000000007
#define M 100007
void FAST() {
std::ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
void solve() {}
bool cmp(string s, string t) {
int x = s.compare(t);
if (x <= 0)
return 1;
return 0;
}
int main() {
FAST();
ll n;
cin >> n;
string arr[n + 1];
for (int i = 0; i < n; ++i) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr, arr + n, cmp);
ll ans = 0;
int i = 0;
while (i < n) {
int j = i + 1;
while (j < n && arr[i].compare(arr[j]) == 0) {
++j;
}
// cout<<i<<" "<<j<<"\n";
ans += ((j - i) * (j - i - 1)) / 2;
i = j;
}
cout << ans << "\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define popb pop_back
#define mem(a, b) memset(a, b, sizeof(a))
#define i first
#define j second
#define inf 2e9
#define MOD 1000000007
#define M 100007
void FAST() {
std::ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
void solve() {}
bool cmp(string s, string t) {
int x = s.compare(t);
if (x <= 0)
return 1;
return 0;
}
int main() {
FAST();
ll n;
cin >> n;
string arr[n + 1];
for (int i = 0; i < n; ++i) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr, arr + n);
ll ans = 0;
int i = 0;
while (i < n) {
int j = i + 1;
while (j < n && arr[i].compare(arr[j]) == 0) {
++j;
}
// cout<<i<<" "<<j<<"\n";
ans += ((j - i) * 1LL * (j - i - 1)) / 2;
i = j;
}
cout << ans << "\n";
return 0;
} | [
"call.arguments.change",
"assignment.change"
] | 748,304 | 748,303 | u040711752 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
++mp[s];
}
int ans = 0;
for (auto x : mp) {
ans += x.second * (x.second - 1);
}
cout << ans / 2 << '\n';
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
++mp[s];
}
long long ans = 0;
for (auto x : mp) {
ans += 1ll * x.second * (x.second - 1);
}
cout << ans / 2ll << '\n';
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"assignment.change"
] | 748,305 | 748,306 | u617619153 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
void fast() {
std::ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main() {
fast();
int n, i, ans = 0, cnt = 0, j;
cin >> n;
string s;
vector<string> v;
for (i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
v.push_back(s);
}
sort(v.begin(), v.end());
for (i = 0; i < n; i++) {
cnt = 0;
for (j = i + 1; j < n; j++) {
if (v[i] == v[j])
cnt++;
else
break;
}
ans += cnt * (cnt + 1) / 2;
i = j - 1;
}
cout << ans;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
void fast() {
std::ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main() {
fast();
long long int n, i, ans = 0, cnt = 0, j;
cin >> n;
string s;
vector<string> v;
for (i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
v.push_back(s);
}
sort(v.begin(), v.end());
for (i = 0; i < n; i++) {
cnt = 0;
for (j = i + 1; j < n; j++) {
if (v[i] == v[j])
cnt++;
else
break;
}
ans += cnt * (cnt + 1) / 2;
i = j - 1;
}
cout << ans;
return 0;
} | [
"variable_declaration.type.widen.change"
] | 748,307 | 748,308 | u301397468 | 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;
map<string, int> map;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
map[s]++;
}
int sum = 0;
for (auto x : map)
sum += x.second * (x.second - 1) / 2;
cout << sum << endl;
return 0;
}
| #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;
map<string, long> map;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
map[s]++;
}
long sum = 0;
for (auto x : map)
sum += x.second * (x.second - 1) / 2;
cout << sum << endl;
return 0;
}
| [
"variable_declaration.type.primitive.change"
] | 748,309 | 748,310 | u207048881 | cpp |
p02947 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
map<string, int> cnt;
REP(i, N) {
string s;
cin >> s;
sort(ALL(s));
cnt[s]++;
}
ll ans = 0;
for (auto v : cnt) {
if (v.second == 1)
continue;
ans += v.second * (v.second - 1) / 2;
}
cout << ans << endl;
} | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
map<string, ll> cnt;
REP(i, N) {
string s;
cin >> s;
sort(ALL(s));
cnt[s]++;
}
ll ans = 0;
for (auto v : cnt) {
if (v.second == 1)
continue;
ans += v.second * (v.second - 1) / 2;
}
cout << ans << endl;
} | [] | 748,311 | 748,312 | u318727472 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
mp[s]++;
}
long long sum = 0;
for (auto p : mp) {
int i = p.second;
sum += i * (i - 1) / 2;
}
OP(sum)
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
mp[s]++;
}
ll sum = 0;
for (auto p : mp) {
ll i = p.second;
sum += i * (i - 1) / 2;
}
OP(sum)
return 0;
} | [
"variable_declaration.type.narrow.change",
"variable_declaration.type.change"
] | 748,315 | 748,316 | u016189984 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
mp[s]++;
}
int sum = 0;
for (auto p : mp) {
int i = p.second;
sum += i * (i - 1) / 2;
}
OP(sum)
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
mp[s]++;
}
ll sum = 0;
for (auto p : mp) {
ll i = p.second;
sum += i * (i - 1) / 2;
}
OP(sum)
return 0;
} | [
"variable_declaration.type.change"
] | 748,317 | 748,316 | u016189984 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for (int i = (m); i < (n); i++)
#define rep(i, n) REP(i, 0, n)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<string> v(n);
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
v[i] = s;
}
sort(v.begin(), v.end());
v.push_back("");
int now = 0, k = 0, ans = 0;
while (now <= n) {
if (v[now] == v[k])
now++;
else {
ans += (now - k) * (now - k - 1) / 2;
k = now;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for (int i = (m); i < (n); i++)
#define rep(i, n) REP(i, 0, n)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<string> v(n);
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
v[i] = s;
}
sort(v.begin(), v.end());
v.push_back("");
ll now = 0, k = 0, ans = 0;
while (now <= n) {
if (v[now] == v[k])
now++;
else {
ans += (now - k) * (now - k - 1) / 2;
k = now;
}
}
cout << ans << endl;
} | [
"variable_declaration.type.change"
] | 748,319 | 748,320 | u339937125 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for (int i = (m); i < (n); i++)
#define rep(i, n) REP(i, 0, n)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<string> v(n);
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
v[i] = s;
}
sort(v.begin(), v.end());
v.push_back("");
int now = 0, k = 0, ans = 0;
while (now <= n) {
if (v[now] == v[k])
now++;
else {
ans += (now - k) * (now - k - 1) / 2;
k = now;
now++;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for (int i = (m); i < (n); i++)
#define rep(i, n) REP(i, 0, n)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<string> v(n);
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
v[i] = s;
}
sort(v.begin(), v.end());
v.push_back("");
ll now = 0, k = 0, ans = 0;
while (now <= n) {
if (v[now] == v[k])
now++;
else {
ans += (now - k) * (now - k - 1) / 2;
k = now;
}
}
cout << ans << endl;
} | [
"variable_declaration.type.change",
"expression.unary.arithmetic.remove"
] | 748,321 | 748,320 | u339937125 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
typedef long long ll;
typedef vector<string> vec;
typedef vector<vec> mat;
typedef pair<int, int> P;
int main() {
int N;
cin >> N;
vec s(N);
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int cnt = 0;
int ans = 0;
rep(i, N - 1) {
if (s[i + 1] == s[i]) {
cnt++;
ans += cnt;
} else {
cnt = 0;
}
}
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
typedef long long ll;
typedef vector<string> vec;
typedef vector<vec> mat;
typedef pair<int, int> P;
int main() {
int N;
cin >> N;
vec s(N);
rep(i, N) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int cnt = 0;
ll ans = 0;
rep(i, N - 1) {
if (s[i + 1] == s[i]) {
cnt++;
ans += cnt;
} else {
cnt = 0;
}
}
cout << ans << endl;
} | [
"variable_declaration.type.change"
] | 748,328 | 748,329 | u782219335 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
int ans = 0;
int N;
cin >> N;
map<string, int> counts;
for (int n = 0; n < N; n++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += counts[s];
counts[s]++;
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll ans = 0;
int N;
cin >> N;
map<string, int> counts;
for (int n = 0; n < N; n++) {
string s;
cin >> s;
sort(s.begin(), s.end());
ans += counts[s];
counts[s]++;
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.change"
] | 748,332 | 748,333 | u419255487 | cpp |
p02947 | // Green Bin
#include <algorithm>
#include <initializer_list>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> m;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
int tmp = m[s];
tmp++;
m[s] = tmp;
}
int cnt = 0;
for (auto it = m.begin(); it != m.end(); ++it) {
int value = it->second;
if (value > 1) {
cnt += ((value * (value - 1)) / 2);
}
}
cout << cnt << endl;
return 0;
} | // Green Bin
#include <algorithm>
#include <initializer_list>
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
map<string, long long> m;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
int tmp = m[s];
tmp++;
m[s] = tmp;
}
long long cnt = 0;
for (auto it = m.begin(); it != m.end(); ++it) {
long long value = it->second;
if (value > 1) {
cnt += ((value * (value - 1)) / 2);
}
}
cout << cnt << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,334 | 748,335 | u362209280 | cpp |
p02947 | #include "algorithm"
#include "bitset"
#include "cassert"
#include "climits"
#include "cmath"
#include "cstdio"
#include "functional"
#include "iomanip"
#include "iostream"
#include "list"
#include "map"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "stack"
#include "string"
#include "unordered_map"
#include "unordered_set"
using namespace std;
// constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
// constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;
// int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
map<string, long long int> m;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (auto i : m) {
K += (i.second * i.second - 1) / 2;
}
cout << K << endl;
}
| #include "algorithm"
#include "bitset"
#include "cassert"
#include "climits"
#include "cmath"
#include "cstdio"
#include "functional"
#include "iomanip"
#include "iostream"
#include "list"
#include "map"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "stack"
#include "string"
#include "unordered_map"
#include "unordered_set"
using namespace std;
// constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
// constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;
// int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
map<string, long long int> m;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
for (auto i : m) {
K += (i.second * (i.second - 1)) / 2;
}
cout << K << endl;
}
| [] | 748,338 | 748,339 | u468700753 | cpp |
p02947 | /*----------------------|
/ Author : Ashraf Tasin |
/ Date : 08.08.19 |
/----------------------*/
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define all v.begin(), v.end()
#define flash \
ios ::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define db double
#define endl "\n"
#define mnm pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>
#define show \
for (int i = 0; i < v.size(); i++) \
cout << v[i] << " ";
#define eps 1e-6
#define mx 100008
using namespace std;
int dx[] = {-1, 1, -1, 0, 1, -1, 0, 1};
int dy[] = {0, 0, -1, -1, -1, 1, 1, 1};
/*Knight Moves
int dx[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int dy[] = { 1, 2, 2, 1, -1, -2, -2, -1 }; */
/*Normal Moves
int x[] = {0, 1, 0, -1};
int y[] = {-1, 0, 1, 0}; */
int main() {
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
flash
int n;
cin >> n;
map<string, int> m;
map<string, int>::iterator it;
for (int i = 1; i <= n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
++m[s];
}
ll cnt = 0;
for (it = m.begin(); it != m.end(); ++it) {
int x = it->second;
--x;
cnt += (x * (x + 1)) / 2;
}
cout << cnt << endl;
return 0;
}
| /*----------------------|
/ Author : Ashraf Tasin |
/ Date : 08.08.19 |
/----------------------*/
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define all v.begin(), v.end()
#define flash \
ios ::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define db double
#define endl "\n"
#define mnm pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>
#define show \
for (int i = 0; i < v.size(); i++) \
cout << v[i] << " ";
#define eps 1e-6
#define mx 100008
using namespace std;
int dx[] = {-1, 1, -1, 0, 1, -1, 0, 1};
int dy[] = {0, 0, -1, -1, -1, 1, 1, 1};
/*Knight Moves
int dx[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int dy[] = { 1, 2, 2, 1, -1, -2, -2, -1 }; */
/*Normal Moves
int x[] = {0, 1, 0, -1};
int y[] = {-1, 0, 1, 0}; */
int main() {
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
flash
int n;
cin >> n;
map<string, int> m;
map<string, int>::iterator it;
for (int i = 1; i <= n; ++i) {
string s;
cin >> s;
sort(s.begin(), s.end());
++m[s];
}
ll cnt = 0;
for (it = m.begin(); it != m.end(); ++it) {
ll x = it->second;
cnt += (x * (x - 1)) / 2;
}
cout << cnt << endl;
return 0;
}
| [
"variable_declaration.type.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 748,340 | 748,341 | u478656065 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n;
cin >> n;
map<string, int> m;
int ans = 0;
for (int i = 0; i < n; i++) {
string h;
cin >> h;
sort(h.begin(), h.end());
if (m.count(h)) {
m[h]++;
ans += m[h];
} else {
m[h] = 0;
}
}
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n;
cin >> n;
map<string, int> m;
long long ans = 0;
for (int i = 0; i < n; i++) {
string h;
cin >> h;
sort(h.begin(), h.end());
if (m.count(h)) {
m[h]++;
ans += m[h];
} else {
m[h] = 0;
}
}
cout << ans << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,342 | 748,343 | u671556593 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
char a[100010][12];
bool camp(char x[], char y[]) {
for (int i = 0; i < 10; i++)
if (x[i] != y[i])
return x[i] < y[i];
return 0;
}
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%s", a[i]), sort(a[i], a[i] + 10);
char **re = new char *[100010];
for (int i = 1; i <= n; i++)
re[i] = a[i];
sort((char **)(re + 1), (char **)(re + n + 1), camp);
// for(int i=1;i<=n;i++,cout<<endl)for(int j=1;j<=10;j++)cout<<re[i][j];
for (int i = 1; i < n; i++)
a[i][11] = camp(re[i], re[i + 1]);
int cnt = 0;
for (int i = 1, j = 1; i < n; i = j + 1, j = i) {
while (j < n && !a[j][11])
j++;
cnt += (j - i + 1) * (j - i) / 2;
}
cout << cnt << endl;
} | #include <bits/stdc++.h>
using namespace std;
char a[100010][12];
bool camp(char x[], char y[]) {
for (int i = 0; i < 10; i++)
if (x[i] != y[i])
return x[i] < y[i];
return 0;
}
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%s", a[i]), sort(a[i], a[i] + 10);
char **re = new char *[100010];
for (int i = 1; i <= n; i++)
re[i] = a[i];
sort((char **)(re + 1), (char **)(re + n + 1), camp);
// for(int i=1;i<=n;i++,cout<<endl)for(int j=1;j<=10;j++)cout<<re[i][j];
for (int i = 1; i < n; i++)
a[i][11] = camp(re[i], re[i + 1]);
long long cnt = 0;
for (int i = 1, j = 1; i < n; i = j + 1, j = i) {
while (j < n && !a[j][11])
j++;
cnt += 1LL * (j - i + 1) * (j - i) / 2;
}
cout << cnt << endl;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"assignment.change"
] | 748,344 | 748,345 | u623737228 | cpp |
p02947 | //#include<bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
int q;
cin >> q;
unordered_map<string, int> d;
for (int i = 0; i < q; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (d.find(s) == d.end()) {
d[s] = 1;
} else {
d[s]++;
}
}
int res = 0;
for (auto i : d) {
int t = i.second;
res += t * (t - 1) / 2;
}
cout << res;
return 0;
}
| //#include<bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
int q;
cin >> q;
unordered_map<string, int> d;
for (int i = 0; i < q; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (d.find(s) == d.end()) {
d[s] = 1;
} else {
d[s]++;
}
}
long long res = 0;
for (auto i : d) {
long long t = i.second;
res += t * (t - 1) / 2;
}
cout << res;
return 0;
}
| [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,353 | 748,354 | u111686122 | cpp |
p02947 | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<string> strs;
string curStr;
int total;
cin >> total;
for (int i = 0; i < total; ++i) {
cin >> curStr;
sort(curStr.begin(), curStr.end());
strs.push_back(curStr);
}
sort(strs.begin(), strs.end());
long long answer = 0;
int consecutive = 1;
for (int i = 1; i < strs.size(); ++i) {
if (strs[i] != strs[i - 1]) {
answer += consecutive * (consecutive - 1) / 2;
consecutive = 1;
} else {
consecutive = consecutive + 1;
}
}
answer += consecutive * (consecutive - 1) / 2;
cout << answer << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<string> strs;
string curStr;
int total;
cin >> total;
for (int i = 0; i < total; ++i) {
cin >> curStr;
sort(curStr.begin(), curStr.end());
strs.push_back(curStr);
}
sort(strs.begin(), strs.end());
long long answer = 0;
long long consecutive = 1;
for (int i = 1; i < strs.size(); ++i) {
if (strs[i] != strs[i - 1]) {
answer += consecutive * (consecutive - 1) / 2;
consecutive = 1;
} else {
consecutive = consecutive + 1;
}
}
answer += consecutive * (consecutive - 1) / 2;
cout << answer << endl;
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 748,355 | 748,356 | u121604126 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> num;
for (int i = 0; i < N; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
if (num.count(str)) {
num[str]++;
} else {
num[str] = 1;
}
}
int64_t result = 0;
for (auto p : num) {
int mmm = p.second;
result += ((mmm) * (mmm - 1)) / 2;
}
cout << result << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
map<string, int> num;
for (int i = 0; i < N; i++) {
string str;
cin >> str;
sort(str.begin(), str.end());
if (num.count(str)) {
num[str]++;
} else {
num[str] = 1;
}
}
int64_t result = 0;
for (auto p : num) {
int64_t mmm = p.second;
result += ((mmm) * (mmm - 1)) / 2;
}
cout << result << endl;
} | [
"variable_declaration.type.primitive.change"
] | 748,357 | 748,358 | u408053928 | cpp |
p02947 | #include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#define db "knapsack"
#define fi first
#define se second
#define endl '\n'
const int INF = 1e9 + 1;
const int maxN = 1e5 + 2;
const int mod = 1e9 + 7;
typedef long long ll;
typedef int Array[maxN];
typedef ll LLArray[maxN];
typedef pair<int, int> PII;
typedef PII PIIArray[maxN];
void docfile() {
if (ifstream("FORM.inp")) {
freopen("FORM.inp", "r", stdin);
freopen("FORM.out", "w", stdout);
} else if (ifstream(db ".inp")) {
freopen(db ".inp", "r", stdin);
freopen(db ".out", "w", stdout);
}
}
//-----------------------------------------------------------------------------
int n, cnt;
ll ans;
string a[maxN];
void solve() {
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; i++) {
if (a[i] == a[i - 1])
cnt++;
else {
ans += (cnt * (cnt - 1) / 2);
cnt = 1;
}
}
if (cnt != 1)
ans += (cnt * (cnt - 1) / 2);
cout << ans;
}
void input() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
}
solve();
}
int main() {
docfile();
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
input();
}
//-----------------------------------------------------------------------------
/*
template <typename T>
void write (T a)
{
if (a < 0)
{
putchar ('-');
write (-a);
return;
}
if (a < 10)
{
putchar ('0' + a);
return;
}
write (a / 10);
putchar ((char)('0' + (a % 10)));
}
void read(long long& x)
{
x = 0;
int f = 1;
char ch = getchar();
while (!isdigit(ch))
f = ch == '-' ? - f : f, ch = getchar();
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
x *= f;
}
*/
| #include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#define db "knapsack"
#define fi first
#define se second
#define endl '\n'
const int INF = 1e9 + 1;
const int maxN = 1e5 + 2;
const int mod = 1e9 + 7;
typedef long long ll;
typedef int Array[maxN];
typedef ll LLArray[maxN];
typedef pair<int, int> PII;
typedef PII PIIArray[maxN];
void docfile() {
if (ifstream("FORM.inp")) {
freopen("FORM.inp", "r", stdin);
freopen("FORM.out", "w", stdout);
} else if (ifstream(db ".inp")) {
freopen(db ".inp", "r", stdin);
freopen(db ".out", "w", stdout);
}
}
//-----------------------------------------------------------------------------
ll n, cnt;
ll ans;
string a[maxN];
void solve() {
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; i++) {
if (a[i] == a[i - 1])
cnt++;
else {
ans += (cnt * (cnt - 1) / 2);
cnt = 1;
}
}
if (cnt != 1)
ans += (cnt * (cnt - 1) / 2);
cout << ans;
}
void input() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
sort(a[i].begin(), a[i].end());
}
solve();
}
int main() {
docfile();
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
input();
}
//-----------------------------------------------------------------------------
/*
template <typename T>
void write (T a)
{
if (a < 0)
{
putchar ('-');
write (-a);
return;
}
if (a < 10)
{
putchar ('0' + a);
return;
}
write (a / 10);
putchar ((char)('0' + (a % 10)));
}
void read(long long& x)
{
x = 0;
int f = 1;
char ch = getchar();
while (!isdigit(ch))
f = ch == '-' ? - f : f, ch = getchar();
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
x *= f;
}
*/
| [
"variable_declaration.type.change"
] | 748,359 | 748,360 | u162854028 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
int main() {
int N;
cin >> N;
unordered_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;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
int main() {
int N;
cin >> N;
unordered_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"
] | 748,367 | 748,368 | u138597672 | cpp |
p02947 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
int main() {
int N;
cin >> N;
unordered_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 < (int)(n); i++)
typedef long long ll;
using namespace std;
int main() {
int N;
cin >> N;
unordered_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"
] | 748,369 | 748,368 | u138597672 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.