problem_id
stringlengths 6
6
| buggy_code
stringlengths 8
526k
| fixed_code
stringlengths 12
526k
| labels
listlengths 0
15
⌀ | buggy_submission_id
int64 1
1.54M
| fixed_submission_id
int64 2
1.54M
| user_id
stringlengths 10
10
| language
stringclasses 8
values |
|---|---|---|---|---|---|---|---|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n, i, count = 0;
cin >> n;
vector<string> v1(n);
map<string, int> map1;
for (i = 0; i < n; i++) {
cin >> v1[i];
sort(v1[i].begin(), v1[i].end());
map1[v1[i]]++;
}
for (auto x : map1) {
if (x.second) {
// cout<<x.second;
count += x.second * (x.second - 1) / 2;
}
}
cout << count;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n, i, count = 0;
cin >> n;
vector<string> v1(n);
map<string, ll> map1;
for (i = 0; i < n; i++) {
cin >> v1[i];
sort(v1[i].begin(), v1[i].end());
map1[v1[i]]++;
}
for (auto x : map1) {
if (x.second) {
// cout<<x.second;
count += x.second * (x.second - 1) / 2;
}
}
cout << count;
return 0;
}
|
[] | 746,704
| 746,705
|
u863370423
|
cpp
|
p02947
|
#include "bits/stdc++.h"
#include "sstream"
#define quick \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
using namespace std;
const int N = 1e5 + 1;
map<string, int> mp;
int main() {
quick int n;
cin >> n;
string s;
long long ans = 0;
while (n--) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto i : mp) {
ans += (i.second - 1) * i.second / 2;
}
cout << ans;
}
|
#include "bits/stdc++.h"
#include "sstream"
#define quick \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
using namespace std;
const int N = 1e5 + 1;
map<string, long long> mp;
int main() {
quick int n;
cin >> n;
string s;
long long ans = 0;
while (n--) {
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
for (auto i : mp) {
ans += (i.second - 1) * i.second / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,706
| 746,707
|
u863370423
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
// long long
using ll = long long;
// pair<int, int>
using PII = pair<int, int>;
//最大値、mod
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(20) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
//配列入力
vector<long long> vecin(ll n) {
vector<long long> res(n);
for (int i = 0; i < n; i++)
cin >> res[i];
return res;
}
// begin() end()
#define all(x) (x).begin(), (x).end()
// for
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rrep(i, a, b) for (int i = (a); i > (b); i--)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//最大公約数
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
// 最小公倍数
unsigned lcm(unsigned a, unsigned b) { return a / gcd(a, b) * b; }
// a = max(a, b), a = min(a, b)
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
// 階乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
ll prod = 1;
num %= mod;
while (pow > 0) {
if (pow & 1)
prod = prod * num % mod;
num = num * num % mod;
pow >>= 1;
}
return prod;
}
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// UnionFind
struct UnionFind {
vector<int> par;
vector<int> rank;
vector<ll> Size;
UnionFind(int n = 1) { init(n); }
void init(int n = 1) {
par.resize(n + 1);
rank.resize(n + 1);
Size.resize(n + 1);
for (int i = 0; i <= n; ++i)
par[i] = i, rank[i] = 0, Size[i] = 1;
}
int root(int x) {
if (par[x] == x) {
return x;
} else {
int r = root(par[x]);
return par[x] = r;
}
}
bool issame(int x, int y) { return root(x) == root(y); }
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (rank[x] < rank[y])
swap(x, y);
if (rank[x] == rank[y])
++rank[x];
par[y] = x;
Size[x] += Size[y];
return true;
}
ll size(int x) { return Size[root(x)]; }
};
// modint構造体
struct Mint {
int val;
Mint inv() const {
int tmp, a = val, b = mod, x = 1, y = 0;
while (b)
tmp = a / b, a -= tmp * b, swap(a, b), x -= tmp * y, swap(x, y);
return Mint(x);
}
public:
Mint() : val(0) {}
Mint(ll x) {
if ((val = x % mod) < 0)
val += mod;
}
Mint pow(ll t) {
Mint res = 1, b = *this;
while (t) {
if (t & 1)
res *= b;
b *= b;
t >>= 1;
}
return res;
}
Mint &operator+=(const Mint &x) {
if ((val += x.val) >= mod)
val -= mod;
return *this;
}
Mint &operator-=(const Mint &x) {
if ((val += mod - x.val) >= mod)
val -= mod;
return *this;
}
Mint &operator*=(const Mint &x) {
val = (ll)val * x.val % mod;
return *this;
}
Mint &operator/=(const Mint &x) { return *this *= x.inv(); }
bool operator==(const Mint &x) const { return val == x.val; }
bool operator!=(const Mint &x) const { return val != x.val; }
bool operator<(const Mint &x) const { return val < x.val; }
bool operator<=(const Mint &x) const { return val <= x.val; }
bool operator>(const Mint &x) const { return val > x.val; }
bool operator>=(const Mint &x) const { return val >= x.val; }
Mint operator+(const Mint &x) const { return Mint(*this) += x; }
Mint operator-(const Mint &x) const { return Mint(*this) -= x; }
Mint operator*(const Mint &x) const { return Mint(*this) *= x; }
Mint operator/(const Mint &x) const { return Mint(*this) /= x; }
};
struct factorial {
vector<Mint> Fact, Finv;
public:
// factorial fact(10000010);
// fact.nCr(a, b)
//「fact」の部分は自由に名前変更可能
factorial(int maxx) {
Fact.resize(maxx + 1), Finv.resize(maxx + 1);
Fact[0] = Mint(1);
rep(i, 0, maxx) Fact[i + 1] = Fact[i] * (i + 1);
Finv[maxx] = Mint(1) / Fact[maxx];
rrep(i, maxx, 0) Finv[i - 1] = Finv[i] * i;
}
Mint fact(int n, bool inv = 0) {
if (inv)
return Finv[n];
else
return Fact[n];
}
Mint nPr(int n, int r) {
if (n < 0 || n < r || r < 0)
return Mint(0);
else
return Fact[n] * Finv[n - r];
}
Mint nCr(int n, int r) {
if (n < 0 || n < r || r < 0)
return Mint(0);
else
return Fact[n] * Finv[r] * Finv[n - r];
}
};
// 1 * 2 * 3 .... * n (mod)
ll modfact(ll n) {
if (n <= 1)
return 1;
return (n * modfact(n - 1)) % MOD;
}
// kが角度だった場合:cos(k * (PI / 180));
const double PI = acos(-1);
// 多次元 vector 生成 例: auto dp = make_vec<long long>(N+1, 5, 5, 5);
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
//素因数分解
vector<pair<long long, int>> factorize(long long n) {
vector<pair<long long, int>> res;
for (long long i = 2; i * i <= n; ++i) {
if (n % i)
continue;
res.emplace_back(i, 0);
while (n % i == 0) {
n /= i;
res.back().second++;
}
}
if (n != 1)
res.emplace_back(n, 1);
return res;
}
// 素数判定
bool primejudge(long long a) {
if (a <= 1)
return false;
for (long long i = 2; i * i <= a; i++) {
if (a % i == 0)
return false;
}
return true;
}
//累積和
// vector<long long>sums(vector<int>n){
// vector<long long>res(n.size() + 1, 0);
// for(int i = 0; i < n.size(); i++) res[i + 1] = n[i] + res[i];
// return res;
// }
// int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
int main() {
int n;
cin >> n;
map<string, int> s;
REP(i, n) {
string t;
cin >> t;
sort(all(t));
s[t]++;
}
ll ans = 0;
for (auto x : s)
if (x.second > 1)
ans += (x.second - 1) * x.second / 2;
print(ans);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
// long long
using ll = long long;
// pair<int, int>
using PII = pair<int, int>;
//最大値、mod
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(20) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
//配列入力
vector<long long> vecin(ll n) {
vector<long long> res(n);
for (int i = 0; i < n; i++)
cin >> res[i];
return res;
}
// begin() end()
#define all(x) (x).begin(), (x).end()
// for
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rrep(i, a, b) for (int i = (a); i > (b); i--)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//最大公約数
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
// 最小公倍数
unsigned lcm(unsigned a, unsigned b) { return a / gcd(a, b) * b; }
// a = max(a, b), a = min(a, b)
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
// 階乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
ll prod = 1;
num %= mod;
while (pow > 0) {
if (pow & 1)
prod = prod * num % mod;
num = num * num % mod;
pow >>= 1;
}
return prod;
}
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// UnionFind
struct UnionFind {
vector<int> par;
vector<int> rank;
vector<ll> Size;
UnionFind(int n = 1) { init(n); }
void init(int n = 1) {
par.resize(n + 1);
rank.resize(n + 1);
Size.resize(n + 1);
for (int i = 0; i <= n; ++i)
par[i] = i, rank[i] = 0, Size[i] = 1;
}
int root(int x) {
if (par[x] == x) {
return x;
} else {
int r = root(par[x]);
return par[x] = r;
}
}
bool issame(int x, int y) { return root(x) == root(y); }
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (rank[x] < rank[y])
swap(x, y);
if (rank[x] == rank[y])
++rank[x];
par[y] = x;
Size[x] += Size[y];
return true;
}
ll size(int x) { return Size[root(x)]; }
};
// modint構造体
struct Mint {
int val;
Mint inv() const {
int tmp, a = val, b = mod, x = 1, y = 0;
while (b)
tmp = a / b, a -= tmp * b, swap(a, b), x -= tmp * y, swap(x, y);
return Mint(x);
}
public:
Mint() : val(0) {}
Mint(ll x) {
if ((val = x % mod) < 0)
val += mod;
}
Mint pow(ll t) {
Mint res = 1, b = *this;
while (t) {
if (t & 1)
res *= b;
b *= b;
t >>= 1;
}
return res;
}
Mint &operator+=(const Mint &x) {
if ((val += x.val) >= mod)
val -= mod;
return *this;
}
Mint &operator-=(const Mint &x) {
if ((val += mod - x.val) >= mod)
val -= mod;
return *this;
}
Mint &operator*=(const Mint &x) {
val = (ll)val * x.val % mod;
return *this;
}
Mint &operator/=(const Mint &x) { return *this *= x.inv(); }
bool operator==(const Mint &x) const { return val == x.val; }
bool operator!=(const Mint &x) const { return val != x.val; }
bool operator<(const Mint &x) const { return val < x.val; }
bool operator<=(const Mint &x) const { return val <= x.val; }
bool operator>(const Mint &x) const { return val > x.val; }
bool operator>=(const Mint &x) const { return val >= x.val; }
Mint operator+(const Mint &x) const { return Mint(*this) += x; }
Mint operator-(const Mint &x) const { return Mint(*this) -= x; }
Mint operator*(const Mint &x) const { return Mint(*this) *= x; }
Mint operator/(const Mint &x) const { return Mint(*this) /= x; }
};
struct factorial {
vector<Mint> Fact, Finv;
public:
// factorial fact(10000010);
// fact.nCr(a, b)
//「fact」の部分は自由に名前変更可能
factorial(int maxx) {
Fact.resize(maxx + 1), Finv.resize(maxx + 1);
Fact[0] = Mint(1);
rep(i, 0, maxx) Fact[i + 1] = Fact[i] * (i + 1);
Finv[maxx] = Mint(1) / Fact[maxx];
rrep(i, maxx, 0) Finv[i - 1] = Finv[i] * i;
}
Mint fact(int n, bool inv = 0) {
if (inv)
return Finv[n];
else
return Fact[n];
}
Mint nPr(int n, int r) {
if (n < 0 || n < r || r < 0)
return Mint(0);
else
return Fact[n] * Finv[n - r];
}
Mint nCr(int n, int r) {
if (n < 0 || n < r || r < 0)
return Mint(0);
else
return Fact[n] * Finv[r] * Finv[n - r];
}
};
// 1 * 2 * 3 .... * n (mod)
ll modfact(ll n) {
if (n <= 1)
return 1;
return (n * modfact(n - 1)) % MOD;
}
// kが角度だった場合:cos(k * (PI / 180));
const double PI = acos(-1);
// 多次元 vector 生成 例: auto dp = make_vec<long long>(N+1, 5, 5, 5);
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
//素因数分解
vector<pair<long long, int>> factorize(long long n) {
vector<pair<long long, int>> res;
for (long long i = 2; i * i <= n; ++i) {
if (n % i)
continue;
res.emplace_back(i, 0);
while (n % i == 0) {
n /= i;
res.back().second++;
}
}
if (n != 1)
res.emplace_back(n, 1);
return res;
}
// 素数判定
bool primejudge(long long a) {
if (a <= 1)
return false;
for (long long i = 2; i * i <= a; i++) {
if (a % i == 0)
return false;
}
return true;
}
//累積和
// vector<long long>sums(vector<int>n){
// vector<long long>res(n.size() + 1, 0);
// for(int i = 0; i < n.size(); i++) res[i + 1] = n[i] + res[i];
// return res;
// }
// int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
int main() {
int n;
cin >> n;
map<string, ll> s;
REP(i, n) {
string t;
cin >> t;
sort(all(t));
s[t]++;
}
ll ans = 0;
for (auto x : s)
if (x.second > 1)
ans += (x.second - 1) * x.second / 2;
print(ans);
return 0;
}
|
[] | 746,708
| 746,709
|
u832995587
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
// long long
using ll = long long;
//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// begin() end()
#define all(x) (x).begin(), (x).end()
// for
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n, i##_len = (n); i >= 0; i--)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; ++i)
//最大公約数
unsigned gcd(unsigned a, unsigned b) {
if (a < b)
return gcd(b, a);
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
REP(i, N) {
cin >> s.at(i);
sort(all(s.at(i)));
}
sort(all(s));
int cnt = 0;
int tmp = 0;
REP(i, N - 1) {
if (s.at(i) == s.at(i + 1)) {
tmp++;
cnt += tmp;
} else {
tmp = 1;
}
}
print(cnt);
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
// long long
using ll = long long;
//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// begin() end()
#define all(x) (x).begin(), (x).end()
// for
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n, i##_len = (n); i >= 0; i--)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; ++i)
//最大公約数
unsigned gcd(unsigned a, unsigned b) {
if (a < b)
return gcd(b, a);
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
REP(i, N) {
cin >> s.at(i);
sort(all(s.at(i)));
}
sort(all(s));
ll cnt = 0;
ll tmp = 0;
REP(i, N - 1) {
if (s.at(i) == s.at(i + 1)) {
tmp++;
cnt += tmp;
} else {
tmp = 0;
}
}
print(cnt);
}
|
[
"variable_declaration.type.change",
"literal.number.change",
"assignment.value.change"
] | 746,710
| 746,711
|
u832995587
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
// long long
using ll = long long;
//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// begin() end()
#define all(x) (x).begin(), (x).end()
// for
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n, i##_len = (n); i >= 0; i--)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; ++i)
//最大公約数
unsigned gcd(unsigned a, unsigned b) {
if (a < b)
return gcd(b, a);
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
REP(i, N) {
cin >> s.at(i);
sort(all(s.at(i)));
}
sort(all(s));
int cnt = 0;
int tmp = 0;
REP(i, N - 1) {
if (s.at(i) == s.at(i + 1)) {
tmp++;
cnt += tmp;
} else {
tmp = 0;
}
}
print(cnt);
}
|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
// long long
using ll = long long;
//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// begin() end()
#define all(x) (x).begin(), (x).end()
// for
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n, i##_len = (n); i >= 0; i--)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i < i##_len; ++i)
//最大公約数
unsigned gcd(unsigned a, unsigned b) {
if (a < b)
return gcd(b, a);
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
int main() {
int N;
cin >> N;
vector<string> s(N);
REP(i, N) {
cin >> s.at(i);
sort(all(s.at(i)));
}
sort(all(s));
ll cnt = 0;
ll tmp = 0;
REP(i, N - 1) {
if (s.at(i) == s.at(i + 1)) {
tmp++;
cnt += tmp;
} else {
tmp = 0;
}
}
print(cnt);
}
|
[
"variable_declaration.type.change"
] | 746,712
| 746,711
|
u832995587
|
cpp
|
p02947
|
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
string str[1000000];
int main() {
int n;
int count = 0;
int tmp = 1;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
cin >> str[i];
sort(str[i].begin(), str[i].end());
}
sort(str, str + n);
/* for(int i=0;i<n;i++)
{
cout << str[i];
printf("\n");
}*/
for (int i = 1; i < n; i++) {
if (str[i] == str[i - 1]) {
tmp++;
} else {
// if(tmp!=2)
count += tmp * (tmp - 1) / 2;
// else
// count++;
tmp = 1;
}
}
if (tmp != 0) {
// printf("test tmp=%d\n",tmp);
// if(tmp!=2)
count += tmp * (tmp - 1) / 2;
// else
// count++;
}
printf("%d", count);
}
|
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long ll;
string str[1000000];
int main() {
int n;
ll count = 0;
ll tmp = 1;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
cin >> str[i];
sort(str[i].begin(), str[i].end());
}
sort(str, str + n);
/* for(int i=0;i<n;i++)
{
cout << str[i];
printf("\n");
}*/
for (int i = 1; i < n; i++) {
if (str[i] == str[i - 1]) {
tmp++;
} else {
count += tmp * (tmp - 1) / 2;
tmp = 1;
}
}
if (tmp != 0) {
// printf("test tmp=%d\n",tmp);
count += tmp * (tmp - 1) / 2;
}
printf("%lld", count);
}
|
[
"variable_declaration.type.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 746,713
| 746,714
|
u816631826
|
cpp
|
p02947
|
// Green bin.cpp : This file contains the 'main' function. Program execution
// begins and ends there.
//
#include <algorithm>
#include <iostream>
using namespace std;
const int N = 1e5;
string arr[N];
int main() {
int n;
long long ans = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr, arr + n);
int count = 1;
string prev = arr[0];
for (int i = 1; i < n; i++) {
string cur = arr[i];
if (prev == cur)
count++;
else {
ans += count * (count - 1) / 2;
count = 1;
prev = cur;
}
}
ans += count * (count - 1) / 2;
cout << ans;
}
|
// Green bin.cpp : This file contains the 'main' function. Program execution
// begins and ends there.
//
#include <algorithm>
#include <iostream>
using namespace std;
const int N = 1e5;
string arr[N];
int main() {
int n;
long long ans = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
sort(arr[i].begin(), arr[i].end());
}
sort(arr, arr + n);
long long count = 1;
string prev = arr[0];
for (int i = 1; i < n; i++) {
string cur = arr[i];
if (prev == cur)
count++;
else {
ans += count * (count - 1) / 2;
count = 1;
prev = cur;
}
}
ans += count * (count - 1) / 2;
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,715
| 746,716
|
u089230684
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#include <iostream>
#include <set>
#define ll long long
using namespace std;
int main() {
ll t;
cin >> t;
int num = 0;
map<string, int> a;
while (t--) {
string s;
cin >> s;
sort(s.begin(), s.end());
num += a[s]++;
}
cout << num << endl;
return 0;
}
|
#include <bits/stdc++.h>
#include <iostream>
#include <set>
#define ll long long
using namespace std;
int main() {
ll t;
cin >> t;
ll num = 0;
map<string, int> a;
while (t--) {
string s;
cin >> s;
sort(s.begin(), s.end());
num += a[s]++;
}
cout << num << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,717
| 746,718
|
u353919145
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
/////////////////////////////////
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll ans = 0;
int cnt = 1;
rep(i, n - 1) {
if (s[i] == s[i + 1])
cnt++;
else {
ans += (cnt - 1) * cnt / 2;
cnt = 1;
}
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
/////////////////////////////////
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
ll ans = 0;
ll cnt = 1;
rep(i, n - 1) {
if (s[i] == s[i + 1])
cnt++;
else {
ans += (cnt - 1) * cnt / 2;
cnt = 1;
}
}
ans += cnt * (cnt - 1) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,720
| 746,721
|
u019359540
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
map<string, ll> anagram;
for (ll i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
anagram[s]++;
}
int ans = 0;
for (auto itr = anagram.begin(); itr != anagram.end(); itr++) {
if (itr->second > 1) {
int num = itr->second;
ans += num * (num - 1) / 2;
}
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
map<string, ll> anagram;
for (ll i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
anagram[s]++;
}
ll ans = 0;
for (auto itr = anagram.begin(); itr != anagram.end(); itr++) {
if (itr->second > 1) {
ll num = itr->second;
ans += (ll)num * (num - 1) / 2;
}
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,722
| 746,723
|
u850165979
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
map<string, ll> anagram;
for (ll i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
anagram[s]++;
}
int ans = 0;
for (auto itr = anagram.begin(); itr != anagram.end(); itr++) {
if (itr->second > 1) {
int num = itr->second;
ans += ceil(num * (num - 1) / 2);
}
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n;
cin >> n;
map<string, ll> anagram;
for (ll i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
anagram[s]++;
}
ll ans = 0;
for (auto itr = anagram.begin(); itr != anagram.end(); itr++) {
if (itr->second > 1) {
ll num = itr->second;
ans += (ll)num * (num - 1) / 2;
}
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change",
"call.arguments.change"
] | 746,724
| 746,723
|
u850165979
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) sort(s[i].begin(), s[i].end());
map<string, int> mp;
rep(i, n)++ mp[s[i]];
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
ans += (*itr).second * ((*itr).second - 1) / 2LL;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
rep(i, n) sort(s[i].begin(), s[i].end());
map<string, int> mp;
rep(i, n)++ mp[s[i]];
ll ans = 0;
for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
ans += (ll)(*itr).second * ((*itr).second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,727
| 746,728
|
u714642046
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
string S[n];
for (i = 0; i < n; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
}
sort(S, S + n);
int count = 0, ans = 0;
for (i = 0; i < n; i++) {
if (S[i] == S[i + 1])
count++;
else {
ans += count * (count + 1) / 2;
count = 0;
}
}
if (count != 0)
ans += count * (count + 1) / 2;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i;
cin >> n;
string S[n];
for (i = 0; i < n; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
}
sort(S, S + n);
long long int count = 0, ans = 0;
for (i = 0; i < n - 1; i++) {
if (S[i] == S[i + 1])
count++;
else {
ans += count * (count + 1) / 2;
count = 0;
}
}
if (count != 0)
ans += count * (count + 1) / 2;
cout << ans << endl;
return 0;
}
|
[
"control_flow.loop.for.condition.change",
"misc.off_by_one"
] | 746,729
| 746,730
|
u028218659
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
string S[n];
for (i = 0; i < n; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
}
sort(S, S + n);
int count = 0, ans = 0;
for (i = 0; i < n - 1; i++) {
if (S[i] == S[i + 1])
count++;
else {
ans += count * (count + 1) / 2;
count = 0;
}
}
if (count != 0)
ans += count * (count + 1) / 2;
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i;
cin >> n;
string S[n];
for (i = 0; i < n; i++) {
cin >> S[i];
sort(S[i].begin(), S[i].end());
}
sort(S, S + n);
long long int count = 0, ans = 0;
for (i = 0; i < n - 1; i++) {
if (S[i] == S[i + 1])
count++;
else {
ans += count * (count + 1) / 2;
count = 0;
}
}
if (count != 0)
ans += count * (count + 1) / 2;
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,731
| 746,730
|
u028218659
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll factorial(ll n) {
if (n == 0)
return 1;
else
return n * factorial(n - 1);
}
vector<int> make_map(string s) {
vector<int> c(26);
for (int i = 0; i < s.size(); i++) {
int n = s.at(i) - 'a';
c.at(n)++;
}
return c;
}
int main() {
int n;
cin >> n;
map<string, int> m;
ll count = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (m.count(s)) {
m[s]++;
} else {
m[s] = 1;
}
}
for (auto p : m) {
// cout << p.second << endl;
if (p.second > 1) {
count += p.second * (p.second - 1) / 2;
}
}
cout << count << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll factorial(ll n) {
if (n == 0)
return 1;
else
return n * factorial(n - 1);
}
vector<int> make_map(string s) {
vector<int> c(26);
for (int i = 0; i < s.size(); i++) {
int n = s.at(i) - 'a';
c.at(n)++;
}
return c;
}
int main() {
int n;
cin >> n;
map<string, ll> m;
ll count = 0;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (m.count(s)) {
m[s]++;
} else {
m[s] = 1;
}
}
for (auto p : m) {
// cout << p.second << endl;
if (p.second > 1) {
count += p.second * (p.second - 1) / 2;
}
}
cout << count << endl;
}
|
[] | 746,736
| 746,737
|
u959813156
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forin(in) \
for (int i = 0; i < (int)in.size(); i++) \
cin >> in[i]
#define forout(out) \
for (int i = 0; i < (int)out.size(); i++) \
cout << out[i] << endl
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
int n;
cin >> n;
map<string, ll> m;
vector<string> s(n);
int ans = 0;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]]++;
if (m[s[i]] != 1)
ans += m[s[i]] - 1;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forin(in) \
for (int i = 0; i < (int)in.size(); i++) \
cin >> in[i]
#define forout(out) \
for (int i = 0; i < (int)out.size(); i++) \
cout << out[i] << endl
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
ll n;
cin >> n;
map<string, ll> m;
vector<string> s(n);
ll ans = 0;
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
m[s[i]]++;
if (m[s[i]] != 1)
ans += m[s[i]] - 1;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,740
| 746,741
|
u060116081
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace ::std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;
template <class T> istream &operator>>(istream &I, vector<T> &v) {
for (T &e : v)
I >> e;
return I;
}
template <class T> ostream &operator<<(ostream &O, const vector<T> &v) {
for (const T &e : v)
O << e << ' ';
return O;
}
void _main() {
int n;
cin >> n;
map<string, int> freq;
while (n--) {
string s;
cin >> s;
sort(all(s));
freq[s]++;
}
ll ans = 0;
for (auto it : freq)
ans += (it.second) * (it.second - 1) / 2;
cout << ans;
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("input.txt", "r", stdin);
int _t = 1;
// cin >> _t;
while (_t--)
_main();
return 0;
}
|
#include <bits/stdc++.h>
using namespace ::std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;
template <class T> istream &operator>>(istream &I, vector<T> &v) {
for (T &e : v)
I >> e;
return I;
}
template <class T> ostream &operator<<(ostream &O, const vector<T> &v) {
for (const T &e : v)
O << e << ' ';
return O;
}
void _main() {
int n;
cin >> n;
map<string, int> freq;
while (n--) {
string s;
cin >> s;
sort(all(s));
freq[s]++;
}
ll ans = 0;
for (auto it : freq)
ans += (ll)(it.second) * (it.second - 1) / 2;
cout << ans;
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("input.txt", "r", stdin);
int _t = 1;
// cin >> _t;
while (_t--)
_main();
return 0;
}
|
[] | 746,742
| 746,743
|
u093681822
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
int main() {
long long int i, n, p = 0, j;
map<string, int> cnt;
map<string, int>::iterator itr;
cin >> n;
// string s[n];
// for(i=0;i<n;i++)
// cin>>s[i];
for (i = 0; i < n; i++) {
int sum = 0;
string s;
cin >> s;
sort(s.begin(), s.end());
// for(j=0;j<10;j++)
// sum+=s[j]-'a';
cnt[s]++;
}
for (itr = cnt.begin(); itr != cnt.end(); itr++) {
p += itr->second * (itr->second - 1) / 2;
}
cout << p << endl;
}
|
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
int main() {
long long int i, n, p = 0, j;
map<string, long long int> cnt;
map<string, long long int>::iterator itr;
cin >> n;
// string s[n];
// for(i=0;i<n;i++)
// cin>>s[i];
for (i = 0; i < n; i++) {
int sum = 0;
string s;
cin >> s;
sort(s.begin(), s.end());
// for(j=0;j<10;j++)
// sum+=s[j]-'a';
cnt[s]++;
}
for (itr = cnt.begin(); itr != cnt.end(); itr++) {
p += itr->second * (itr->second - 1) / 2;
}
cout << p << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 746,744
| 746,745
|
u246218976
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int cnt = 0;
map<string, int> a;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
// cout << s << endl;
if (a.count(s)) {
cnt += a[s];
a[s]++;
} else
a[s] = 1;
}
cout << cnt;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long cnt = 0;
map<string, long> a;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
// cout << s << endl;
if (a.count(s)) {
cnt += a[s];
a[s]++;
} else
a[s] = 1;
}
cout << cnt;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,750
| 746,751
|
u600480888
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main(void) {
int n;
cin >> n;
string s[n + 1];
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i < n; i++) {
char c[10];
for (int j = 0; j < 10; j++) {
c[j] = s[i][j];
}
sort(c, c + 10);
for (int j = 0; j < 10; j++) {
s[i][j] = c[j];
}
}
sort(s, s + n);
int count = 1;
s[n] = "zzzzzzzzzzzzzzzzzzzzzzzz";
ll ans = 0;
for (int i = 0; i < n; i++) {
if (s[i] != s[i + 1]) {
if (count % 2 == 0) {
ans += ((count / 2) * (count - 1));
} else {
ans += (((count - 1) / 2) * count);
}
count = 1;
} else
count++;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main(void) {
int n;
cin >> n;
string s[n + 1];
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i < n; i++) {
char c[10];
for (int j = 0; j < 10; j++) {
c[j] = s[i][j];
}
sort(c, c + 10);
for (int j = 0; j < 10; j++) {
s[i][j] = c[j];
}
}
sort(s, s + n);
ll count = 1;
s[n] = "zzzzzzzzzzzzzzzzzzzzzzzz";
ll ans = 0;
for (int i = 0; i < n; i++) {
if (s[i] != s[i + 1]) {
if (count % 2 == 0) {
ans += ((count / 2) * (count - 1));
} else {
ans += (((count - 1) / 2) * count);
}
count = 1;
} else
count++;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,754
| 746,755
|
u633967774
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
set<string> st;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (st.count(s) == 0)
st.insert(s);
else {
++mp[s];
}
}
auto fac = [&](int n) {
int res = 0;
for (int a = 1; a <= n; ++a) {
res += a;
}
return res;
};
int ans = 0;
for (auto i = mp.begin(); i != mp.end(); ++i) {
ans += fac(i->second);
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
set<string> st;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (st.count(s) == 0)
st.insert(s);
else {
++mp[s];
}
}
auto fac = [&](ll n) {
ll res = 0;
for (ll a = 1; a <= n; ++a) {
res += a;
}
return res;
};
ll ans = 0;
for (auto i = mp.begin(); i != mp.end(); ++i) {
ans += fac(i->second);
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"control_flow.loop.for.initializer.change"
] | 746,758
| 746,759
|
u188332959
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
int main() {
long long N;
cin >> N;
vector<string> s(N);
REP(i, N) cin >> s[i];
map<string, int> um;
// まずは要素ごとにソートする
int result = 0;
REP(i, N) {
sort(s[i].begin(), s[i].end());
if (um[s[i]] > 0) {
result += um[s[i]];
um[s[i]]++;
} else {
um[s[i]] = 1;
}
}
cout << result << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
int main() {
long long N;
cin >> N;
vector<string> s(N);
REP(i, N) cin >> s[i];
map<string, long long> um;
// まずは要素ごとにソートする
long long result = 0;
REP(i, N) {
sort(s[i].begin(), s[i].end());
if (um[s[i]] > 0) {
result += um[s[i]];
um[s[i]]++;
} else {
um[s[i]] = 1;
}
}
cout << result << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,762
| 746,763
|
u308463793
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
int cou = 1;
long long int ans = 0;
vector<string> v(n);
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
v.at(i) = s;
}
sort(v.begin(), v.end());
for (int j = 0; j < n - 1; j++) {
if (v.at(j) == v.at(j + 1)) {
cou++;
} else {
ans += cou * (cou - 1) / 2;
cou = 1;
}
}
ans += cou * (cou - 1) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
long long int cou = 1;
long long int ans = 0;
vector<string> v(n);
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
v.at(i) = s;
}
sort(v.begin(), v.end());
for (int j = 0; j < n - 1; j++) {
if (v.at(j) == v.at(j + 1)) {
cou++;
} else {
ans += cou * (cou - 1) / 2;
cou = 1;
}
}
ans += cou * (cou - 1) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 746,764
| 746,765
|
u031450170
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
int cou = 1;
int ans = 0;
vector<string> v(n);
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
v.at(i) = s;
}
sort(v.begin(), v.end());
for (int j = 0; j < n - 1; j++) {
if (v.at(j) == v.at(j + 1)) {
cou++;
} else {
ans += cou * (cou - 1) / 2;
cou = 1;
}
}
ans += cou * (cou - 1) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
long long int cou = 1;
long long int ans = 0;
vector<string> v(n);
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
v.at(i) = s;
}
sort(v.begin(), v.end());
for (int j = 0; j < n - 1; j++) {
if (v.at(j) == v.at(j + 1)) {
cou++;
} else {
ans += cou * (cou - 1) / 2;
cou = 1;
}
}
ans += cou * (cou - 1) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 746,766
| 746,765
|
u031450170
|
cpp
|
p02947
|
#include <bits/stdc++.h>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repa(i, s, n) for (int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i, a, b) for (int i = a; i >= b; i--)
signed main() {
int n;
cin >> n;
map<string, ll> m;
string s;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll v = 0;
for (auto itr = m.begin(); itr != m.end(); itr++) {
ll t = itr->second;
v += t * (t - 1) / 2;
}
cout << n << endl;
}
|
#include <bits/stdc++.h>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repa(i, s, n) for (int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i, a, b) for (int i = a; i >= b; i--)
signed main() {
int n;
cin >> n;
map<string, ll> m;
string s;
rep(i, n) {
cin >> s;
sort(s.begin(), s.end());
m[s]++;
}
ll v = 0;
for (auto itr = m.begin(); itr != m.end(); itr++) {
ll t = itr->second;
v += t * (t - 1) / 2;
}
cout << v << endl;
}
|
[
"identifier.change",
"io.output.change"
] | 746,767
| 746,768
|
u510749912
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int n;
scanf("%d", &n);
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
int cnt = 0;
// for (int i = 0; i < n - 1; i++) {
// for (int j = i + 1; j < n; j++) {
// if (s[i] == s[j]) cnt++;
// }
// }
long ans = 0;
if (n == 2) {
if (s[0] == s[1]) {
ans = 1;
}
} else {
rep(i, n - 1) {
if (s[i] == s[i + 1]) {
cnt++;
} else {
ans += cnt * (cnt + 1) / 2;
cnt = 0;
}
if (i == n - 2) {
ans += cnt * (cnt + 1) / 2;
}
}
}
cout << ans << endl;
// string s = "acornistnt";
// sort(s.begin(), s.end());
// cout << s << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int n;
scanf("%d", &n);
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s.begin(), s.end());
long cnt = 0;
// for (int i = 0; i < n - 1; i++) {
// for (int j = i + 1; j < n; j++) {
// if (s[i] == s[j]) cnt++;
// }
// }
long ans = 0;
if (n == 2) {
if (s[0] == s[1]) {
ans = 1;
}
} else {
rep(i, n - 1) {
if (s[i] == s[i + 1]) {
cnt++;
} else {
ans += cnt * (cnt + 1) / 2;
cnt = 0;
}
if (i == n - 2) {
ans += cnt * (cnt + 1) / 2;
}
}
}
cout << ans << endl;
// string s = "acornistnt";
// sort(s.begin(), s.end());
// cout << s << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,769
| 746,770
|
u915582296
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string t;
cin >> t;
sort(t.begin(), t.end());
s[i] = t;
}
map<string, int> mp;
rep(i, n) mp[s[i]]++;
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
string t;
cin >> t;
sort(t.begin(), t.end());
s[i] = t;
}
map<string, ll> mp;
rep(i, n) mp[s[i]]++;
ll ans = 0;
for (auto p : mp) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans << endl;
}
|
[] | 746,777
| 746,778
|
u016334391
|
cpp
|
p02947
|
#pragma region template
#ifdef ONLINE_JUDGE
#pragma GCC target("avx2")
#pragma GCC optimize("tree-vectorize")
#pragma GCC diagnostic ignored "-Wunused-result"
#define here
#define cprint(vec)
#define com(msg)
#define obs(...)
#define local(x)
#define alter(x, y) y
#else
#define here cerr << __func__ << '/' << __LINE__ << ": reached\n"
#define cprint(vec) dmp(vec)
#define com(msg) cerr << "{ " << msg << " }\n"
#define obs(...) observe(#__VA_ARGS__, __VA_ARGS__)
#define local(x) x
#define alter(x, y) x
#endif
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define brep(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; i++)
#define rrep(i, n) for (int i = (n)-1, now = 0; i >= 0; i--, now++)
#define xrep(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define yes(n) cout << ((n) ? YES : NO) << '\n'
#define cco(...) prints(__VA_ARGS__)
#define fout cout << fixed << setprecision(15)
#define Sort(v) sort(all(v))
#define rSort(v) sort(rall(v))
#define Rev(v) reverse(all(v))
#define Unique(v) (v).erase(unique(all(v)), (v).end())
#define in_range(x, a, b) ((a) <= (x) && (x) < (b))
#define in_area(x, y, a, b) (0 <= (x) && 0 <= (y) && (x) < (a) && (y) < (b))
#define eb emplace_back
using namespace std;
using ll = long long;
using ld = long double;
using pt = pair<int, int>;
using ull = unsigned long long;
using str = string;
using vbl = vector<bool>;
using dqbl = deque<bool>;
using vint = vector<int>;
using vll = vector<long long>;
using vdb = vector<double>;
using vld = vector<long double>;
using vpt = vector<pair<int, int>>;
using vstr = vector<string>;
using vvdb = vector<vector<double>>;
using vvbl = vector<vector<bool>>;
using vdqbl = vector<deque<bool>>;
using vvint = vector<vector<int>>;
using vvll = vector<vector<long long>>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-9;
constexpr int dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dx[] = {0, 1, 0, -1, -1, 1, 1, -1};
// --- functions which take 1 argument --- //
template <class T> int sgn(const T &x) { return (x > 0) - (x < 0); }
template <class S, class T> int digit(S x, const T &b = 10) {
int r = 1;
while ((x /= b) >= 1)
r++;
return r;
}
template <class T> double degToRad(const T &a) { return a / 180.0 * M_PI; }
template <class T> double radToDeg(const T &a) { return a / M_PI * 180.0; }
template <class T> long long factorial(const T &n) {
if (n == 0)
return 1;
long long r = 1;
brep(i, 2, n) r *= i;
return r;
}
template <class T> bool isPrime(const T &n) {
T i = 2;
while (i * i <= n) {
if (n % i == 0 && n != i)
return 0;
i++;
}
return 1;
}
template <class T> map<T, T> factorize(T n) {
map<T, T> r;
for (T i = 2; i * i <= n; i++) {
while (n % i == 0) {
r[i]++;
n /= i;
}
}
if (n != 1)
r[n] = 1;
return r;
}
template <class T> vector<T> divisor(const T &n) {
vector<T> r;
for (T i = 1; i * i <= n; i++) {
if (!(n % i)) {
r.eb(i);
if (i * i != n)
r.eb(n / i);
}
}
return r;
}
// --- functions which take more than 1 argument --- //
template <class S, class T> bool chmax(S &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class S, class T> bool chmin(S &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class S, class T> bool near(const S &a, const T &b) {
return abs(a - b) < EPS;
}
template <class S, class T> long long bpow(S m, T n) {
long long r = 1;
while (n > 0) {
if (n & 1)
r *= m;
m *= m;
n /= 2;
}
return r;
}
template <class S, class T>
typename common_type<S, T>::type min(const S &m, const T &n) {
return min((typename common_type<S, T>::type)m,
(typename common_type<S, T>::type)n);
}
template <class S, class T>
typename common_type<S, T>::type max(const S &m, const T &n) {
return max((typename common_type<S, T>::type)m,
(typename common_type<S, T>::type)n);
}
template <class S, class T>
typename common_type<S, T>::type nPr(const S &n, const T &k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
brep(i, n - k + 1, n) r *= i;
return r;
}
template <class S, class T>
typename common_type<S, T>::type nCr(const S &n, T k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
k = min(k, n - k);
brep(i, n - k + 1, n) r *= i;
return r / factorial(k);
}
template <class T> void prints(const T &v) { cout << v << '\n'; }
template <class S, class... T> void prints(const S &v, const T &...w) {
cout << v << ' ';
prints(w...);
}
// --- functions which take vector/deque as argument --- //
template <class T> void printD(const vector<T> &v, string d) {
rep(i, sz(v) - 1) cout << v[i] << d;
cout << *v.rbegin() << '\n';
}
template <class T> void printD(const vector<vector<T>> &v, string d) {
for (const auto &x : v)
printD(x, d);
}
template <class T> bool in(const T &k, const vector<T> &v) {
return find(all(v), k) != v.end();
}
bool in(const int &k, const vector<long long> &v) {
return find(all(v), k) != v.end();
}
bool in(const long long &k, const vector<int> &v) {
return find(all(v), k) != v.end();
}
bool in(const char &k, const string &v) { return find(all(v), k) != v.end(); }
bool in(const char *k, const vector<string> &v) {
return find(all(v), k) != v.end();
}
template <class T> double veclen(const vector<T> &v) {
return sqrt(reduce(all(v), 0.0, [](T s, T v) { return s += v * v; }));
}
template <class T> T min(const vector<T> &v) { return *min_element(all(v)); }
template <class T> T max(const vector<T> &v) { return *max_element(all(v)); }
template <class T> T sum(const vector<T> &v) { return reduce(all(v), (T)0); }
template <class T> T gcd(const vector<T> &v) {
T r = v[0];
brep(i, 1, (int)v.size() - 1) r = gcd(r, v[i]);
return r;
}
template <class T> T lcm(const vector<T> &v) {
T r = v[0];
brep(i, 1, (int)v.size() - 1) r = lcm(r, v[i]);
return r;
}
template <class T> T vectorAdd(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] + v[i];
return r;
}
template <class T> T vectorSubtract(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] - v[i];
return r;
}
template <class T> T vectorMultiply(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] * v[i];
return r;
}
template <class T> T vectorDivide(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] / v[i];
return r;
}
template <class T> T dotProduct(const deque<bool> &u, const vector<T> &v) {
T r = 0;
rep(i, u.size()) if (u[i]) r += v[i];
return r;
}
template <class S, class T>
typename common_type<S, T>::type dotProduct(const vector<S> &u,
const vector<T> &v) {
T r = 0;
rep(i, u.size()) r += u[i] * v[i];
return r;
}
template <class S, class T> void sortBySecond(vector<pair<S, T>> &v) {
sort(all(v), [](auto L, auto R) { return L.second < R.second; });
}
// --- functions which take set/map as argument --- //
template <class T> T min(const set<T> &v) { return *min_element(all(v)); }
template <class T> T max(const set<T> &v) { return *max_element(all(v)); }
template <class T> T sum(const set<T> &v) { return reduce(all(v), (T)0); }
template <class T> T gcd(const set<T> &v) {
T r = 0;
for (const T &x : v)
r = (r == 0) ? x : gcd(r, x);
return r;
}
template <class T> T lcm(const set<T> &v) {
T r = 0;
for (const T &x : v)
r = (r == 0) ? x : lcm(r, x);
return r;
}
template <class T> bool in(const T &k, const set<T> &v) {
return find(all(v), k) != v.end();
}
template <class S, class T> pair<S, T> min(const map<S, T> &m) {
pair<S, T> r = *m.begin();
for (const auto &p : m)
if (chmin(r.second, p.second))
r = p;
return r;
}
template <class S, class T> pair<S, T> max(const map<S, T> &m) {
pair<S, T> r = *m.begin();
for (const auto &p : m)
if (chmax(r.second, p.second))
r = p;
return r;
}
// --- functions for debugging --- //
template <class T> void observe(const char *n, T &&v) {
cerr << n << ": " << v << '\n';
}
template <class S, class... T> void observe(const char *n, S &&v, T &&...w) {
const char *c = strchr(n + 1, ',');
cerr.write(n, c - n) << ": " << v << " |";
observe(c + 1, w...);
}
template <class T> void dmp(const vector<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class T> void dmp(const deque<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class T> void dmp(const set<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class P> void dmp(const P &p) {
cerr << "{ " << p.first << ' ' << p.second << " } ";
}
template <class T> void dmp(const vector<vector<T>> &v) {
for (const auto &x : v)
dmp<T>(x);
}
template <class T> void dmp(const vector<deque<T>> &v) {
for (const auto &x : v)
dmp<T>(x);
}
template <class S, class T> void dmp(const map<S, T> &m) {
cerr << "[ ";
for (const auto &p : m)
cerr << "{ " << p.first << ", " << p.second << " } ";
cerr << "]\n";
}
template <class S, class T> void dmp(const vector<pair<S, T>> &v) {
cerr << "[ ";
for (const auto &x : v)
dmp<pair<S, T>>(x);
cerr << "]\n";
}
#pragma endregion template
int main() {
int N;
scanf("%d", &N);
map<str, int> mp;
str tmp;
rep(i, N) {
cin >> tmp;
Sort(tmp);
mp[tmp]++;
}
ll ans = 0;
for (auto &&[k, v] : mp) {
ans += v * (v - 1) / 2;
}
cout << ans << '\n';
return 0;
}
|
#pragma region template
#ifdef ONLINE_JUDGE
#pragma GCC target("avx2")
#pragma GCC optimize("tree-vectorize")
#pragma GCC diagnostic ignored "-Wunused-result"
#define here
#define cprint(vec)
#define com(msg)
#define obs(...)
#define local(x)
#define alter(x, y) y
#else
#define here cerr << __func__ << '/' << __LINE__ << ": reached\n"
#define cprint(vec) dmp(vec)
#define com(msg) cerr << "{ " << msg << " }\n"
#define obs(...) observe(#__VA_ARGS__, __VA_ARGS__)
#define local(x) x
#define alter(x, y) x
#endif
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define brep(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; i++)
#define rrep(i, n) for (int i = (n)-1, now = 0; i >= 0; i--, now++)
#define xrep(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define yes(n) cout << ((n) ? YES : NO) << '\n'
#define cco(...) prints(__VA_ARGS__)
#define fout cout << fixed << setprecision(15)
#define Sort(v) sort(all(v))
#define rSort(v) sort(rall(v))
#define Rev(v) reverse(all(v))
#define Unique(v) (v).erase(unique(all(v)), (v).end())
#define in_range(x, a, b) ((a) <= (x) && (x) < (b))
#define in_area(x, y, a, b) (0 <= (x) && 0 <= (y) && (x) < (a) && (y) < (b))
#define eb emplace_back
using namespace std;
using ll = long long;
using ld = long double;
using pt = pair<int, int>;
using ull = unsigned long long;
using str = string;
using vbl = vector<bool>;
using dqbl = deque<bool>;
using vint = vector<int>;
using vll = vector<long long>;
using vdb = vector<double>;
using vld = vector<long double>;
using vpt = vector<pair<int, int>>;
using vstr = vector<string>;
using vvdb = vector<vector<double>>;
using vvbl = vector<vector<bool>>;
using vdqbl = vector<deque<bool>>;
using vvint = vector<vector<int>>;
using vvll = vector<vector<long long>>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-9;
constexpr int dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dx[] = {0, 1, 0, -1, -1, 1, 1, -1};
// --- functions which take 1 argument --- //
template <class T> int sgn(const T &x) { return (x > 0) - (x < 0); }
template <class S, class T> int digit(S x, const T &b = 10) {
int r = 1;
while ((x /= b) >= 1)
r++;
return r;
}
template <class T> double degToRad(const T &a) { return a / 180.0 * M_PI; }
template <class T> double radToDeg(const T &a) { return a / M_PI * 180.0; }
template <class T> long long factorial(const T &n) {
if (n == 0)
return 1;
long long r = 1;
brep(i, 2, n) r *= i;
return r;
}
template <class T> bool isPrime(const T &n) {
T i = 2;
while (i * i <= n) {
if (n % i == 0 && n != i)
return 0;
i++;
}
return 1;
}
template <class T> map<T, T> factorize(T n) {
map<T, T> r;
for (T i = 2; i * i <= n; i++) {
while (n % i == 0) {
r[i]++;
n /= i;
}
}
if (n != 1)
r[n] = 1;
return r;
}
template <class T> vector<T> divisor(const T &n) {
vector<T> r;
for (T i = 1; i * i <= n; i++) {
if (!(n % i)) {
r.eb(i);
if (i * i != n)
r.eb(n / i);
}
}
return r;
}
// --- functions which take more than 1 argument --- //
template <class S, class T> bool chmax(S &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class S, class T> bool chmin(S &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class S, class T> bool near(const S &a, const T &b) {
return abs(a - b) < EPS;
}
template <class S, class T> long long bpow(S m, T n) {
long long r = 1;
while (n > 0) {
if (n & 1)
r *= m;
m *= m;
n /= 2;
}
return r;
}
template <class S, class T>
typename common_type<S, T>::type min(const S &m, const T &n) {
return min((typename common_type<S, T>::type)m,
(typename common_type<S, T>::type)n);
}
template <class S, class T>
typename common_type<S, T>::type max(const S &m, const T &n) {
return max((typename common_type<S, T>::type)m,
(typename common_type<S, T>::type)n);
}
template <class S, class T>
typename common_type<S, T>::type nPr(const S &n, const T &k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
brep(i, n - k + 1, n) r *= i;
return r;
}
template <class S, class T>
typename common_type<S, T>::type nCr(const S &n, T k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
k = min(k, n - k);
brep(i, n - k + 1, n) r *= i;
return r / factorial(k);
}
template <class T> void prints(const T &v) { cout << v << '\n'; }
template <class S, class... T> void prints(const S &v, const T &...w) {
cout << v << ' ';
prints(w...);
}
// --- functions which take vector/deque as argument --- //
template <class T> void printD(const vector<T> &v, string d) {
rep(i, sz(v) - 1) cout << v[i] << d;
cout << *v.rbegin() << '\n';
}
template <class T> void printD(const vector<vector<T>> &v, string d) {
for (const auto &x : v)
printD(x, d);
}
template <class T> bool in(const T &k, const vector<T> &v) {
return find(all(v), k) != v.end();
}
bool in(const int &k, const vector<long long> &v) {
return find(all(v), k) != v.end();
}
bool in(const long long &k, const vector<int> &v) {
return find(all(v), k) != v.end();
}
bool in(const char &k, const string &v) { return find(all(v), k) != v.end(); }
bool in(const char *k, const vector<string> &v) {
return find(all(v), k) != v.end();
}
template <class T> double veclen(const vector<T> &v) {
return sqrt(reduce(all(v), 0.0, [](T s, T v) { return s += v * v; }));
}
template <class T> T min(const vector<T> &v) { return *min_element(all(v)); }
template <class T> T max(const vector<T> &v) { return *max_element(all(v)); }
template <class T> T sum(const vector<T> &v) { return reduce(all(v), (T)0); }
template <class T> T gcd(const vector<T> &v) {
T r = v[0];
brep(i, 1, (int)v.size() - 1) r = gcd(r, v[i]);
return r;
}
template <class T> T lcm(const vector<T> &v) {
T r = v[0];
brep(i, 1, (int)v.size() - 1) r = lcm(r, v[i]);
return r;
}
template <class T> T vectorAdd(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] + v[i];
return r;
}
template <class T> T vectorSubtract(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] - v[i];
return r;
}
template <class T> T vectorMultiply(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] * v[i];
return r;
}
template <class T> T vectorDivide(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] / v[i];
return r;
}
template <class T> T dotProduct(const deque<bool> &u, const vector<T> &v) {
T r = 0;
rep(i, u.size()) if (u[i]) r += v[i];
return r;
}
template <class S, class T>
typename common_type<S, T>::type dotProduct(const vector<S> &u,
const vector<T> &v) {
T r = 0;
rep(i, u.size()) r += u[i] * v[i];
return r;
}
template <class S, class T> void sortBySecond(vector<pair<S, T>> &v) {
sort(all(v), [](auto L, auto R) { return L.second < R.second; });
}
// --- functions which take set/map as argument --- //
template <class T> T min(const set<T> &v) { return *min_element(all(v)); }
template <class T> T max(const set<T> &v) { return *max_element(all(v)); }
template <class T> T sum(const set<T> &v) { return reduce(all(v), (T)0); }
template <class T> T gcd(const set<T> &v) {
T r = 0;
for (const T &x : v)
r = (r == 0) ? x : gcd(r, x);
return r;
}
template <class T> T lcm(const set<T> &v) {
T r = 0;
for (const T &x : v)
r = (r == 0) ? x : lcm(r, x);
return r;
}
template <class T> bool in(const T &k, const set<T> &v) {
return find(all(v), k) != v.end();
}
template <class S, class T> pair<S, T> min(const map<S, T> &m) {
pair<S, T> r = *m.begin();
for (const auto &p : m)
if (chmin(r.second, p.second))
r = p;
return r;
}
template <class S, class T> pair<S, T> max(const map<S, T> &m) {
pair<S, T> r = *m.begin();
for (const auto &p : m)
if (chmax(r.second, p.second))
r = p;
return r;
}
// --- functions for debugging --- //
template <class T> void observe(const char *n, T &&v) {
cerr << n << ": " << v << '\n';
}
template <class S, class... T> void observe(const char *n, S &&v, T &&...w) {
const char *c = strchr(n + 1, ',');
cerr.write(n, c - n) << ": " << v << " |";
observe(c + 1, w...);
}
template <class T> void dmp(const vector<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class T> void dmp(const deque<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class T> void dmp(const set<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class P> void dmp(const P &p) {
cerr << "{ " << p.first << ' ' << p.second << " } ";
}
template <class T> void dmp(const vector<vector<T>> &v) {
for (const auto &x : v)
dmp<T>(x);
}
template <class T> void dmp(const vector<deque<T>> &v) {
for (const auto &x : v)
dmp<T>(x);
}
template <class S, class T> void dmp(const map<S, T> &m) {
cerr << "[ ";
for (const auto &p : m)
cerr << "{ " << p.first << ", " << p.second << " } ";
cerr << "]\n";
}
template <class S, class T> void dmp(const vector<pair<S, T>> &v) {
cerr << "[ ";
for (const auto &x : v)
dmp<pair<S, T>>(x);
cerr << "]\n";
}
#pragma endregion template
int main() {
int N;
scanf("%d", &N);
map<str, ll> mp;
str tmp;
rep(i, N) {
cin >> tmp;
Sort(tmp);
mp[tmp]++;
}
ll ans = 0;
for (auto &&[k, v] : mp) {
ans += v * (v - 1) / 2;
}
cout << ans << '\n';
return 0;
}
|
[] | 746,779
| 746,780
|
u368735320
|
cpp
|
p02947
|
#pragma region template
#ifdef ONLINE_JUDGE
#pragma GCC target("avx2")
#pragma GCC optimize("tree-vectorize")
#pragma GCC diagnostic ignored "-Wunused-result"
#define here
#define cprint(vec)
#define com(msg)
#define obs(...)
#define local(x)
#define alter(x, y) y
#else
#define here cerr << __func__ << '/' << __LINE__ << ": reached\n"
#define cprint(vec) dmp(vec)
#define com(msg) cerr << "{ " << msg << " }\n"
#define obs(...) observe(#__VA_ARGS__, __VA_ARGS__)
#define local(x) x
#define alter(x, y) x
#endif
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define brep(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; i++)
#define rrep(i, n) for (int i = (n)-1, now = 0; i >= 0; i--, now++)
#define xrep(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define yes(n) cout << ((n) ? YES : NO) << '\n'
#define cco(...) prints(__VA_ARGS__)
#define fout cout << fixed << setprecision(15)
#define Sort(v) sort(all(v))
#define rSort(v) sort(rall(v))
#define Rev(v) reverse(all(v))
#define Unique(v) (v).erase(unique(all(v)), (v).end())
#define in_range(x, a, b) ((a) <= (x) && (x) < (b))
#define in_area(x, y, a, b) (0 <= (x) && 0 <= (y) && (x) < (a) && (y) < (b))
#define eb emplace_back
using namespace std;
using ll = long long;
using ld = long double;
using pt = pair<int, int>;
using ull = unsigned long long;
using str = string;
using vbl = vector<bool>;
using dqbl = deque<bool>;
using vint = vector<int>;
using vll = vector<long long>;
using vdb = vector<double>;
using vld = vector<long double>;
using vpt = vector<pair<int, int>>;
using vstr = vector<string>;
using vvdb = vector<vector<double>>;
using vvbl = vector<vector<bool>>;
using vdqbl = vector<deque<bool>>;
using vvint = vector<vector<int>>;
using vvll = vector<vector<long long>>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-9;
constexpr int dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dx[] = {0, 1, 0, -1, -1, 1, 1, -1};
// --- functions which take 1 argument --- //
template <class T> int sgn(const T &x) { return (x > 0) - (x < 0); }
template <class S, class T> int digit(S x, const T &b = 10) {
int r = 1;
while ((x /= b) >= 1)
r++;
return r;
}
template <class T> double degToRad(const T &a) { return a / 180.0 * M_PI; }
template <class T> double radToDeg(const T &a) { return a / M_PI * 180.0; }
template <class T> long long factorial(const T &n) {
if (n == 0)
return 1;
long long r = 1;
brep(i, 2, n) r *= i;
return r;
}
template <class T> bool isPrime(const T &n) {
T i = 2;
while (i * i <= n) {
if (n % i == 0 && n != i)
return 0;
i++;
}
return 1;
}
template <class T> map<T, T> factorize(T n) {
map<T, T> r;
for (T i = 2; i * i <= n; i++) {
while (n % i == 0) {
r[i]++;
n /= i;
}
}
if (n != 1)
r[n] = 1;
return r;
}
template <class T> vector<T> divisor(const T &n) {
vector<T> r;
for (T i = 1; i * i <= n; i++) {
if (!(n % i)) {
r.eb(i);
if (i * i != n)
r.eb(n / i);
}
}
return r;
}
// --- functions which take more than 1 argument --- //
template <class S, class T> bool chmax(S &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class S, class T> bool chmin(S &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class S, class T> bool near(const S &a, const T &b) {
return abs(a - b) < EPS;
}
template <class S, class T> long long bpow(S m, T n) {
long long r = 1;
while (n > 0) {
if (n & 1)
r *= m;
m *= m;
n /= 2;
}
return r;
}
template <class S, class T>
typename common_type<S, T>::type min(const S &m, const T &n) {
return min((typename common_type<S, T>::type)m,
(typename common_type<S, T>::type)n);
}
template <class S, class T>
typename common_type<S, T>::type max(const S &m, const T &n) {
return max((typename common_type<S, T>::type)m,
(typename common_type<S, T>::type)n);
}
template <class S, class T>
typename common_type<S, T>::type nPr(const S &n, const T &k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
brep(i, n - k + 1, n) r *= i;
return r;
}
template <class S, class T>
typename common_type<S, T>::type nCr(const S &n, T k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
k = min(k, n - k);
brep(i, n - k + 1, n) r *= i;
return r / factorial(k);
}
template <class T> void prints(const T &v) { cout << v << '\n'; }
template <class S, class... T> void prints(const S &v, const T &...w) {
cout << v << ' ';
prints(w...);
}
// --- functions which take vector/deque as argument --- //
template <class T> void printD(const vector<T> &v, string d) {
rep(i, sz(v) - 1) cout << v[i] << d;
cout << *v.rbegin() << '\n';
}
template <class T> void printD(const vector<vector<T>> &v, string d) {
for (const auto &x : v)
printD(x, d);
}
template <class T> bool in(const T &k, const vector<T> &v) {
return find(all(v), k) != v.end();
}
bool in(const int &k, const vector<long long> &v) {
return find(all(v), k) != v.end();
}
bool in(const long long &k, const vector<int> &v) {
return find(all(v), k) != v.end();
}
bool in(const char &k, const string &v) { return find(all(v), k) != v.end(); }
bool in(const char *k, const vector<string> &v) {
return find(all(v), k) != v.end();
}
template <class T> double veclen(const vector<T> &v) {
return sqrt(reduce(all(v), 0.0, [](T s, T v) { return s += v * v; }));
}
template <class T> T min(const vector<T> &v) { return *min_element(all(v)); }
template <class T> T max(const vector<T> &v) { return *max_element(all(v)); }
template <class T> T sum(const vector<T> &v) { return reduce(all(v), (T)0); }
template <class T> T gcd(const vector<T> &v) {
T r = v[0];
brep(i, 1, (int)v.size() - 1) r = gcd(r, v[i]);
return r;
}
template <class T> T lcm(const vector<T> &v) {
T r = v[0];
brep(i, 1, (int)v.size() - 1) r = lcm(r, v[i]);
return r;
}
template <class T> T vectorAdd(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] + v[i];
return r;
}
template <class T> T vectorSubtract(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] - v[i];
return r;
}
template <class T> T vectorMultiply(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] * v[i];
return r;
}
template <class T> T vectorDivide(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] / v[i];
return r;
}
template <class T> T dotProduct(const deque<bool> &u, const vector<T> &v) {
T r = 0;
rep(i, u.size()) if (u[i]) r += v[i];
return r;
}
template <class S, class T>
typename common_type<S, T>::type dotProduct(const vector<S> &u,
const vector<T> &v) {
T r = 0;
rep(i, u.size()) r += u[i] * v[i];
return r;
}
template <class S, class T> void sortBySecond(vector<pair<S, T>> &v) {
sort(all(v), [](auto L, auto R) { return L.second < R.second; });
}
// --- functions which take set/map as argument --- //
template <class T> T min(const set<T> &v) { return *min_element(all(v)); }
template <class T> T max(const set<T> &v) { return *max_element(all(v)); }
template <class T> T sum(const set<T> &v) { return reduce(all(v), (T)0); }
template <class T> T gcd(const set<T> &v) {
T r = 0;
for (const T &x : v)
r = (r == 0) ? x : gcd(r, x);
return r;
}
template <class T> T lcm(const set<T> &v) {
T r = 0;
for (const T &x : v)
r = (r == 0) ? x : lcm(r, x);
return r;
}
template <class T> bool in(const T &k, const set<T> &v) {
return find(all(v), k) != v.end();
}
template <class S, class T> pair<S, T> min(const map<S, T> &m) {
pair<S, T> r = *m.begin();
for (const auto &p : m)
if (chmin(r.second, p.second))
r = p;
return r;
}
template <class S, class T> pair<S, T> max(const map<S, T> &m) {
pair<S, T> r = *m.begin();
for (const auto &p : m)
if (chmax(r.second, p.second))
r = p;
return r;
}
// --- functions for debugging --- //
template <class T> void observe(const char *n, T &&v) {
cerr << n << ": " << v << '\n';
}
template <class S, class... T> void observe(const char *n, S &&v, T &&...w) {
const char *c = strchr(n + 1, ',');
cerr.write(n, c - n) << ": " << v << " |";
observe(c + 1, w...);
}
template <class T> void dmp(const vector<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class T> void dmp(const deque<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class T> void dmp(const set<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class P> void dmp(const P &p) {
cerr << "{ " << p.first << ' ' << p.second << " } ";
}
template <class T> void dmp(const vector<vector<T>> &v) {
for (const auto &x : v)
dmp<T>(x);
}
template <class T> void dmp(const vector<deque<T>> &v) {
for (const auto &x : v)
dmp<T>(x);
}
template <class S, class T> void dmp(const map<S, T> &m) {
cerr << "[ ";
for (const auto &p : m)
cerr << "{ " << p.first << ", " << p.second << " } ";
cerr << "]\n";
}
template <class S, class T> void dmp(const vector<pair<S, T>> &v) {
cerr << "[ ";
for (const auto &x : v)
dmp<pair<S, T>>(x);
cerr << "]\n";
}
#pragma endregion template
int main() {
int N;
scanf("%d", &N);
map<str, int> mp;
str tmp;
rep(i, N) {
cin >> tmp;
Sort(tmp);
mp[tmp]++;
}
int ans = 0;
for (auto &&[k, v] : mp) {
ans += v * (v - 1) / 2;
}
cout << ans << '\n';
return 0;
}
|
#pragma region template
#ifdef ONLINE_JUDGE
#pragma GCC target("avx2")
#pragma GCC optimize("tree-vectorize")
#pragma GCC diagnostic ignored "-Wunused-result"
#define here
#define cprint(vec)
#define com(msg)
#define obs(...)
#define local(x)
#define alter(x, y) y
#else
#define here cerr << __func__ << '/' << __LINE__ << ": reached\n"
#define cprint(vec) dmp(vec)
#define com(msg) cerr << "{ " << msg << " }\n"
#define obs(...) observe(#__VA_ARGS__, __VA_ARGS__)
#define local(x) x
#define alter(x, y) x
#endif
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define brep(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; i++)
#define rrep(i, n) for (int i = (n)-1, now = 0; i >= 0; i--, now++)
#define xrep(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define yes(n) cout << ((n) ? YES : NO) << '\n'
#define cco(...) prints(__VA_ARGS__)
#define fout cout << fixed << setprecision(15)
#define Sort(v) sort(all(v))
#define rSort(v) sort(rall(v))
#define Rev(v) reverse(all(v))
#define Unique(v) (v).erase(unique(all(v)), (v).end())
#define in_range(x, a, b) ((a) <= (x) && (x) < (b))
#define in_area(x, y, a, b) (0 <= (x) && 0 <= (y) && (x) < (a) && (y) < (b))
#define eb emplace_back
using namespace std;
using ll = long long;
using ld = long double;
using pt = pair<int, int>;
using ull = unsigned long long;
using str = string;
using vbl = vector<bool>;
using dqbl = deque<bool>;
using vint = vector<int>;
using vll = vector<long long>;
using vdb = vector<double>;
using vld = vector<long double>;
using vpt = vector<pair<int, int>>;
using vstr = vector<string>;
using vvdb = vector<vector<double>>;
using vvbl = vector<vector<bool>>;
using vdqbl = vector<deque<bool>>;
using vvint = vector<vector<int>>;
using vvll = vector<vector<long long>>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-9;
constexpr int dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dx[] = {0, 1, 0, -1, -1, 1, 1, -1};
// --- functions which take 1 argument --- //
template <class T> int sgn(const T &x) { return (x > 0) - (x < 0); }
template <class S, class T> int digit(S x, const T &b = 10) {
int r = 1;
while ((x /= b) >= 1)
r++;
return r;
}
template <class T> double degToRad(const T &a) { return a / 180.0 * M_PI; }
template <class T> double radToDeg(const T &a) { return a / M_PI * 180.0; }
template <class T> long long factorial(const T &n) {
if (n == 0)
return 1;
long long r = 1;
brep(i, 2, n) r *= i;
return r;
}
template <class T> bool isPrime(const T &n) {
T i = 2;
while (i * i <= n) {
if (n % i == 0 && n != i)
return 0;
i++;
}
return 1;
}
template <class T> map<T, T> factorize(T n) {
map<T, T> r;
for (T i = 2; i * i <= n; i++) {
while (n % i == 0) {
r[i]++;
n /= i;
}
}
if (n != 1)
r[n] = 1;
return r;
}
template <class T> vector<T> divisor(const T &n) {
vector<T> r;
for (T i = 1; i * i <= n; i++) {
if (!(n % i)) {
r.eb(i);
if (i * i != n)
r.eb(n / i);
}
}
return r;
}
// --- functions which take more than 1 argument --- //
template <class S, class T> bool chmax(S &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class S, class T> bool chmin(S &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class S, class T> bool near(const S &a, const T &b) {
return abs(a - b) < EPS;
}
template <class S, class T> long long bpow(S m, T n) {
long long r = 1;
while (n > 0) {
if (n & 1)
r *= m;
m *= m;
n /= 2;
}
return r;
}
template <class S, class T>
typename common_type<S, T>::type min(const S &m, const T &n) {
return min((typename common_type<S, T>::type)m,
(typename common_type<S, T>::type)n);
}
template <class S, class T>
typename common_type<S, T>::type max(const S &m, const T &n) {
return max((typename common_type<S, T>::type)m,
(typename common_type<S, T>::type)n);
}
template <class S, class T>
typename common_type<S, T>::type nPr(const S &n, const T &k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
brep(i, n - k + 1, n) r *= i;
return r;
}
template <class S, class T>
typename common_type<S, T>::type nCr(const S &n, T k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
k = min(k, n - k);
brep(i, n - k + 1, n) r *= i;
return r / factorial(k);
}
template <class T> void prints(const T &v) { cout << v << '\n'; }
template <class S, class... T> void prints(const S &v, const T &...w) {
cout << v << ' ';
prints(w...);
}
// --- functions which take vector/deque as argument --- //
template <class T> void printD(const vector<T> &v, string d) {
rep(i, sz(v) - 1) cout << v[i] << d;
cout << *v.rbegin() << '\n';
}
template <class T> void printD(const vector<vector<T>> &v, string d) {
for (const auto &x : v)
printD(x, d);
}
template <class T> bool in(const T &k, const vector<T> &v) {
return find(all(v), k) != v.end();
}
bool in(const int &k, const vector<long long> &v) {
return find(all(v), k) != v.end();
}
bool in(const long long &k, const vector<int> &v) {
return find(all(v), k) != v.end();
}
bool in(const char &k, const string &v) { return find(all(v), k) != v.end(); }
bool in(const char *k, const vector<string> &v) {
return find(all(v), k) != v.end();
}
template <class T> double veclen(const vector<T> &v) {
return sqrt(reduce(all(v), 0.0, [](T s, T v) { return s += v * v; }));
}
template <class T> T min(const vector<T> &v) { return *min_element(all(v)); }
template <class T> T max(const vector<T> &v) { return *max_element(all(v)); }
template <class T> T sum(const vector<T> &v) { return reduce(all(v), (T)0); }
template <class T> T gcd(const vector<T> &v) {
T r = v[0];
brep(i, 1, (int)v.size() - 1) r = gcd(r, v[i]);
return r;
}
template <class T> T lcm(const vector<T> &v) {
T r = v[0];
brep(i, 1, (int)v.size() - 1) r = lcm(r, v[i]);
return r;
}
template <class T> T vectorAdd(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] + v[i];
return r;
}
template <class T> T vectorSubtract(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] - v[i];
return r;
}
template <class T> T vectorMultiply(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] * v[i];
return r;
}
template <class T> T vectorDivide(const T &u, const T &v) {
T r(u.size());
rep(i, u.size()) r[i] = u[i] / v[i];
return r;
}
template <class T> T dotProduct(const deque<bool> &u, const vector<T> &v) {
T r = 0;
rep(i, u.size()) if (u[i]) r += v[i];
return r;
}
template <class S, class T>
typename common_type<S, T>::type dotProduct(const vector<S> &u,
const vector<T> &v) {
T r = 0;
rep(i, u.size()) r += u[i] * v[i];
return r;
}
template <class S, class T> void sortBySecond(vector<pair<S, T>> &v) {
sort(all(v), [](auto L, auto R) { return L.second < R.second; });
}
// --- functions which take set/map as argument --- //
template <class T> T min(const set<T> &v) { return *min_element(all(v)); }
template <class T> T max(const set<T> &v) { return *max_element(all(v)); }
template <class T> T sum(const set<T> &v) { return reduce(all(v), (T)0); }
template <class T> T gcd(const set<T> &v) {
T r = 0;
for (const T &x : v)
r = (r == 0) ? x : gcd(r, x);
return r;
}
template <class T> T lcm(const set<T> &v) {
T r = 0;
for (const T &x : v)
r = (r == 0) ? x : lcm(r, x);
return r;
}
template <class T> bool in(const T &k, const set<T> &v) {
return find(all(v), k) != v.end();
}
template <class S, class T> pair<S, T> min(const map<S, T> &m) {
pair<S, T> r = *m.begin();
for (const auto &p : m)
if (chmin(r.second, p.second))
r = p;
return r;
}
template <class S, class T> pair<S, T> max(const map<S, T> &m) {
pair<S, T> r = *m.begin();
for (const auto &p : m)
if (chmax(r.second, p.second))
r = p;
return r;
}
// --- functions for debugging --- //
template <class T> void observe(const char *n, T &&v) {
cerr << n << ": " << v << '\n';
}
template <class S, class... T> void observe(const char *n, S &&v, T &&...w) {
const char *c = strchr(n + 1, ',');
cerr.write(n, c - n) << ": " << v << " |";
observe(c + 1, w...);
}
template <class T> void dmp(const vector<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class T> void dmp(const deque<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class T> void dmp(const set<T> &v) {
cerr << "[ ";
for (const T &x : v)
cerr << x << ' ';
cerr << "]\n";
}
template <class P> void dmp(const P &p) {
cerr << "{ " << p.first << ' ' << p.second << " } ";
}
template <class T> void dmp(const vector<vector<T>> &v) {
for (const auto &x : v)
dmp<T>(x);
}
template <class T> void dmp(const vector<deque<T>> &v) {
for (const auto &x : v)
dmp<T>(x);
}
template <class S, class T> void dmp(const map<S, T> &m) {
cerr << "[ ";
for (const auto &p : m)
cerr << "{ " << p.first << ", " << p.second << " } ";
cerr << "]\n";
}
template <class S, class T> void dmp(const vector<pair<S, T>> &v) {
cerr << "[ ";
for (const auto &x : v)
dmp<pair<S, T>>(x);
cerr << "]\n";
}
#pragma endregion template
int main() {
int N;
scanf("%d", &N);
map<str, ll> mp;
str tmp;
rep(i, N) {
cin >> tmp;
Sort(tmp);
mp[tmp]++;
}
ll ans = 0;
for (auto &&[k, v] : mp) {
ans += v * (v - 1) / 2;
}
cout << ans << '\n';
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,781
| 746,780
|
u368735320
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++)
#define brep(i, a, b) for (ll i = (a), i##_len = (b); i <= i##_len; i++)
#define rrep(i, n) \
ll i = (n); \
ll now = -1; \
while (i-- && (now++ || 1))
#define xrep(i, n) for (ll i = 1, i##_len = (n); i <= i##_len; i++)
#define Yes(n) cout << ((n) ? YES : NO) << '\n'
#define rYes(n) \
cout << ((n) ? YES : NO) << '\n'; \
return
#define co(n) cout << (n) << '\n'
#define rco(n) \
cout << (n) << '\n'; \
return
#define Sort(v) sort(all(v))
#define rSort(v) \
sort(all(v)); \
reverse(all(v))
#define Unique(v) (v).erase(unique(all(v)), (v).end())
#define eb emplace_back
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vbl = vector<bool>;
using vint = vector<int>;
using vvll = vector<vll>;
using vstr = vector<string>;
const ll INF = 1e18;
// --- functions which take 1 argument ---
static inline void ignore_ret(int x) { x++; }
template <class T> inline int sgn(T x) { return (x > 0) - (x < 0); }
template <class T> inline ll factorial(T n) {
if (n == 0)
return 1;
ll r = 1;
for (T i = 2; i <= n; i++)
r *= i;
return r;
}
template <class T> inline map<T, T> factorize(T n) {
map<T, T> r;
for (T i = 2; i * i <= n; i++) {
while (n % i == 0) {
r[i]++;
n /= i;
}
}
if (n != 1)
r[n] = 1;
return r;
}
template <class T> inline vector<T> divisor(T n) {
vector<T> r;
for (T i = 1; i * i <= n; i++) {
if (!(n % i)) {
r.eb(i);
if (i * i != n)
r.eb(n / i);
}
}
Sort(r);
return r;
}
// --- functions which take 2 arguments ---
template <class T> inline bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline T nPr(T n, T k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
for (T i = n - k + 1; i <= n; i++)
r *= i;
return r;
}
template <class T> inline T nCr(T n, T k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
k = min(k, n - k);
for (T i = n - k + 1; i <= n; i++)
r *= i;
return r / factorial(k);
}
// --- functions which take vector(s) as argument(s) ---
template <class T> inline void print(T v) {
cout << "[ ";
for (auto x : v)
cout << x << ' ';
cout << "]\n";
}
template <class T> inline void print_d(T v) {
for (auto x : v)
cout << x;
cout << '\n';
}
template <class T> inline void print_all(T v) {
for (auto x : v)
cout << x << '\n';
}
template <class T> inline T min(vector<T> v) { return *min_element(all(v)); }
template <class T> inline T max(vector<T> v) { return *max_element(all(v)); }
template <class T> inline ll sum(T v) { return reduce(all(v), 0LL); }
template <class T> inline T gcd(vector<T> v) {
T r = v[0];
for (T i = 1; i < v.size(); i++)
r = gcd(r, v[i]);
return r;
}
template <class T> inline T lcm(vector<T> v) {
T r = v[0];
for (T i = 1; i < v.size(); i++)
r = lcm(r, v[i]);
return r;
}
template <class T> inline double abs(vector<T> v) {
return sqrt(reduce(all(v), 0.0, [](T s, T v) { return s += v * v; }));
}
template <class T> inline T vector_add(T u, T v) {
ll s = u.size();
if (s > v.size())
return {};
T r;
rep(i, s) r.eb(u[i] + v[i]);
return r;
}
template <class T> inline T vector_subtract(T u, T v) {
ll s = u.size();
if (s > v.size())
return {};
T r;
rep(i, s) r.eb(u[i] - v[i]);
return r;
}
template <class T> inline T dot_product(vector<T> u, vector<T> v) {
if (u.size() < v.size())
return 0;
T r = 0;
for (T i = 0; i < u.size(); i++)
r += u[i] * v[i];
return r;
}
template <class T> inline T cross_product(T u, T v) {
T r(3);
r[0] = u[1] * v[2] - u[2] * v[1];
r[1] = u[2] * v[0] - u[0] * v[2];
r[2] = u[0] * v[1] - u[1] * v[0];
return r;
}
// --- functions which take set(s) as argument(s) ---
template <class T> inline T min(set<T> v) { return *min_element(all(v)); }
template <class T> inline T max(set<T> v) { return *max_element(all(v)); }
template <class T> inline T gcd(set<T> v) {
T r = 0;
for (T x : v)
r = (r == 0) ? x : gcd(r, x);
return r;
}
template <class T> inline T lcm(set<T> v) {
T r = 0;
for (T x : v)
r = (r == 0) ? x : lcm(r, x);
return r;
}
// --- Template ends here ---
void solve(vector<string> s) {
ll ans = 0;
unordered_map<string, int> mp;
for (auto x : s) {
Sort(x);
mp[x]++;
}
for (auto x : mp) {
ans += (x.second - 1) * x.second / 2;
}
cout << ans << '\n';
}
int main() {
ll N;
ignore_ret(scanf("%lld", &N));
vector<string> s(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
}
solve(move(s));
return 0;
}
|
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; i++)
#define brep(i, a, b) for (ll i = (a), i##_len = (b); i <= i##_len; i++)
#define rrep(i, n) \
ll i = (n); \
ll now = -1; \
while (i-- && (now++ || 1))
#define xrep(i, n) for (ll i = 1, i##_len = (n); i <= i##_len; i++)
#define Yes(n) cout << ((n) ? YES : NO) << '\n'
#define rYes(n) \
cout << ((n) ? YES : NO) << '\n'; \
return
#define co(n) cout << (n) << '\n'
#define rco(n) \
cout << (n) << '\n'; \
return
#define Sort(v) sort(all(v))
#define rSort(v) \
sort(all(v)); \
reverse(all(v))
#define Unique(v) (v).erase(unique(all(v)), (v).end())
#define eb emplace_back
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vbl = vector<bool>;
using vint = vector<int>;
using vvll = vector<vll>;
using vstr = vector<string>;
const ll INF = 1e18;
// --- functions which take 1 argument ---
static inline void ignore_ret(int x) { x++; }
template <class T> inline int sgn(T x) { return (x > 0) - (x < 0); }
template <class T> inline ll factorial(T n) {
if (n == 0)
return 1;
ll r = 1;
for (T i = 2; i <= n; i++)
r *= i;
return r;
}
template <class T> inline map<T, T> factorize(T n) {
map<T, T> r;
for (T i = 2; i * i <= n; i++) {
while (n % i == 0) {
r[i]++;
n /= i;
}
}
if (n != 1)
r[n] = 1;
return r;
}
template <class T> inline vector<T> divisor(T n) {
vector<T> r;
for (T i = 1; i * i <= n; i++) {
if (!(n % i)) {
r.eb(i);
if (i * i != n)
r.eb(n / i);
}
}
Sort(r);
return r;
}
// --- functions which take 2 arguments ---
template <class T> inline bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline T nPr(T n, T k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
for (T i = n - k + 1; i <= n; i++)
r *= i;
return r;
}
template <class T> inline T nCr(T n, T k) {
if (n < k || n < 0 || k < 0)
return 0;
T r = 1;
k = min(k, n - k);
for (T i = n - k + 1; i <= n; i++)
r *= i;
return r / factorial(k);
}
// --- functions which take vector(s) as argument(s) ---
template <class T> inline void print(T v) {
cout << "[ ";
for (auto x : v)
cout << x << ' ';
cout << "]\n";
}
template <class T> inline void print_d(T v) {
for (auto x : v)
cout << x;
cout << '\n';
}
template <class T> inline void print_all(T v) {
for (auto x : v)
cout << x << '\n';
}
template <class T> inline T min(vector<T> v) { return *min_element(all(v)); }
template <class T> inline T max(vector<T> v) { return *max_element(all(v)); }
template <class T> inline ll sum(T v) { return reduce(all(v), 0LL); }
template <class T> inline T gcd(vector<T> v) {
T r = v[0];
for (T i = 1; i < v.size(); i++)
r = gcd(r, v[i]);
return r;
}
template <class T> inline T lcm(vector<T> v) {
T r = v[0];
for (T i = 1; i < v.size(); i++)
r = lcm(r, v[i]);
return r;
}
template <class T> inline double abs(vector<T> v) {
return sqrt(reduce(all(v), 0.0, [](T s, T v) { return s += v * v; }));
}
template <class T> inline T vector_add(T u, T v) {
ll s = u.size();
if (s > v.size())
return {};
T r;
rep(i, s) r.eb(u[i] + v[i]);
return r;
}
template <class T> inline T vector_subtract(T u, T v) {
ll s = u.size();
if (s > v.size())
return {};
T r;
rep(i, s) r.eb(u[i] - v[i]);
return r;
}
template <class T> inline T dot_product(vector<T> u, vector<T> v) {
if (u.size() < v.size())
return 0;
T r = 0;
for (T i = 0; i < u.size(); i++)
r += u[i] * v[i];
return r;
}
template <class T> inline T cross_product(T u, T v) {
T r(3);
r[0] = u[1] * v[2] - u[2] * v[1];
r[1] = u[2] * v[0] - u[0] * v[2];
r[2] = u[0] * v[1] - u[1] * v[0];
return r;
}
// --- functions which take set(s) as argument(s) ---
template <class T> inline T min(set<T> v) { return *min_element(all(v)); }
template <class T> inline T max(set<T> v) { return *max_element(all(v)); }
template <class T> inline T gcd(set<T> v) {
T r = 0;
for (T x : v)
r = (r == 0) ? x : gcd(r, x);
return r;
}
template <class T> inline T lcm(set<T> v) {
T r = 0;
for (T x : v)
r = (r == 0) ? x : lcm(r, x);
return r;
}
// --- Template ends here ---
void solve(vector<string> s) {
ll ans = 0;
unordered_map<string, ll> mp;
for (auto x : s) {
Sort(x);
mp[x]++;
}
for (auto x : mp) {
ans += (x.second - 1) * x.second / 2;
}
cout << ans << '\n';
}
int main() {
ll N;
ignore_ret(scanf("%lld", &N));
vector<string> s(N);
for (int i = 0; i < N; i++) {
cin >> s[i];
}
solve(move(s));
return 0;
}
|
[] | 746,782
| 746,783
|
u368735320
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = 1; i <= (n); i++)
#define drep(i, n) for (int i = (n)-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define rng(a) a.begin(), a.end()
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n + 1);
rep(i, n) {
cin >> s[i];
sort(rng(s[i]));
}
sort(rng(s));
ll ans = 0;
int cnt = 1;
rep(i, n) {
if (s[i] != s[i + 1]) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
continue;
}
cnt++;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = 1; i <= (n); i++)
#define drep(i, n) for (int i = (n)-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define rng(a) a.begin(), a.end()
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(rng(s[i]));
}
sort(rng(s));
ll ans = 0;
ll cnt = 1;
rep(i, n) {
if (s[i] != s[i + 1]) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
continue;
}
cnt++;
}
cout << ans << endl;
return 0;
}
|
[
"expression.operation.binary.remove",
"variable_declaration.type.change"
] | 746,784
| 746,785
|
u651197500
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = 1; i <= (n); i++)
#define drep(i, n) for (int i = (n)-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define rng(a) a.begin(), a.end()
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(rng(s[i]));
}
sort(rng(s));
ll ans = 0;
int cnt = 1;
rep(i, n - 1) {
if (s[i] != s[i + 1]) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
continue;
}
cnt++;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = 1; i <= (n); i++)
#define drep(i, n) for (int i = (n)-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define rng(a) a.begin(), a.end()
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(rng(s[i]));
}
sort(rng(s));
ll ans = 0;
ll cnt = 1;
rep(i, n) {
if (s[i] != s[i + 1]) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
continue;
}
cnt++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"expression.operation.binary.remove"
] | 746,786
| 746,785
|
u651197500
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = 1; i <= (n); i++)
#define drep(i, n) for (int i = (n)-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define rng(a) a.begin(), a.end()
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(rng(s[i]));
}
sort(rng(s));
ll ans = 0;
int cnt = 1;
rep(i, n) {
if (s[i] != s[i + 1]) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
continue;
}
cnt++;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = 1; i <= (n); i++)
#define drep(i, n) for (int i = (n)-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define rng(a) a.begin(), a.end()
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) {
cin >> s[i];
sort(rng(s[i]));
}
sort(rng(s));
ll ans = 0;
ll cnt = 1;
rep(i, n) {
if (s[i] != s[i + 1]) {
ans += cnt * (cnt - 1) / 2;
cnt = 1;
continue;
}
cnt++;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,787
| 746,785
|
u651197500
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
using namespace std;
using ll = long long;
/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/
ll gcd(ll a, ll b) {
if (a < b) {
return gcd(b, a);
}
while (b != 0) {
ll tmp = b;
b = a % b;
a = tmp;
}
return a;
}
struct Data {
int r, l, k;
};
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int N;
cin >> N;
map<string, int> M;
loop(0, N, i) {
string S;
cin >> S;
sort(S.begin(), S.end());
if (M.find(S) != M.end()) {
M[S] = M[S] + 1;
} else {
M[S] = 1;
}
}
ll sum = 0;
for (auto &x : M) {
if (x.second == 1) {
continue;
}
sum += x.second * (x.second - 1) / 2;
}
print(sum);
}
|
#include <bits/stdc++.h>
#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
using namespace std;
using ll = long long;
/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/
ll gcd(ll a, ll b) {
if (a < b) {
return gcd(b, a);
}
while (b != 0) {
ll tmp = b;
b = a % b;
a = tmp;
}
return a;
}
struct Data {
int r, l, k;
};
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int N;
cin >> N;
map<string, ll> M;
loop(0, N, i) {
string S;
cin >> S;
sort(S.begin(), S.end());
if (M.find(S) != M.end()) {
M[S] = M[S] + 1;
} else {
M[S] = 1;
}
}
ll sum = 0;
for (auto &x : M) {
if (x.second == 1) {
continue;
}
sum += x.second * (x.second - 1) / 2;
}
print(sum);
}
|
[] | 746,792
| 746,793
|
u111653921
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }
int main() {
int N;
cin >> N;
ll ans = 0;
vector<string> sss(N);
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
sss[i] = s;
}
sort(sss.begin(), sss.end());
int cnt = 0;
rep(i, N - 1) {
if (sss[i] == sss[i + 1])
cnt++;
else {
if (cnt > 0)
ans += cnt * (cnt + 1) / 2;
cnt = 0;
}
}
if (cnt != 0)
ans += cnt * (cnt + 1) / 2;
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }
int main() {
int N;
cin >> N;
ll ans = 0;
vector<string> sss(N);
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
sss[i] = s;
}
sort(sss.begin(), sss.end());
ll cnt = 0;
rep(i, N - 1) {
if (sss[i] == sss[i + 1])
cnt++;
else {
if (cnt > 0)
ans += cnt * (cnt + 1) / 2;
cnt = 0;
}
}
if (cnt != 0)
ans += cnt * (cnt + 1) / 2;
cout << ans << endl;
return 0;
}
|
[
"preprocessor.define.value.change",
"variable_declaration.type.change"
] | 746,796
| 746,797
|
u941353203
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }
int main() {
int N;
cin >> N;
int ans = 0;
vector<string> sss(N);
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
sss[i] = s;
}
sort(sss.begin(), sss.end());
int cnt = 0;
rep(i, N - 1) {
if (sss[i] == sss[i + 1])
cnt++;
else {
if (cnt > 0)
ans += cnt * (cnt + 1) / 2;
cnt = 0;
}
}
if (cnt != 0)
ans += cnt * (cnt + 1) / 2;
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }
int main() {
int N;
cin >> N;
ll ans = 0;
vector<string> sss(N);
rep(i, N) {
string s;
cin >> s;
sort(s.begin(), s.end());
sss[i] = s;
}
sort(sss.begin(), sss.end());
ll cnt = 0;
rep(i, N - 1) {
if (sss[i] == sss[i + 1])
cnt++;
else {
if (cnt > 0)
ans += cnt * (cnt + 1) / 2;
cnt = 0;
}
}
if (cnt != 0)
ans += cnt * (cnt + 1) / 2;
cout << ans << endl;
return 0;
}
|
[
"preprocessor.define.value.change",
"variable_declaration.type.change"
] | 746,798
| 746,797
|
u941353203
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) { cin >> s[i]; }
rep(i, n) { sort(s[i].begin(), s[i].end()); }
sort(s.begin(), s.end());
string first = s[0];
int num = 0;
ll ans = 0;
rep(i, n) {
if (first == s[i]) {
num++;
} else if (i != n - 1) {
first = s[i];
ans += num * (num - 1) / 2;
num = 1;
}
if (i == n - 1) {
ans += num * (num - 1) / 2;
}
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) { cin >> s[i]; }
rep(i, n) { sort(s[i].begin(), s[i].end()); }
sort(s.begin(), s.end());
string first = s[0];
ll num = 0;
ll ans = 0;
rep(i, n) {
if (first == s[i]) {
num++;
} else if (i != n - 1) {
first = s[i];
ans += num * (num - 1) / 2;
num = 1;
}
if (i == n - 1) {
ans += num * (num - 1) / 2;
}
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,799
| 746,800
|
u446766335
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) { cin >> s[i]; }
rep(i, n) { sort(s[i].begin(), s[i].end()); }
sort(s.begin(), s.end());
string first = s[0];
int num = 0;
int ans = 0;
rep(i, n) {
if (first == s[i]) {
num++;
} else if (i != n - 1) {
first = s[i];
ans += num * (num - 1) / 2;
num = 1;
}
if (i == n - 1) {
ans += num * (num - 1) / 2;
}
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
int main() {
int n;
cin >> n;
vector<string> s(n);
rep(i, n) { cin >> s[i]; }
rep(i, n) { sort(s[i].begin(), s[i].end()); }
sort(s.begin(), s.end());
string first = s[0];
ll num = 0;
ll ans = 0;
rep(i, n) {
if (first == s[i]) {
num++;
} else if (i != n - 1) {
first = s[i];
ans += num * (num - 1) / 2;
num = 1;
}
if (i == n - 1) {
ans += num * (num - 1) / 2;
}
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,801
| 746,800
|
u446766335
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int64_t ans = 0;
map<string, int> memo;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
memo[s]++;
}
for (auto x : memo) {
int tmp = x.second;
ans += tmp * (tmp - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int64_t ans = 0;
map<string, int64_t> memo;
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
memo[s]++;
}
for (auto x : memo) {
int64_t tmp = x.second;
ans += tmp * (tmp - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,803
| 746,804
|
u735528230
|
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());
}
unordered_map<string, int> num;
int ans = 0;
for (int i = 0; i < n; i++) {
ans += num[s[i]];
num[s[i]]++;
}
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());
}
unordered_map<string, long long> num;
long long ans = 0;
for (int i = 0; i < n; i++) {
ans += num[s[i]];
num[s[i]]++;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,816
| 746,817
|
u105533331
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto p : mp) {
int s = p.second;
ans += s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
unordered_map<string, int> mp;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
long long ans = 0;
for (auto p : mp) {
int s = p.second;
ans += (long long)s * (s - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 746,818
| 746,819
|
u550014122
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, int> count;
for (int i = 0; i < N; ++i) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
++count[s.at(i)];
}
int64_t sum = 0;
for (auto s : count) {
int t = s.second;
sum = sum + (t * (t - 1) / 2);
}
cout << sum << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> s(N);
map<string, int> count;
for (int i = 0; i < N; ++i) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
++count[s.at(i)];
}
int64_t sum = 0;
for (auto s : count) {
int64_t t = s.second;
sum = sum + (t * (t - 1) / 2);
}
cout << sum << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,820
| 746,821
|
u304862095
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
rep(i, (int)v.size()) {
if (i)
os << ",";
os << v[i];
}
os << "}";
return os;
}
template <typename T, size_t S> void printArray(const T (&array)[S]) {
for (auto val : array)
std::cout << val << ", ";
std::cout << "\n";
}
const int mod = 1e9 + 7;
const int inf = 1e9 + 5;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << std::setprecision(10);
int n;
std::cin >> n;
map<string, int> cnt;
rep(i, n) {
string s;
std::cin >> s;
sort(rng(s));
cnt[s]++;
}
ll ans = 0;
for (auto &p : cnt)
if (p.se > 1) {
ans += p.se * (p.se - 1) / 2;
}
std::cout << ans << "\n";
}
|
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << "(" << p.first << "," << p.second << ")";
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << "{";
rep(i, (int)v.size()) {
if (i)
os << ",";
os << v[i];
}
os << "}";
return os;
}
template <typename T, size_t S> void printArray(const T (&array)[S]) {
for (auto val : array)
std::cout << val << ", ";
std::cout << "\n";
}
const int mod = 1e9 + 7;
const int inf = 1e9 + 5;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << std::setprecision(10);
int n;
std::cin >> n;
map<string, ll> cnt;
rep(i, n) {
string s;
std::cin >> s;
sort(rng(s));
cnt[s]++;
}
ll ans = 0;
for (auto &p : cnt)
if (p.se > 1) {
ans += p.se * (p.se - 1) / 2;
}
std::cout << ans << "\n";
}
|
[] | 746,822
| 746,823
|
u700484101
|
cpp
|
p02947
|
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
const int mod = 1e9 + 7;
const int inf = 1e9;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;
struct edge {
ll from, to, cost;
};
int main() {
int n;
cin >> n;
vector<string> s;
for (int i = 0; i < n; i++) {
string k;
cin >> k;
sort(k.begin(), k.end());
s.push_back(k);
}
sort(s.begin(), s.end());
string tmp = s[0];
int cnt = 1;
ll ans = 0;
int a = 1;
while (true) {
if (cnt == n) {
ans += (a * (a - 1)) / 2;
break;
}
if (tmp == s[cnt]) {
a++;
} else {
ans += (a * (a - 1)) / 2;
tmp = s[cnt];
a = 1;
}
cnt++;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
const int mod = 1e9 + 7;
const int inf = 1e9;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;
struct edge {
ll from, to, cost;
};
int main() {
int n;
cin >> n;
vector<string> s;
for (int i = 0; i < n; i++) {
string k;
cin >> k;
sort(k.begin(), k.end());
s.push_back(k);
}
sort(s.begin(), s.end());
string tmp = s[0];
int cnt = 1;
ll ans = 0;
ll a = 1;
while (true) {
if (cnt == n) {
ans += ((a * (a - 1)) / 2);
break;
}
if (tmp == s[cnt]) {
a++;
} else {
ans += ((a * (a - 1)) / 2);
tmp = s[cnt];
a = 1;
}
cnt++;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,824
| 746,825
|
u883323885
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
map<string, int> smap;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
++smap[s];
}
ll ans = 0;
for (auto a : smap) {
int t = a.second;
ans += (t * (t - 1) / 2);
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
int n;
cin >> n;
map<string, int> smap;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
++smap[s];
}
ll ans = 0;
for (auto a : smap) {
int t = a.second;
ans += ((ll)t * (t - 1) / 2);
}
cout << ans << endl;
}
|
[
"type_conversion.add"
] | 746,826
| 746,827
|
u989306199
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
string S;
map<string, int> T;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> S;
sort(S.begin(), S.end());
T[S]++;
}
ll ans = 0;
for (auto &b : T) {
int a = b.second;
ans += ll((a) * (a - 1) / 2);
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
string S;
map<string, ll> T;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> S;
sort(S.begin(), S.end());
T[S]++;
}
ll ans = 0;
for (auto &b : T) {
ll a = b.second;
ans += (a) * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change",
"call.remove",
"call.arguments.change"
] | 746,830
| 746,831
|
u699600793
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
string S;
map<string, int> T;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> S;
sort(S.begin(), S.end());
T[S]++;
}
ll ans = 0;
for (auto &b : T) {
int a = b.second;
ans += (a) * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
string S;
map<string, ll> T;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> S;
sort(S.begin(), S.end());
T[S]++;
}
ll ans = 0;
for (auto &b : T) {
ll a = b.second;
ans += (a) * (a - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,832
| 746,831
|
u699600793
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
string s[100005];
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n;
cin >> n;
map<string, int> anagrams;
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (anagrams.count(s[i])) {
anagrams[s[i]]++;
} else
anagrams[s[i]] = 1;
}
long long cnt = 0;
for (auto x : anagrams) {
cnt += (x.second * (x.second - 1)) / 2;
}
cout << cnt << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string s[100005];
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n;
cin >> n;
unordered_map<string, long long> anagrams;
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (anagrams.count(s[i])) {
anagrams[s[i]]++;
} else
anagrams[s[i]] = 1;
}
long long cnt = 0;
for (auto x : anagrams) {
cnt += (x.second * (x.second - 1)) / 2;
}
cout << cnt << '\n';
return 0;
}
|
[
"variable_declaration.type.change",
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,842
| 746,843
|
u194015723
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
string s[100005];
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n;
cin >> n;
map<string, int> anagrams;
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (anagrams.count(s[i])) {
anagrams[s[i]]++;
} else
anagrams[s[i]] = 1;
}
long long cnt = 0;
for (auto x : anagrams) {
cnt += (x.second * (x.second - 1)) / 2;
}
cout << cnt << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
string s[100005];
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n;
cin >> n;
map<string, long long> anagrams;
for (int i = 0; i < n; ++i) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
if (anagrams.count(s[i])) {
anagrams[s[i]]++;
} else
anagrams[s[i]] = 1;
}
long long cnt = 0;
for (auto x : anagrams) {
cnt += (x.second * (x.second - 1)) / 2;
}
cout << cnt << '\n';
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,842
| 746,844
|
u194015723
|
cpp
|
p02947
|
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <limits> //setprecision
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <utility> // pair, make_pair
#include <vector> // vector
//#include <cstdio> // printf
#include <cmath> //abs,,,
#include <deque> // deque
#include <map> // map
#include <math.h> //pow,,,
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
// It is so troublesome that I include bits/stdc++.h !
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 100100100100100100;
const int MOD = 1000000007;
typedef pair<bool, long long> P;
// NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
if (M == 0)
return 1;
long long res = mod_pow((N * N) % MOD, M / 2);
//最下位ビット(*N)が1の時は単独でNをかける
if (M & 1)
res = (res * N) % MOD;
return res %= MOD;
}
int main() {
int N;
cin >> N;
string T;
set<string> S;
map<string, int> A;
long long ans = 0;
for (int i = 0; i < N; i++) {
cin >> T;
sort(T.begin(), T.end());
S.insert(T);
if (A[T] == 0)
A[T] = 1;
else
A[T]++;
}
for (auto R : S) {
ans += (A[R]) * (A[R] - 1) / 2;
}
cout << ans << endl;
// PLEASE GIVE ME THE "ACCEPTED" !
}
|
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <limits> //setprecision
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <utility> // pair, make_pair
#include <vector> // vector
//#include <cstdio> // printf
#include <cmath> //abs,,,
#include <deque> // deque
#include <map> // map
#include <math.h> //pow,,,
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
// It is so troublesome that I include bits/stdc++.h !
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 100100100100100100;
const int MOD = 1000000007;
typedef pair<bool, long long> P;
// NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
if (M == 0)
return 1;
long long res = mod_pow((N * N) % MOD, M / 2);
//最下位ビット(*N)が1の時は単独でNをかける
if (M & 1)
res = (res * N) % MOD;
return res %= MOD;
}
int main() {
int N;
cin >> N;
string T;
set<string> S;
map<string, long long> A;
long long ans = 0;
for (int i = 0; i < N; i++) {
cin >> T;
sort(T.begin(), T.end());
S.insert(T);
if (A[T] == 0)
A[T] = 1;
else
A[T]++;
}
for (auto R : S) {
ans += (A[R]) * (A[R] - 1) / 2;
}
cout << ans << endl;
// PLEASE GIVE ME THE "ACCEPTED" !
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,847
| 746,848
|
u590927341
|
cpp
|
p02947
|
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <limits> //setprecision
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <utility> // pair, make_pair
#include <vector> // vector
//#include <cstdio> // printf
#include <cmath> //abs,,,
#include <deque> // deque
#include <map> // map
#include <math.h> //pow,,,
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
// It is so troublesome that I include bits/stdc++.h !
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 100100100100100100;
const int MOD = 1000000007;
typedef pair<bool, long long> P;
// NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
if (M == 0)
return 1;
long long res = mod_pow((N * N) % MOD, M / 2);
//最下位ビット(*N)が1の時は単独でNをかける
if (M & 1)
res = (res * N) % MOD;
return res %= MOD;
}
int main() {
int N;
cin >> N;
string T;
set<string> S;
map<string, int> A;
long long ans = 0;
for (int i = 0; i < N; i++) {
cin >> T;
sort(T.begin(), T.end());
S.insert(T);
if (A[T] == 0)
A[T] = 1;
else
A[T]++;
}
for (auto R : S) {
ans += (A[R]) * (A[R] - 1) / 2;
}
cout << ans / 2 << endl;
// PLEASE GIVE ME THE "ACCEPTED" !
}
|
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <limits> //setprecision
#include <string> // string, to_string, stoi
#include <tuple> // tuple, make_tuple
#include <utility> // pair, make_pair
#include <vector> // vector
//#include <cstdio> // printf
#include <cmath> //abs,,,
#include <deque> // deque
#include <map> // map
#include <math.h> //pow,,,
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
// It is so troublesome that I include bits/stdc++.h !
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const long long INF = 100100100100100100;
const int MOD = 1000000007;
typedef pair<bool, long long> P;
// NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
if (M == 0)
return 1;
long long res = mod_pow((N * N) % MOD, M / 2);
//最下位ビット(*N)が1の時は単独でNをかける
if (M & 1)
res = (res * N) % MOD;
return res %= MOD;
}
int main() {
int N;
cin >> N;
string T;
set<string> S;
map<string, long long> A;
long long ans = 0;
for (int i = 0; i < N; i++) {
cin >> T;
sort(T.begin(), T.end());
S.insert(T);
if (A[T] == 0)
A[T] = 1;
else
A[T]++;
}
for (auto R : S) {
ans += (A[R]) * (A[R] - 1) / 2;
}
cout << ans << endl;
// PLEASE GIVE ME THE "ACCEPTED" !
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"expression.operation.binary.remove"
] | 746,849
| 746,848
|
u590927341
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vecl = vector<ll>;
using Graph = vector<vector<int>>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
ll ans = 0;
cin >> N;
vector<string> str(N);
REP(i, N) {
cin >> str.at(i);
sort(str.at(i).begin(), str.at(i).end());
}
sort(str.begin(), str.end());
int tmp = 1;
for (int j = 1; j < N; j++) {
if (str.at(j) == str.at(j - 1))
tmp++;
else {
ans += (tmp * (tmp - 1)) / 2;
tmp = 1;
}
}
ans += (tmp * (tmp - 1)) / 2;
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vecl = vector<ll>;
using Graph = vector<vector<int>>;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
ll ans = 0;
cin >> N;
vector<string> str(N);
REP(i, N) {
cin >> str.at(i);
sort(str.at(i).begin(), str.at(i).end());
}
sort(str.begin(), str.end());
ll tmp = 1;
for (int j = 1; j < N; j++) {
if (str.at(j) == str.at(j - 1))
tmp++;
else {
ans += (tmp * (tmp - 1)) / 2;
tmp = 1;
}
}
ans += (tmp * (tmp - 1)) / 2;
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,854
| 746,855
|
u847969825
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
int func(int a) {
int sum = 0;
for (int i = 1; i <= a - 1; i++) {
sum += i;
}
return sum;
}
int main() {
int n;
int sum = 0;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
map<string, int> mp;
for (int i = 0; i < n; i++) {
mp[s.at(i)] += 1;
}
for (auto i : mp) {
if (i.second > 1) {
// cout << i.first << endl;
// cout << i.second << endl;
sum += func(i.second);
// cout << sum << endl;
}
}
cout << sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
ll func(ll a) {
ll sum = 0;
for (int i = 1; i <= a - 1; i++) {
sum += i;
}
return sum;
}
int main() {
int n;
ll sum = 0;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
map<string, ll> mp;
for (int i = 0; i < n; i++) {
mp[s.at(i)] += 1;
}
for (auto i : mp) {
if (i.second > 1) {
// cout << i.first << endl;
// cout << i.second << endl;
sum += func(i.second);
// cout << sum << endl;
}
}
cout << sum << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,856
| 746,857
|
u489603283
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = 1e18;
ll MOD = 1e9 + 7;
int main() {
ll N;
cin >> N;
map<string, ll> M;
for (ll i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
M[S]++;
}
ll ans = 0;
for (auto m : M) {
if (m.second == 1)
ans++;
else
ans += (m.second * (m.second - 1)) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = 1e18;
ll MOD = 1e9 + 7;
int main() {
ll N;
cin >> N;
map<string, ll> M;
for (ll i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
M[S]++;
}
ll ans = 0;
for (auto m : M) {
if (m.second == 1)
continue;
else
ans += (m.second * (m.second - 1)) / 2;
}
cout << ans << endl;
}
|
[] | 746,858
| 746,859
|
u521973174
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007
// cout << (c)?"Yay!":":(" << endl;
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string a;
cin >> a;
SORT(a);
mp[a]++;
}
long long int sum = 0;
// cout << mp.size() << endl;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
sum += itr->second * (itr->second - 1) / 2;
}
cout << sum << endl;
return 0;
}
|
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define MOD 1000000007
// cout << (c)?"Yay!":":(" << endl;
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;
int main() {
int n;
cin >> n;
map<string, long long int> mp;
rep(i, n) {
string a;
cin >> a;
SORT(a);
mp[a]++;
}
long long int sum = 0;
// cout << mp.size() << endl;
for (auto itr = mp.begin(); itr != mp.end(); itr++) {
sum += itr->second * (itr->second - 1) / 2;
}
cout << sum << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,860
| 746,861
|
u393086221
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main() {
int n;
cin >> n;
map<string, ll> mp;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
int s = p.second;
ans += s * (s - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main() {
int n;
cin >> n;
map<string, ll> mp;
rep(i, n) {
string s;
cin >> s;
sort(ALL(s));
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
int s = p.second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans << endl;
}
|
[
"type_conversion.add"
] | 746,869
| 746,870
|
u455067221
|
cpp
|
p02947
|
// Template //
#include <bits/stdc++.h>
using namespace std;
// マクロ //
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)
#define db(i) cout << #i << " = " << i;
// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vpii = vector<pii>;
using msi = map<string, int>;
// 関数 //
template <class T> lint gcd(T a, T b) {
int t;
while (b != 0) {
t = a % b;
a = b;
b = t;
}
return a;
}
template <class T> lint lcm(T a, T b) { return a * b / gcd(a, b); }
double distance(pii a, pii b) {
double dist;
dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
return dist;
}
lint perm(int a) {
lint perm = 1;
for (int i = a; i >= 1; i--) {
perm *= i;
}
return perm;
}
lint combination(int n, int m) {
long double c = 1;
for (int i = n, k = 1; i > m; i--, k++) {
c *= i;
c /= k;
}
return (lint)c;
}
template <class T, class Q> inline bool chmin(T &a, Q b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T, class Q> inline bool chmax(T &a, Q b) {
if (a < b) {
a = b;
return true;
}
return false;
}
// 定数 //
const double pi = acos(-1);
const int mod = 1000000007;
const int MOD = 998244353;
const int inf = 1045141919;
const lint linf = ((1LL << 62) - 1);
// キーワード //
#define elif else if
// End of Template //
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
int N;
cin >> N;
string s;
msi appear;
rep(i, N) {
cin >> s;
sort(s);
if (appear.count(s)) {
appear[s]++;
} else {
appear[s] = 1;
}
}
lint ana = 0;
for (auto x : appear) {
ana += x.second * (x.second - 1) / 2;
}
cou(ana);
}
|
// Template //
#include <bits/stdc++.h>
using namespace std;
// マクロ //
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)
#define db(i) cout << #i << " = " << i;
// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vpii = vector<pii>;
using msi = map<string, int>;
// 関数 //
template <class T> lint gcd(T a, T b) {
int t;
while (b != 0) {
t = a % b;
a = b;
b = t;
}
return a;
}
template <class T> lint lcm(T a, T b) { return a * b / gcd(a, b); }
double distance(pii a, pii b) {
double dist;
dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
return dist;
}
lint perm(int a) {
lint perm = 1;
for (int i = a; i >= 1; i--) {
perm *= i;
}
return perm;
}
lint combination(int n, int m) {
long double c = 1;
for (int i = n, k = 1; i > m; i--, k++) {
c *= i;
c /= k;
}
return (lint)c;
}
template <class T, class Q> inline bool chmin(T &a, Q b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T, class Q> inline bool chmax(T &a, Q b) {
if (a < b) {
a = b;
return true;
}
return false;
}
// 定数 //
const double pi = acos(-1);
const int mod = 1000000007;
const int MOD = 998244353;
const int inf = 1045141919;
const lint linf = ((1LL << 62) - 1);
// キーワード //
#define elif else if
// End of Template //
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
int N;
cin >> N;
string s;
map<string, lint> appear;
rep(i, N) {
cin >> s;
sort(s);
if (appear.count(s)) {
appear[s]++;
} else {
appear[s] = 1;
}
}
lint ana = 0;
for (auto x : appear) {
ana += x.second * (x.second - 1) / 2;
}
cou(ana);
}
|
[
"variable_declaration.type.change"
] | 746,871
| 746,872
|
u073983440
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
int x = p.second;
ans += x * (x - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto p : mp) {
ll x = p.second;
ans += x * (x - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,873
| 746,874
|
u194930818
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;
constexpr int MOD = 1000000007;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<map<char, int>, int> dict;
rep(_, 0, n) {
string s;
cin >> s;
map<char, int> d;
rep(i, 0, s.size()) { ++d[s[i]]; }
++dict[d];
}
ll ans = 0;
for (auto elem : dict) {
ans += elem.second * (elem.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;
constexpr int MOD = 1000000007;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<map<char, ll>, ll> dict;
rep(_, 0, n) {
string s;
cin >> s;
map<char, ll> d;
rep(i, 0, s.size()) { ++d[s[i]]; }
++dict[d];
}
ll ans = 0;
for (auto elem : dict) {
ans += elem.second * (elem.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,875
| 746,876
|
u955627293
|
cpp
|
p02947
|
#include <iostream>
using namespace std;
#include <iomanip>
void _130() {
int w, h, x, y;
cin >> w >> h >> x >> y;
cout << fixed << setprecision(10);
cout << (double)w * h / 2 << " " << (2 * x == w && 2 * y == h) << endl;
}
void _131() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long count = 0;
for (long long i = a; i <= b; ++i) {
if (i % c != 0 && i % d != 0) {
count++;
}
}
cout << count << endl;
}
#include <cmath>
void _131_() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long min_baisuu;
for (long long i = min(c, d); i <= c * d; ++i) {
if (i % c == 0 && i % d == 0) {
min_baisuu = i;
cout << min_baisuu << endl;
break;
}
}
long long c_baisuu_num = 0;
long long d_baisuu_num = 0;
long long cd_baisuu_num = 0;
c_baisuu_num = abs(a / c - b / c);
d_baisuu_num = abs(a / d - b / d);
cd_baisuu_num = abs(a / min_baisuu - b / min_baisuu);
cout << abs(a - b) + 1 - (c_baisuu_num + d_baisuu_num - cd_baisuu_num)
<< endl;
}
void _131__() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long min_baisuu = 0;
long long max_yakusuu = 0;
long long amari = 0;
long long bigger = max(c, d);
long long smaller = min(c, d);
while (true) {
amari = bigger % smaller;
if (amari == 0) {
max_yakusuu = smaller;
break;
}
bigger = smaller;
smaller = amari;
}
// cout << max_yakusuu << endl;
min_baisuu = c * d / max_yakusuu;
long long b_num = b - b / c - b / d + b / min_baisuu;
long long a_num = a - 1 - (a - 1) / c - (a - 1) / d + (a - 1) / min_baisuu;
// cout << b_num << " " << a_num << endl;
cout << b_num - a_num << endl;
}
#include <algorithm>
#include <vector>
void _132() {
int n;
cin >> n;
vector<int> d;
int tmp;
for (int i = 0; i < n; ++i) {
cin >> tmp;
d.push_back(tmp);
}
sort(d.begin(), d.end());
if (d.size() % 2 == 1) {
cout << 0 << endl;
return;
}
int half_index = d.size() / 2 - 1;
cout << d[half_index + 1] - d[half_index] << endl;
}
void _133() {
int l, r;
cin >> l >> r;
if (r - l > 2019) {
cout << 0 << endl;
return;
}
int min_mod = 2019;
long long multi;
long long mod;
for (int i = l; i <= r; ++i) {
for (int j = i + 1; j <= r; ++j) {
multi = (long long)i * j;
// multi = i * j;
cout << multi << endl;
mod = multi % 2019;
// cout << i << " " << j << " " << mod <<endl;
if (mod < min_mod) {
min_mod = mod;
// cout << min_mod << endl;
}
}
}
cout << min_mod << endl;
}
#include <algorithm>
#include <vector>
void _134() {
int n;
cin >> n;
int tmp;
vector<int> a;
for (int i = 0; i < n; ++i) {
cin >> tmp;
a.push_back(tmp);
}
vector<int> b(a);
sort(b.begin(), b.end());
for (int i = 0; i < n; ++i) {
if (a[i] == b[n - 1])
cout << b[n - 2] << endl;
else
cout << b[n - 1] << endl;
}
}
void _135() {
int n;
int a[100001];
int b[100000];
cin >> n;
for (int i = 0; i < n + 1; ++i)
cin >> a[i];
for (int i = 0; i < n; ++i)
cin >> b[i];
int residual_capa = 0;
long long count = 0;
int nokori = 0;
for (int i = 0; i < n; ++i) {
nokori = max(0, a[i] - residual_capa);
if (nokori == 0) {
count += a[i];
residual_capa = b[i];
} else {
nokori = max(0, nokori - b[i]);
// cout << nokori << endl;
if (nokori == 0) {
count += a[i];
residual_capa = b[i] - (a[i] - residual_capa);
} else {
count += residual_capa + b[i];
residual_capa = 0;
}
}
// cout << residual_capa << " " << count << endl;
}
count += min(residual_capa, a[n]);
cout << count << endl;
}
void _136() {
int n, h[100000];
cin >> n;
for (int i = 0; i < n; ++i)
cin >> h[i];
bool flag = false;
int current = h[n - 1];
for (int i = n - 1; i > 0; --i) {
// cout << h[i - 1] << " " << current << endl;
if (h[i - 1] <= current) {
current = h[i - 1];
} else if (h[i - 1] - 1 == current) {
current = h[i - 1] - 1;
} else {
flag = true;
break;
}
}
if (flag == true)
cout << "No" << endl;
else
cout << "Yes" << endl;
}
#include <string>
#include <unordered_map>
#if 0
void count_char(string s, vector<map<char, int> > &data) {
map<char, int> tmp;
for (int i = 0; i < s.size(); ++i) {
if (map.ke)
}
}
#endif
void _137() {
#if 0
// char test[] = "cab";
// vector<char> a;
string a("cab");
// for (int i = 0; i < 3; ++i)
// a.push_back(test[i]);
sort(a.begin(), a.end());
cout << a << endl;
#endif
#if 1
int n;
cin >> n;
string s;
unordered_map<string, int> data;
int count = 0;
int anagram_count = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
count = data[s];
if (count != 0) {
anagram_count += count;
}
data[s] = count + 1;
}
cout << anagram_count << endl;
#endif
}
int main() {
_137();
return 0;
}
|
#include <iostream>
using namespace std;
#include <iomanip>
void _130() {
int w, h, x, y;
cin >> w >> h >> x >> y;
cout << fixed << setprecision(10);
cout << (double)w * h / 2 << " " << (2 * x == w && 2 * y == h) << endl;
}
void _131() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long count = 0;
for (long long i = a; i <= b; ++i) {
if (i % c != 0 && i % d != 0) {
count++;
}
}
cout << count << endl;
}
#include <cmath>
void _131_() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long min_baisuu;
for (long long i = min(c, d); i <= c * d; ++i) {
if (i % c == 0 && i % d == 0) {
min_baisuu = i;
cout << min_baisuu << endl;
break;
}
}
long long c_baisuu_num = 0;
long long d_baisuu_num = 0;
long long cd_baisuu_num = 0;
c_baisuu_num = abs(a / c - b / c);
d_baisuu_num = abs(a / d - b / d);
cd_baisuu_num = abs(a / min_baisuu - b / min_baisuu);
cout << abs(a - b) + 1 - (c_baisuu_num + d_baisuu_num - cd_baisuu_num)
<< endl;
}
void _131__() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long min_baisuu = 0;
long long max_yakusuu = 0;
long long amari = 0;
long long bigger = max(c, d);
long long smaller = min(c, d);
while (true) {
amari = bigger % smaller;
if (amari == 0) {
max_yakusuu = smaller;
break;
}
bigger = smaller;
smaller = amari;
}
// cout << max_yakusuu << endl;
min_baisuu = c * d / max_yakusuu;
long long b_num = b - b / c - b / d + b / min_baisuu;
long long a_num = a - 1 - (a - 1) / c - (a - 1) / d + (a - 1) / min_baisuu;
// cout << b_num << " " << a_num << endl;
cout << b_num - a_num << endl;
}
#include <algorithm>
#include <vector>
void _132() {
int n;
cin >> n;
vector<int> d;
int tmp;
for (int i = 0; i < n; ++i) {
cin >> tmp;
d.push_back(tmp);
}
sort(d.begin(), d.end());
if (d.size() % 2 == 1) {
cout << 0 << endl;
return;
}
int half_index = d.size() / 2 - 1;
cout << d[half_index + 1] - d[half_index] << endl;
}
void _133() {
int l, r;
cin >> l >> r;
if (r - l > 2019) {
cout << 0 << endl;
return;
}
int min_mod = 2019;
long long multi;
long long mod;
for (int i = l; i <= r; ++i) {
for (int j = i + 1; j <= r; ++j) {
multi = (long long)i * j;
// multi = i * j;
cout << multi << endl;
mod = multi % 2019;
// cout << i << " " << j << " " << mod <<endl;
if (mod < min_mod) {
min_mod = mod;
// cout << min_mod << endl;
}
}
}
cout << min_mod << endl;
}
#include <algorithm>
#include <vector>
void _134() {
int n;
cin >> n;
int tmp;
vector<int> a;
for (int i = 0; i < n; ++i) {
cin >> tmp;
a.push_back(tmp);
}
vector<int> b(a);
sort(b.begin(), b.end());
for (int i = 0; i < n; ++i) {
if (a[i] == b[n - 1])
cout << b[n - 2] << endl;
else
cout << b[n - 1] << endl;
}
}
void _135() {
int n;
int a[100001];
int b[100000];
cin >> n;
for (int i = 0; i < n + 1; ++i)
cin >> a[i];
for (int i = 0; i < n; ++i)
cin >> b[i];
int residual_capa = 0;
long long count = 0;
int nokori = 0;
for (int i = 0; i < n; ++i) {
nokori = max(0, a[i] - residual_capa);
if (nokori == 0) {
count += a[i];
residual_capa = b[i];
} else {
nokori = max(0, nokori - b[i]);
// cout << nokori << endl;
if (nokori == 0) {
count += a[i];
residual_capa = b[i] - (a[i] - residual_capa);
} else {
count += residual_capa + b[i];
residual_capa = 0;
}
}
// cout << residual_capa << " " << count << endl;
}
count += min(residual_capa, a[n]);
cout << count << endl;
}
void _136() {
int n, h[100000];
cin >> n;
for (int i = 0; i < n; ++i)
cin >> h[i];
bool flag = false;
int current = h[n - 1];
for (int i = n - 1; i > 0; --i) {
// cout << h[i - 1] << " " << current << endl;
if (h[i - 1] <= current) {
current = h[i - 1];
} else if (h[i - 1] - 1 == current) {
current = h[i - 1] - 1;
} else {
flag = true;
break;
}
}
if (flag == true)
cout << "No" << endl;
else
cout << "Yes" << endl;
}
#include <string>
#include <unordered_map>
#if 0
void count_char(string s, vector<map<char, int> > &data) {
map<char, int> tmp;
for (int i = 0; i < s.size(); ++i) {
if (map.ke)
}
}
#endif
void _137() {
#if 0
// char test[] = "cab";
// vector<char> a;
string a("cab");
// for (int i = 0; i < 3; ++i)
// a.push_back(test[i]);
sort(a.begin(), a.end());
cout << a << endl;
#endif
#if 1
int n;
cin >> n;
string s;
unordered_map<string, long long> data;
long long count = 0;
long long anagram_count = 0;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
count = data[s];
if (count != 0) {
anagram_count += count;
}
data[s] = count + 1;
}
cout << anagram_count << endl;
#endif
}
int main() {
_137();
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,877
| 746,878
|
u243740419
|
cpp
|
p02947
|
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
scanf("%d", &n);
char s[n + 1][11];
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (int i = 0; i < n; i++) {
sort(s[i], s[i] + 10);
}
string t[n];
for (int i = 0; i < n; i++) {
t[i] = s[i];
}
sort(t, t + n);
string u = t[0];
int ans = 0;
int num = 1;
for (int i = 1; i < n; i++) {
if (u == t[i])
num++;
else {
ans += (num * (num - 1)) / 2;
u = t[i];
num = 1;
}
}
ans += (num * (num - 1)) / 2;
printf("%d\n", ans);
}
|
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
scanf("%d", &n);
char s[n][11];
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (int i = 0; i < n; i++) {
sort(s[i], s[i] + 10);
}
string t[n];
for (int i = 0; i < n; i++) {
t[i] = s[i];
}
sort(t, t + n);
string u = t[0];
long int ans = 0;
long int num = 1;
for (int i = 1; i < n; i++) {
if (u == t[i])
num++;
else {
ans += (num * (num - 1)) / 2;
u = t[i];
num = 1;
}
}
ans += (num * (num - 1)) / 2;
printf("%ld\n", ans);
}
|
[
"expression.operation.binary.remove",
"variable_declaration.type.widen.change",
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 746,879
| 746,880
|
u416773418
|
cpp
|
p02947
|
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << (x) << endl
int main() {
int n;
cin >> n;
map<map<char, int>, int> list;
REP(i, n) {
map<char, int> str;
string t;
cin >> t;
REP(j, 10) { str[t[j]]++; }
list[str]++;
}
int count = 0;
for (const auto &i : list) {
int num = i.second;
if (i.second == 1)
continue;
else
count += ((num - 1) * num) / 2;
}
COUT(count);
return 0;
}
|
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << (x) << endl
int main() {
int n;
cin >> n;
map<map<char, int>, int> list;
REP(i, n) {
map<char, int> str;
string t;
cin >> t;
REP(j, 10) { str[t[j]]++; }
list[str]++;
}
ll count = 0;
for (const auto &i : list) {
ll num = i.second;
if (i.second == 1)
continue;
else
count += ((num - 1) * num) / 2;
}
COUT(count);
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,881
| 746,882
|
u459105164
|
cpp
|
p02947
|
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
string anagramize(string s) {
vector<char> v;
for (int i = 0; i < 10; i++) {
v.push_back(s[i]);
}
sort(v.begin(), v.end());
for (int i = 0; i < 10; i++) {
s[i] = v[i];
}
return s;
}
int main() {
int n;
long long ans = 0;
cin >> n;
map<string, int> m;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
m[anagramize(s)]++;
}
for (map<string, int>::iterator it = m.begin(); it != m.end(); it++) {
int k = it->second;
ans += k * (k - 1) / 2;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
string anagramize(string s) {
vector<char> v;
for (int i = 0; i < 10; i++) {
v.push_back(s[i]);
}
sort(v.begin(), v.end());
for (int i = 0; i < 10; i++) {
s[i] = v[i];
}
return s;
}
int main() {
int n;
long long ans = 0;
cin >> n;
map<string, int> m;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
m[anagramize(s)]++;
}
for (map<string, int>::iterator it = m.begin(); it != m.end(); it++) {
long long k = it->second;
ans += k * (k - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,883
| 746,884
|
u120050685
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
string s;
map<string, int> S;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (S.count(s)) {
S[s]++;
} else {
S[s] = 1;
}
}
ll ans = 0;
for (auto p : S) {
int N = p.second;
ans += N * (N - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
string s;
map<string, int> S;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (S.count(s)) {
S[s]++;
} else {
S[s] = 1;
}
}
ll ans = 0;
for (auto p : S) {
ll N = p.second;
ans += N * (N - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,885
| 746,886
|
u115927976
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
string s;
map<string, int> S;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (S.count(s)) {
S[s]++;
} else {
S[s] = 1;
}
}
int ans = 0;
for (auto p : S) {
int N = p.second;
ans += N * (N - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
cin >> N;
string s;
map<string, int> S;
for (int i = 0; i < N; i++) {
cin >> s;
sort(s.begin(), s.end());
if (S.count(s)) {
S[s]++;
} else {
S[s] = 1;
}
}
ll ans = 0;
for (auto p : S) {
ll N = p.second;
ans += N * (N - 1) / 2;
}
cout << ans << endl;
}
|
[
"variable_declaration.type.change"
] | 746,887
| 746,886
|
u115927976
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm = 1000000000;
ll MM = mm + 7;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int n;
cin >> n;
vector<vector<char>> s(n, vector<char>(10));
rep(i, n) {
rep(j, 10) { cin >> s.at(i).at(j); }
sort(s.at(i).begin(), s.at(i).end());
}
vector<string> w(n, "");
rep(i, n) {
rep(j, 10) { w.at(i).push_back(s.at(i).at(j)); }
}
map<string, int> cnt;
for (string x : w) {
if (cnt.count(x)) {
cnt.at(x)++;
} else {
cnt[x] = 1;
}
}
ll sum = 0;
for (auto y : cnt) {
int v = y.second;
sum += v * (v - 1) / 2;
}
cout << sum << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm = 1000000000;
ll MM = mm + 7;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int n;
cin >> n;
vector<vector<char>> s(n, vector<char>(10));
rep(i, n) {
rep(j, 10) { cin >> s.at(i).at(j); }
sort(s.at(i).begin(), s.at(i).end());
}
vector<string> w(n, "");
rep(i, n) {
rep(j, 10) { w.at(i).push_back(s.at(i).at(j)); }
}
map<string, ll> cnt;
for (string x : w) {
if (cnt.count(x)) {
cnt.at(x)++;
} else {
cnt[x] = 1;
}
}
ll sum = 0;
for (auto y : cnt) {
ll v = y.second;
sum += v * (v - 1) / 2;
}
cout << sum << endl;
}
|
[
"variable_declaration.type.change"
] | 746,888
| 746,889
|
u927053131
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define int long long int
signed combination(int n) { return (n * (n - 1)) / 2; }
signed main(void) {
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());
// for (int i=0;i<n;++i) cout << s[i] << endl;
int count = 1;
int ans = 0;
for (int i = 0; i < n - 1; i++) {
if (s[i + 1] == s[i])
count++;
else {
// nC2
ans += combination(count);
count = 1;
}
}
if (count != 1)
ans += combination(count);
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define int long long
long long combination(int n) { return (long long)(n * (n - 1)) / 2; }
signed main(void) {
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());
// for (int i=0;i<n;++i) cout << s[i] << endl;
int count = 1;
int ans = 0;
for (int i = 0; i < n - 1; i++) {
if (s[i + 1] == s[i])
count++;
else {
// nC2
ans += combination(count);
count = 1;
}
}
if (count != 1)
ans += combination(count);
cout << ans;
return 0;
}
|
[
"type_conversion.add"
] | 746,898
| 746,899
|
u576375251
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, c = 0;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
c += m[s]++;
}
cout << c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, c = 0;
cin >> n;
map<string, int> m;
for (int i = 0; i < n; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
c += m[s]++;
}
cout << c;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,900
| 746,901
|
u313970998
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size();
#define all(x) (x).begin(), (x).end()
#define Red \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Rep(i, a, b) for (int i = a; i <= b; i++)
#define pii pair<int, int>
typedef vector<int> vi;
typedef long long ll;
const int inf = int(1e9);
const int mod = 1e9 + 7;
const int N = (int)2e5 + 5;
void solve() {
int n;
cin >> n;
map<string, int> m;
while (n--) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
vi v;
for (auto i : m) {
if (i.S > 1) {
v.pb(i.S);
}
}
ll ans = 0;
for (int i = 0; i < (int)v.size(); i++) {
int sum = 0;
v[i]--;
while (v[i] != 0) {
sum += v[i];
--v[i];
}
ans += sum;
}
cout << ans;
}
int main() {
Red;
int t = 1;
// cin>>t;
while (t--)
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size();
#define all(x) (x).begin(), (x).end()
#define Red \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Rep(i, a, b) for (int i = a; i <= b; i++)
#define pii pair<int, int>
typedef vector<int> vi;
typedef long long ll;
const int inf = int(1e9);
const int mod = 1e9 + 7;
const int N = (int)2e5 + 5;
void solve() {
int n;
cin >> n;
map<string, int> m;
while (n--) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
vi v;
for (auto i : m) {
if (i.S > 1) {
v.pb(i.S);
}
}
ll ans = 0;
for (int i = 0; i < (int)v.size(); i++) {
ll sum = 0;
v[i]--;
while (v[i] != 0) {
sum += v[i];
--v[i];
}
ans += sum;
}
cout << ans;
}
int main() {
Red;
int t = 1;
// cin>>t;
while (t--)
solve();
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,905
| 746,906
|
u002627851
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size();
#define all(x) (x).begin(), (x).end()
#define Red \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Rep(i, a, b) for (int i = a; i <= b; i++)
#define pii pair<int, int>
typedef vector<int> vi;
typedef long long ll;
const int inf = int(1e9);
const int mod = 1e9 + 7;
const int N = (int)2e5 + 5;
void solve() {
int n;
cin >> n;
map<string, int> m;
while (n--) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
vi v;
for (auto i : m) {
if (i.S > 1) {
v.pb(i.S);
}
}
int ans = 0;
for (int i = 0; i < (int)v.size(); i++) {
int sum = 0;
v[i]--;
while (v[i] != 0) {
sum += v[i];
--v[i];
}
ans += sum;
}
cout << ans;
}
int main() {
Red;
int t = 1;
// cin>>t;
while (t--)
solve();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size();
#define all(x) (x).begin(), (x).end()
#define Red \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Rep(i, a, b) for (int i = a; i <= b; i++)
#define pii pair<int, int>
typedef vector<int> vi;
typedef long long ll;
const int inf = int(1e9);
const int mod = 1e9 + 7;
const int N = (int)2e5 + 5;
void solve() {
int n;
cin >> n;
map<string, int> m;
while (n--) {
string s;
cin >> s;
sort(all(s));
m[s]++;
}
vi v;
for (auto i : m) {
if (i.S > 1) {
v.pb(i.S);
}
}
ll ans = 0;
for (int i = 0; i < (int)v.size(); i++) {
ll sum = 0;
v[i]--;
while (v[i] != 0) {
sum += v[i];
--v[i];
}
ans += sum;
}
cout << ans;
}
int main() {
Red;
int t = 1;
// cin>>t;
while (t--)
solve();
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,907
| 746,906
|
u002627851
|
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 >= 0; i--)
#define FOR(i, m, n) for (int i = m; i <= n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const string YES = "Yes";
const string NO = "No";
const ll mod = 1e9 + 7;
int main() {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
string s;
map<string, int> dic;
REP(i, n) {
cin >> s;
sort(s.begin(), s.end());
dic[s]++;
}
ll ans = 0;
for (auto p : dic) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans;
return 0;
}
|
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i <= n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const string YES = "Yes";
const string NO = "No";
const ll mod = 1e9 + 7;
int main() {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
ll n;
cin >> n;
string s;
map<string, ll> dic;
REP(i, n) {
cin >> s;
sort(s.begin(), s.end());
dic[s]++;
}
ll ans = 0;
for (auto p : dic) {
ans += p.second * (p.second - 1) / 2;
}
cout << ans;
return 0;
}
|
[] | 746,908
| 746,909
|
u557565572
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define TIMER_S(start) \
chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) \
chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) \
cout \
<< static_cast<double>( \
chrono::duration_cast<chrono::microseconds>(end - start).count()) \
<< "ms" \
<< "\n";
int main() {
int n;
ll ans = 0;
cin >> n;
unordered_map<string, int> cnt;
REP(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (cnt.count(s))
cnt.at(s)++;
else
cnt[s] = 1;
}
// cout << "\n";
for (auto x : cnt) {
// cout << x.first << " " << x.second << "\n";
ans += (x.second - 1) * x.second / 2;
}
cout << ans << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define TIMER_S(start) \
chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) \
chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) \
cout \
<< static_cast<double>( \
chrono::duration_cast<chrono::microseconds>(end - start).count()) \
<< "ms" \
<< "\n";
int main() {
int n;
ll ans = 0;
cin >> n;
unordered_map<string, int> cnt;
REP(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (cnt.count(s))
cnt.at(s)++;
else
cnt[s] = 1;
}
// cout << "\n";
for (auto x : cnt) {
// cout << x.first << " " << x.second << "\n";
ans += (ll)(x.second - 1) * x.second / 2;
}
cout << ans << "\n";
return 0;
}
|
[] | 746,910
| 746,911
|
u517348254
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
using namespace std;
int main(void) {
long long a;
long long b;
string str;
vector<string> vec;
cin >> a;
for (int i = 0; i < a; i++) {
cin >> str;
sort(str.begin(), str.end());
vec.push_back(str);
}
sort(vec.begin(), vec.end());
str = vec.front();
int count = 0;
int ans = 0;
for (int i = 0; i < a; i++) {
if (vec[i] == str) {
count++;
} else {
if (count > 1) {
ans += count * (count - 1) / 2;
}
count = 1;
str = vec[i];
}
}
if (count > 1) {
ans += count * (count - 1) / 2;
}
cout << ans;
}
|
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
using namespace std;
int main(void) {
long long a;
long long b;
string str;
vector<string> vec;
cin >> a;
for (int i = 0; i < a; i++) {
cin >> str;
sort(str.begin(), str.end());
vec.push_back(str);
}
sort(vec.begin(), vec.end());
str = vec.front();
long long count = 0;
long long ans = 0;
for (int i = 0; i < a; i++) {
if (vec[i] == str) {
count++;
} else {
if (count > 1) {
ans += count * (count - 1) / 2;
}
count = 1;
str = vec[i];
}
}
if (count > 1) {
ans += count * (count - 1) / 2;
}
cout << ans;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,912
| 746,913
|
u192307314
|
cpp
|
p02947
|
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const ll LLINF = 1LL << 60;
/* -- template -- */
int main() {
int N;
cin >> N;
map<string, int> m;
string s;
rep(i, N) {
cin >> s;
sort(s.begin(), s.end());
m[s] += 1;
}
auto begin = m.begin(), end = m.end();
ll ans = 0;
for (auto iter = begin; iter != end; iter++) {
ans += (iter->second - 1) * (iter->second) / 2;
}
cout << ans << endl;
}
|
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const ll LLINF = 1LL << 60;
/* -- template -- */
int main() {
int N;
cin >> N;
map<string, ll> m;
string s;
rep(i, N) {
cin >> s;
sort(s.begin(), s.end());
m[s] += 1;
}
auto begin = m.begin(), end = m.end();
ll ans = 0;
for (auto iter = begin; iter != end; iter++) {
ans += (iter->second - 1) * (iter->second) / 2;
}
cout << ans << endl;
}
|
[] | 746,914
| 746,915
|
u275488634
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
ll comb(int now) {
ll res;
return (ll)now * (now - 1) / 2;
}
int main() {
int n;
cin >> n;
vector<string> a;
rep(i, n) {
string t;
cin >> t;
sort(t.begin(), t.end());
a.push_back(t);
}
sort(a.begin(), a.end());
int now = 1;
int ans = 0;
rep(i, n - 1) {
if (a[i] == a[i + 1]) {
now++;
} else {
ans += comb(now);
now = 1;
}
}
ans += comb(now);
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
ll comb(int now) {
ll res;
return (ll)now * (now - 1) / 2;
}
int main() {
int n;
cin >> n;
vector<string> a;
rep(i, n) {
string t;
cin >> t;
sort(t.begin(), t.end());
a.push_back(t);
}
sort(a.begin(), a.end());
int now = 1;
ll ans = 0;
rep(i, n - 1) {
if (a[i] == a[i + 1]) {
now++;
} else {
ans += comb(now);
now = 1;
}
}
ans += comb(now);
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,921
| 746,922
|
u045408189
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
ll comb(int now) {
ll res;
return now * (now - 1) / 2;
}
int main() {
int n;
cin >> n;
vector<string> a;
rep(i, n) {
string t;
cin >> t;
sort(t.begin(), t.end());
a.push_back(t);
}
sort(a.begin(), a.end());
int now = 1;
int ans = 0;
rep(i, n - 1) {
if (a[i] == a[i + 1]) {
now++;
} else {
ans += comb(now);
now = 1;
}
}
ans += comb(now);
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
ll comb(int now) {
ll res;
return (ll)now * (now - 1) / 2;
}
int main() {
int n;
cin >> n;
vector<string> a;
rep(i, n) {
string t;
cin >> t;
sort(t.begin(), t.end());
a.push_back(t);
}
sort(a.begin(), a.end());
int now = 1;
ll ans = 0;
rep(i, n - 1) {
if (a[i] == a[i + 1]) {
now++;
} else {
ans += comb(now);
now = 1;
}
}
ans += comb(now);
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,923
| 746,922
|
u045408189
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int N;
cin >> N;
map<string, ll> ans;
rep(i, N) {
string S;
cin >> S;
sort(S.begin(), S.end());
if (ans.count(S)) {
ans[S]++;
} else {
ans[S] = 1;
}
}
int count = 0;
for (auto res : ans) {
// cout << res.first << " " << res.second << endl;
if (res.second != 1)
count += (res.second - 1) * res.second / 2;
}
cout << count << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int N;
cin >> N;
map<string, ll> ans;
rep(i, N) {
string S;
cin >> S;
sort(S.begin(), S.end());
if (ans.count(S)) {
ans[S]++;
} else {
ans[S] = 1;
}
}
ll count = 0;
for (auto res : ans) {
// cout << res.first << " " << res.second << endl;
if (res.second != 1)
count += (res.second - 1) * res.second / 2;
}
cout << count << endl;
}
|
[
"variable_declaration.type.change"
] | 746,924
| 746,925
|
u446371873
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
ll mod = 1000000000 + 7;
int main() {
ll N;
cin >> N;
vs s(N);
for (ll i = 0; i < N; ++i) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
map<string, int> S;
for (ll i = 0; i < N; ++i) {
S[s.at(i)] += 1;
}
long long int sum = 0;
for (auto c : S) {
sum += c.second * (c.second - 1) / 2;
}
cout << sum << endl;
}
|
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
ll mod = 1000000000 + 7;
int main() {
ll N;
cin >> N;
vs s(N);
for (ll i = 0; i < N; ++i) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
map<string, long long int> S;
for (ll i = 0; i < N; ++i) {
S[s.at(i)] += 1;
}
long long int sum = 0;
for (auto c : S) {
sum += c.second * (c.second - 1) / 2;
}
cout << sum << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 746,926
| 746,927
|
u032437757
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
ll mod = 1000000000 + 7;
int main() {
ll N;
cin >> N;
vs s(N);
for (ll i = 0; i < N; ++i) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
map<string, int> S;
for (ll i = 0; i < N; ++i) {
S[s.at(i)] += 1;
}
ll sum = 0;
for (auto c : S) {
sum += c.second * (c.second - 1) / 2;
}
cout << sum << endl;
}
|
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
ll mod = 1000000000 + 7;
int main() {
ll N;
cin >> N;
vs s(N);
for (ll i = 0; i < N; ++i) {
cin >> s.at(i);
sort(s.at(i).begin(), s.at(i).end());
}
map<string, long long int> S;
for (ll i = 0; i < N; ++i) {
S[s.at(i)] += 1;
}
long long int sum = 0;
for (auto c : S) {
sum += c.second * (c.second - 1) / 2;
}
cout << sum << endl;
}
|
[
"variable_declaration.type.widen.change"
] | 746,928
| 746,927
|
u032437757
|
cpp
|
p02947
|
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
using namespace std;
using Graph = vector<vector<Int>>;
const double pi = M_PI;
const Int MOD = 1000000007;
int main() {
int n;
cin >> n;
Int ans = 0;
unordered_map<string, int> pairs;
string in;
for (int i = 0; i < n; i++) {
cin >> in;
sort(in.begin(), in.end());
if (!pairs.insert({in, 1}).second) {
pairs[in]++;
}
}
for (auto e : pairs) {
ans += e.second * (e.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
using namespace std;
using Graph = vector<vector<Int>>;
const double pi = M_PI;
const Int MOD = 1000000007;
int main() {
int n;
cin >> n;
Int ans = 0;
unordered_map<string, Int> pairs;
string in;
for (int i = 0; i < n; i++) {
cin >> in;
sort(in.begin(), in.end());
if (!pairs.insert({in, 1}).second) {
pairs[in]++;
}
}
for (auto e : pairs) {
ans += e.second * (e.second - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,929
| 746,930
|
u261538386
|
cpp
|
p02947
|
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
using namespace std;
using Graph = vector<vector<Int>>;
const double pi = M_PI;
const Int MOD = 1000000007;
int main() {
int n;
cin >> n;
Int ans = 0;
vector<int> pairs;
vector<string> s(n), sp;
string in;
for (int i = 0; i < n; i++) {
cin >> in;
sort(in.begin(), in.end());
s[i] = in;
in.clear();
}
sort(s.begin(), s.end());
// unique_copy(s.begin(), s.end(), back_inserter(sp));
// for (auto e : sp) {
// pairs.push_back(count(s.begin(), s.end(), e));
// }
for (int i = 0; i < n - 1; i++) {
int tem = 1;
while (i < n - 1) {
if (s[i] == s[i + 1]) {
tem++;
i++;
} else {
break;
}
}
pairs.push_back(tem);
}
for (auto e : pairs) {
ans += e * (e - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
using namespace std;
using Graph = vector<vector<Int>>;
const double pi = M_PI;
const Int MOD = 1000000007;
int main() {
int n;
cin >> n;
Int ans = 0;
vector<Int> pairs;
vector<string> s(n), sp;
string in;
for (int i = 0; i < n; i++) {
cin >> in;
sort(in.begin(), in.end());
s[i] = in;
in.clear();
}
sort(s.begin(), s.end());
// unique_copy(s.begin(), s.end(), back_inserter(sp));
// for (auto e : sp) {
// pairs.push_back(count(s.begin(), s.end(), e));
// }
for (int i = 0; i < n - 1; i++) {
int tem = 1;
while (i < n - 1) {
if (s[i] == s[i + 1]) {
tem++;
i++;
} else {
break;
}
}
pairs.push_back(tem);
}
for (auto e : pairs) {
ans += e * (e - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[] | 746,931
| 746,932
|
u261538386
|
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> k;
rep(i, n) {
string s;
cin >> s;
rep(i, 10) {
rep(j, i) {
if (s[i] < s[j])
swap(s[i], s[j]);
}
}
k[s]++;
}
int64_t ans = 0;
// Keyの値が小さい順にループ
for (auto p : k) {
auto key = p.first;
auto value = p.second;
ans += value * (value - 1) / 2;
// key, valueを使う
}
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;
map<string, int64_t> k;
rep(i, n) {
string s;
cin >> s;
rep(i, 10) {
rep(j, i) {
if (s[i] < s[j])
swap(s[i], s[j]);
}
}
k[s]++;
}
int64_t ans = 0;
// Keyの値が小さい順にループ
for (auto p : k) {
auto key = p.first;
auto value = p.second;
ans += value * (value - 1) / 2;
// key, valueを使う
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change"
] | 746,935
| 746,936
|
u525560003
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define repeq(i, n) for (int(i) = 0; (i) <= (int)(n); (i)++)
#define rep1(i, x, n) for (int(i) = (x); (i) < (int)(n); (i)++)
#define rep1eq(i, x, n) for (int(i) = (x); (i) <= (int)(n); (i)++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
using namespace std;
using ll = long long;
using Int = long long;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int, int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int>>
IntReversePrioQueue;
//少数点表示
// cout << std::fixed << std::setprecision(14) << 値
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (mp.find(s) == mp.end()) {
mp[s] = 1;
} else {
mp[s]++;
}
}
ll ans = 0;
for (auto i = mp.begin(); i != mp.end(); i++) {
int num = i->second;
ans += num * (num - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define repeq(i, n) for (int(i) = 0; (i) <= (int)(n); (i)++)
#define rep1(i, x, n) for (int(i) = (x); (i) < (int)(n); (i)++)
#define rep1eq(i, x, n) for (int(i) = (x); (i) <= (int)(n); (i)++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
using namespace std;
using ll = long long;
using Int = long long;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int, int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int>>
IntReversePrioQueue;
//少数点表示
// cout << std::fixed << std::setprecision(14) << 値
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (mp.find(s) == mp.end()) {
mp[s] = 1;
} else {
mp[s]++;
}
}
ll ans = 0;
for (auto i = mp.begin(); i != mp.end(); i++) {
int num = i->second;
ans += (ll)num * (num - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"type_conversion.add"
] | 746,937
| 746,938
|
u924373338
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define repeq(i, n) for (int(i) = 0; (i) <= (int)(n); (i)++)
#define rep1(i, x, n) for (int(i) = (x); (i) < (int)(n); (i)++)
#define rep1eq(i, x, n) for (int(i) = (x); (i) <= (int)(n); (i)++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
using namespace std;
using ll = long long;
using Int = long long;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int, int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int>>
IntReversePrioQueue;
//少数点表示
// cout << std::fixed << std::setprecision(14) << 値
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (mp.find(s) == mp.end()) {
mp[s] = 1;
} else {
mp[s]++;
}
}
int ans = 0;
for (auto i = mp.begin(); i != mp.end(); i++) {
int num = i->second;
ans += num * (num - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define repeq(i, n) for (int(i) = 0; (i) <= (int)(n); (i)++)
#define rep1(i, x, n) for (int(i) = (x); (i) < (int)(n); (i)++)
#define rep1eq(i, x, n) for (int(i) = (x); (i) <= (int)(n); (i)++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
using namespace std;
using ll = long long;
using Int = long long;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int, int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int>>
IntReversePrioQueue;
//少数点表示
// cout << std::fixed << std::setprecision(14) << 値
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (mp.find(s) == mp.end()) {
mp[s] = 1;
} else {
mp[s]++;
}
}
ll ans = 0;
for (auto i = mp.begin(); i != mp.end(); i++) {
int num = i->second;
ans += (ll)num * (num - 1) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,939
| 746,938
|
u924373338
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
long long C(int x, long long y) {
long long ans = 1;
for (int i = 1; i <= y; i++) {
ans = ans * (x - i + 1) / i;
}
return ans;
}
int main() {
long long N, c = 1, ans = 0;
cin >> N;
vector<string> S(N);
vector<int> cc(N);
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S.at(i) = s;
}
sort(S.begin(), S.end());
for (int i = 0; i < N; i++) {
if (i != N - 1 && S.at(i) == S.at(i + 1)) {
c++;
} else {
cc.at(i) = C(c, 2);
c = 1;
}
}
for (int i = 0; i < cc.size(); i++) {
ans += cc.at(i);
}
cout << ans;
// cout<<C(100000 ,2);
}
|
#include <bits/stdc++.h>
using namespace std;
long long C(int x, long long y) {
long long ans = 1;
for (int i = 1; i <= y; i++) {
ans = ans * (x - i + 1) / i;
}
return ans;
}
int main() {
long long N, c = 1, ans = 0;
cin >> N;
vector<string> S(N);
vector<long long> cc(N);
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S.at(i) = s;
}
sort(S.begin(), S.end());
for (int i = 0; i < N; i++) {
if (i != N - 1 && S.at(i) == S.at(i + 1)) {
c++;
} else {
cc.at(i) = C(c, 2);
c = 1;
}
}
for (int i = 0; i < cc.size(); i++) {
ans += cc.at(i);
}
cout << ans;
// cout<<C(100000 ,2);
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,940
| 746,941
|
u102070373
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
long long C(int x, long long y) {
long long ans = 1;
for (int i = 1; i <= y; i++) {
ans = ans * (x - i + 1) / i;
}
return ans;
}
int main() {
long long N, c = 1, ans = 0;
cin >> N;
vector<string> S(N);
vector<int> cc(N);
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S.at(i) = s;
}
sort(S.begin(), S.end());
for (int i = 0; i < N; i++) {
if (i != N - 1 && S.at(i) == S.at(i + 1)) {
c++;
} else {
cc.at(i) = C(c, 2);
c = 1;
}
}
for (int i = 0; i < cc.size(); i++) {
ans += cc.at(i);
}
cout << ans;
// cout<<C(0,2);
}
|
#include <bits/stdc++.h>
using namespace std;
long long C(int x, long long y) {
long long ans = 1;
for (int i = 1; i <= y; i++) {
ans = ans * (x - i + 1) / i;
}
return ans;
}
int main() {
long long N, c = 1, ans = 0;
cin >> N;
vector<string> S(N);
vector<long long> cc(N);
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S.at(i) = s;
}
sort(S.begin(), S.end());
for (int i = 0; i < N; i++) {
if (i != N - 1 && S.at(i) == S.at(i + 1)) {
c++;
} else {
cc.at(i) = C(c, 2);
c = 1;
}
}
for (int i = 0; i < cc.size(); i++) {
ans += cc.at(i);
}
cout << ans;
// cout<<C(100000 ,2);
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,942
| 746,941
|
u102070373
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
long long C(int x, long long y) {
long long ans = 1;
for (int i = 1; i <= y; i++) {
ans = ans * (x - i + 1) / i;
}
return ans;
}
int main() {
int N, c = 1, ans = 0;
cin >> N;
vector<string> S(N);
vector<int> cc(N);
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S.at(i) = s;
}
sort(S.begin(), S.end());
for (int i = 0; i < N; i++) {
if (i != N - 1 && S.at(i) == S.at(i + 1)) {
c++;
} else {
cc.at(i) = C(c, 2);
c = 1;
}
}
for (int i = 0; i < cc.size(); i++) {
ans += cc.at(i);
}
cout << ans;
// cout<<C(0,2);
}
|
#include <bits/stdc++.h>
using namespace std;
long long C(int x, long long y) {
long long ans = 1;
for (int i = 1; i <= y; i++) {
ans = ans * (x - i + 1) / i;
}
return ans;
}
int main() {
long long N, c = 1, ans = 0;
cin >> N;
vector<string> S(N);
vector<long long> cc(N);
for (int i = 0; i < N; i++) {
string s;
cin >> s;
sort(s.begin(), s.end());
S.at(i) = s;
}
sort(S.begin(), S.end());
for (int i = 0; i < N; i++) {
if (i != N - 1 && S.at(i) == S.at(i + 1)) {
c++;
} else {
cc.at(i) = C(c, 2);
c = 1;
}
}
for (int i = 0; i < cc.size(); i++) {
ans += cc.at(i);
}
cout << ans;
// cout<<C(100000 ,2);
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,943
| 746,941
|
u102070373
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;
int main() {
ll n, a, b;
in(n);
string s, u;
vector<char> t(10);
map<string, ll> c;
rep(i, n) {
in(s);
rep(j, 10) t[j] = s[j];
s = "";
sort(all(t));
rep(j, 10) {
u = t[i];
s += u;
}
if (c[s] != 0)
c[s]++;
else
c[s] = 1;
}
a = 0;
for (auto i = c.begin(); i != c.end(); i++) {
if (i->second > 1)
a += i->second * (i->second - 1) / 2;
}
out(a);
memi;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;
int main() {
ll n, a, b;
in(n);
string s, u;
vector<char> t(10);
map<string, ll> c;
rep(i, n) {
in(s);
rep(j, 10) t[j] = s[j];
s = "";
sort(all(t));
rep(j, 10) {
u = t[j];
s += u;
}
if (c[s] != 0)
c[s]++;
else
c[s] = 1;
}
a = 0;
for (auto i = c.begin(); i != c.end(); i++) {
if (i->second > 1)
a += i->second * (i->second - 1) / 2;
}
out(a);
memi;
}
|
[
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 746,948
| 746,949
|
u917049698
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
//組み合わせの数nCrを計算
int calcNumOfCombination(int n, int r) {
int num = 1;
for (int i = 1; i <= r; i++) {
num = num * (n - i + 1) / i;
}
return num;
}
int main(void) {
int N;
cin >> N;
vector<string> s;
for (int i = 0; i < N; i++) {
string si;
cin >> si;
sort(si.begin(), si.end());
s.push_back(si);
}
sort(s.begin(), s.end());
long long int sum = 0;
int suc = 1;
string last = s[0];
for (int i = 1; i < N - 1; i++) {
if (last == s[i]) {
suc++;
} else {
sum += calcNumOfCombination(suc, 2);
suc = 1;
last = s[i];
}
}
if (last == s[N - 1])
suc++;
sum += calcNumOfCombination(suc, 2);
cout << sum << endl;
return 0;
}
|
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
//組み合わせの数nCrを計算
long long int calcNumOfCombination(int n, int r) {
long long int num = 1;
for (int i = 1; i <= r; i++) {
num = num * (n - i + 1) / i;
}
return num;
}
int main(void) {
int N;
cin >> N;
vector<string> s;
for (int i = 0; i < N; i++) {
string si;
cin >> si;
sort(si.begin(), si.end());
s.push_back(si);
}
sort(s.begin(), s.end());
long long int sum = 0;
int suc = 1;
string last = s[0];
for (int i = 1; i < N - 1; i++) {
if (last == s[i]) {
suc++;
} else {
sum += calcNumOfCombination(suc, 2);
suc = 1;
last = s[i];
}
}
if (last == s[N - 1])
suc++;
sum += calcNumOfCombination(suc, 2);
cout << sum << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,950
| 746,951
|
u823871776
|
cpp
|
p02947
|
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
//組み合わせの数nCrを計算
int calcNumOfCombination(int n, int r) {
int num = 1;
for (int i = 1; i <= r; i++) {
num = num * (n - i + 1) / i;
}
return num;
}
int main(void) {
int N;
cin >> N;
vector<string> s;
for (int i = 0; i < N; i++) {
string si;
cin >> si;
sort(si.begin(), si.end());
s.push_back(si);
}
sort(s.begin(), s.end());
int sum = 0;
int suc = 1;
string last = s[0];
for (int i = 1; i < N - 1; i++) {
if (last == s[i]) {
suc++;
} else {
sum += calcNumOfCombination(suc, 2);
suc = 1;
last = s[i];
}
}
if (last == s[N - 1])
suc++;
sum += calcNumOfCombination(suc, 2);
cout << sum << endl;
return 0;
}
|
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
//組み合わせの数nCrを計算
long long int calcNumOfCombination(int n, int r) {
long long int num = 1;
for (int i = 1; i <= r; i++) {
num = num * (n - i + 1) / i;
}
return num;
}
int main(void) {
int N;
cin >> N;
vector<string> s;
for (int i = 0; i < N; i++) {
string si;
cin >> si;
sort(si.begin(), si.end());
s.push_back(si);
}
sort(s.begin(), s.end());
long long int sum = 0;
int suc = 1;
string last = s[0];
for (int i = 1; i < N - 1; i++) {
if (last == s[i]) {
suc++;
} else {
sum += calcNumOfCombination(suc, 2);
suc = 1;
last = s[i];
}
}
if (last == s[N - 1])
suc++;
sum += calcNumOfCombination(suc, 2);
cout << sum << endl;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,952
| 746,951
|
u823871776
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
// << fixed << setprecision(0) <<
// sort(ALL(),greater<int>());
int main() {
int n;
cin >> n;
map<string, int> m;
string s;
REP(i, n) {
cin >> s;
sort(ALL(s));
m[s]++;
}
int ans = 0;
int x;
for (auto i : m) {
x = i.second;
ans += (x - 1) * x / 2;
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
// << fixed << setprecision(0) <<
// sort(ALL(),greater<int>());
int main() {
ll n;
cin >> n;
map<string, ll> m;
string s;
REP(i, n) {
cin >> s;
sort(ALL(s));
m[s]++;
}
ll ans = 0;
ll x;
for (auto i : m) {
x = i.second;
ans += (x - 1) * x / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,955
| 746,956
|
u281876921
|
cpp
|
p02947
|
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
int main() {
map<string, int> a;
set<string> st;
int n;
cin >> n;
rep(i, 0, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (a.count(s))
a[s]++;
else
a[s] = 1;
st.insert(s);
}
int ans = 0;
for (auto value : st) {
int x = a.at(value);
ans += (x * (x - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
int main() {
map<string, long long> a;
set<string> st;
int n;
cin >> n;
rep(i, 0, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
if (a.count(s))
a[s]++;
else
a[s] = 1;
st.insert(s);
}
long long ans = 0;
for (auto value : st) {
long long x = a.at(value);
ans += (x * (x - 1)) / 2;
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,957
| 746,958
|
u407213771
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int N;
cin >> N;
map<string, int> MA;
for (int i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
MA[S]++;
}
int ans = 0;
for (auto ma : MA) {
ans += ma.second * (ma.second - 1) / 2;
}
cout << ans << "\n";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int N;
cin >> N;
map<string, long long> MA;
for (int i = 0; i < N; i++) {
string S;
cin >> S;
sort(S.begin(), S.end());
MA[S]++;
}
long long ans = 0;
for (auto ma : MA) {
ans += ma.second * (ma.second - 1) / 2;
}
cout << ans << "\n";
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,959
| 746,960
|
u045289115
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S;
vector<string> vec(N);
for (int i = 0; i < N; i++) {
cin >> S;
sort(S.begin(), S.end());
vec.at(i) = S;
}
sort(vec.begin(), vec.end());
int ans = 0;
int ctr = 0;
for (int i = 1; i < N; i++) {
if (vec.at(i - 1) == vec.at(i)) {
ctr++;
ans += ctr;
} else {
ctr = 0;
}
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S;
vector<string> vec(N);
for (int i = 0; i < N; i++) {
cin >> S;
sort(S.begin(), S.end());
vec.at(i) = S;
}
sort(vec.begin(), vec.end());
long long ans = 0;
int ctr = 0;
for (int i = 1; i < N; i++) {
if (vec.at(i - 1) == vec.at(i)) {
ctr++;
ans += ctr;
} else {
ctr = 0;
}
}
cout << ans << endl;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 746,961
| 746,962
|
u045289115
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
// 総数を1000000007(素数)で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
int main() {
int n;
cin >> n;
map<string, int> sm;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
sm[s]++;
}
auto sigma = [&](int n) {
int ans = 0;
rep1(i, n) ans += i;
return ans;
};
int ans = 0;
for (pair<string, int> num : sm) {
ans += sigma(num.second - 1);
}
cout << ans << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
// 総数を1000000007(素数)で割った余り
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair
#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
int main() {
int n;
cin >> n;
map<string, int> sm;
rep(i, n) {
string s;
cin >> s;
sort(all(s));
sm[s]++;
}
auto sigma = [&](int n) {
ll ans = 0;
rep1(i, n) ans += i;
return ans;
};
ll ans = 0;
for (pair<string, int> num : sm) {
ans += sigma(num.second - 1);
}
cout << ans << endl;
return 0;
}
|
[
"variable_declaration.type.change"
] | 746,965
| 746,966
|
u682820318
|
cpp
|
p02947
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += s * (s - 1) / 2;
}
cout << ans << endl;
}
|
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
map<string, int> mp;
rep(i, n) {
string s;
cin >> s;
sort(s.begin(), s.end());
mp[s]++;
}
ll ans = 0;
for (auto &p : mp) {
int s = p.second;
ans += (ll)s * (s - 1) / 2;
}
cout << ans << endl;
}
|
[
"type_conversion.add"
] | 746,967
| 746,968
|
u862412671
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long int sum = 0;
for (int i = 0; i < n; i++) {
int count = 0;
for (int j = i + 1; j < n; j++) {
if (s[i] == s[j]) {
count++;
i++;
} else {
break;
}
}
if (count != 0) {
sum = sum + count * (count + 1) / 2;
}
}
cout << sum;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long int sum = 0;
for (int i = 0; i < n; i++) {
long long int count = 0;
for (int j = i + 1; j < n; j++) {
if (s[i] == s[j]) {
count++;
i++;
} else {
break;
}
}
if (count != 0) {
sum = sum + count * (count + 1) / 2;
}
}
cout << sum;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,969
| 746,970
|
u094746828
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
int sum = 0;
for (int i = 0; i < n - 1; i++) {
int count = 0;
for (int j = i + 1; j < n; j++) {
if (s[i] == s[j]) {
count++;
i++;
} else {
break;
}
}
if (count != 0) {
sum = sum + count * (count + 1) / 2;
}
}
cout << sum;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long int sum = 0;
for (int i = 0; i < n; i++) {
long long int count = 0;
for (int j = i + 1; j < n; j++) {
if (s[i] == s[j]) {
count++;
i++;
} else {
break;
}
}
if (count != 0) {
sum = sum + count * (count + 1) / 2;
}
}
cout << sum;
return 0;
}
|
[
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 746,971
| 746,970
|
u094746828
|
cpp
|
p02947
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
int sum = 0;
for (int i = 0; i < n; i++) {
int count = 0;
for (int j = i + 1; j < n; j++) {
if (s[i] == s[j]) {
count++;
i++;
} else {
break;
}
}
if (count != 0) {
sum = sum + count * (count + 1) / 2;
}
}
cout << sum;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
sort(s[i].begin(), s[i].end());
}
sort(s, s + n);
long long int sum = 0;
for (int i = 0; i < n; i++) {
long long int count = 0;
for (int j = i + 1; j < n; j++) {
if (s[i] == s[j]) {
count++;
i++;
} else {
break;
}
}
if (count != 0) {
sum = sum + count * (count + 1) / 2;
}
}
cout << sum;
return 0;
}
|
[
"variable_declaration.type.widen.change"
] | 746,972
| 746,970
|
u094746828
|
cpp
|
p02947
|
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
using namespace std;
map<string, int> ma;
int main(void) {
int n;
long long sum = 0;
string s;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ma[s]++;
}
for (auto &x : ma) {
// cout << x.second << endl;
sum += (x.second * (x.second - 1) / 2);
}
cout << sum;
return 0;
}
|
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
using namespace std;
map<string, long long> ma;
int main(void) {
long long n;
long long sum = 0;
string s;
cin >> n;
for (long long i = 0; i < n; i++) {
cin >> s;
sort(s.begin(), s.end());
ma[s]++;
}
for (auto &x : ma) {
sum += (x.second * (x.second - 1) / 2);
}
cout << sum;
return 0;
}
|
[
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"control_flow.loop.for.initializer.change"
] | 746,975
| 746,976
|
u959634984
|
cpp
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.