Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
9 values
p03095
#include <bits/stdc++.h> using namespace std; #define int long long int INF = 1e9 + 7; signed main() { int N; string S; cin >> N >> S; vector<int> cnt(26, 1); for (int i = 0; i < N; i++) { cnt[S[i] - 'a']++; } int res = 1; for (int i = 0; i < 26; i++) { res *= cnt[i]; res = res % INF; } cout << res << endl; }
#include <bits/stdc++.h> using namespace std; #define int long long int INF = 1e9 + 7; signed main() { int N; string S; cin >> N >> S; vector<int> cnt(26, 1); for (int i = 0; i < N; i++) { cnt[S[i] - 'a']++; } int res = 1; for (int i = 0; i < 26; i++) { res *= cnt[i]; res = res % INF; } cout << res - 1 << endl; }
[ "expression.operation.binary.add" ]
905,244
905,245
u237390401
cpp
p03095
#include <bits/stdc++.h> #include <cmath> // using namespace boost::multiprecision; using namespace std; typedef long long ll; // typedef unsigned long long ll; const double EPS = 1e-9; #define rep(i, n) for (int i = 0; i < (n); ++i) //#define rep(i, n) for (ll i = 0; i < (n); ++i) //#define sz(x) ll(x.size()) typedef pair<int, int> P; // typedef pair<ll, int> P; // typedef pair<ll, ll> P; // const double INF = 1e10; const ll INF = LONG_LONG_MAX / 100; // const ll INF = (1ll << 31) - 1; // const ll INF = 1e15; const ll MINF = LONG_LONG_MIN; // const int INF = INT_MAX / 10; #define cmin(x, y) x = min(x, y) #define cmax(x, y) x = max(x, y) // typedef pair<int, int> P; // typedef pair<double, double> P; #define ret() return 0; bool contain(set<char> &s, char a) { return s.find(a) != s.end(); } // ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt"); // ofstream outfile("log.txt"); // outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') // << rank << endl; // std::cout << std::bitset<8>(9); const int mod = 1000000007; // const ll mod = 1e10; typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } friend std::istream &operator>>(std::istream &in, mint &o) { ll a; in >> a; o = a; return in; } friend std::ostream &operator<<(std::ostream &out, const mint &o) { out << o.x; return out; } }; int main() { int n; string s; cin >> n >> s; vector<int> counts(n, 1); for (char c : s) counts[c - 'a']++; mint ans = 1; for (int i : counts) ans *= i; ans = ans - 1; cout << ans << endl; }
#include <bits/stdc++.h> #include <cmath> // using namespace boost::multiprecision; using namespace std; typedef long long ll; // typedef unsigned long long ll; const double EPS = 1e-9; #define rep(i, n) for (int i = 0; i < (n); ++i) //#define rep(i, n) for (ll i = 0; i < (n); ++i) //#define sz(x) ll(x.size()) typedef pair<int, int> P; // typedef pair<ll, int> P; // typedef pair<ll, ll> P; // const double INF = 1e10; const ll INF = LONG_LONG_MAX / 100; // const ll INF = (1ll << 31) - 1; // const ll INF = 1e15; const ll MINF = LONG_LONG_MIN; // const int INF = INT_MAX / 10; #define cmin(x, y) x = min(x, y) #define cmax(x, y) x = max(x, y) // typedef pair<int, int> P; // typedef pair<double, double> P; #define ret() return 0; bool contain(set<char> &s, char a) { return s.find(a) != s.end(); } // ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt"); // ofstream outfile("log.txt"); // outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') // << rank << endl; // std::cout << std::bitset<8>(9); const int mod = 1000000007; // const ll mod = 1e10; typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res += a; } mint operator-(const mint a) const { mint res(*this); return res -= a; } mint operator*(const mint a) const { mint res(*this); return res *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res /= a; } friend std::istream &operator>>(std::istream &in, mint &o) { ll a; in >> a; o = a; return in; } friend std::ostream &operator<<(std::ostream &out, const mint &o) { out << o.x; return out; } }; int main() { int n; string s; cin >> n >> s; vector<int> counts(27, 1); for (char c : s) counts[c - 'a']++; mint ans = 1; for (int i : counts) ans *= i; ans = ans - 1; cout << ans << endl; }
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change" ]
905,251
905,252
u564182781
cpp
p03095
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; long long co[30] = {0}; long long ans = 1; int main() { int n; string s; cin >> n >> s; for (int i = 0; i < n; i++) { co[int(s[i] - 'a')]++; } for (int i = 0; i < n; i++) { ans = ans * (co[i] + 1) % 1000000007; } ans--; if (ans < 0) { ans += 1000000007; } cout << ans << endl; }
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <vector> using namespace std; long long co[30] = {0}; long long ans = 1; int main() { int n; string s; cin >> n >> s; for (int i = 0; i < n; i++) { co[int(s[i] - 'a')]++; } for (int i = 0; i < 26; i++) { ans = ans * (co[i] + 1) % 1000000007; } ans--; if (ans < 0) { ans += 1000000007; } cout << ans << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,264
905,265
u003026289
cpp
p03095
const int LG = 21; const int FN = 400005; const long long MOD = 1e9 + 7; const long long INF = 1e9; const long long INFLL = 1e18; #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vector<int>> G; #define forn(i, n) for (int(i) = 0; (i) != (n); (i)++) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define popcount(x) __builtin_popcount(x) #define popcountll(x) __builtin_popcountll(x) #define fi first #define se second #define re return #define pb push_back #define uniq(x) \ sort(all(x)); \ (x).resize(unique(all(x)) - (x).begin()) #ifdef LOCAL #define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl #define ln cerr << __LINE__ << endl #else #define dbg(x) void(0) #define ln void(0) #endif // LOCAL int cx[4] = {-1, 0, 1, 0}; int cy[4] = {0, -1, 0, 1}; string Ans[2] = {"No", "Yes"}; string ANS[2] = {"NO", "YES"}; ll inq(ll x, ll y) { if (!y) re 1 % MOD; ll l = inq(x, y / 2); if (y % 2) re l *l % MOD *x % MOD; re l *l % MOD; } ll rev(ll x) { return inq(x, MOD - 2); } bool __precomputed_combinatorics = 0; vector<ll> __fact, __ufact, __rev; void __precompute_combinatorics() { __precomputed_combinatorics = 1; __fact.resize(FN); __ufact.resize(FN); __rev.resize(FN); __rev[1] = 1; for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD; __fact[0] = 1, __ufact[0] = 1; for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD; } ll fact(int x) { if (!__precomputed_combinatorics) __precompute_combinatorics(); return __fact[x]; } ll cnk(int n, int k) { if (k < 0 || k > n) return 0; if (!__precomputed_combinatorics) __precompute_combinatorics(); return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD; } int Root(int x, vector<int> &root) { if (x == root[x]) return x; return root[x] = Root(root[x], root); } void Merge(int v, int u, vector<int> &root, vector<int> &sz) { v = Root(v, root), u = Root(u, root); if (v == u) return; if (sz[v] < sz[u]) { sz[u] += sz[v]; root[v] = u; } else { sz[v] += sz[u]; root[u] = v; } } int ok(int x, int n) { return 0 <= x && x < n; } void bfs(int v, vi &dist, vector<vi> &graph) { fill(all(dist), -1); dist[v] = 0; vi q = {v}; for (int i = 0; i < q.size(); i++) { for (auto u : graph[q[i]]) { if (dist[u] == -1) { dist[u] = dist[q[i]] + 1; q.push_back(u); } } } } int t; void dfs(int v, int p, G &graph, vi &in, vi &up) { up[v] = in[v] = t; t++; for (auto u : graph[v]) { if (u == p) continue; if (in[u] == 0) { dfs(u, v, graph, in, up); } up[v] = min(up[v], up[u]); } } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; vi cnt(26); forn(i, s.size()) cnt[s[i] - 'a']++; ll ans = 0; forn(i, 26) { ans = ans * (cnt[i] + 1) % MOD; } cout << (ans + MOD - 1) % MOD; } /* Note: Check constants at the beginning of the code. N is set to 4e5 but be careful in problems with large constant factor. Setting N in every problem is more effective. Check corner cases. N = 1 No def int long long for now. Add something here. */
const int LG = 21; const int FN = 400005; const long long MOD = 1e9 + 7; const long long INF = 1e9; const long long INFLL = 1e18; #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vector<int>> G; #define forn(i, n) for (int(i) = 0; (i) != (n); (i)++) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define popcount(x) __builtin_popcount(x) #define popcountll(x) __builtin_popcountll(x) #define fi first #define se second #define re return #define pb push_back #define uniq(x) \ sort(all(x)); \ (x).resize(unique(all(x)) - (x).begin()) #ifdef LOCAL #define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl #define ln cerr << __LINE__ << endl #else #define dbg(x) void(0) #define ln void(0) #endif // LOCAL int cx[4] = {-1, 0, 1, 0}; int cy[4] = {0, -1, 0, 1}; string Ans[2] = {"No", "Yes"}; string ANS[2] = {"NO", "YES"}; ll inq(ll x, ll y) { if (!y) re 1 % MOD; ll l = inq(x, y / 2); if (y % 2) re l *l % MOD *x % MOD; re l *l % MOD; } ll rev(ll x) { return inq(x, MOD - 2); } bool __precomputed_combinatorics = 0; vector<ll> __fact, __ufact, __rev; void __precompute_combinatorics() { __precomputed_combinatorics = 1; __fact.resize(FN); __ufact.resize(FN); __rev.resize(FN); __rev[1] = 1; for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD; __fact[0] = 1, __ufact[0] = 1; for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD; } ll fact(int x) { if (!__precomputed_combinatorics) __precompute_combinatorics(); return __fact[x]; } ll cnk(int n, int k) { if (k < 0 || k > n) return 0; if (!__precomputed_combinatorics) __precompute_combinatorics(); return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD; } int Root(int x, vector<int> &root) { if (x == root[x]) return x; return root[x] = Root(root[x], root); } void Merge(int v, int u, vector<int> &root, vector<int> &sz) { v = Root(v, root), u = Root(u, root); if (v == u) return; if (sz[v] < sz[u]) { sz[u] += sz[v]; root[v] = u; } else { sz[v] += sz[u]; root[u] = v; } } int ok(int x, int n) { return 0 <= x && x < n; } void bfs(int v, vi &dist, vector<vi> &graph) { fill(all(dist), -1); dist[v] = 0; vi q = {v}; for (int i = 0; i < q.size(); i++) { for (auto u : graph[q[i]]) { if (dist[u] == -1) { dist[u] = dist[q[i]] + 1; q.push_back(u); } } } } int t; void dfs(int v, int p, G &graph, vi &in, vi &up) { up[v] = in[v] = t; t++; for (auto u : graph[v]) { if (u == p) continue; if (in[u] == 0) { dfs(u, v, graph, in, up); } up[v] = min(up[v], up[u]); } } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; vi cnt(26); forn(i, s.size()) cnt[s[i] - 'a']++; ll ans = 1; forn(i, 26) { ans = ans * (cnt[i] + 1) % MOD; } cout << (ans + MOD - 1) % MOD; } /* Note: Check constants at the beginning of the code. N is set to 4e5 but be careful in problems with large constant factor. Setting N in every problem is more effective. Check corner cases. N = 1 No def int long long for now. Add something here. */
[ "literal.number.change", "variable_declaration.value.change" ]
905,293
905,294
u798339690
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LINF = 1e18; int main() { int n; cin >> n; string s; cin >> s; vector<ll> num(30, 0); for (auto c : s) { num[c - 'a']++; } ll ans = 1; for (int i = 0; i < 26; ++i) { ans *= num[i] + 1; ans %= MOD; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const int MOD = 1e9 + 7; const ll LINF = 1e18; int main() { int n; cin >> n; string s; cin >> s; vector<ll> num(30, 0); for (auto c : s) { num[c - 'a']++; } ll ans = 1; for (int i = 0; i < 26; ++i) { ans *= num[i] + 1; ans %= MOD; } ans -= 1; cout << ans << endl; }
[ "assignment.add" ]
905,297
905,298
u701556979
cpp
p03095
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #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 REP(i, n) FOR(i, 0, (n)) #define REPR(i, n) FORR(i, (n)-1, 0) #define REP1(i, n) FOR(i, 1, (n) + 1) #define REPS(c, s) for (char c : s) #define ALL(c) (c).begin(), (c).end() #define SORT(c) sort(ALL(c)) #define REV(c) reverse(ALL(c)) #define sz(v) (int)v.size() #define endl '\n' 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 int MOD = 1000000007; const int INF = 1000000001; const ll LINF = 1000000001000000001LL; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(numeric_limits<double>::max_digits10); solve(); return 0; } void solve() { int n; string s; cin >> n >> s; vector<int> v(26, 0); REP(i, n) v[s[i] - 'a']++; ll ans = 1; REP(i, n) ans = (ans * (v[i] + 1)) % MOD; cout << ans - 1 << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #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 REP(i, n) FOR(i, 0, (n)) #define REPR(i, n) FORR(i, (n)-1, 0) #define REP1(i, n) FOR(i, 1, (n) + 1) #define REPS(c, s) for (char c : s) #define ALL(c) (c).begin(), (c).end() #define SORT(c) sort(ALL(c)) #define REV(c) reverse(ALL(c)) #define sz(v) (int)v.size() #define endl '\n' 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 int MOD = 1000000007; const int INF = 1000000001; const ll LINF = 1000000001000000001LL; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(numeric_limits<double>::max_digits10); solve(); return 0; } void solve() { int n; string s; cin >> n >> s; vector<ll> v(26, 0); REP(i, n) v[s[i] - 'a']++; ll ans = 1; REP(i, sz(v)) ans = (ans * (v[i] + 1)) % MOD; cout << ans - 1 << endl; }
[ "assignment.variable.change", "call.arguments.change", "call.arguments.add" ]
905,305
905,306
u540491484
cpp
p03095
#include <algorithm> #include <climits> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rep1(i, n) for (int i = 1; i <= (int)(n); ++i) #define range(i, l, r) for (int i = l; i < (int)(r); ++i) #define rrange(i, l, r) for (int i = r - 1; i >= (int)(l); --i) #define unless(a) if (!(a)) #define all(a) begin(a), end(a) #define fst first #define scd second #define PB emplace_back #define PPB pop_back using vi = vector<int>; using pii = pair<int, int>; using ll = long long; bool chmin(int &a, int b) { return a > b ? (a = b, true) : false; } bool chmax(int &a, int b) { return a < b ? (a = b, true) : false; } int read() { int a; scanf("%lld", &a); return a; } const int inf = 1e9 + 10; const int mod = 1e9 + 7; inline ll mod_pow(ll a, ll x, ll m) { if (x == 0) return 1; ll res = mod_pow(a, x / 2, m); res *= res; res %= m; if (x % 2) { res *= a; res %= m; } return res; } int counter[26]; signed main() { int N; cin >> N; string S; cin >> S; rep(i, N) { int c = S[i] - 'a'; counter[c]++; } int ans = 1; rep(i, 26)(ans *= counter[i]) %= mod; ans += mod - 1; ans %= mod; cout << ans << endl; }
#include <algorithm> #include <climits> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rep1(i, n) for (int i = 1; i <= (int)(n); ++i) #define range(i, l, r) for (int i = l; i < (int)(r); ++i) #define rrange(i, l, r) for (int i = r - 1; i >= (int)(l); --i) #define unless(a) if (!(a)) #define all(a) begin(a), end(a) #define fst first #define scd second #define PB emplace_back #define PPB pop_back using vi = vector<int>; using pii = pair<int, int>; using ll = long long; bool chmin(int &a, int b) { return a > b ? (a = b, true) : false; } bool chmax(int &a, int b) { return a < b ? (a = b, true) : false; } int read() { int a; scanf("%lld", &a); return a; } const int inf = 1e9 + 10; const int mod = 1e9 + 7; inline ll mod_pow(ll a, ll x, ll m) { if (x == 0) return 1; ll res = mod_pow(a, x / 2, m); res *= res; res %= m; if (x % 2) { res *= a; res %= m; } return res; } int counter[26]; signed main() { int N; cin >> N; string S; cin >> S; rep(i, N) { int c = S[i] - 'a'; counter[c]++; } int ans = 1; rep(i, 26)(ans *= counter[i] + 1) %= mod; ans += mod - 1; ans %= mod; cout << ans << endl; }
[ "assignment.change" ]
905,307
905,308
u491256431
cpp
p03095
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vb = vector<bool>; using vl = vector<long>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvb = vector<vector<bool>>; using vvc = vector<vector<char>>; using vvl = vector<vector<long>>; using pii = pair<int, int>; using pil = pair<int, long>; using pll = pair<long, long>; using vc = vector<char>; #define fix20 cout << fixed << setprecision(20) #define YES cout << "Yes" << endl #define NO cout << "No" << endl #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, s, t) for (int i = s; i < t; i++) #define RNG(i, s, t, u) for (int i = s; i < t; i += u) #define MOD 1000000007 #define all(vec) vec.begin(), vec.end() int main() { int n; string s; cin >> n >> s; vector<long> cnt(26, 0); rep(i, n) { cnt.at(s.at(i) - '0')++; } long ans = 1; rep(i, 26) { ans *= cnt.at(i) + 1; ans %= MOD; } cout << (ans + MOD - 1) % MOD << endl; }
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vb = vector<bool>; using vl = vector<long>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvb = vector<vector<bool>>; using vvc = vector<vector<char>>; using vvl = vector<vector<long>>; using pii = pair<int, int>; using pil = pair<int, long>; using pll = pair<long, long>; using vc = vector<char>; #define fix20 cout << fixed << setprecision(20) #define YES cout << "Yes" << endl #define NO cout << "No" << endl #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, s, t) for (int i = s; i < t; i++) #define RNG(i, s, t, u) for (int i = s; i < t; i += u) #define MOD 1000000007 #define all(vec) vec.begin(), vec.end() int main() { int n; string s; cin >> n >> s; vector<long> cnt(26, 0); rep(i, n) { cnt.at(s.at(i) - 'a')++; } long ans = 1; rep(i, 26) { ans *= cnt.at(i) + 1; ans %= MOD; } cout << (ans + MOD - 1) % MOD << endl; }
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change" ]
905,309
905,310
u184335045
cpp
p03095
#include <bits/stdc++.h> #include <chrono> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repl(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++) int main() { ll N; string S; cin >> N >> S; vector<ll> count(26, 0); rep(i, N) { char s = S[i]; int num = (int)(s - 'a'); count[num]++; } ll ans = 1; rep(i, N) { ans *= (count[i] + 1); ans %= 1000000007; } if (ans == 0) { cout << 1000000006 << endl; } else { cout << ans - 1 << endl; } }
#include <bits/stdc++.h> #include <chrono> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repl(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++) int main() { ll N; string S; cin >> N >> S; vector<ll> count(26, 0); rep(i, N) { char s = S[i]; int num = (int)(s - 'a'); count[num]++; } ll ans = 1; rep(i, 26) { ans *= (count[i] + 1); ans %= 1000000007; } if (ans == 0) { cout << 1000000006 << endl; } else { cout << ans - 1 << endl; } }
[]
905,315
905,316
u632527507
cpp
p03095
#include <bits/stdc++.h> #include <chrono> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repl(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++) int main() { int N; string S; cin >> N >> S; vector<int> count(26, 0); rep(i, N) { char s = S[i]; int num = (int)(s - 'a'); count[num]++; } ll ans = 1; rep(i, N) { ans *= (count[i] + 1); ans %= 1000000007; } if (ans == 0) { cout << 1000000006 << endl; } else { cout << ans - 1 << endl; } }
#include <bits/stdc++.h> #include <chrono> using namespace std; using ll = long long; using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repl(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) #define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++) int main() { ll N; string S; cin >> N >> S; vector<ll> count(26, 0); rep(i, N) { char s = S[i]; int num = (int)(s - 'a'); count[num]++; } ll ans = 1; rep(i, 26) { ans *= (count[i] + 1); ans %= 1000000007; } if (ans == 0) { cout << 1000000006 << endl; } else { cout << ans - 1 << endl; } }
[ "variable_declaration.type.change" ]
905,317
905,316
u632527507
cpp
p03095
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll mod = 1e9 + 7; int n; string s; string a = "abcdefghijklmnopqrstuvwxyz"; cin >> n >> s; ll ans = 1; ll vec[26] = {}; for (int i = 0; i < n; i++) { for (int j = 0; j < 26; j++) { if (s[i] == a[j]) { vec[j]++; } } } for (int i = 0; i < n; i++) { ans *= vec[i] + 1; ans %= mod; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll mod = 1e9 + 7; int n; string s; string a = "abcdefghijklmnopqrstuvwxyz"; cin >> n >> s; ll ans = 1; ll vec[26] = {}; for (int i = 0; i < n; i++) { for (int j = 0; j < 26; j++) { if (s[i] == a[j]) { vec[j]++; } } } for (int i = 0; i < 26; i++) { ans *= vec[i] + 1; ans %= mod; } cout << ans - 1 << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,319
905,320
u363369454
cpp
p03095
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; const ll mod = 1000000007; #define rep(i, n) for (int i = 0; i < n; i++) #define repl(i, s, e) for (int i = s; i < e; i++) #define reple(i, s, e) for (int i = s; i <= e; i++) #define revrep(i, n) for (int i = n - 1; i >= 0; i--) #define vll vector<ll> #define vvll vector<vector<ll>> #define all(x) (x).begin(), (x).end() int main() { int N; cin >> N; string S; cin >> S; map<char, int> counts; rep(i, S.size()) { counts[S[i]]++; } ll ans = 0; for (auto x : counts) { ans *= (x.second + 1); ans %= mod; } cout << ans - 1 << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; const ll mod = 1000000007; #define rep(i, n) for (int i = 0; i < n; i++) #define repl(i, s, e) for (int i = s; i < e; i++) #define reple(i, s, e) for (int i = s; i <= e; i++) #define revrep(i, n) for (int i = n - 1; i >= 0; i--) #define vll vector<ll> #define vvll vector<vector<ll>> #define all(x) (x).begin(), (x).end() int main() { int N; cin >> N; string S; cin >> S; map<char, int> counts; rep(i, S.size()) { counts[S[i]]++; } ll ans = 1; for (auto x : counts) { ans *= (x.second + 1); ans %= mod; } cout << ans - 1 << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
905,321
905,322
u889915625
cpp
p03095
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; const long long mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n; i++) #define rep2(i, x, n) for (int i = x; i < n; i++) #define all(v) v.begin(), v.end() #define nepe(v) next_permutation(all(v)) #define F first #define S second #define PB push_back #define MP make_pair using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<long long>; using vvl = vector<vl>; using vp = vector<pair<int, int>>; typedef pair<int, int> P; string s; int k; ll INF = 10000000000000000; int main() { int N; string S; cin >> N >> S; vi abc(26, 0); rep(i, N) { abc[S[i] - 'a']++; } ll ans = 1; rep(i, N) { ans = ans * (abc[i] + 1); ans %= mod; } cout << ans - 1 << endl; }
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; const long long mod = 1e9 + 7; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n; i++) #define rep2(i, x, n) for (int i = x; i < n; i++) #define all(v) v.begin(), v.end() #define nepe(v) next_permutation(all(v)) #define F first #define S second #define PB push_back #define MP make_pair using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<long long>; using vvl = vector<vl>; using vp = vector<pair<int, int>>; typedef pair<int, int> P; string s; int k; ll INF = 10000000000000000; int main() { int N; string S; cin >> N >> S; vi abc(26, 0); rep(i, N) { abc[S[i] - 'a']++; } ll ans = 1; rep(i, 26) { ans *= abc[i] + 1; ans %= mod; } cout << ans - 1 << endl; }
[ "assignment.value.change", "expression.operation.binary.remove" ]
905,341
905,342
u498607746
cpp
p03095
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string s; cin >> s; vector<int64_t> A(26, 1); for (int i = 0; i < N; i++) { char x = s.at(i); int y = x - 'a'; A.at(y)++; } int64_t ans = 1; for (int i = 0; i < 26; i++) { ans = (ans * A.at(i)) % 1000000007; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; string s; cin >> s; vector<int64_t> A(26, 1); for (int i = 0; i < N; i++) { char x = s.at(i); int y = x - 'a'; A.at(y)++; } int64_t ans = 1; for (int i = 0; i < 26; i++) { ans = (ans * A.at(i)) % 1000000007; } ans--; cout << ans << endl; return 0; }
[ "expression.unary.arithmetic.add" ]
905,361
905,362
u101018317
cpp
p03095
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <string> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORR(i, a, b) for (ll i = (a); i <= (b); i++) #define repR(i, n) for (ll i = n; i >= 0; i--) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout << (x) << endl #define PQ priority_queue<ll> #define PQR priority_queue<ll, vector<ll>, greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO") << endl #define Yes(n) cout << ((n) ? "Yes" : "No") << endl #define mp make_pair #define maxs(x, y) (x = max(x, y)) #define mins(x, y) (x = min(x, y)) #define sz(x) (ll)(x).size() typedef pair<int, int> pii; typedef pair<ll, ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; using vc = vector<char>; using vvc = vector<vc>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } ll dx[4] = {0, 1, 0, -1}; ll dy[4] = {1, 0, -1, 0}; int main() { ll n; string s; cin >> n >> s; map<char, ll> p; rep(i, n) { p[s[i]]++; } ll ans = 1; for (auto u : p) { ans *= (u.S + 1); ans %= MOD; } COUT(ans); }
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <string> #include <unordered_map> #include <unordered_set> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORR(i, a, b) for (ll i = (a); i <= (b); i++) #define repR(i, n) for (ll i = n; i >= 0; i--) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout << (x) << endl #define PQ priority_queue<ll> #define PQR priority_queue<ll, vector<ll>, greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO") << endl #define Yes(n) cout << ((n) ? "Yes" : "No") << endl #define mp make_pair #define maxs(x, y) (x = max(x, y)) #define mins(x, y) (x = min(x, y)) #define sz(x) (ll)(x).size() typedef pair<int, int> pii; typedef pair<ll, ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; using vc = vector<char>; using vvc = vector<vc>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } ll dx[4] = {0, 1, 0, -1}; ll dy[4] = {1, 0, -1, 0}; int main() { ll n; string s; cin >> n >> s; map<char, ll> p; rep(i, n) { p[s[i]]++; } ll ans = 1; for (auto u : p) { ans *= (u.S + 1); ans %= MOD; } COUT(ans - 1); }
[ "expression.operation.binary.add" ]
905,372
905,373
u103850114
cpp
p03095
#define _USE_MATH_DEFINES #include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define MOD int(1e9 + 7) #define INF (long long)(1e18) int main() { long long N; vector<long long> c(26, 1); cin >> N; for (long long i = 0; i < N; i++) { char t; cin >> t; c[t - 'a']++; } long long total = 1; for (long long i = 0; i < N; i++) { total *= c[i]; total %= MOD; } cout << total - 1 << endl; }
#define _USE_MATH_DEFINES #include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define MOD int(1e9 + 7) #define INF (long long)(1e18) int main() { long long N; vector<long long> c(26, 1); cin >> N; for (long long i = 0; i < N; i++) { char t; cin >> t; c[t - 'a']++; } long long total = 1; for (long long i = 0; i < 26; i++) { total *= c[i]; total %= MOD; } cout << total - 1 << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,376
905,377
u528005130
cpp
p03095
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0), ios::sync_with_stdio(false); int n; cin >> n; map<int, int> cnt; char c; for (int i = 0; i < n; ++i) { cin >> c; ++cnt[c - 'a']; } int ans = 1, mod = 1e9 + 7; for (auto &i : cnt) ans = (ans * i.second + 1) / mod; cout << ans - 1 << "\n"s; }
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0), ios::sync_with_stdio(false); int n; cin >> n; map<int, int> cnt; char c; for (int i = 0; i < n; ++i) { cin >> c; ++cnt[c - 'a']; } int64_t ans = 1, mod = 1e9 + 7; for (auto &i : cnt) ans = (ans * (i.second + 1)) % mod; cout << ans - 1 << "\n"s; }
[ "variable_declaration.type.primitive.change", "assignment.value.change", "expression.operation.binary.change" ]
905,410
905,409
u104613587
cpp
p03095
/*Function Template*/ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pint; const int MAX = 510000; const int MOD = 1000000007; #define rep(i, n) for (ll i = 0; i < (n); i++) #define Rep(i, n) for (ll i = 1; i < (n); i++) #define ALL(a) (a).begin(), (a).end() #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); ll fac[MAX], finv[MAX], inv[MAX]; 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; } // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll 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; } } ll Len(ll n) { ll s = 0; while (n != 0) s++, n /= 10; return s; } ll Sint(ll n) { ll m = 0, s = 0, a = n; while (a != 0) s++, a /= 10; for (ll i = s - 1; i >= 0; i--) m += n / ((ll)pow(10, i)) - (n / ((ll)pow(10, i + 1))) * 10; return m; } ll Svec(vector<ll> v) { ll n = 0; for (ll i = 0; i < v.size(); i++) n += v[i]; return n; } ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return a / GCD(a, b) * b; } ll Factorial(ll n) { ll m = 1; while (n >= 1) m *= n, n--; return m; } void runlength(string s, vector<pair<char, ll>> &p) { ll x = 1; if (s.size() == 1) { p.push_back(pair<char, ll>(s[0], 1)); } for (ll i = 0; i < s.size() - 1; i++) { if (s[i] == s[i + 1]) { x++; if (i == s.size() - 2) { p.push_back(pair<char, ll>(s[i], x)); } } else { p.push_back(pair<char, ll>(s[i], x)); x = 1; if (i == s.size() - 2) { p.push_back(pair<char, ll>(s[s.size() - 1], x)); } } } } ll COM(ll n, ll k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } const int MAX_N = 100010; vector<bool> sieve_of_eratosthenes() { vector<bool> isPrime(MAX_N + 1, true); for (int i = 2; i <= MAX_N; i++) { if (isPrime[i]) { for (int j = 2 * i; j <= MAX_N; j += i) { isPrime[j] = false; } } } return isPrime; } vector<pint> prime_factorize(ll n) { vector<pint> ans; for (ll p = 2; p <= sqrt(n); p++) { if (n % p != 0) continue; ll cnt = 0; while (n % p == 0) { n /= p; cnt++; } ans.push_back(make_pair(p, cnt)); } if (n != 1) ans.push_back(make_pair(n, 1)); return ans; } /*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/ int main() { IOS; ll n, ans = 1; string s; cin >> n >> s; map<char, ll> mp; rep(i, n) { mp[s[i]]++; } for (auto tmp : mp) { ans *= (tmp.second + 1); ans %= MOD; } cout << ans << endl; }
/*Function Template*/ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pint; const int MAX = 510000; const int MOD = 1000000007; #define rep(i, n) for (ll i = 0; i < (n); i++) #define Rep(i, n) for (ll i = 1; i < (n); i++) #define ALL(a) (a).begin(), (a).end() #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); ll fac[MAX], finv[MAX], inv[MAX]; 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; } // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll 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; } } ll Len(ll n) { ll s = 0; while (n != 0) s++, n /= 10; return s; } ll Sint(ll n) { ll m = 0, s = 0, a = n; while (a != 0) s++, a /= 10; for (ll i = s - 1; i >= 0; i--) m += n / ((ll)pow(10, i)) - (n / ((ll)pow(10, i + 1))) * 10; return m; } ll Svec(vector<ll> v) { ll n = 0; for (ll i = 0; i < v.size(); i++) n += v[i]; return n; } ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } ll LCM(ll a, ll b) { return a / GCD(a, b) * b; } ll Factorial(ll n) { ll m = 1; while (n >= 1) m *= n, n--; return m; } void runlength(string s, vector<pair<char, ll>> &p) { ll x = 1; if (s.size() == 1) { p.push_back(pair<char, ll>(s[0], 1)); } for (ll i = 0; i < s.size() - 1; i++) { if (s[i] == s[i + 1]) { x++; if (i == s.size() - 2) { p.push_back(pair<char, ll>(s[i], x)); } } else { p.push_back(pair<char, ll>(s[i], x)); x = 1; if (i == s.size() - 2) { p.push_back(pair<char, ll>(s[s.size() - 1], x)); } } } } ll COM(ll n, ll k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } const int MAX_N = 100010; vector<bool> sieve_of_eratosthenes() { vector<bool> isPrime(MAX_N + 1, true); for (int i = 2; i <= MAX_N; i++) { if (isPrime[i]) { for (int j = 2 * i; j <= MAX_N; j += i) { isPrime[j] = false; } } } return isPrime; } vector<pint> prime_factorize(ll n) { vector<pint> ans; for (ll p = 2; p <= sqrt(n); p++) { if (n % p != 0) continue; ll cnt = 0; while (n % p == 0) { n /= p; cnt++; } ans.push_back(make_pair(p, cnt)); } if (n != 1) ans.push_back(make_pair(n, 1)); return ans; } /*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/ int main() { IOS; ll n, ans = 1; string s; cin >> n >> s; map<char, ll> mp; rep(i, n) { mp[s[i]]++; } for (auto tmp : mp) { ans *= (tmp.second + 1); ans %= MOD; } cout << (ans - 1) << endl; }
[]
905,437
905,438
u264265458
cpp
p03095
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) #define rep2(i, s, n) for (int i = s; i < n; ++i) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define tmax(a, b, c) max(a, max(b, c)) #define tmin(a, b, c) min(a, min(b, c)) #define pb push_back using namespace std; using ll = long long; using P = pair<int, int>; using LP = pair<ll, ll>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } const int inf = 1001001001; const ll linf = 1001001001001001001; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; string s; cin >> n >> s; const int mod = 1e9 + 7; vector<int> v(26, 1); rep(i, n) v[s[i] - 'a']++; ll ans = 1; rep(i, 26) { ans *= v[i]; ans %= mod; } cout << ans << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) #define rep2(i, s, n) for (int i = s; i < n; ++i) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define tmax(a, b, c) max(a, max(b, c)) #define tmin(a, b, c) min(a, min(b, c)) #define pb push_back using namespace std; using ll = long long; using P = pair<int, int>; using LP = pair<ll, ll>; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } const int inf = 1001001001; const ll linf = 1001001001001001001; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; string s; cin >> n >> s; const int mod = 1e9 + 7; vector<int> v(26, 1); rep(i, n) v[s[i] - 'a']++; ll ans = 1; rep(i, 26) { ans *= v[i]; ans %= mod; } cout << ans - 1 << endl; }
[ "expression.operation.binary.add" ]
905,441
905,442
u853721692
cpp
p03095
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define ll long long #define rep(i, s, n) for (int i = s; i < n; i++) #define MOD 1000000007; int main() { int n; cin >> n; string s; cin >> s; ll ans = 1; vector<int> count(26, 0); for (int i = 0; i < n; i++) { count[s[i] - 'a']++; } rep(i, 0, n) { if (count[i] == 0) { continue; } ans *= count[i] + 1; ans %= MOD; } cout << ans - 1 << endl; }
#include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define ll long long #define rep(i, s, n) for (int i = s; i < n; i++) #define MOD 1000000007; int main() { int n; cin >> n; string s; cin >> s; ll ans = 1; vector<int> count(26, 0); for (int i = 0; i < n; i++) { count[s[i] - 'a']++; } rep(i, 0, count.size()) { if (count[i] == 0) { continue; } ans *= count[i] + 1; ans %= MOD; } cout << ans - 1 << endl; }
[ "call.arguments.change", "call.add" ]
905,465
905,466
u465669072
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; string S; cin >> N >> S; vector<int> count(26); for (int i = 0; i < N; i++) { count.at((int)(S.at(i) - 'a'))++; } ll ans = 1; int div = 1000000007; for (int i = 0; i < N; i++) { ans *= count.at(i) + 1; ans %= div; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; string S; cin >> N >> S; vector<int> count(26); for (int i = 0; i < N; i++) { count.at((int)(S.at(i) - 'a'))++; } ll ans = 1; int div = 1000000007; for (int i = 0; i < 26; i++) { ans *= count.at(i) + 1; ans %= div; } cout << ans - 1 << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,474
905,475
u433189059
cpp
p03095
#include <bits/stdc++.h> #define llong long long #define mkpr make_pair #define riterator reverse_iterator using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) { if (ch == '-') f = -1; } for (; isdigit(ch); ch = getchar()) { x = x * 10 + ch - 48; } return x * f; } const int N = 1e5; const int S = 26; const int P = 1e9 + 7; char a[N + 3]; int cnt[S + 3]; int n; int main() { scanf("%d%s", &n, a + 1); for (int i = 1; i <= n; i++) cnt[a[i] - 96]++; llong ans = 1ll; for (int i = 1; i <= n; i++) ans = ans * (cnt[i] + 1ll) % P; ans = (ans - 1 + P) % P; printf("%lld\n", ans); return 0; }
#include <bits/stdc++.h> #define llong long long #define mkpr make_pair #define riterator reverse_iterator using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) { if (ch == '-') f = -1; } for (; isdigit(ch); ch = getchar()) { x = x * 10 + ch - 48; } return x * f; } const int N = 1e5; const int S = 26; const int P = 1e9 + 7; char a[N + 3]; int cnt[S + 3]; int n; int main() { scanf("%d%s", &n, a + 1); for (int i = 1; i <= n; i++) cnt[a[i] - 96]++; llong ans = 1ll; for (int i = 1; i <= S; i++) ans = ans * (cnt[i] + 1ll) % P; ans = (ans - 1 + P) % P; printf("%lld\n", ans); return 0; }
[ "identifier.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,505
905,506
u396278429
cpp
p03095
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; int main() { int64_t n, mod = 1000000007, a = 0; string s; cin >> n >> s; map<char, int64_t> m; rep(i, n) { if (!m.count(s[i])) m[s[i]] = 1; else ++m[s[i]]; } for (auto p : m) { a *= (p.second + 1); a %= mod; } cout << a - 1 << endl; return 0; }
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; int main() { int64_t n, mod = 1000000007, a = 1; string s; cin >> n >> s; map<char, int64_t> m; rep(i, n) { if (!m.count(s[i])) m[s[i]] = 1; else ++m[s[i]]; } for (auto p : m) { a *= (p.second + 1); a %= mod; } cout << a - 1 << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
905,507
905,508
u757584836
cpp
p03095
#include <bits/stdc++.h> using namespace std; #define ALL(a) (a).begin(), (a).end() #define rALL(a) (a).rbegin(), (a).rend() typedef pair<int, int> Pint; typedef pair<int64_t, int64_t> Pll; int main() { int64_t N, ans = 1; string S; cin >> N >> S; vector<int64_t> A(26); for (int i = 0; i < N; i++) { A.at(S.at(i) - 'a')++; } for (int i = 0; i < N; i++) { ans = ans * (A.at(i) + 1) % 1000000007; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> using namespace std; #define ALL(a) (a).begin(), (a).end() #define rALL(a) (a).rbegin(), (a).rend() typedef pair<int, int> Pint; typedef pair<int64_t, int64_t> Pll; int main() { int64_t N, ans = 1; string S; cin >> N >> S; vector<int64_t> A(26); for (int i = 0; i < N; i++) { A.at(S.at(i) - 'a')++; } for (int i = 0; i < 26; i++) { ans = ans * (A.at(i) + 1) % 1000000007; } cout << ans - 1 << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,537
905,538
u028572059
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll n; string s; cin >> n >> s; vector<ll> a(26); for (ll i = 0; i < n; i++) { a[s[i] - 'a']++; } ll ans = 1; for (ll i = 0; i < 26; i++) { ans *= a[i] + 1; ans /= 100000007; } cout << ans - 1; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll n; string s; cin >> n >> s; vector<ll> a(26); for (ll i = 0; i < n; i++) { a[s[i] - 'a']++; } ll ans = 1; for (ll i = 0; i < 26; i++) { ans *= a[i] + 1; ans %= 1000000007; } cout << ans - 1; return 0; }
[ "assignment.change" ]
905,549
905,548
u125051909
cpp
p03095
#include <algorithm> #include <bitset> #include <cmath> #include <fstream> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <string> #include <unordered_set> #include <vector> #define MOD_BIG 1000000007 #define MOD_BIG2 998244353 using std::cerr; using std::cin; using std::cout; using std::endl; using std::string; using ll = long long; using pint = std::pair<int, int>; using pll = std::pair<ll, ll>; using std::vector; #define FOR(i, begin, end) \ for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) \ for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) ////////////////////////////////////// ////////////////////////////////////// int main() { int N; cin >> N; string S; cin >> S; vector<int> cnt(26); REP(i, N) { cnt[S[i] - 'a'] += 1; } ll ans = 1; REP(i, N) { ans *= (cnt[i] + 1); ans %= MOD_BIG; } ans -= 1; cout << ans << endl; return 0; }
#include <algorithm> #include <bitset> #include <cmath> #include <fstream> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <string> #include <unordered_set> #include <vector> #define MOD_BIG 1000000007 #define MOD_BIG2 998244353 using std::cerr; using std::cin; using std::cout; using std::endl; using std::string; using ll = long long; using pint = std::pair<int, int>; using pll = std::pair<ll, ll>; using std::vector; #define FOR(i, begin, end) \ for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) \ for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) ////////////////////////////////////// ////////////////////////////////////// int main() { int N; cin >> N; string S; cin >> S; vector<int> cnt(26); REP(i, N) { cnt[S[i] - 'a'] += 1; } ll ans = 1; REP(i, 26) { ans *= (cnt[i] + 1); ans %= MOD_BIG; } ans -= 1; cout << ans << endl; return 0; }
[]
905,553
905,554
u888094685
cpp
p03095
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define INF 1000000010 #define EPS 1e-9 #define fst first #define scd second #define debug(x) cout << x << endl; #define repi(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) repi(i, 0, n) #define lp(i, n) repi(i, 0, n) #define repn(i, n) for (int i = n; i >= 0; i--) #define int long long #define endl "\n" signed main() { cin.tie(0); ios::sync_with_stdio(false); int n; string s; cin >> n >> s; int a[26] = {0}; rep(i, n) { a[s[i] - 'a']++; } int ans = 1; rep(i, 26) { ans *= a[i] + 1; ans %= MOD; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define INF 1000000010 #define EPS 1e-9 #define fst first #define scd second #define debug(x) cout << x << endl; #define repi(i, x, n) for (int i = x; i < n; i++) #define rep(i, n) repi(i, 0, n) #define lp(i, n) repi(i, 0, n) #define repn(i, n) for (int i = n; i >= 0; i--) #define int long long #define endl "\n" signed main() { cin.tie(0); ios::sync_with_stdio(false); int n; string s; cin >> n >> s; int a[26] = {0}; rep(i, n) { a[s[i] - 'a']++; } int ans = 1; rep(i, 26) { ans *= (a[i] + 1); ans %= MOD; } cout << ans - 1 << endl; return 0; }
[ "expression.operation.binary.add" ]
905,576
905,577
u386769326
cpp
p03095
#include <bits/stdc++.h> using namespace std; #define int long long #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define co(a) cout << a << endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp() pop_back() #define V vector #define P pair #define V2(a, b, c) V<V<int>> a(b, V<int>(c)) #define V2a(a, b, c, d) V<V<int>> a(b, V<int>(c, d)) #define incin(a) \ int a; \ cin >> a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(), a.end()), a.end()) #define pri priority_queue #define syo <int,V<int> #define ff fi.fi #define fs fi.se #define sf se.fi #define ss se.se //#define min min<int> //#define max max<int> template <class T> void cou(vector<vector<T>> a) { int b = a.size(); int c = a[0].size(); fo(i, b) { fo(j, c) { cout << a[i][j]; if (j == c - 1) cout << endl; else cout << ' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a, int b) { if (a % b == 0) return a / b; else return a / b + 1; } int keta(int a) { double b = a; b = log10(b); int c = b; return c + 1; } int souwa(int a) { return a * (a + 1) / 2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } */ int gcm(int a, int b) { int d = a, e = b, f; if (a < b) swap(a, b); int c, m = 1; while (m) { c = a % b; if (c == 0) { f = b; m--; } else { a = b; b = c; } } return f; } bool prime(int a) { if (a < 2) return false; else if (a == 2) return true; else if (a % 2 == 0) return false; double b = sqrt(a); for (int i = 3; i <= b; i += 2) { if (a % i == 0) { return false; } } return true; } struct Union { vector<int> par; Union(int a) { par = vector<int>(a, -1); } int find(int a) { if (par[a] < 0) return a; else return par[a] = find(par[a]); } bool same(int a, int b) { return find(a) == find(b); } int Size(int a) { return -par[find(a)]; } void unite(int a, int b) { a = find(a); b = find(b); if (a == b) return; if (Size(b) > Size(a)) swap<int>(a, b); par[a] += par[b]; par[b] = a; } }; int ketas(int a) { string b = to_string(a); int c = 0; fo(i, keta(a)) { c += b[i] - '0'; } return c; } /*int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); }*/ int lcm(int a, int b) { return a / gcm(a, b) * b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ }*/ bool fe(int a, int b) { a %= 10; b %= 10; if (a == 0) a = 10; if (b == 0) b = 10; if (a > b) return true; else return false; } int INF = 1000000007; struct edge { int s, t, d; }; V<int> mojisyu(string a) { V<int> b(26, 0); Sort(a); fo(i, a.sz) { b[a[i] - 'a']++; } return b; } signed main() { int f; cin >> f; string a; cin >> a; Sort(a); int b = 0; V<int> c(26, 0); for (char i = 'a'; i <= 'z'; i++) { for (int j = b; j < f; j++) { if (a[j] != i) break; b++; c[i - 'a']++; } } int d = 1; fo(i, 26) { d *= c[i]; d %= INF; } cout << d - 1 << endl; }
#include <bits/stdc++.h> using namespace std; #define int long long #define fo(a, b) for (int a = 0; a < b; a++) #define Sort(a) sort(a.begin(), a.end()) #define rev(a) reverse(a.begin(), a.end()) #define fi first #define se second #define co(a) cout << a << endl #define sz size() #define bgn begin() #define en end() #define pb(a) push_back(a) #define pp() pop_back() #define V vector #define P pair #define V2(a, b, c) V<V<int>> a(b, V<int>(c)) #define V2a(a, b, c, d) V<V<int>> a(b, V<int>(c, d)) #define incin(a) \ int a; \ cin >> a #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(), a.end()), a.end()) #define pri priority_queue #define syo <int,V<int> #define ff fi.fi #define fs fi.se #define sf se.fi #define ss se.se //#define min min<int> //#define max max<int> template <class T> void cou(vector<vector<T>> a) { int b = a.size(); int c = a[0].size(); fo(i, b) { fo(j, c) { cout << a[i][j]; if (j == c - 1) cout << endl; else cout << ' '; } } } /*template<> void cou(vector<vector<char>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } }*/ int wari(int a, int b) { if (a % b == 0) return a / b; else return a / b + 1; } int keta(int a) { double b = a; b = log10(b); int c = b; return c + 1; } int souwa(int a) { return a * (a + 1) / 2; } /*int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } */ int gcm(int a, int b) { int d = a, e = b, f; if (a < b) swap(a, b); int c, m = 1; while (m) { c = a % b; if (c == 0) { f = b; m--; } else { a = b; b = c; } } return f; } bool prime(int a) { if (a < 2) return false; else if (a == 2) return true; else if (a % 2 == 0) return false; double b = sqrt(a); for (int i = 3; i <= b; i += 2) { if (a % i == 0) { return false; } } return true; } struct Union { vector<int> par; Union(int a) { par = vector<int>(a, -1); } int find(int a) { if (par[a] < 0) return a; else return par[a] = find(par[a]); } bool same(int a, int b) { return find(a) == find(b); } int Size(int a) { return -par[find(a)]; } void unite(int a, int b) { a = find(a); b = find(b); if (a == b) return; if (Size(b) > Size(a)) swap<int>(a, b); par[a] += par[b]; par[b] = a; } }; int ketas(int a) { string b = to_string(a); int c = 0; fo(i, keta(a)) { c += b[i] - '0'; } return c; } /*int gcm(int a,int b){ if(b==0) return a; return gcm(b,a%b); }*/ int lcm(int a, int b) { return a / gcm(a, b) * b; } /*struct aa{ vector<int> gt; aa(int n){ gt= vector<int>(n, 1); } void c(V<int> d,int b){ if(d[b]==0){ gt[d[b]-1]++; gt[gt.sz-1]++; } else{ gt[d[b]-1]++; c(d,d[d[b]]-1); } } void cok(int a){ cout<<gt[a-1]<<endl; fo(i,a-1) cout<<gt[i]<<endl; } }; */ /*struct dfs(){ }*/ bool fe(int a, int b) { a %= 10; b %= 10; if (a == 0) a = 10; if (b == 0) b = 10; if (a > b) return true; else return false; } int INF = 1000000007; struct edge { int s, t, d; }; V<int> mojisyu(string a) { V<int> b(26, 0); Sort(a); fo(i, a.sz) { b[a[i] - 'a']++; } return b; } signed main() { int f; cin >> f; string a; cin >> a; Sort(a); int b = 0; V<int> c(26, 0); for (char i = 'a'; i <= 'z'; i++) { for (int j = b; j < f; j++) { if (a[j] != i) break; b++; c[i - 'a']++; } } int d = 1; fo(i, 26) { d *= c[i] + 1; d %= INF; } cout << d - 1 << endl; }
[ "assignment.change" ]
905,578
905,579
u322177979
cpp
p03095
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9 + 7; int main() { int n; string s; cin >> n >> s; ll ans = 1; vector<ll> al(26, 0); for (int i = 0; i < n; i++) { al[s[i] - 'a']++; } for (int i = 0; i < n; i++) { ans *= (al[i] + 1); ans %= MOD; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9 + 7; int main() { int n; string s; cin >> n >> s; ll ans = 1; vector<ll> al(26, 0); for (int i = 0; i < n; i++) { al[s[i] - 'a']++; } for (int i = 0; i < 26; i++) { ans *= (al[i] + 1); ans %= MOD; } cout << ans - 1 << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,600
905,601
u003019316
cpp
p03095
#include <bits/stdc++.h> using namespace std; using Int = long long; typedef pair<int, int> P; typedef priority_queue<int> Pr; typedef vector<int> V; typedef vector<P> Vp; typedef map<int, int> MP; const int mod = 1000000007; const Int INF = 1145141919810893931; #define END \ { \ cout << ans << '\n'; \ return 0; \ } template <class T> inline bool cmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool cmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <int MOD> struct ModInt { static const int Mod = MOD; unsigned x; ModInt() : x(0) {} ModInt(signed sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; } ModInt(signed long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; } int get() const { return (int)x; } ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; } ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; } ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; } ModInt &operator/=(ModInt that) { return *this *= that.inverse(); } ModInt operator+(ModInt that) const { return ModInt(*this) += that; } ModInt operator-(ModInt that) const { return ModInt(*this) -= that; } ModInt operator*(ModInt that) const { return ModInt(*this) *= that; } ModInt operator/(ModInt that) const { return ModInt(*this) /= that; } ModInt inverse() const { signed a = x, b = MOD, u = 1, v = 0; while (b) { signed t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } if (u < 0) u += Mod; ModInt res; res.x = (unsigned)u; return res; } bool operator==(ModInt that) const { return x == that.x; } bool operator!=(ModInt that) const { return x != that.x; } ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; } }; template <int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) { ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; } typedef ModInt<mod> mint; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; string s; cin >> s; mint ans = 1; int a[26] = {}; for (int i = 0; i < n; i++) a[s[i] - 'a']++; for (int i = 0; i < n; i++) if (a[i]) ans *= a[i] + 1; cout << (ans - 1).get() << '\n'; }
#include <bits/stdc++.h> using namespace std; using Int = long long; typedef pair<int, int> P; typedef priority_queue<int> Pr; typedef vector<int> V; typedef vector<P> Vp; typedef map<int, int> MP; const int mod = 1000000007; const Int INF = 1145141919810893931; #define END \ { \ cout << ans << '\n'; \ return 0; \ } template <class T> inline bool cmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool cmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } template <int MOD> struct ModInt { static const int Mod = MOD; unsigned x; ModInt() : x(0) {} ModInt(signed sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; } ModInt(signed long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; } int get() const { return (int)x; } ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; } ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; } ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; } ModInt &operator/=(ModInt that) { return *this *= that.inverse(); } ModInt operator+(ModInt that) const { return ModInt(*this) += that; } ModInt operator-(ModInt that) const { return ModInt(*this) -= that; } ModInt operator*(ModInt that) const { return ModInt(*this) *= that; } ModInt operator/(ModInt that) const { return ModInt(*this) /= that; } ModInt inverse() const { signed a = x, b = MOD, u = 1, v = 0; while (b) { signed t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } if (u < 0) u += Mod; ModInt res; res.x = (unsigned)u; return res; } bool operator==(ModInt that) const { return x == that.x; } bool operator!=(ModInt that) const { return x != that.x; } ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; } }; template <int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) { ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; } typedef ModInt<mod> mint; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; string s; cin >> s; mint ans = 1; int a[26] = {}; for (int i = 0; i < n; i++) a[s[i] - 'a']++; for (int i = 0; i < 26; i++) if (a[i]) ans *= a[i] + 1; cout << (ans - 1).get() << '\n'; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,618
905,619
u735089337
cpp
p03095
#include <iostream> #include <map> using namespace std; const long long MOD = 1000000007; int main() { long long n, result = 1; string s; cin >> n >> s; map<char, long long> count; for (char c : s) { count[c]++; } for (auto &p : count) { result = result * p.second % MOD; } cout << (result - 1 + MOD) % MOD; return 0; }
#include <iostream> #include <map> using namespace std; const long long MOD = 1000000007; int main() { long long n, result = 1; string s; cin >> n >> s; map<char, long long> count; for (char c : s) { count[c]++; } for (auto &p : count) { result = result * (p.second + 1) % MOD; } cout << (result - 1 + MOD) % MOD; return 0; }
[]
905,628
905,629
u085367022
cpp
p03095
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPP(i, n) for (int i = 1; i <= n; i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF = (long long)1E17; #define i_7 (long long)(1E9 + 7) long mod(long a) { long long c = a % i_7; if (c >= 0) return c; return c + i_7; } using namespace std; bool prime_(int n) { if (n == 1) { return false; } else if (n == 2) { return true; } else { for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } } long long gcd_(long long a, long long b) { if (a < b) { swap(a, b); } if (a % b == 0) { return b; } else { return gcd_(b, a % b); } } long long lcm_(long long x, long long y) { return (x / gcd_(x, y)) * y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } // Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)]; //先祖をrootで取っておきたい。 } // AとBをくっ付ける bool connect(int A, int B) { // AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); // Aのサイズを更新する Parent[A] += Parent[B]; // Bの親をAに変更する Parent[B] = A; return true; } }; int main() { long long n; string s; cin >> n; cin >> s; long long cnt[26] = {}; int c; REP(i, n) { c = s[i] - 'a'; cnt[c]++; } long long ans = 1; REP(i, n) { if (cnt[i]) { ans *= 1 + cnt[i]; ans = mod(ans); } } ans -= 1; cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPP(i, n) for (int i = 1; i <= n; i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF = (long long)1E17; #define i_7 (long long)(1E9 + 7) long mod(long a) { long long c = a % i_7; if (c >= 0) return c; return c + i_7; } using namespace std; bool prime_(int n) { if (n == 1) { return false; } else if (n == 2) { return true; } else { for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } } long long gcd_(long long a, long long b) { if (a < b) { swap(a, b); } if (a % b == 0) { return b; } else { return gcd_(b, a % b); } } long long lcm_(long long x, long long y) { return (x / gcd_(x, y)) * y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } // Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)]; //先祖をrootで取っておきたい。 } // AとBをくっ付ける bool connect(int A, int B) { // AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); // Aのサイズを更新する Parent[A] += Parent[B]; // Bの親をAに変更する Parent[B] = A; return true; } }; int main() { long long n; string s; cin >> n; cin >> s; long long cnt[26] = {}; int c; REP(i, n) { c = s[i] - 'a'; cnt[c]++; } long long ans = 1; REP(i, 26) { if (cnt[i]) { ans *= 1 + cnt[i]; ans = mod(ans); } } ans -= 1; cout << ans << endl; return 0; }
[]
905,630
905,631
u222293734
cpp
p03095
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(a, b) for (int a = 0; a < (b); ++a) #define REP1(i, n) for (int i = 1; i <= (n); ++i) #define debug(x) cerr << #x << ": " << x << '\n' #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define pb push_back #define mp make_pair #define INF (1 << 29) using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; int dy[] = {0, 0, 1, -1, 0}; int dx[] = {1, -1, 0, 0, 0}; template <class T = int> T in() { T x; cin >> x; return (x); } template <class T> void print(T &x) { cout << x << '\n'; } const int MOD = (int)1e9 + 7; const int MAX = 510000; ll fac[MAX], finv[MAX], inv[MAX]; void COMint() { 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; } } ll 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; } ll gcd(ll a, ll b) { if (b == 0) return a; if (a > b) { swap(a, b); } return gcd(a, b % a); } ll lcm(ll a, ll b) { ll g; g = gcd(a, b); return a * b / g; } bool compare_by_b(pair<int, int> a, pair<int, int> b) { if (a.second != b.second) { return a.second < b.second; } else { return a.first < b.first; } } bool compare_by_a(pair<int, int> a, pair<int, int> b) { if (a.first != b.first) { return a.first < b.first; } else { return a.second < b.second; } } int main() { ios::sync_with_stdio(false); cin.tie(0); int N = in(); string s = in<string>(); vector<int> str; REP(i, N) { str.pb(s[i] - 'a'); } int cnt_1; cnt_1 = 0; ll k; k = 1; REP(i, 24) { if (count(all(str), i) == 1) { cnt_1++; } else if (count(all(str), i) > 1) { k = k * (count(all(str), i) + 1); k %= MOD; } } ll ans; ans = 1; REP(i, cnt_1) { ans *= 2; ans %= MOD; } ans *= k; ans %= MOD; if (ans > 1) { ans--; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(a, b) for (int a = 0; a < (b); ++a) #define REP1(i, n) for (int i = 1; i <= (n); ++i) #define debug(x) cerr << #x << ": " << x << '\n' #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define pb push_back #define mp make_pair #define INF (1 << 29) using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; int dy[] = {0, 0, 1, -1, 0}; int dx[] = {1, -1, 0, 0, 0}; template <class T = int> T in() { T x; cin >> x; return (x); } template <class T> void print(T &x) { cout << x << '\n'; } const int MOD = (int)1e9 + 7; const int MAX = 510000; ll fac[MAX], finv[MAX], inv[MAX]; void COMint() { 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; } } ll 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; } ll gcd(ll a, ll b) { if (b == 0) return a; if (a > b) { swap(a, b); } return gcd(a, b % a); } ll lcm(ll a, ll b) { ll g; g = gcd(a, b); return a * b / g; } bool compare_by_b(pair<int, int> a, pair<int, int> b) { if (a.second != b.second) { return a.second < b.second; } else { return a.first < b.first; } } bool compare_by_a(pair<int, int> a, pair<int, int> b) { if (a.first != b.first) { return a.first < b.first; } else { return a.second < b.second; } } int main() { ios::sync_with_stdio(false); cin.tie(0); int N = in(); string s = in<string>(); vector<int> str; REP(i, N) { str.pb(s[i] - 'a'); } int cnt_1; cnt_1 = 0; ll k; k = 1; REP(i, 26) { if (count(all(str), i) == 1) { cnt_1++; } else if (count(all(str), i) > 1) { k = k * (count(all(str), i) + 1); k %= MOD; } } ll ans; ans = 1; REP(i, cnt_1) { ans *= 2; ans %= MOD; } ans *= k; ans %= MOD; if (ans > 1) { ans--; } cout << ans << endl; return 0; }
[ "literal.number.change", "call.arguments.change" ]
905,638
905,639
u311671153
cpp
p03095
#include <bits/stdc++.h> using namespace std; int mod = 1'000'000'007; int main() { int n; cin >> n; string s; cin >> s; vector<int> num(26, 0); for (int i = 0; i < n; i++) num[s[i] - 'a']++; long long ans = 1; for (int i = 0; i < n; i++) { ans *= num[i] + 1; ans %= mod; } cout << (ans + mod - 1) % mod << endl; }
#include <bits/stdc++.h> using namespace std; int mod = 1'000'000'007; int main() { int n; cin >> n; string s; cin >> s; vector<int> num(26, 0); for (int i = 0; i < n; i++) num[s[i] - 'a']++; long long ans = 1; for (int i = 0; i < 26; i++) { ans *= num[i] + 1; ans %= mod; } cout << (ans + mod - 1) % mod << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,640
905,641
u013408661
cpp
p03095
#include <iostream> #include <vector> using namespace std; int alphabet[26]; typedef long long ll; const int mod = 1e9 + 7; int main() { int N; cin >> N; for (int i = 0; i < 26; i++) { alphabet[i] = 1; } string S; cin >> S; for (int i = 0; i < N; i++) { int c = S[i] - 'a'; alphabet[c]++; } ll sum = 0; for (int i = 0; i < 26; i++) { sum *= alphabet[i]; sum = sum % mod; } cout << sum - 1 << endl; return 0; }
#include <iostream> #include <vector> using namespace std; int alphabet[26]; typedef long long ll; const int mod = 1e9 + 7; int main() { int N; cin >> N; for (int i = 0; i < 26; i++) { alphabet[i] = 1; } string S; cin >> S; for (int i = 0; i < N; i++) { int c = S[i] - 'a'; alphabet[c]++; } ll sum = 1; for (int i = 0; i < 26; i++) { sum *= alphabet[i]; sum = sum % mod; } cout << sum - 1 << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
905,654
905,655
u904123392
cpp
p03095
#include <iostream> #include <string> #include <vector> using namespace std; int main(void) { int N; cin >> N; string s; cin >> s; vector<int> check(26, 1); long ans = 0; for (int j = 0; j < N; j++) { check[s[j] - 'a']++; } for (int i = 0; i < 26; i++) { ans *= check[i]; ans %= 1000000007; } cout << ans - 1 << endl; return 0; }
#include <iostream> #include <string> #include <vector> using namespace std; int main(void) { int N; cin >> N; string s; cin >> s; vector<int> check(26, 1); long ans = 1; for (int j = 0; j < N; j++) { check[s[j] - 'a']++; } for (int i = 0; i < 26; i++) { ans *= check[i]; ans %= 1000000007; } cout << ans - 1 << endl; return 0; }
[ "literal.number.change", "variable_declaration.value.change" ]
905,672
905,673
u407416173
cpp
p03095
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) using ll = long long; using namespace std; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } // sort(a, a + N, greater<ll>()) // descend // sort(a, a+N) // ascend /** void comb(vector<vector <ll> > &v) { rep (i,0,v.size()) { v[i][0] = 1; v[i][i] = 1; } rep (k,1,v.size()) { rep (j,1,k) { v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]); } } } /*main内でnCn~nC0 生成 ** vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0)); comb(v); */ int main() { ll mod = 1000000007; ll n; cin >> n; string s; cin >> s; ll cnt[50] = {0}; ll p = 0; rep(j, 0x61, 0x7b) { rep(i, 0, n) { if (s[i] == j) cnt[p]++; } p++; } ll ans = 1; rep(i, 0, p) { if (cnt[i] >= 1) ans = (cnt[i] + 1) % mod; ans = ans % mod; } cout << (ans - 1) % mod; }
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) using ll = long long; using namespace std; ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; } // sort(a, a + N, greater<ll>()) // descend // sort(a, a+N) // ascend /** void comb(vector<vector <ll> > &v) { rep (i,0,v.size()) { v[i][0] = 1; v[i][i] = 1; } rep (k,1,v.size()) { rep (j,1,k) { v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]); } } } /*main内でnCn~nC0 生成 ** vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0)); comb(v); */ int main() { ll mod = 1000000007; ll n; cin >> n; string s; cin >> s; ll cnt[50] = {0}; ll p = 0; rep(j, 0x61, 0x7b) { rep(i, 0, n) { if (s[i] == j) cnt[p]++; } p++; } ll ans = 1; rep(i, 0, p) { if (cnt[i] >= 1) ans *= (cnt[i] + 1) % mod; ans = ans % mod; } cout << (ans - 1) % mod; }
[ "assignment.value.change" ]
905,676
905,677
u499009346
cpp
p03095
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define repi(i, n, m) for (int i = (int)(n); i < (int)(m); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; using namespace std; int main() { int n; string s; cin >> n >> s; vector<ll> l(26, 0); rep(i, n) l.at(s.at(i) - 'a')++; ll ans = 1; rep(i, n) { ans *= (l.at(i) + 1); ans %= 1000000007; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define reps(i, n) for (int i = 1; i <= (int)(n); i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define repi(i, n, m) for (int i = (int)(n); i < (int)(m); i++) #define all(x) (x).begin(), (x).end() typedef long long ll; using namespace std; int main() { int n; string s; cin >> n >> s; vector<ll> l(26, 0); rep(i, n) l.at(s.at(i) - 'a')++; ll ans = 1; rep(i, 26) { ans *= (l.at(i) + 1); ans %= 1000000007; } cout << ans - 1 << endl; }
[]
905,685
905,684
u649915042
cpp
p03095
#include <bits/stdc++.h> using namespace std; int main() { vector<int> alph(25, 1); int N; char x; cin >> N; for (int i = 0; i < N; i++) { cin >> x; int k = x - 97; alph[k]++; } long long ans = 1; for (int k : alph) { ans *= k; ans %= 1000000007; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { vector<int> alph(26, 1); int N; char x; cin >> N; for (int i = 0; i < N; i++) { cin >> x; int k = x - 97; alph[k]++; } long long ans = 1; for (int k : alph) { ans *= k; ans %= 1000000007; } cout << ans - 1 << endl; }
[ "literal.number.change", "call.arguments.change" ]
905,728
905,729
u507188501
cpp
p03095
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> using namespace std; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <class T> using VVV = V<VV<T>>; template <class T, class U> using P = pair<T, U>; template <class S, class T, class U> using TUP = tuple<S, T, U>; using ll = long long; using ull = unsigned long long; using dbl = double; using ld = long double; using str = string; using vll = V<ll>; using vll2 = VV<ll>; using vll3 = VVV<ll>; using pll = P<ll, ll>; using tll = TUP<ll, ll, ll>; using vpll = V<pll>; using tpll = V<tll>; using vs = V<str>; using vvs = V<vs>; using vd = V<dbl>; using vvd = V<vd>; using qll = queue<ll>; using qpll = queue<pll>; using mapll = map<ll, ll>; using setll = set<ll>; #define int ll #define fst first #define snd second #define PQ priority_queue #define mp make_pair #define mt make_tuple #define pb push_back #define popb pop_back() #define sz size() #define bn begin() #define ed end() #define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++) #define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) #define REP(i, n) FOR(i, 0, (n)-1) #define REP1(i, n) FOR(i, 1, (n)) #define VFOR(i, v) for (auto &(i) : v) #define IOTA(a, n) \ vll(a)((n)); \ iota((a).bn, (a).ed, (0)); #define fixed_echo(x) echo(fixed, setprecision(20), x) #define SORT_ASC(a) sort((a).bn, (a).ed) #define SORT_DESC(a) sort((a).rbegin(), (a).rend()) #define UNIQUE(a) (a).erase(unique((a).bn, (a).ed), (a).ed) #define PREVP(a) prev_permutation((a).bn, (a).ed) #define NEXTP(a) next_permutation((a).bn, (a).ed) #define BINS(a, target) binary_search((a).bn, (a).ed, target) #define LB(a, target) lower_bound((a).bn, (a).ed, target) #define FIND(a, target) find((a).bn, (a).ed, target) #define UB(a, target) upper_bound((a).bn, (a).ed, target) #define ARG(a, itr) distance((a).begin(), itr) #define CNT(a, target) count((a).bn, (a).ed, target) #define SUM(a) accumulate((a).bn, (a).ed, 0) #define DEBUG(...) \ dal(#__VA_ARGS__); \ dal(__VA_ARGS__) #define Dig2(a, b) ((a) >> (b)&1) #define Dig10(a, b) (ll)(((a) / ((ll)(pow(10.0, (dbl)(b))))) % 10) #define DigN2(a) ((llabs(a) == 0) ? 1 : ((ll)log2((dbl)llabs(a)) + 1)) #define DigN10(a) ((llabs(a) == 0) ? 1 : ((ll)log10((dbl)llabs(a)) + 1)) #define Pow2(a) ((ll)(1) << (a)) #define Pow10(a) ((ll)(pow(10.0, double(a)))) #define LSB(a) ((a) & -(a)) #define llin(n) \ ll n; \ cin >> n; #define strin(n) \ str n; \ cin >> n; #define vin(v) \ VFOR(i, v) { cin >> (i); }; #define vllin(v, N) \ vll(v)((N)); \ vin(v); #define vpllin(vp, N) \ vpll vp; \ REP(i, N) { \ ll a, b; \ cin >> a >> b; \ vp.pb(mp(a, b)); \ } #define vll2in(vv, col, row) \ vll2(vv); \ (vv).resize((col)); \ for (ll i = 0; i < col; i++) { \ vv[i].resize(row); \ } \ REP(y, col) { \ REP(x, row) { cin >> (vv)[y][x]; } \ } #define vl4in(v1, v2, N) \ vll(v1)(N), (v2)(N); \ REP(i, N) { cin >> (v1)[i] >> (v2)[i]; }; #define vl6in(v1, v2, v3, N) \ vll(v1)(N), (v2)(N), (v3)(N); \ REP(i, N) { cin >> (v1)[i] >> (v2)[i] >> (v3)[i]; }; #define vsin(v, N) \ vs(v)((N)); \ vin(v); #define sort_asc_pair_by_second(vp) \ std::sort(vp.begin(), vp.end(), [](auto &left, auto &right) { \ return left.second < right.second; \ }); #define sort_desc_pair_by_second(vp) \ std::sort(vp.begin(), vp.end(), [](auto &left, auto &right) { \ return left.second > right.second; \ }); #define min(...) Min(__VA_ARGS__) #define max(...) Max(__VA_ARGS__) #define emin(a, ...) ((a) = Min((a), __VA_ARGS__)) #define emax(a, ...) ((a) = Max((a), __VA_ARGS__)) #define egcd(a, ...) ((a) = gcd((a), __VA_ARGS__)) #define elcm(a, ...) ((a) = lcm((a), __VA_ARGS__)) #define tf(cond, t, f) \ if (cond) { \ echo(t); \ } else { \ echo(f); \ } #define yn(cond) tf(cond, "yes", "no") #define Yn(cond) tf(cond, "Yes", "No") #define YN(cond) tf(cond, "YES", "NO") static const ll MOD = (ll)1e9 + 7; static const ll INF = (1LL << 62) - 1; // 4.611E+18 static const dbl PI = acos(-1.0); void Input(){}; template <class T, class... Args> void Input(T &t, Args &...args) { cin >> t; Input(args...); } void vInit(ll size) {} template <class T, class... Args> void vInit(ll size, V<T> &v, Args &...args) { v.resize(size); vInit(size, args...); } void vInputNum(ll num) {} template <class T, class... Args> void vInputNum(ll num, V<T> &v, Args &...args) { cin >> v[num]; vInputNum(num, args...); } void vInput(ll size) {} template <class... Args> void vInput(ll size, Args &...args) { vInit(size); REP(i, size) { vInputNum(i, args...); } } template <class S, class T> ostream &operator<<(ostream &o, const P<S, T> &p) { return o << "(" << p.first << ", " << p.second << ")"; } template <class T> ostream &operator<<(ostream &o, const V<T> &v) { if (v.empty()) { return o << "[]"; } else { auto itr = v.bn; o << "[" << *itr; itr++; while (itr != v.ed) { o << ", " << *itr; itr++; } o << "]"; return o; } } template <class T> ostream &operator<<(ostream &o, queue<T> q) { if (q.empty()) { return o << "| |"; } else { while (!q.empty()) { o << "| " << q.front() << " "; q.pop(); } o << "|"; return o; } } template <class S, class T> ostream &operator<<(ostream &o, const map<S, T> &m) { if (m.empty()) { return o << "[]"; } else { auto itr = m.bn; o << "{" << itr->first << ": " << itr->second; itr++; while (itr != m.ed) { o << "} {" << itr->first << ": " << itr->second; itr++; } o << "}"; return o; } } template <class T> ostream &operator<<(ostream &o, const set<T> &s) { if (s.empty()) { return o << "<>"; } else { auto itr = s.bn; o << "<" << *itr; itr++; while (itr != s.ed) { o << ", " << *itr; itr++; } o << ">"; return o; } } void say() {} template <class T> void say(T t) { cout << t; } template <class Head, class... Body> void say(Head h, Body... b) { cout << h; say(b...); } void puts() {} template <class T> void puts(T t) { cout << t; } template <class Head, class... Body> void puts(Head h, Body... b) { cout << h << " "; puts(b...); } void echo() { cout << "\n"; } template <class... Args> void echo(Args... args) { say(args...); cout << "\n"; } void print() { cout << "\n"; } template <class... Args> void print(Args... args) { puts(args...); cout << "\n"; } void dbgsay() {} template <class T> void dbgsay(T t) { cout << t; } template <class Head, class... Body> void dbgsay(Head h, Body... b) { cerr << h << " "; dbgsay(b...); } void dbgecho() { cout << "\n"; } template <class... Args> void dbgecho(Args... args) { dbgsay(args...); cerr << "\n"; } void echovv() {} template <class T> void echovv(VV<T> v) { if (v.empty()) { echo(); } else { VFOR(i, v) echo(v); } } template <class T, class... Args> void echovv(VV<T> v, Args... args) { echovv(v); echovv(args...); } template <class Head> Head Min(Head head) { return head; } template <class Head, class... Body> Head Min(Head h, Body... b) { auto t = Min(b...); return (h < t) ? h : t; } template <class Head> Head Max(Head head) { return head; } template <class Head, class... Body> Head Max(Head h, Body... b) { auto t = Max(b...); return (h > t) ? h : t; } ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } template <class... Body> ll gcd(ll h, Body... b) { return gcd(h, gcd(b...)); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } template <class... Body> ll lcm(ll h, Body... b) { return lcm(h, lcm(b...)); } ll Bset(ll a, ll b, ll c) { if (c) a |= b; else a &= ~b; return a; } ll sumOfRange(ll N) { return N * (N - 1) / 2; } struct UF { public: ll tsize; ll mode; ll connect = 0; vll nodeSize; vll par; vll rank; UF(){}; UF(const UF &uf) {} UF(ll _size, ll _mode = 0) { tsize = _size; mode = _mode; par.assign(tsize, -1); if (!mode) rank.resize(tsize, 0); nodeSize.resize(tsize, 1); } ll root(ll x) { return par[x] < 0 ? x : par[x] = root(par[x]); } bool isRoot(ll x) { return root(x) == x; } void unite(ll x, ll y) { x = root(x); y = root(y); if (x == y) return; if (mode) { par[x] += par[y]; par[y] += x; } else { connect -= sumOfRange(nodeSize[x]) + sumOfRange(nodeSize[y]); connect += sumOfRange(nodeSize[x] + nodeSize[y]); if (rank[x] < rank[y]) { nodeSize[y] += nodeSize[x]; par[y] += par[x]; par[x] = y; } else { nodeSize[x] += nodeSize[y]; par[x] += par[y]; par[y] = x; if (rank[x] == rank[y]) rank[x]++; } } } bool same(ll x, ll y) { return root(x) == root(y); } ll size(ll x) { return -par[root(x)]; } }; class Vertex { public: ll idx; ll param = -1; ll dist = INF; vector<pair<Vertex *, ll> /**/> e; ll size() { return e.size(); } bool operator==(const Vertex *o) { return dist == o->dist; } bool operator!=(const Vertex *o) { return dist != o->dist; } bool operator>(const Vertex *o) { return dist > o->dist; } bool operator<(const Vertex *o) { return dist < o->dist; } bool operator>=(const Vertex *o) { return dist >= o->dist; } bool operator<=(const Vertex *o) { return dist <= o->dist; } }; class Graph { public: vector<Vertex *> V; vll order; typedef tuple<Vertex *, Vertex *, ll> Edge; vector<Edge> E; Graph(ll siz) { REP(i, siz) { auto v = new Vertex(); v->idx = i; V.pb(v); } } static bool comp(const Edge &e1, const Edge &e2) { return get<2>(e1) < get<2>(e2); } Vertex *getVertex(ll idx) { return V[idx]; } void unite(ll from, ll to, ll w = 1, bool digraph = true) { E.push_back(make_tuple(V[from], V[to], w)); V[from]->e.pb(make_pair(V[to], w)); if (!digraph) { E.push_back(make_tuple(V[to], V[from], w)); V[to]->e.pb(make_pair(V[from], w)); } } void dijkstra(ll start) { PQ<Vertex *, vector<Vertex *>, greater<Vertex *> /**/> pq; Vertex *s = getVertex(start); s->dist = 0; pq.push(s); while (!pq.empty()) { Vertex *v = pq.top(); pq.pop(); for (auto &u : v->e) { if (u.first->dist > v->dist + u.second) { u.first->dist = v->dist + u.second; pq.push(u.first); } } } } bool sort() { for (auto &v : V) { if (v->param == -1 && !sort_visit(v->idx)) { return false; } } reverse(order.bn, order.ed); return true; } bool sort_visit(int v) { Vertex *_v = getVertex(v); _v->param = 1; if (!_v->e.empty()) { for (auto &u : _v->e) { if (u.first->param == 2) continue; if (u.first->param == 1) return false; if (!sort_visit(u.first->idx)) return false; } } order.push_back(v); _v->param = 2; return true; } }; ll isPrime(ll n) { if (n <= 1) return 0; FOR(i, 2, (ll)sqrt(n)) { if (n % i == 0) return 0; } return 1; } ll DigS10(ll n) { ll m = 0; REP(i, DigN10(n)) { m += (ll)((llabs(n) % Pow10(i + 1))) / Pow10(i); } return m; } ll PowMod(ll a, ll b) { ll ans = 1, x = a % MOD; REP(i, DigN2(b)) { if (Dig2(b, i) == 1) { ans = (ans * x) % MOD; } if (i != (DigN2(b) - 1)) { x = (x * x) % MOD; } } return ans; } vll FactMod(1, 1); vll FactModInv(1, 1); ll Mod(ll n) { n %= MOD; n = (n + MOD) % MOD; return n; } ll InvM(ll n) { n = Mod(n); n = PowMod(n, MOD - 2); return n; } void CFactMod(ll n) { if (FactMod.size() <= n) { FOR(i, FactMod.size(), n) { FactMod.pb((FactMod[i - 1] * (i % MOD)) % MOD); } } } void CFactModInv(ll n) { CFactMod(n); if (FactModInv.size() < (n + 1)) { FactModInv.resize(n + 1, -1); } if (FactModInv[n] == -1) { FactModInv[n] = PowMod(FactMod[n], MOD - 2); } for (int i = n - 1; i >= 1; i--) { if (FactModInv[i] != -1) break; FactModInv[i] = ((FactModInv[i + 1] * ((i + 1) % MOD)) % MOD); } } ll CombMod(ll n, ll k) { if (n < 0 || k < 0 || n < k) return 0; if (n + 1 > FactModInv.size()) CFactModInv(n); return ((((FactModInv[k] * FactModInv[n - k]) % MOD) * FactMod[n]) % MOD); } pll factor_sub(ll n, ll m) { ll i = 0; while (n % m == 0) { i++; n /= m; } return mp(i, n); } vpll factrization(ll n) { vpll a; ll c, m; tie(c, m) = factor_sub(n, 2); if (c > 0) a.pb(mp(2, c)); for (ll i = 3; m >= i * i; i += 2) { tie(c, m) = factor_sub(m, i); if (c > 0) a.pb(mp(i, c)); } if (m > 1) a.pb(mp(m, 1)); return a; } vll countSameNeighbour(vll v) { ll prev, pres; vll ctr; ctr.pb(1); FOR(i, 1, v.size() - 1) { prev = v[i - 1]; pres = v[i]; if (pres != prev) { ctr.pb(1); } else { ctr[ctr.size() - 1]++; } } return ctr; } vll countSameNeighbour(str s) { ll prev, pres; vll ctr; ctr.pb(1); FOR(i, 1, s.size() - 1) { prev = s[i - 1]; pres = s[i]; if (pres != prev) { ctr.pb(1); } else { ctr[ctr.size() - 1]++; } } return ctr; } ll sumDigit(ll N) { ll sum = 0; for (ll i = 1; i <= N; i *= 10) { sum += (N % (i * 10)) / i; } return sum; } ll dot(vll a, vll b) { ll ans = 0; REP(i, a.size()) { ans += a[i] * b[i]; } return ans; } ll dot(vpll p) { ll ans = 0; REP(i, p.size()) { ans += p[i].first * p[i].second; } return ans; } ll xorSum(ll n) { if (n <= 0) return 0; switch (n % 4) { case 0: return n; break; case 1: return 1; break; case 2: return n + 1; break; default: return 0; break; } } signed main() { llin(n); strin(s); SORT_ASC(s); vll ctr = countSameNeighbour(s); ll ans = 1; REP(i, n) { ans *= (ctr[i] + 1) % MOD; } echo(ans - 1); }
#include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <stack> #include <string> #include <vector> using namespace std; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <class T> using VVV = V<VV<T>>; template <class T, class U> using P = pair<T, U>; template <class S, class T, class U> using TUP = tuple<S, T, U>; using ll = long long; using ull = unsigned long long; using dbl = double; using ld = long double; using str = string; using vll = V<ll>; using vll2 = VV<ll>; using vll3 = VVV<ll>; using pll = P<ll, ll>; using tll = TUP<ll, ll, ll>; using vpll = V<pll>; using tpll = V<tll>; using vs = V<str>; using vvs = V<vs>; using vd = V<dbl>; using vvd = V<vd>; using qll = queue<ll>; using qpll = queue<pll>; using mapll = map<ll, ll>; using setll = set<ll>; #define int ll #define fst first #define snd second #define PQ priority_queue #define mp make_pair #define mt make_tuple #define pb push_back #define popb pop_back() #define sz size() #define bn begin() #define ed end() #define FOR(i, a, b) for (ll i = (a); i <= (ll)(b); i++) #define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) #define REP(i, n) FOR(i, 0, (n)-1) #define REP1(i, n) FOR(i, 1, (n)) #define VFOR(i, v) for (auto &(i) : v) #define IOTA(a, n) \ vll(a)((n)); \ iota((a).bn, (a).ed, (0)); #define fixed_echo(x) echo(fixed, setprecision(20), x) #define SORT_ASC(a) sort((a).bn, (a).ed) #define SORT_DESC(a) sort((a).rbegin(), (a).rend()) #define UNIQUE(a) (a).erase(unique((a).bn, (a).ed), (a).ed) #define PREVP(a) prev_permutation((a).bn, (a).ed) #define NEXTP(a) next_permutation((a).bn, (a).ed) #define BINS(a, target) binary_search((a).bn, (a).ed, target) #define LB(a, target) lower_bound((a).bn, (a).ed, target) #define FIND(a, target) find((a).bn, (a).ed, target) #define UB(a, target) upper_bound((a).bn, (a).ed, target) #define ARG(a, itr) distance((a).begin(), itr) #define CNT(a, target) count((a).bn, (a).ed, target) #define SUM(a) accumulate((a).bn, (a).ed, 0) #define DEBUG(...) \ dal(#__VA_ARGS__); \ dal(__VA_ARGS__) #define Dig2(a, b) ((a) >> (b)&1) #define Dig10(a, b) (ll)(((a) / ((ll)(pow(10.0, (dbl)(b))))) % 10) #define DigN2(a) ((llabs(a) == 0) ? 1 : ((ll)log2((dbl)llabs(a)) + 1)) #define DigN10(a) ((llabs(a) == 0) ? 1 : ((ll)log10((dbl)llabs(a)) + 1)) #define Pow2(a) ((ll)(1) << (a)) #define Pow10(a) ((ll)(pow(10.0, double(a)))) #define LSB(a) ((a) & -(a)) #define llin(n) \ ll n; \ cin >> n; #define strin(n) \ str n; \ cin >> n; #define vin(v) \ VFOR(i, v) { cin >> (i); }; #define vllin(v, N) \ vll(v)((N)); \ vin(v); #define vpllin(vp, N) \ vpll vp; \ REP(i, N) { \ ll a, b; \ cin >> a >> b; \ vp.pb(mp(a, b)); \ } #define vll2in(vv, col, row) \ vll2(vv); \ (vv).resize((col)); \ for (ll i = 0; i < col; i++) { \ vv[i].resize(row); \ } \ REP(y, col) { \ REP(x, row) { cin >> (vv)[y][x]; } \ } #define vl4in(v1, v2, N) \ vll(v1)(N), (v2)(N); \ REP(i, N) { cin >> (v1)[i] >> (v2)[i]; }; #define vl6in(v1, v2, v3, N) \ vll(v1)(N), (v2)(N), (v3)(N); \ REP(i, N) { cin >> (v1)[i] >> (v2)[i] >> (v3)[i]; }; #define vsin(v, N) \ vs(v)((N)); \ vin(v); #define sort_asc_pair_by_second(vp) \ std::sort(vp.begin(), vp.end(), [](auto &left, auto &right) { \ return left.second < right.second; \ }); #define sort_desc_pair_by_second(vp) \ std::sort(vp.begin(), vp.end(), [](auto &left, auto &right) { \ return left.second > right.second; \ }); #define min(...) Min(__VA_ARGS__) #define max(...) Max(__VA_ARGS__) #define emin(a, ...) ((a) = Min((a), __VA_ARGS__)) #define emax(a, ...) ((a) = Max((a), __VA_ARGS__)) #define egcd(a, ...) ((a) = gcd((a), __VA_ARGS__)) #define elcm(a, ...) ((a) = lcm((a), __VA_ARGS__)) #define tf(cond, t, f) \ if (cond) { \ echo(t); \ } else { \ echo(f); \ } #define yn(cond) tf(cond, "yes", "no") #define Yn(cond) tf(cond, "Yes", "No") #define YN(cond) tf(cond, "YES", "NO") static const ll MOD = (ll)1e9 + 7; static const ll INF = (1LL << 62) - 1; // 4.611E+18 static const dbl PI = acos(-1.0); void Input(){}; template <class T, class... Args> void Input(T &t, Args &...args) { cin >> t; Input(args...); } void vInit(ll size) {} template <class T, class... Args> void vInit(ll size, V<T> &v, Args &...args) { v.resize(size); vInit(size, args...); } void vInputNum(ll num) {} template <class T, class... Args> void vInputNum(ll num, V<T> &v, Args &...args) { cin >> v[num]; vInputNum(num, args...); } void vInput(ll size) {} template <class... Args> void vInput(ll size, Args &...args) { vInit(size); REP(i, size) { vInputNum(i, args...); } } template <class S, class T> ostream &operator<<(ostream &o, const P<S, T> &p) { return o << "(" << p.first << ", " << p.second << ")"; } template <class T> ostream &operator<<(ostream &o, const V<T> &v) { if (v.empty()) { return o << "[]"; } else { auto itr = v.bn; o << "[" << *itr; itr++; while (itr != v.ed) { o << ", " << *itr; itr++; } o << "]"; return o; } } template <class T> ostream &operator<<(ostream &o, queue<T> q) { if (q.empty()) { return o << "| |"; } else { while (!q.empty()) { o << "| " << q.front() << " "; q.pop(); } o << "|"; return o; } } template <class S, class T> ostream &operator<<(ostream &o, const map<S, T> &m) { if (m.empty()) { return o << "[]"; } else { auto itr = m.bn; o << "{" << itr->first << ": " << itr->second; itr++; while (itr != m.ed) { o << "} {" << itr->first << ": " << itr->second; itr++; } o << "}"; return o; } } template <class T> ostream &operator<<(ostream &o, const set<T> &s) { if (s.empty()) { return o << "<>"; } else { auto itr = s.bn; o << "<" << *itr; itr++; while (itr != s.ed) { o << ", " << *itr; itr++; } o << ">"; return o; } } void say() {} template <class T> void say(T t) { cout << t; } template <class Head, class... Body> void say(Head h, Body... b) { cout << h; say(b...); } void puts() {} template <class T> void puts(T t) { cout << t; } template <class Head, class... Body> void puts(Head h, Body... b) { cout << h << " "; puts(b...); } void echo() { cout << "\n"; } template <class... Args> void echo(Args... args) { say(args...); cout << "\n"; } void print() { cout << "\n"; } template <class... Args> void print(Args... args) { puts(args...); cout << "\n"; } void dbgsay() {} template <class T> void dbgsay(T t) { cout << t; } template <class Head, class... Body> void dbgsay(Head h, Body... b) { cerr << h << " "; dbgsay(b...); } void dbgecho() { cout << "\n"; } template <class... Args> void dbgecho(Args... args) { dbgsay(args...); cerr << "\n"; } void echovv() {} template <class T> void echovv(VV<T> v) { if (v.empty()) { echo(); } else { VFOR(i, v) echo(v); } } template <class T, class... Args> void echovv(VV<T> v, Args... args) { echovv(v); echovv(args...); } template <class Head> Head Min(Head head) { return head; } template <class Head, class... Body> Head Min(Head h, Body... b) { auto t = Min(b...); return (h < t) ? h : t; } template <class Head> Head Max(Head head) { return head; } template <class Head, class... Body> Head Max(Head h, Body... b) { auto t = Max(b...); return (h > t) ? h : t; } ll gcd(ll a, ll b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; } template <class... Body> ll gcd(ll h, Body... b) { return gcd(h, gcd(b...)); } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } template <class... Body> ll lcm(ll h, Body... b) { return lcm(h, lcm(b...)); } ll Bset(ll a, ll b, ll c) { if (c) a |= b; else a &= ~b; return a; } ll sumOfRange(ll N) { return N * (N - 1) / 2; } struct UF { public: ll tsize; ll mode; ll connect = 0; vll nodeSize; vll par; vll rank; UF(){}; UF(const UF &uf) {} UF(ll _size, ll _mode = 0) { tsize = _size; mode = _mode; par.assign(tsize, -1); if (!mode) rank.resize(tsize, 0); nodeSize.resize(tsize, 1); } ll root(ll x) { return par[x] < 0 ? x : par[x] = root(par[x]); } bool isRoot(ll x) { return root(x) == x; } void unite(ll x, ll y) { x = root(x); y = root(y); if (x == y) return; if (mode) { par[x] += par[y]; par[y] += x; } else { connect -= sumOfRange(nodeSize[x]) + sumOfRange(nodeSize[y]); connect += sumOfRange(nodeSize[x] + nodeSize[y]); if (rank[x] < rank[y]) { nodeSize[y] += nodeSize[x]; par[y] += par[x]; par[x] = y; } else { nodeSize[x] += nodeSize[y]; par[x] += par[y]; par[y] = x; if (rank[x] == rank[y]) rank[x]++; } } } bool same(ll x, ll y) { return root(x) == root(y); } ll size(ll x) { return -par[root(x)]; } }; class Vertex { public: ll idx; ll param = -1; ll dist = INF; vector<pair<Vertex *, ll> /**/> e; ll size() { return e.size(); } bool operator==(const Vertex *o) { return dist == o->dist; } bool operator!=(const Vertex *o) { return dist != o->dist; } bool operator>(const Vertex *o) { return dist > o->dist; } bool operator<(const Vertex *o) { return dist < o->dist; } bool operator>=(const Vertex *o) { return dist >= o->dist; } bool operator<=(const Vertex *o) { return dist <= o->dist; } }; class Graph { public: vector<Vertex *> V; vll order; typedef tuple<Vertex *, Vertex *, ll> Edge; vector<Edge> E; Graph(ll siz) { REP(i, siz) { auto v = new Vertex(); v->idx = i; V.pb(v); } } static bool comp(const Edge &e1, const Edge &e2) { return get<2>(e1) < get<2>(e2); } Vertex *getVertex(ll idx) { return V[idx]; } void unite(ll from, ll to, ll w = 1, bool digraph = true) { E.push_back(make_tuple(V[from], V[to], w)); V[from]->e.pb(make_pair(V[to], w)); if (!digraph) { E.push_back(make_tuple(V[to], V[from], w)); V[to]->e.pb(make_pair(V[from], w)); } } void dijkstra(ll start) { PQ<Vertex *, vector<Vertex *>, greater<Vertex *> /**/> pq; Vertex *s = getVertex(start); s->dist = 0; pq.push(s); while (!pq.empty()) { Vertex *v = pq.top(); pq.pop(); for (auto &u : v->e) { if (u.first->dist > v->dist + u.second) { u.first->dist = v->dist + u.second; pq.push(u.first); } } } } bool sort() { for (auto &v : V) { if (v->param == -1 && !sort_visit(v->idx)) { return false; } } reverse(order.bn, order.ed); return true; } bool sort_visit(int v) { Vertex *_v = getVertex(v); _v->param = 1; if (!_v->e.empty()) { for (auto &u : _v->e) { if (u.first->param == 2) continue; if (u.first->param == 1) return false; if (!sort_visit(u.first->idx)) return false; } } order.push_back(v); _v->param = 2; return true; } }; ll isPrime(ll n) { if (n <= 1) return 0; FOR(i, 2, (ll)sqrt(n)) { if (n % i == 0) return 0; } return 1; } ll DigS10(ll n) { ll m = 0; REP(i, DigN10(n)) { m += (ll)((llabs(n) % Pow10(i + 1))) / Pow10(i); } return m; } ll PowMod(ll a, ll b) { ll ans = 1, x = a % MOD; REP(i, DigN2(b)) { if (Dig2(b, i) == 1) { ans = (ans * x) % MOD; } if (i != (DigN2(b) - 1)) { x = (x * x) % MOD; } } return ans; } vll FactMod(1, 1); vll FactModInv(1, 1); ll Mod(ll n) { n %= MOD; n = (n + MOD) % MOD; return n; } ll InvM(ll n) { n = Mod(n); n = PowMod(n, MOD - 2); return n; } void CFactMod(ll n) { if (FactMod.size() <= n) { FOR(i, FactMod.size(), n) { FactMod.pb((FactMod[i - 1] * (i % MOD)) % MOD); } } } void CFactModInv(ll n) { CFactMod(n); if (FactModInv.size() < (n + 1)) { FactModInv.resize(n + 1, -1); } if (FactModInv[n] == -1) { FactModInv[n] = PowMod(FactMod[n], MOD - 2); } for (int i = n - 1; i >= 1; i--) { if (FactModInv[i] != -1) break; FactModInv[i] = ((FactModInv[i + 1] * ((i + 1) % MOD)) % MOD); } } ll CombMod(ll n, ll k) { if (n < 0 || k < 0 || n < k) return 0; if (n + 1 > FactModInv.size()) CFactModInv(n); return ((((FactModInv[k] * FactModInv[n - k]) % MOD) * FactMod[n]) % MOD); } pll factor_sub(ll n, ll m) { ll i = 0; while (n % m == 0) { i++; n /= m; } return mp(i, n); } vpll factrization(ll n) { vpll a; ll c, m; tie(c, m) = factor_sub(n, 2); if (c > 0) a.pb(mp(2, c)); for (ll i = 3; m >= i * i; i += 2) { tie(c, m) = factor_sub(m, i); if (c > 0) a.pb(mp(i, c)); } if (m > 1) a.pb(mp(m, 1)); return a; } vll countSameNeighbour(vll v) { ll prev, pres; vll ctr; ctr.pb(1); FOR(i, 1, v.size() - 1) { prev = v[i - 1]; pres = v[i]; if (pres != prev) { ctr.pb(1); } else { ctr[ctr.size() - 1]++; } } return ctr; } vll countSameNeighbour(str s) { ll prev, pres; vll ctr; ctr.pb(1); FOR(i, 1, s.size() - 1) { prev = s[i - 1]; pres = s[i]; if (pres != prev) { ctr.pb(1); } else { ctr[ctr.size() - 1]++; } } return ctr; } ll sumDigit(ll N) { ll sum = 0; for (ll i = 1; i <= N; i *= 10) { sum += (N % (i * 10)) / i; } return sum; } ll dot(vll a, vll b) { ll ans = 0; REP(i, a.size()) { ans += a[i] * b[i]; } return ans; } ll dot(vpll p) { ll ans = 0; REP(i, p.size()) { ans += p[i].first * p[i].second; } return ans; } ll xorSum(ll n) { if (n <= 0) return 0; switch (n % 4) { case 0: return n; break; case 1: return 1; break; case 2: return n + 1; break; default: return 0; break; } } signed main() { llin(n); strin(s); SORT_ASC(s); vll ctr = countSameNeighbour(s); ll ans = 1; REP(i, ctr.sz) { ans *= (ctr[i] + 1); ans %= MOD; } echo(ans - 1); }
[ "expression.operation.binary.change", "assignment.change" ]
905,746
905,747
u127844950
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long long int llint; #define MM 1000000000 #define MOD MM + 7 #define MAX 101000 #define MAP 110 #define initial_value -1 #define Pair pair<int, int> #define chmax(a, b) (a < b ? a = b : 0) #define chmin(a, b) (a > b ? a = b : 0) #define INF (1 << 29) // 536870912 int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; int main() { int n; cin >> n; string s; cin >> s; map<char, int> mp; for (int i = 0; i < n; i++) { mp[s[i]]++; } ll ans = 1; for (char t = 'a'; t <= 'z'; t++) { if (mp[t] == 0) continue; ans *= (mp[t] + 1); ans %= MOD; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long long int llint; #define MM 1000000000 #define MOD MM + 7 #define MAX 101000 #define MAP 110 #define initial_value -1 #define Pair pair<int, int> #define chmax(a, b) (a < b ? a = b : 0) #define chmin(a, b) (a > b ? a = b : 0) #define INF (1 << 29) // 536870912 int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; int main() { int n; cin >> n; string s; cin >> s; map<char, int> mp; for (int i = 0; i < n; i++) { mp[s[i]]++; } ll ans = 1; for (char t = 'a'; t <= 'z'; t++) { if (mp[t] == 0) continue; ans *= (mp[t] + 1); ans %= MOD; } cout << ans - 1 << endl; }
[ "expression.operation.binary.add" ]
905,776
905,777
u342051078
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MM 1000000000 #define MOD MM + 7 #define MAX 101000 #define MAP 110 #define initial_value -1 #define Pair pair<int, int> #define lPair pair<ll, ll> #define chmax(a, b) (a < b ? a = b : 0) #define chmin(a, b) (a > b ? a = b : 0) int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; vector<int> places[200200]; ll dp[200200]; void add(ll &a, ll b) { a += b; if (a >= MOD) a -= MOD; } int main() { int N; cin >> N; map<char, int> mp; string s; cin >> s; for (int i = 0; i < N; i++) { mp[s[i]]++; } ll ans = 1; for (char t = 'a'; t <= 'z'; t++) { if (mp[t] == 0) continue; ans *= (mp[t] + 1); ans %= MOD; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MM 1000000000 #define MOD MM + 7 #define MAX 101000 #define MAP 110 #define initial_value -1 #define Pair pair<int, int> #define lPair pair<ll, ll> #define chmax(a, b) (a < b ? a = b : 0) #define chmin(a, b) (a > b ? a = b : 0) int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; vector<int> places[200200]; ll dp[200200]; void add(ll &a, ll b) { a += b; if (a >= MOD) a -= MOD; } int main() { int N; cin >> N; map<char, int> mp; string s; cin >> s; for (int i = 0; i < N; i++) { mp[s[i]]++; } ll ans = 1; for (char t = 'a'; t <= 'z'; t++) { if (mp[t] == 0) continue; ans *= (mp[t] + 1); ans %= MOD; } cout << ans - 1 << endl; }
[ "expression.operation.binary.add" ]
905,778
905,779
u342051078
cpp
p03095
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int n; cin >> n; string s; cin >> s; map<char, int> m; for (int i = 0; i < n; i++) { m[s[i]]++; } ll res = 1; for (auto iter = m.begin(); iter != m.end(); iter++) { res = (res * iter->second + 1) % 1000000007; } cout << res - 1 << endl; }
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <string> #include <vector> using namespace std; typedef long long ll; int main() { int n; cin >> n; string s; cin >> s; map<char, int> m; for (int i = 0; i < n; i++) { m[s[i]]++; } ll res = 1; for (auto iter = m.begin(); iter != m.end(); iter++) { res = (res * (iter->second + 1)) % 1000000007; } cout << res - 1 << endl; }
[]
905,800
905,801
u713830790
cpp
p03095
#include <bits/stdc++.h> using namespace std; #define ll long long const ll MOD = (1e+9) + 7; int main() { int n; int lim = 'z' - 'a' + 1; ll a[lim] = {}; string s; ll ans = 1; cin >> n >> s; for (int i = 0; i < lim; i++) { a[s[i] - 'a']++; } for (int i = 0; i < lim; i++) { ans = (ans * (a[i] + 1)) % MOD; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> using namespace std; #define ll long long const ll MOD = (1e+9) + 7; int main() { int n; int lim = 'z' - 'a' + 1; ll a[lim] = {}; string s; ll ans = 1; cin >> n >> s; for (int i = 0; i < n; i++) { a[s[i] - 'a']++; } for (int i = 0; i < lim; i++) { ans = (ans * (a[i] + 1)) % MOD; } cout << ans - 1 << endl; }
[ "identifier.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,808
905,809
u798086274
cpp
p03095
#include <algorithm> #include <cmath> #include <iostream> #include <vector> typedef char SINT8; typedef unsigned char UINT8; typedef short SINT16; typedef unsigned short UINT16; typedef int SINT32; typedef unsigned int UINT32; typedef long long SINT64; typedef unsigned long long UINT64; typedef double DOUBLE; #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define ABS(a) ((a) > (0) ? (a) : -(a)) #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define MOD 1000000007 using namespace std; int main() { SINT32 N = 0; string S; SINT64 ANS = 1; cin >> N; cin >> S; vector<SINT32> DATA(N); for (SINT32 i = 0; i < N; i++) { DATA[i] = 0; } for (SINT32 i = 0; i < N; i++) { DATA[S[i] - 'a']++; } for (SINT32 i = 0; i < N; i++) { ANS = ANS * ((DATA[i] + 1) % MOD); ANS = ANS % MOD; } ANS--; cout << ANS << endl; return 0; } // sort(DATA.begin(),DATA.end()); // sort(DATA.begin(),DATA.end(),std::greater<SINT32>()); // __gcd(ANS,DATA[i]); /* SINT32 M = 3; vector<pair<SINT32,SINT32>> DATA2(M); for (SINT32 i = 0; i < M; i++) { cin >> DATA2[i].first; cin >> DATA2[i].second; } sort(DATA2.begin(),DATA2.end()); cout << DATA2[0].first << endl; cout << DATA2[0].second << endl; */ // APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - //ADATA.begin(); BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - //BDATA.begin();
#include <algorithm> #include <cmath> #include <iostream> #include <vector> typedef char SINT8; typedef unsigned char UINT8; typedef short SINT16; typedef unsigned short UINT16; typedef int SINT32; typedef unsigned int UINT32; typedef long long SINT64; typedef unsigned long long UINT64; typedef double DOUBLE; #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define ABS(a) ((a) > (0) ? (a) : -(a)) #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define MOD 1000000007 using namespace std; int main() { SINT32 N = 0; string S; SINT64 ANS = 1; cin >> N; cin >> S; vector<SINT32> DATA(26); for (SINT32 i = 0; i < 26; i++) { DATA[i] = 0; } for (SINT32 i = 0; i < N; i++) { DATA[S[i] - 'a']++; } for (SINT32 i = 0; i < 26; i++) { ANS = ANS * ((DATA[i] + 1) % MOD); ANS = ANS % MOD; } ANS--; cout << ANS << endl; return 0; } // sort(DATA.begin(),DATA.end()); // sort(DATA.begin(),DATA.end(),std::greater<SINT32>()); // __gcd(ANS,DATA[i]); /* SINT32 M = 3; vector<pair<SINT32,SINT32>> DATA2(M); for (SINT32 i = 0; i < M; i++) { cin >> DATA2[i].first; cin >> DATA2[i].second; } sort(DATA2.begin(),DATA2.end()); cout << DATA2[0].first << endl; cout << DATA2[0].second << endl; */ // APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - //ADATA.begin(); BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - //BDATA.begin();
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,815
905,813
u824905100
cpp
p03095
#include <bits/stdc++.h> using namespace std; int cnt[26]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { char x; scanf(" %c", &x); cnt[x - 'a']++; } long long prod = 1; for (int i = 0; i < 26; ++i) { prod *= cnt[i] + 1; prod %= (int)(1e9 + 7); } printf("%d\n", prod); }
#include <bits/stdc++.h> using namespace std; int cnt[26]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { char x; scanf(" %c", &x); cnt[x - 'a']++; } long long prod = 1; for (int i = 0; i < 26; ++i) { prod *= cnt[i] + 1; prod %= (int)(1e9 + 7); } printf("%d\n", (prod - 1)); }
[ "call.arguments.change" ]
905,824
905,825
u939637096
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const ll mod = 1000000007; ll num[26], tot = 1; int main() { ios_base::sync_with_stdio(false); cin.tie(0); string S; int N; cin >> N >> S; for (int i = 0; i < S.size(); ++i) { num[S[i] - 'a']++; } for (int i = 0; i < 26; ++i) { tot *= (num[i] + 1); tot %= mod; } cout << tot << '\n'; cout << flush; // for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}} }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const ll mod = 1000000007; ll num[26], tot = 1; int main() { ios_base::sync_with_stdio(false); cin.tie(0); string S; int N; cin >> N >> S; for (int i = 0; i < S.size(); ++i) { num[S[i] - 'a']++; } for (int i = 0; i < 26; ++i) { tot *= (num[i] + 1); tot %= mod; } cout << tot - 1 << '\n'; cout << flush; // for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}} }
[ "expression.operation.binary.add" ]
905,840
905,841
u496254754
cpp
p03095
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int N = 1e5 + 5; int n; char s[N]; int cnt[666]; int main() { scanf("%d", &n); scanf("%s", s + 1); for (int i = 0; i < n; i++) { cnt[s[i]]++; } int res = 1; for (int i = 'a'; i <= 'z'; i++) { res = (long long)res * cnt[i] % MOD; } printf("%d\n", (res - 1 + MOD) % MOD); return 0; }
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int N = 1e5 + 5; int n; char s[N]; int cnt[666]; int main() { scanf("%d", &n); scanf("%s", s + 1); for (int i = 1; i <= n; i++) { cnt[s[i]]++; } int res = 1; for (int i = 'a'; i <= 'z'; i++) { res = (long long)res * (cnt[i] + 1) % MOD; } printf("%d\n", (res - 1 + MOD) % MOD); return 0; }
[ "literal.number.change", "variable_declaration.value.change", "control_flow.loop.for.initializer.change", "expression.off_by_one", "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,842
905,843
u353573192
cpp
p03095
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> s(26, 1); for (int i = 0; i < n; i++) { char c; cin >> c; s[c - 97]++; } long long ans = 1; for (int i = 0; i < n; i++) { ans *= s[i]; ans %= 1000000007; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> s(26, 1); for (int i = 0; i < n; i++) { char c; cin >> c; s[c - 97]++; } long long ans = 1; for (int i = 0; i < 26; i++) { ans *= s[i]; ans %= 1000000007; } cout << ans - 1 << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,846
905,847
u640800420
cpp
p03095
#include <iostream> using namespace std; int f[26]; #define MOD 1000000007 int main() { int n; string s; cin >> n; cin >> s; for (int i = 0; i < n; i++) { f[s[i] - 'a']++; } long long ans = 1; for (int i = 0; i < 26; i++) { ans = (ans * (f[i] + 1)) % MOD; } cout << ans << endl; }
#include <iostream> using namespace std; int f[26]; #define MOD 1000000007 int main() { int n; string s; cin >> n; cin >> s; for (int i = 0; i < n; i++) { f[s[i] - 'a']++; } long long ans = 1; for (int i = 0; i < 26; i++) { ans = (ans * (f[i] + 1)) % MOD; } cout << ans - 1 << endl; }
[ "expression.operation.binary.add" ]
905,850
905,851
u719290158
cpp
p03095
#include <algorithm> #include <bits/stdc++.h> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; int main() { //回答が整数の場合 ll ans = 1; //整数値の入力 int n; cin >> n; //行列の入力 char table[n] = {}; for (int i = 0; i < n; ++i) { cin >> table[i]; } sort(table, table + n); int al[26] = {}; al[0]++; int syu = 0; for (int i = 0; i < n - 1; ++i) { if (table[i] == table[i + 1]) { al[syu]++; } else { syu++; al[syu]++; } } for (int i = 0; i < 26; ++i) { ans = ans * (al[i] + 1); ans = ans % 1000000007; } //回答 cout << ans << endl; return 0; }
#include <algorithm> #include <bits/stdc++.h> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> P; int main() { //回答が整数の場合 ll ans = 1; //整数値の入力 int n; cin >> n; //行列の入力 char table[n] = {}; for (int i = 0; i < n; ++i) { cin >> table[i]; } sort(table, table + n); int al[26] = {}; al[0]++; int syu = 0; for (int i = 0; i < n - 1; ++i) { if (table[i] == table[i + 1]) { al[syu]++; } else { syu++; al[syu]++; } } for (int i = 0; i < 26; ++i) { ans = ans * (al[i] + 1); ans = ans % 1000000007; } //回答 cout << ans - 1 << endl; return 0; }
[ "expression.operation.binary.add" ]
905,885
905,886
u419307948
cpp
p03095
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 100010, Mod = 1e9 + 7; char st[N]; int s[N]; int main() { int n, ans = 1; cin >> n >> st + 1; for (int i = 1; i <= n; i++) s[st[i] - 'a']++; for (int i = 0; i <= n; i++) ans = 1ll * ans * (s[i] + 1) % Mod; cout << (ans + Mod - 1) % Mod << "\n"; return 0; }
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 100010, Mod = 1e9 + 7; char st[N]; int s[N]; int main() { int n, ans = 1; cin >> n >> st + 1; for (int i = 1; i <= n; i++) s[st[i] - 'a']++; for (int i = 0; i < 26; i++) ans = 1ll * ans * (s[i] + 1) % Mod; cout << (ans + Mod - 1) % Mod << "\n"; return 0; }
[ "control_flow.loop.for.condition.change" ]
905,888
905,889
u496601567
cpp
p03095
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, int(n) + 1) #define rrep(i, n) RFOR(i, 0, n) #define rrep1(i, n) RFOR(i, 1, int(n) + 1) #define all(c) begin(c), end(c) #define al(d) d.begin(), d.end() using namespace std; template <typename T> void putv(vector<T> &V) { // cout << "The elements in the vector are: " << endl; for (auto x : V) cout << x << " "; cout << endl; } template <class T> vector<T> getv(int n) { vector<T> vec; rep(i, n) { T input; cin >> input; vec.emplace_back(input); } return vec; } using AdjList = vector<vector<int>>; using Weight = int; using Flow = int; struct Edge { int src, dst; Weight weight; Flow cap; Edge() : src(0), dst(0), weight(0) {} Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {} }; using Edges = std::vector<Edge>; using Graph = std::vector<Edges>; using Array = std::vector<Weight>; using Matrix = std::vector<Array>; void add_edge(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); g[b].emplace_back(b, a, w); } void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); } // Recieve edge(=(int,int)) as an adj list. AdjList getadj(int N, int M) { // Initialize all lists of the graph as a empty vector. vector<int> init; vector<vector<int>> graph(N, init); rep(i, M) { int a, b; cin >> a >> b; graph[a - 1].emplace_back(b - 1); graph[b - 1].emplace_back(a - 1); } // rep(i,N) // putv(graph[i]); return graph; } long long Manhattan_dist(long long x1, long long y1, long long x2, long long y2) { return abs(x1 - x2) + abs(y1 - y2); } void out(bool ans) { if (ans == true) cout << "yes" << endl; else cout << "no" << endl; } void Out(bool ans) { if (ans == true) cout << "Yes" << endl; else cout << "No" << endl; } void OUT(bool ans) { if (ans == true) cout << "YES" << endl; else cout << "NO" << endl; } unsigned long long gcd(const unsigned long long a, const unsigned long long b) { return (b == 0) ? a : gcd(b, a % b); } int main() { int mod = 1e9 + 7; int N; cin >> N; string S; cin >> S; map<char, int> cntr; for (auto c : S) cntr[c]++; int ans = 1; for (auto x : cntr) { // cout << x.second << endl; ans = (ans * x.second + 1) % mod; } cout << ans - 1 << endl; }
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, int(n) + 1) #define rrep(i, n) RFOR(i, 0, n) #define rrep1(i, n) RFOR(i, 1, int(n) + 1) #define all(c) begin(c), end(c) #define al(d) d.begin(), d.end() using namespace std; template <typename T> void putv(vector<T> &V) { // cout << "The elements in the vector are: " << endl; for (auto x : V) cout << x << " "; cout << endl; } template <class T> vector<T> getv(int n) { vector<T> vec; rep(i, n) { T input; cin >> input; vec.emplace_back(input); } return vec; } using AdjList = vector<vector<int>>; using Weight = int; using Flow = int; struct Edge { int src, dst; Weight weight; Flow cap; Edge() : src(0), dst(0), weight(0) {} Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {} }; using Edges = std::vector<Edge>; using Graph = std::vector<Edges>; using Array = std::vector<Weight>; using Matrix = std::vector<Array>; void add_edge(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); g[b].emplace_back(b, a, w); } void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); } // Recieve edge(=(int,int)) as an adj list. AdjList getadj(int N, int M) { // Initialize all lists of the graph as a empty vector. vector<int> init; vector<vector<int>> graph(N, init); rep(i, M) { int a, b; cin >> a >> b; graph[a - 1].emplace_back(b - 1); graph[b - 1].emplace_back(a - 1); } // rep(i,N) // putv(graph[i]); return graph; } long long Manhattan_dist(long long x1, long long y1, long long x2, long long y2) { return abs(x1 - x2) + abs(y1 - y2); } void out(bool ans) { if (ans == true) cout << "yes" << endl; else cout << "no" << endl; } void Out(bool ans) { if (ans == true) cout << "Yes" << endl; else cout << "No" << endl; } void OUT(bool ans) { if (ans == true) cout << "YES" << endl; else cout << "NO" << endl; } unsigned long long gcd(const unsigned long long a, const unsigned long long b) { return (b == 0) ? a : gcd(b, a % b); } int main() { long long mod = 1e9 + 7; int N; cin >> N; string S; cin >> S; map<char, int> cntr; for (auto c : S) cntr[c]++; long long ans = 1; for (auto x : cntr) { // cout << x.second << endl; ans = (ans * (x.second + 1)) % mod; } cout << ans - 1 << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
905,892
905,891
u153846982
cpp
p03095
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <vector> #define f first #define s second #define ll long long #define pb push_back #define all(x) x.begin(), x.end() #define mp make_pair #define y0 wefkljekfjwek using namespace std; const ll mod = 1000000007; int kilk[26]; string s; ll ans = 1; int main() { ios_base::sync_with_stdio(0); // freopen("INPUT.txt","r",stdin); cin >> s; for (int i = 0; i < s.size(); i++) kilk[s[i] - 'a']++; for (int i = 0; i < 26; i++) ans = (ans * (kilk[i] + 1)) % mod; cout << (ans - 1 + mod) % mod; }
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <vector> #define f first #define s second #define ll long long #define pb push_back #define all(x) x.begin(), x.end() #define mp make_pair #define y0 wefkljekfjwek using namespace std; const ll mod = 1000000007; int kilk[26]; string s; ll ans = 1; int n; int main() { ios_base::sync_with_stdio(0); // freopen("INPUT.txt","r",stdin); cin >> n >> s; for (int i = 0; i < s.size(); i++) kilk[s[i] - 'a']++; for (int i = 0; i < 26; i++) ans = (ans * (kilk[i] + 1)) % mod; cout << (ans - 1 + mod) % mod; }
[ "variable_declaration.add" ]
905,941
905,942
u372953141
cpp
p03095
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int mod = 1e9 + 7; const int N = 1e5 + 5; const double eps = 1e-4; typedef long long ll; typedef pair<int, int> pii; int a[N]; char s[N]; int vis[N]; int main() { int n; scanf("%d", &n); scanf("%s", s); int len = strlen(s); for (int i = 0; i < len; i++) { vis[s[i] - 'a']++; } ll ans = 1; for (int i = 0; i <= 26; i++) { ans = 1ll * ans * (vis[i] + 1) % mod; } ans %= mod; printf("%lld\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int mod = 1e9 + 7; const int N = 1e5 + 5; const double eps = 1e-4; typedef long long ll; typedef pair<int, int> pii; int a[N]; char s[N]; int vis[N]; int main() { int n; scanf("%d", &n); scanf("%s", s); int len = strlen(s); for (int i = 0; i < len; i++) { vis[s[i] - 'a']++; } ll ans = 1; for (int i = 0; i <= 26; i++) { ans = 1ll * ans * (vis[i] + 1) % mod; } ans %= mod; printf("%lld\n", ans - 1ll); return 0; }
[ "expression.operation.binary.add" ]
905,947
905,948
u935313188
cpp
p03095
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 using ll = long long; int main() { int N; string S; cin >> N >> S; ll ans = 1; int Num[26]; // aからzまでの文字の個数を数えるコード for (int i = 0; i < N; i++) { Num[S[i] - 'a']++; } // range-based for loops for (int x : Num) { ans *= (x + 1); ans %= mod; } cout << ans - 1; return 0; }
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 using ll = long long; int main() { int N; string S; cin >> N >> S; ll ans = 1; int Num[26] = {}; // aからzまでの文字の個数を数えるコード for (int i = 0; i < N; i++) { Num[S[i] - 'a']++; } // range-based for loops for (int x : Num) { ans *= x + 1; ans %= mod; } cout << ans - 1; return 0; }
[ "variable_declaration.value.change" ]
905,951
905,952
u590088474
cpp
p03095
#include <bits/stdc++.h> #define f first #define s second #define MOD 1000000007 using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> plii; typedef pair<int, pii> piii; const int INF = 1e9 + 10; const ll LINF = 1LL * INF * INF; const int MAXN = 1e5 + 10; const int MAXM = 3e3 + 10; priority_queue<int> pq; vector<vector<int>> graph; int A[MAXN]; int chk[30]; char S[MAXN]; int main() { int n, m, k, a, b, x, y; int sum = 0; int cnt = 0; scanf("%d", &n); scanf("%s", &S); for (int i = 0; i < n; i++) chk[S[i] - 'a']++; for (int i = 0; i < 26; i++) chk[i]++; ll res = 1; for (int i = 0; i < n; i++) { res *= (ll)chk[i]; res %= MOD; } res += (MOD - 1); res %= MOD; cout << res; return 0; }
#include <bits/stdc++.h> #define f first #define s second #define MOD 1000000007 using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, ll> plii; typedef pair<int, pii> piii; const int INF = 1e9 + 10; const ll LINF = 1LL * INF * INF; const int MAXN = 1e5 + 10; const int MAXM = 3e3 + 10; priority_queue<int> pq; vector<vector<int>> graph; int A[MAXN]; int chk[30]; char S[MAXN]; int main() { int n, m, k, a, b, x, y; int sum = 0; int cnt = 0; scanf("%d", &n); scanf("%s", &S); for (int i = 0; i < n; i++) chk[S[i] - 'a']++; for (int i = 0; i < 26; i++) chk[i]++; ll res = 1; for (int i = 0; i < 26; i++) { res *= (ll)chk[i]; res %= MOD; } res += (MOD - 1); res %= MOD; cout << res; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,955
905,956
u114415753
cpp
p03095
#include <bits/stdc++.h> #define ll long long using namespace std; const ll Mod = 1e9 + 7; ll Cnt[26]; int main() { ll n; cin >> n; string s; cin >> s; for (ll i = 0; i < n; i++) Cnt[s[i] - 'a']++; ll Ans = 1; for (ll i = 0; i < n; i++) Ans = (Ans * (Cnt[i] + 1)) % Mod; cout << (Ans - 1 + Mod) % Mod; }
#include <bits/stdc++.h> #define ll long long using namespace std; const ll Mod = 1e9 + 7; ll Cnt[26]; int main() { ll n; cin >> n; string s; cin >> s; for (ll i = 0; i < n; i++) Cnt[s[i] - 'a']++; ll Ans = 1; for (ll i = 0; i < 26; i++) Ans = (Ans * (Cnt[i] + 1)) % Mod; cout << (Ans - 1 + Mod) % Mod; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
905,961
905,962
u427083104
cpp
p03095
#include <bits/stdc++.h> using namespace std; int cnt[26]; int main() { int n; cin >> n; string s; cin >> s; for (auto i : s) cnt[i - 'a']++; long long ans = 1; for (int i = 0; i < 26; i++) { ans *= (cnt[i] + 1); ans %= (int)(1e9 + 7); } cout << ans; }
#include <bits/stdc++.h> using namespace std; int cnt[26]; int main() { int n; cin >> n; string s; cin >> s; for (auto i : s) cnt[i - 'a']++; long long ans = 1; for (int i = 0; i < 26; i++) { ans *= (cnt[i] + 1); ans %= (int)(1e9 + 7); } cout << ans - 1; }
[ "expression.operation.binary.add" ]
905,985
905,986
u840813237
cpp
p03095
#include <iostream> #include <string> using namespace std; int N; string S; long long cnt[26] = {}; long long ans = 1; int main() { cin >> N >> S; for (int i = 0; i < N; i++) cnt[int(S[i] - 'a')]++; for (int i = 0; i < N; i++) ans = (long long)(ans * (cnt[i] + 1)) % (long long)(1e9 + 7); cout << ans - 1 << endl; return 0; }
#include <iostream> #include <string> using namespace std; int N; string S; long long cnt[26] = {}; long long ans = 1; int main() { cin >> N >> S; for (int i = 0; i < N; i++) cnt[int(S[i] - 'a')]++; for (int i = 0; i < 26; i++) ans = (long long)(ans * (cnt[i] + 1)) % (long long)(1e9 + 7); cout << ans - 1 << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
906,007
906,008
u861034552
cpp
p03095
#include <iostream> #include <string> using namespace std; int N; string S; long long cnt[26] = {}; long long ans = 1; int main() { cin >> N >> S; for (int i = 0; i < N; i++) cnt[int(S[i] - 'a')]++; for (int i = 0; i < N; i++) ans = (int)(ans * (cnt[i] + 1)) % (int)(1e9 + 7); cout << ans - 1 << endl; return 0; }
#include <iostream> #include <string> using namespace std; int N; string S; long long cnt[26] = {}; long long ans = 1; int main() { cin >> N >> S; for (int i = 0; i < N; i++) cnt[int(S[i] - 'a')]++; for (int i = 0; i < 26; i++) ans = (long long)(ans * (cnt[i] + 1)) % (long long)(1e9 + 7); cout << ans - 1 << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "assignment.value.change", "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change" ]
906,009
906,008
u861034552
cpp
p03095
#pragma once #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; #define INF 1000000007 typedef long long ll; typedef pair<int, int> pii; int t[101]; int pri[26]; int res = 0; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } int pr[100010]; void uini(int n) { for (size_t i = 0; i <= n; i++) { pr[i] = i; } } int parent(int x) { if (x == pr[x]) return x; return pr[x] = parent(pr[x]); } bool unit(int x, int y) { int px = parent(x); int py = parent(y); if (px == py) return false; if (px < py) { pr[y] = px; } else { pr[x] = py; } return true; } // dinic struct max_flow { struct edge { int to, cap, rev; edge(int _to, int _cap, int _rev) : to(_to), cap(_cap), rev(_rev) {} }; int V; vector<vector<edge>> G; vector<int> itr, level; max_flow(int V) : V(V) { G.assign(V, vector<edge>()); } void add_edge(int from, int to, int cap) { G[from].push_back(edge(to, cap, (int)G[to].size())); G[to].push_back(edge(from, 0, (int)G[from].size() - 1)); } void bfs(int s) { level.assign(V, -1); queue<int> q; level[s] = 0; q.push(s); while (!q.empty()) { int v = q.front(); q.pop(); for (auto &e : G[v]) { if (e.cap > 0 and level[e.to] < 0) { level[e.to] = level[v] + 1; q.push(e.to); } } } } int dfs(int v, int t, int f) { if (v == t) return f; for (int &i = itr[v]; i < (int)G[v].size(); ++i) { edge &e = G[v][i]; if (e.cap > 0 && level[v] < level[e.to]) { int d = dfs(e.to, t, min(f, e.cap)); if (d > 0) { e.cap -= d; G[e.to][e.rev].cap += d; return d; } } } return 0; } int run(int s, int t) { int ret = 0, f; while (bfs(s), level[t] >= 0) { itr.assign(V, 0); while ((f = dfs(s, t, INF)) > 0) ret += f; } return ret; } }; vector<vector<int>> calcNext(const string &S) { int n = (int)S.size(); vector<vector<int>> res(n + 1, vector<int>(26, n)); for (int i = n - 1; i >= 0; --i) { for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j]; res[i][S[i] - 'a'] = i; } return res; } const int MOD = 1000000007; // mod 1000000007 の世界で a += b する関数 void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; } ll c[26]; ll memo[26]; ll rec(int i) { if (i == 26) { return 1; } ll &res = memo[i]; if (~res) return res; res = 0; for (size_t j = i + 1; j <= 26; j++) { ll v = c[i] * rec(j); v %= INF; res += v; res %= INF; } return res; } void solv() { int n; cin >> n; string S; cin >> S; sort(S.begin(), S.end()); fill(c, c + 26, 0); memset(memo, -1, sizeof(memo)); for (size_t i = 0; i < n; i++) { c[S[i] - 'a']++; } // 集計 ll res = 0; for (size_t i = 0; i < 25; i++) { res += rec(i); res %= INF; } cout << res << endl; } int main() { solv(); return 0; }
#pragma once #include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; #define INF 1000000007 typedef long long ll; typedef pair<int, int> pii; int t[101]; int pri[26]; int res = 0; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } int pr[100010]; void uini(int n) { for (size_t i = 0; i <= n; i++) { pr[i] = i; } } int parent(int x) { if (x == pr[x]) return x; return pr[x] = parent(pr[x]); } bool unit(int x, int y) { int px = parent(x); int py = parent(y); if (px == py) return false; if (px < py) { pr[y] = px; } else { pr[x] = py; } return true; } // dinic struct max_flow { struct edge { int to, cap, rev; edge(int _to, int _cap, int _rev) : to(_to), cap(_cap), rev(_rev) {} }; int V; vector<vector<edge>> G; vector<int> itr, level; max_flow(int V) : V(V) { G.assign(V, vector<edge>()); } void add_edge(int from, int to, int cap) { G[from].push_back(edge(to, cap, (int)G[to].size())); G[to].push_back(edge(from, 0, (int)G[from].size() - 1)); } void bfs(int s) { level.assign(V, -1); queue<int> q; level[s] = 0; q.push(s); while (!q.empty()) { int v = q.front(); q.pop(); for (auto &e : G[v]) { if (e.cap > 0 and level[e.to] < 0) { level[e.to] = level[v] + 1; q.push(e.to); } } } } int dfs(int v, int t, int f) { if (v == t) return f; for (int &i = itr[v]; i < (int)G[v].size(); ++i) { edge &e = G[v][i]; if (e.cap > 0 && level[v] < level[e.to]) { int d = dfs(e.to, t, min(f, e.cap)); if (d > 0) { e.cap -= d; G[e.to][e.rev].cap += d; return d; } } } return 0; } int run(int s, int t) { int ret = 0, f; while (bfs(s), level[t] >= 0) { itr.assign(V, 0); while ((f = dfs(s, t, INF)) > 0) ret += f; } return ret; } }; vector<vector<int>> calcNext(const string &S) { int n = (int)S.size(); vector<vector<int>> res(n + 1, vector<int>(26, n)); for (int i = n - 1; i >= 0; --i) { for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j]; res[i][S[i] - 'a'] = i; } return res; } const int MOD = 1000000007; // mod 1000000007 の世界で a += b する関数 void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; } ll c[26]; ll memo[26]; ll rec(int i) { if (i == 26) { return 1; } ll &res = memo[i]; if (~res) return res; res = 0; for (size_t j = i + 1; j <= 26; j++) { ll v = c[i] * rec(j); v %= INF; res += v; res %= INF; } return res; } void solv() { int n; cin >> n; string S; cin >> S; sort(S.begin(), S.end()); fill(c, c + 26, 0); memset(memo, -1, sizeof(memo)); for (size_t i = 0; i < n; i++) { c[S[i] - 'a']++; } // 集計 ll res = 0; for (size_t i = 0; i < 26; i++) { res += rec(i); res %= INF; } cout << res << endl; } int main() { solv(); return 0; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
906,016
906,017
u224756887
cpp
p03095
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef pair<int, int> P; const int MOD = 1000000007; int N; string S; int n[30] = {}; int main() { cin >> N; cin >> S; LL ans = 1; for (int i = 0; i < N; i++) { n[S[i] - 'a']++; } for (int i = 0; i < 'z' - 'a'; i++) { ans *= n[i] + 1; ans %= MOD; } ans--; cout << ans << endl; return 0; }
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef pair<int, int> P; const int MOD = 1000000007; int N; string S; int n[30] = {}; int main() { cin >> N; cin >> S; LL ans = 1; for (int i = 0; i < N; i++) { n[S[i] - 'a']++; } for (int i = 0; i <= 'z' - 'a'; i++) { ans *= n[i] + 1; ans %= MOD; } ans--; cout << ans << endl; return 0; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
906,040
906,041
u114234520
cpp
p03095
#include <bits/stdc++.h> using namespace std; int a[30]; int main() { char c; int n, i; long long ans = 1; scanf("%d", &n); getchar(); for (i = 1; i <= n; i++) { scanf("%c", &c); a[c - 'a']++; } for (i = 0; i < 26; i++) ans = ans * (a[i] + 1) % 1000000007; printf("%lld", (ans + 1000000006) & 1000000007); return 0; }
#include <bits/stdc++.h> using namespace std; int a[30]; int main() { char c; int n, i; long long ans = 1; scanf("%d", &n); getchar(); for (i = 1; i <= n; i++) { scanf("%c", &c); a[c - 'a']++; } for (i = 0; i < 26; i++) ans = ans * (a[i] + 1) % 1000000007; printf("%lld", (ans + 1000000006) % 1000000007); return 0; }
[ "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
906,050
906,051
u314499126
cpp
p03095
#include <bits/stdc++.h> using namespace std; int a[30]; int main() { char c; int n, i; long long ans = 1; scanf("%d", &n); getchar(); for (i = 1; i <= n; i++) { scanf("%c", &c); a[c - 'a']++; } for (i = 0; i < 26; i++) ans = ans * (a[i] + 1) % 1000000007; printf("%lld", ans); return 0; }
#include <bits/stdc++.h> using namespace std; int a[30]; int main() { char c; int n, i; long long ans = 1; scanf("%d", &n); getchar(); for (i = 1; i <= n; i++) { scanf("%c", &c); a[c - 'a']++; } for (i = 0; i < 26; i++) ans = ans * (a[i] + 1) % 1000000007; printf("%lld", (ans + 1000000006) % 1000000007); return 0; }
[ "call.arguments.change" ]
906,052
906,051
u314499126
cpp
p03095
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll cnt[30]; ll pow_2(ll x) { ll ret = 1; for (int i = 0; i < x; i++) { ret = ret * 2 % 1000000007; } return ret; } int main() { string s; int n; cin >> n >> s; for (int i = 0; i < n; i++) { cnt[s[i] - 'a']++; } ll cnt2 = 0; ll ans = 1; for (int i = 0; i < n; i++) { if (cnt[i] == 1) { cnt2++; } else if (cnt[i] > 1) { ans *= 1 + cnt[i]; } ans %= 1000000007; } if (cnt2 == n) cout << pow_2(cnt2) - 1 << endl; else cout << pow_2(cnt2) * ans % 1000000007 - 1 << endl; return 0; }
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll cnt[30]; ll pow_2(ll x) { ll ret = 1; for (int i = 0; i < x; i++) { ret = ret * 2 % 1000000007; } return ret; } int main() { string s; int n; cin >> n >> s; for (int i = 0; i < n; i++) { cnt[s[i] - 'a']++; } ll cnt2 = 0; ll ans = 1; for (int i = 0; i < 26; i++) { if (cnt[i] == 1) { cnt2++; } else if (cnt[i] > 1) { ans *= 1 + cnt[i]; } ans %= 1000000007; } if (cnt2 == n) cout << pow_2(cnt2) - 1 << endl; else cout << pow_2(cnt2) * ans % 1000000007 - 1 << endl; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
906,064
906,065
u620735210
cpp
p03095
#include <iostream> using namespace std; int c[26]; const long long MOD = 1e9 + 7; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { c[s[i] - 'a']++; } long long ans = 1; for (int i = 0; i < n; i++) { ans *= (c[i] + 1); ans %= MOD; } cout << ans - 1 << '\n'; return 0; }
#include <iostream> using namespace std; int c[26]; const long long MOD = 1e9 + 7; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; for (int i = 0; i < n; i++) { c[s[i] - 'a']++; } long long ans = 1; for (int i = 0; i < 26; i++) { ans *= (c[i] + 1LL); ans %= MOD; } cout << ans - 1 << '\n'; return 0; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "literal.number.type.widen.change" ]
906,068
906,069
u244459371
cpp
p03095
#include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) typedef pair<int, int> PII; //-------- int l[25]; vector<int> pressed; signed main() { int N; string s; cin >> N; cin >> s; REP(i, N) { l[s[i] - 'a']++; } int ans = 1; REP(i, 25) { if (l[i] > 0) { ans *= (l[i] + 1); ans %= 1000000007; } } ans += 1000000006; cout << ans % 1000000007 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) typedef pair<int, int> PII; //-------- int l[50]; vector<int> pressed; signed main() { int N; string s; cin >> N; cin >> s; REP(i, N) { l[s[i] - 'a']++; } int ans = 1; REP(i, 50) { if (l[i] > 0) { ans *= (l[i] + 1); ans %= 1000000007; } } ans += 1000000006; cout << ans % 1000000007 << endl; return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change", "call.arguments.change" ]
906,072
906,073
u465379376
cpp
p03095
#include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) typedef pair<int, int> PII; //-------- int l[25]; vector<int> pressed; signed main() { int N; string s; cin >> N; cin >> s; REP(i, N) { l[s[i] - 'a']++; } int ans = 1; REP(i, 25) { if (l[i] > 0) { ans *= (l[i] + 1); ans %= 1000000007; } } ans -= 1; cout << ans % 1000000007 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) typedef pair<int, int> PII; //-------- int l[50]; vector<int> pressed; signed main() { int N; string s; cin >> N; cin >> s; REP(i, N) { l[s[i] - 'a']++; } int ans = 1; REP(i, 50) { if (l[i] > 0) { ans *= (l[i] + 1); ans %= 1000000007; } } ans += 1000000006; cout << ans % 1000000007 << endl; return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change", "call.arguments.change", "assignment.change" ]
906,074
906,073
u465379376
cpp
p03095
#include <iostream> #include <vector> using namespace std; long long ans = 1; vector<int> charas(26, 0); int main() { int N; string str; cin >> N >> str; for (int i = 0; i < N; i++) { charas[str[i] - 'a']++; } //文字iを選ぶor選ばない for (int i = 0; i < 25; i++) { ans = (ans * (charas[i] + 1)) % ((int)1e9 + 7); } if (ans != 0) ans--; else ans = ((int)1e9 + 7) - 1; cout << ans << endl; return 0; }
#include <iostream> #include <vector> using namespace std; long long ans = 1; vector<int> charas(26, 0); int main() { int N; string str; cin >> N >> str; for (int i = 0; i < N; i++) { charas[str[i] - 'a']++; } //文字iを選ぶor選ばない for (int i = 0; i < 26; i++) { ans = (ans * (charas[i] + 1)) % ((int)1e9 + 7); } if (ans != 0) ans--; else ans = ((int)1e9 + 7) - 1; cout << ans << endl; return 0; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
906,081
906,082
u604023588
cpp
p03095
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> #define set0(x) memset(x, 0, sizeof(x)) #define FF first #define SS second #define PB push_back #define MP make_pair using namespace std; typedef long long ll; typedef pair<ll, ll> pll; template <typename T> void read(T &x) { x = 0; char ch = getchar(); int f = 1; while (!isdigit(ch)) { if (ch == '-') f *= -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 48; ch = getchar(); } x *= f; } ll n, cnt[300], mod = 1e9 + 7; char ch[100010]; int main() { read(n); cin >> ch; for (int i = 1; i <= 120; i++) cnt[i] = 1; for (int i = 0; i < n; i++) cnt[ch[i]] += 1; for (int i = 2; i <= 120; i++) cnt[i] = (cnt[i] * cnt[i - 1]) % mod; cout << (cnt[120] + mod - 1) % mod << endl; return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> #define set0(x) memset(x, 0, sizeof(x)) #define FF first #define SS second #define PB push_back #define MP make_pair using namespace std; typedef long long ll; typedef pair<ll, ll> pll; template <typename T> void read(T &x) { x = 0; char ch = getchar(); int f = 1; while (!isdigit(ch)) { if (ch == '-') f *= -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 48; ch = getchar(); } x *= f; } ll n, cnt[300], mod = 1e9 + 7; char ch[100010]; int main() { read(n); cin >> ch; for (int i = 1; i <= 180; i++) cnt[i] = 1; for (int i = 0; i < n; i++) cnt[ch[i]] += 1; for (int i = 2; i <= 180; i++) cnt[i] = (cnt[i] * cnt[i - 1]) % mod; cout << (cnt[180] + mod - 1) % mod << endl; return 0; }
[ "literal.number.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change", "variable_access.subscript.index.change", "io.output.change" ]
906,085
906,086
u054789652
cpp
p03095
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; char a[100101]; int sum[1010]; int main() { int n, i, ans; scanf("%d", &n); scanf("%s", a + 1); for (i = 1; i <= n; i++) sum[a[i] - 'a']++; for (i = 0; i < 26; i++) ans = (long long)ans * (sum[i] + 1) % 1000000007; printf("%d\n", ans - 1); // freopen(".in","r",stdin); // freopen(".out","w",stdout); return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; char a[100101]; int sum[1010]; int main() { int n, i, ans = 1; scanf("%d", &n); scanf("%s", a + 1); for (i = 1; i <= n; i++) sum[a[i] - 'a']++; for (i = 0; i < 26; i++) ans = (long long)ans * (sum[i] + 1) % 1000000007; printf("%d\n", ans - 1); // freopen(".in","r",stdin); // freopen(".out","w",stdout); return 0; }
[ "variable_declaration.value.change" ]
906,120
906,121
u556820423
cpp
p03095
// finish date: 2019/2/28 #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int(i) = a; (i) < (b); (i)++) #define rep(i, n) FOR(i, 0, n) typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<vector<vector<int>>> vvvi; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef vector<double> vd; typedef vector<vector<double>> vvd; typedef vector<vector<vector<double>>> vvvd; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; typedef vector<string> vs; typedef vector<char> vc; typedef vector<vector<char>> vvc; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<ll, pair<int, int>> plii; const int bigmod = 1000000007; const int INF = 1050000000; const long long INFll = 100000000000000000; //足し算 int add(int a, int b) { return (int)(((ll)a + b + bigmod) % bigmod); } //引き算 int sub(int a, int b) { return (int)(((ll)a - b + bigmod) % bigmod); } //掛け算 int mul(int a, int b) { return (int)(((ll)(a % bigmod) * (b % bigmod)) % bigmod); } int main() { int N; string S; cin >> N >> S; vi cnt(26, 0); rep(i, N) { cnt[S[i] - 'a']++; } int ans = 0; rep(i, N) { if (cnt[i] == 0) continue; ans = add(ans, mul(ans, cnt[i])); ans = add(ans, cnt[i]); } cout << ans << endl; return 0; }
// finish date: 2019/2/28 #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int(i) = a; (i) < (b); (i)++) #define rep(i, n) FOR(i, 0, n) typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<vector<vector<int>>> vvvi; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; typedef vector<double> vd; typedef vector<vector<double>> vvd; typedef vector<vector<vector<double>>> vvvd; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; typedef vector<string> vs; typedef vector<char> vc; typedef vector<vector<char>> vvc; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<ll, pair<int, int>> plii; const int bigmod = 1000000007; const int INF = 1050000000; const long long INFll = 100000000000000000; //足し算 int add(int a, int b) { return (int)(((ll)a + b + bigmod) % bigmod); } //引き算 int sub(int a, int b) { return (int)(((ll)a - b + bigmod) % bigmod); } //掛け算 int mul(int a, int b) { return (int)(((ll)(a % bigmod) * (b % bigmod)) % bigmod); } int main() { int N; string S; cin >> N >> S; vi cnt(26, 0); rep(i, N) { cnt[S[i] - 'a']++; } int ans = 0; rep(i, 26) { if (cnt[i] == 0) continue; ans = add(ans, mul(ans, cnt[i])); ans = add(ans, cnt[i]); } cout << ans << endl; return 0; }
[]
906,122
906,123
u285660186
cpp
p03082
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = int64_t; using ld = long double; using P = pair<int, int>; using vs = vector<string>; using vi = vector<int>; using vvi = vector<vi>; template <class T> using PQ = priority_queue<T>; template <class T> using PQG = priority_queue<T, vector<T>, greater<T>>; const int INF = 100010001; const ll LINF = (ll)INF * INF * 10; template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second; } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second; } const int mod = 1000000007; // const int mod = 998244353; struct mint { int64_t x; mint(int64_t x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } mint pow(int64_t t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) { return mint(*this) /= a; } }; istream &operator>>(istream &is, mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, x; cin >> n >> x; vi a(n); rep(i, n) cin >> a[i]; sort(all(a)); if (x < a[0]) { mint ans(x); rep(i, n) ans *= i + 1; cout << ans << endl; return 0; } vector<mint> dp((x + 1) >> 1); vector<mint> mm(n + 1, 1); rep(i, n) mm[i + 1] = mm[i] * (i + 1); rep(i, (x + 1) >> 1) { auto itr = upper_bound(all(a), i); int num = itr - a.begin(); if (!num) { dp[i] = i; } else { for (int j = num - 1; j >= 0; j--) { itr = upper_bound(all(a), i % a[j]); mint mul = mm[num - 1] / mm[itr - a.begin()]; dp[i] += mul * dp[i % a[j]]; } } } mint ans; auto itr = upper_bound(all(a), x); int num = itr - a.begin(); for (int j = num - 1; j >= 0; j--) { itr = upper_bound(all(a), x % a[j]); mint mul = mm[num - 1] / mm[itr - a.begin()]; ans += mul * dp[x % a[j]]; } cout << ans * mm[n] / mm[n - num] << endl; }
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using namespace std; using ll = int64_t; using ld = long double; using P = pair<int, int>; using vs = vector<string>; using vi = vector<int>; using vvi = vector<vi>; template <class T> using PQ = priority_queue<T>; template <class T> using PQG = priority_queue<T, vector<T>, greater<T>>; const int INF = 100010001; const ll LINF = (ll)INF * INF * 10; template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); } template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second; } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second; } const int mod = 1000000007; // const int mod = 998244353; struct mint { int64_t x; mint(int64_t x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } mint pow(int64_t t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) { return mint(*this) /= a; } }; istream &operator>>(istream &is, mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, x; cin >> n >> x; vi a(n); rep(i, n) cin >> a[i]; sort(all(a)); if (x < a[0]) { mint ans(x); rep(i, n) ans *= i + 1; cout << ans << endl; return 0; } vector<mint> dp((x + 1) >> 1); vector<mint> mm(n + 1, 1); rep(i, n) mm[i + 1] = mm[i] * (i + 1); rep(i, (x + 1) >> 1) { auto itr = upper_bound(all(a), i); int num = itr - a.begin(); if (!num) { dp[i] = i; } else { for (int j = num - 1; j >= 0; j--) { itr = upper_bound(all(a), i % a[j]); mint mul = mm[num - 1] / mm[itr - a.begin()]; dp[i] += mul * dp[i % a[j]]; } } } mint ans; auto itr = upper_bound(all(a), x); int num = itr - a.begin(); for (int j = num - 1; j >= 0; j--) { itr = upper_bound(all(a), x % a[j]); mint mul = mm[num - 1] / mm[itr - a.begin()]; ans += mul * dp[x % a[j]]; } cout << ans * mm[n] / mm[num] << endl; }
[ "expression.operation.binary.remove" ]
906,124
906,125
u802434195
cpp
p03082
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vec; typedef vector<vec> mat; typedef pair<ll, ll> pll; const ll mod = 1e9 + 7; // const ll mod=998244353; const ll inf = 1LL << 61; int main() { ll n, x; cin >> n >> x; vec a(n); for (ll i = 0; i < n; i++) cin >> a[i]; sort(a.rbegin(), a.rend()); mat dp(n, vec(x + 1, 0)); for (ll i = 0; i <= x; i++) dp[n - 1][i] = i % a[n - 1]; for (ll i = n - 2; i >= 0; i--) { for (ll j = 0; j < x + 1; j++) { dp[i][j] = (dp[i + 1][j % a[i]] + i * dp[i + 1][j] % mod) % mod; } } cout << dp[0][x] << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vec; typedef vector<vec> mat; typedef pair<ll, ll> pll; const ll mod = 1e9 + 7; // const ll mod=998244353; const ll inf = 1LL << 61; int main() { ll n, x; cin >> n >> x; vec a(n); for (ll i = 0; i < n; i++) cin >> a[i]; sort(a.rbegin(), a.rend()); mat dp(n, vec(x + 1, 0)); for (ll i = 0; i <= x; i++) dp[n - 1][i] = i % a[n - 1]; for (ll i = n - 2; i >= 0; i--) { for (ll j = 0; j < x + 1; j++) { dp[i][j] = (dp[i + 1][j % a[i]] + (n - i - 1) * dp[i + 1][j] % mod) % mod; } } cout << dp[0][x] << endl; }
[]
906,128
906,129
u718758485
cpp
p03082
#include <bits/stdc++.h> #define int long long int using namespace std; template <typename T, typename U> using P = pair<T, U>; template <typename T> using V = vector<T>; template <typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T> void fill_all(T &arr, const T &v) { arr = v; } template <typename T, typename U> void fill_all(T &arr, const U &v) { for (auto &i : arr) fill_all(i, v); } template <typename T> auto &operator<<(ostream &s, const vector<T> &v) { s << "["; bool a = 1; for (auto e : v) { s << (a ? "" : " ") << e; a = 0; } s << "]"; return s; } template <typename T, typename U> auto &operator<<(ostream &s, const pair<T, U> &p) { s << "(" << p.first << "," << p.second << ")"; return s; } template <typename T> auto &operator<<(ostream &s, const set<T> &st) { s << "{"; bool a = 1; for (auto e : st) { s << (a ? "" : " ") << e; a = 0; } s << "}"; return s; } template <typename T, typename U> auto &operator<<(ostream &s, const map<T, U> &m) { s << "{"; bool a = 1; for (auto e : m) { s << (a ? "" : " ") << e.first << ":" << e.second; a = 0; } s << "}"; return s; } #define DUMP(x) cout << #x << " = " << (x) << endl struct edge { int to, cost; }; const int INF = 1LL << 60; const int MOD = 1e9 + 7; template <typename superType, class Operators> struct Ring { superType x; template <typename... Args> Ring(Args... args) : x(args...) {} template <typename... Args> decltype(auto) operator[](Args... args) { return x.operator[](args...); } Ring &operator=(const Ring &value) & = default; template <typename... Args> static Ring id_add(Args... args) { return Operators::IdAdd(args...); } template <typename... Args> static Ring id_mul(Args... args) { return Operators::IdMul(args...); } Ring operator+() const { return *this; } Ring operator-() const { return Operators::Opposite(x); } Ring operator+=(const Ring &rhs) { x = Operators::Add(x, rhs.x); return *this; } Ring operator-=(const Ring &rhs) { *this += -rhs; return *this; } Ring operator*=(const Ring &rhs) { x = Operators::Mul(x, rhs.x); return *this; } const Ring operator+(const Ring &rhs) const { return Ring(*this) += rhs; } const Ring operator-(const Ring &rhs) const { return Ring(*this) -= rhs; } const Ring operator*(const Ring &rhs) const { return Ring(*this) *= rhs; } Ring power(int n) const { return Operators::Power(x, n); } bool operator<(const Ring &rhs) const { return Operators::Less(x, rhs.x); } bool operator>(const Ring &rhs) const { return rhs < *this; } bool operator<=(const Ring &rhs) const { return !(*this > rhs); } bool operator>=(const Ring &rhs) const { return !(*this < rhs); } bool operator==(const Ring &rhs) const { return !(*this < rhs) && !(*this > rhs); } bool operator!=(const Ring &rhs) const { return !(*this == rhs); } }; template <typename superType, class Operators> auto &operator<<(ostream &s, const Ring<superType, Operators> &a) { s << a.x; return s; } template <typename superType, class Operators> struct Field : Ring<superType, Operators> { using BaseRing = Ring<superType, Operators>; template <typename... Args> Field(Args... args) : BaseRing(args...) {} template <typename... Args> decltype(auto) operator[](Args... args) { return BaseRing::operator[](args...); } Field &operator=(const Field &value) & = default; template <typename... Args> static Field id_add(Args... args) { return BaseRing::id_add(args...); } template <typename... Args> static Field id_mul(Args... args) { return BaseRing::id_mul(args...); } Field operator+() const { return BaseRing::operator+(); } Field operator-() const { return BaseRing::operator-(); } Field reciprocal() const { return Operators::Reciprocal(this->x); } Field operator+=(const Field &rhs) { return *this = BaseRing::operator+=(rhs); } Field operator-=(const Field &rhs) { return *this = BaseRing::operator-=(rhs); } Field operator*=(const Field &rhs) { return *this = BaseRing::operator*=(rhs); } Field operator/=(const Field &rhs) { return *this *= rhs.reciprocal(); } const Field operator+(const Field &rhs) const { return Field(*this) += rhs; } const Field operator-(const Field &rhs) const { return Field(*this) -= rhs; } const Field operator*(const Field &rhs) const { return Field(*this) *= rhs; } const Field operator/(const Field &rhs) const { return Field(*this) /= rhs; } Field power(int n) const { return BaseRing::power(n); } bool operator<(const Field &rhs) const { return BaseRing::operator<(rhs); } bool operator>(const Field &rhs) const { return BaseRing::operator>(rhs); } bool operator<=(const Field &rhs) const { return BaseRing::operator<=(rhs); } bool operator>=(const Field &rhs) const { return BaseRing::operator>=(rhs); } bool operator==(const Field &rhs) const { return BaseRing::operator==(rhs); } bool operator!=(const Field &rhs) const { return BaseRing::operator!=(rhs); } }; template <typename superType, class Operators> auto &operator<<(ostream &s, const Field<superType, Operators> &a) { s << a.x; return s; } template <int mod = MOD> struct ModuloRingOperators { static int Add(int lhs, int rhs) { return (lhs + rhs) % mod; }; static int Mul(int lhs, int rhs) { return (lhs * rhs) % mod; }; static int IdAdd() { return 0; }; static int IdMul() { return 1; }; static int Opposite(int value) { return ((-value % mod) + mod) % mod; }; static bool Less(int lhs, int rhs) { return lhs < rhs; }; static int Power(int value, int n) { int res = IdMul(); while (n > 0) { if (n & 1) res = Mul(res, value); value = Mul(value, value); n >>= 1; } return res; } }; using MR = Ring<int, ModuloRingOperators<MOD>>; template <int mod = MOD> struct GaloisFieldOperators : ModuloRingOperators<mod> { static int Reciprocal(int value) { return ModuloRingOperators<mod>::Power(value, mod - 2); } }; using GF = Field<int, GaloisFieldOperators<MOD>>; signed main() { int n, x; cin >> n >> x; vector<int> s(n); for (int i = 0; i < n; ++i) { cin >> s[i]; } sort(s.rbegin(), s.rend()); auto dp = make_v<GF>(n + 1, x + 1); dp[0][x] = 1; for (int i = 0; i < n; ++i) { for (int j = 0; j <= x; ++j) { dp[i + 1][j % s[i]] += dp[i][j]; dp[i + 1][j] += dp[i][j] * (n - 1 - i); } } GF ans = 0; for (int i = 0; i <= x; ++i) { ans += dp[n][i] * i; } DUMP(ans); return 0; }
#include <bits/stdc++.h> #define int long long int using namespace std; template <typename T, typename U> using P = pair<T, U>; template <typename T> using V = vector<T>; template <typename T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template <typename T> void fill_all(T &arr, const T &v) { arr = v; } template <typename T, typename U> void fill_all(T &arr, const U &v) { for (auto &i : arr) fill_all(i, v); } template <typename T> auto &operator<<(ostream &s, const vector<T> &v) { s << "["; bool a = 1; for (auto e : v) { s << (a ? "" : " ") << e; a = 0; } s << "]"; return s; } template <typename T, typename U> auto &operator<<(ostream &s, const pair<T, U> &p) { s << "(" << p.first << "," << p.second << ")"; return s; } template <typename T> auto &operator<<(ostream &s, const set<T> &st) { s << "{"; bool a = 1; for (auto e : st) { s << (a ? "" : " ") << e; a = 0; } s << "}"; return s; } template <typename T, typename U> auto &operator<<(ostream &s, const map<T, U> &m) { s << "{"; bool a = 1; for (auto e : m) { s << (a ? "" : " ") << e.first << ":" << e.second; a = 0; } s << "}"; return s; } #define DUMP(x) cout << #x << " = " << (x) << endl struct edge { int to, cost; }; const int INF = 1LL << 60; const int MOD = 1e9 + 7; template <typename superType, class Operators> struct Ring { superType x; template <typename... Args> Ring(Args... args) : x(args...) {} template <typename... Args> decltype(auto) operator[](Args... args) { return x.operator[](args...); } Ring &operator=(const Ring &value) & = default; template <typename... Args> static Ring id_add(Args... args) { return Operators::IdAdd(args...); } template <typename... Args> static Ring id_mul(Args... args) { return Operators::IdMul(args...); } Ring operator+() const { return *this; } Ring operator-() const { return Operators::Opposite(x); } Ring operator+=(const Ring &rhs) { x = Operators::Add(x, rhs.x); return *this; } Ring operator-=(const Ring &rhs) { *this += -rhs; return *this; } Ring operator*=(const Ring &rhs) { x = Operators::Mul(x, rhs.x); return *this; } const Ring operator+(const Ring &rhs) const { return Ring(*this) += rhs; } const Ring operator-(const Ring &rhs) const { return Ring(*this) -= rhs; } const Ring operator*(const Ring &rhs) const { return Ring(*this) *= rhs; } Ring power(int n) const { return Operators::Power(x, n); } bool operator<(const Ring &rhs) const { return Operators::Less(x, rhs.x); } bool operator>(const Ring &rhs) const { return rhs < *this; } bool operator<=(const Ring &rhs) const { return !(*this > rhs); } bool operator>=(const Ring &rhs) const { return !(*this < rhs); } bool operator==(const Ring &rhs) const { return !(*this < rhs) && !(*this > rhs); } bool operator!=(const Ring &rhs) const { return !(*this == rhs); } }; template <typename superType, class Operators> auto &operator<<(ostream &s, const Ring<superType, Operators> &a) { s << a.x; return s; } template <typename superType, class Operators> struct Field : Ring<superType, Operators> { using BaseRing = Ring<superType, Operators>; template <typename... Args> Field(Args... args) : BaseRing(args...) {} template <typename... Args> decltype(auto) operator[](Args... args) { return BaseRing::operator[](args...); } Field &operator=(const Field &value) & = default; template <typename... Args> static Field id_add(Args... args) { return BaseRing::id_add(args...); } template <typename... Args> static Field id_mul(Args... args) { return BaseRing::id_mul(args...); } Field operator+() const { return BaseRing::operator+(); } Field operator-() const { return BaseRing::operator-(); } Field reciprocal() const { return Operators::Reciprocal(this->x); } Field operator+=(const Field &rhs) { return *this = BaseRing::operator+=(rhs); } Field operator-=(const Field &rhs) { return *this = BaseRing::operator-=(rhs); } Field operator*=(const Field &rhs) { return *this = BaseRing::operator*=(rhs); } Field operator/=(const Field &rhs) { return *this *= rhs.reciprocal(); } const Field operator+(const Field &rhs) const { return Field(*this) += rhs; } const Field operator-(const Field &rhs) const { return Field(*this) -= rhs; } const Field operator*(const Field &rhs) const { return Field(*this) *= rhs; } const Field operator/(const Field &rhs) const { return Field(*this) /= rhs; } Field power(int n) const { return BaseRing::power(n); } bool operator<(const Field &rhs) const { return BaseRing::operator<(rhs); } bool operator>(const Field &rhs) const { return BaseRing::operator>(rhs); } bool operator<=(const Field &rhs) const { return BaseRing::operator<=(rhs); } bool operator>=(const Field &rhs) const { return BaseRing::operator>=(rhs); } bool operator==(const Field &rhs) const { return BaseRing::operator==(rhs); } bool operator!=(const Field &rhs) const { return BaseRing::operator!=(rhs); } }; template <typename superType, class Operators> auto &operator<<(ostream &s, const Field<superType, Operators> &a) { s << a.x; return s; } template <int mod = MOD> struct ModuloRingOperators { static int Add(int lhs, int rhs) { return (lhs + rhs) % mod; }; static int Mul(int lhs, int rhs) { return (lhs * rhs) % mod; }; static int IdAdd() { return 0; }; static int IdMul() { return 1; }; static int Opposite(int value) { return ((-value % mod) + mod) % mod; }; static bool Less(int lhs, int rhs) { return lhs < rhs; }; static int Power(int value, int n) { int res = IdMul(); while (n > 0) { if (n & 1) res = Mul(res, value); value = Mul(value, value); n >>= 1; } return res; } }; using MR = Ring<int, ModuloRingOperators<MOD>>; template <int mod = MOD> struct GaloisFieldOperators : ModuloRingOperators<mod> { static int Reciprocal(int value) { return ModuloRingOperators<mod>::Power(value, mod - 2); } }; using GF = Field<int, GaloisFieldOperators<MOD>>; signed main() { int n, x; cin >> n >> x; vector<int> s(n); for (int i = 0; i < n; ++i) { cin >> s[i]; } sort(s.rbegin(), s.rend()); auto dp = make_v<GF>(n + 1, x + 1); dp[0][x] = 1; for (int i = 0; i < n; ++i) { for (int j = 0; j <= x; ++j) { dp[i + 1][j % s[i]] += dp[i][j]; dp[i + 1][j] += dp[i][j] * (n - 1 - i); } } GF ans = 0; for (int i = 0; i <= x; ++i) { ans += dp[n][i] * i; } cout << ans << endl; return 0; }
[ "io.output.change" ]
906,170
906,171
u960524878
cpp
p03082
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; constexpr int P = 1000000007; int dp[201][10001]; ll f(int n, int *s, int x) { if (n == 1) { return x % s[0]; } if (dp[n][x] != -1) return dp[n][x]; ll r = 0; r += f(n - 1, s + 1, x % s[0]); r += f(n - 1, s + 1, x) * (n - 1); return dp[n][x] = r % P; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, x; cin >> n >> x; memset(dp, -1, sizeof(dp)); vector<int> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; } sort(s.begin(), s.end()); reverse(s.begin(), s.end()); cout << f(n, &s[0], x) << endl; // vector<ll> a(x + 1), b(x + 1);//xでs[i]を迎える // a[x] = 1; // for (int i = 0; i < n; i++) { // for (int j = 0; j <= x; j++) { // b[j] = a[j]; // } // for (int j = 0; j <= x; j++) { // b[j % s[i]] += a[j]; // b[j % s[i]] %= P; // } // swap(a, b); //} // ll r = 0; // for (int j = 0; j <= x; j++) { // r += a[j] * j; //} // cout << r % P << endl; //単調減少にいくつかかますとしてよい //降順にソートし2^N通りを考える //いや、でかいやつだけみたいなのはできないな //最初に6に当たるとすると、6より小さいやつは6の前に来てないつまりあとに来てることになり return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; constexpr int P = 1000000007; int dp[201][100001]; ll f(int n, int *s, int x) { if (n == 1) { return x % s[0]; } if (dp[n][x] != -1) return dp[n][x]; ll r = 0; r += f(n - 1, s + 1, x % s[0]); r += f(n - 1, s + 1, x) * (n - 1); return dp[n][x] = r % P; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, x; cin >> n >> x; memset(dp, -1, sizeof(dp)); vector<int> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; } sort(s.begin(), s.end()); reverse(s.begin(), s.end()); cout << f(n, &s[0], x) << endl; return 0; }
[ "literal.number.change", "variable_declaration.array_dimensions.change" ]
906,172
906,173
u215860196
cpp
p03082
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = int(a); i < int(b); i++) #define all(x) (x).begin(), (x).end() template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } typedef long long ll; using namespace std; long long modpow(long long x, long long n, long long mod) { if (n == 0) return 1; long long res = modpow(x * x % mod, n / 2, mod); if (n & 1) res = res * x % mod; return res; } long long modinv(long long a, long long mod) // extgcdの方がいいらしい { return modpow(a, mod - 2, mod); } vector<int> inv; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, x; int mod = 1e9 + 7; cin >> n >> x; vector<int> s(n); rep(i, n) cin >> s[i]; sort(all(s), greater<int>()); inv.resize(n + 1); repi(i, 1, n + 1) inv[i] = modinv(i, mod); vector<vector<int>> dp(2, vector<int>(x + 1, 0)); dp[0][x] = 1; rep(i, n) { int no = i & 1, ne = 1 - no; fill(all(dp[ne]), 0); rep(j, x + 1) { if (dp[no][j] == 0) continue; int t = (ll)dp[no][j] * inv[n - i] % mod; int jsi = j % s[i]; dp[ne][jsi] += t; dp[ne][j] += t * (n - i - 1) % mod; if (dp[ne][jsi] > mod) dp[ne][jsi] -= mod; if (dp[ne][j] > mod) dp[ne][jsi] -= mod; } } ll res = 0; int kai = 1; rep(i, n) kai = (ll)kai * (i + 1) % mod; rep(i, x + 1) { res += (ll)kai * dp[n & 1][i] % mod * i % mod; } cout << res % mod << endl; return 0; }
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <unordered_map> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = int(a); i < int(b); i++) #define all(x) (x).begin(), (x).end() template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } typedef long long ll; using namespace std; long long modpow(long long x, long long n, long long mod) { if (n == 0) return 1; long long res = modpow(x * x % mod, n / 2, mod); if (n & 1) res = res * x % mod; return res; } long long modinv(long long a, long long mod) // extgcdの方がいいらしい { return modpow(a, mod - 2, mod); } vector<int> inv; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, x; int mod = 1e9 + 7; cin >> n >> x; vector<int> s(n); rep(i, n) cin >> s[i]; sort(all(s), greater<int>()); inv.resize(n + 1); repi(i, 1, n + 1) inv[i] = modinv(i, mod); vector<vector<int>> dp(2, vector<int>(x + 1, 0)); dp[0][x] = 1; rep(i, n) { int no = i & 1, ne = 1 - no; fill(all(dp[ne]), 0); rep(j, x + 1) { if (dp[no][j] == 0) continue; int t = (ll)dp[no][j] * inv[n - i] % mod; int jsi = j % s[i]; dp[ne][jsi] += t; dp[ne][j] += (ll)t * (n - i - 1) % mod; if (dp[ne][jsi] > mod) dp[ne][jsi] -= mod; if (dp[ne][j] > mod) dp[ne][jsi] -= mod; } } ll res = 0; int kai = 1; rep(i, n) kai = (ll)kai * (i + 1) % mod; rep(i, x + 1) { res += (ll)kai * dp[n & 1][i] % mod * i % mod; } cout << res % mod << endl; return 0; }
[ "type_conversion.add" ]
906,176
906,177
u834415466
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int cnt[256]; void solve() { int n; string s; cin >> n >> s; for (int i = 0; i < n; i++) cnt[s[i]]++; ll ret = 1; for (int i = 0; i < 256; i++) { ret *= ++s[i]; ret %= 1000000007; } ret--; cout << ret << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int cnt[256]; void solve() { int n; string s; cin >> n >> s; for (int i = 0; i < n; i++) cnt[s[i]]++; ll ret = 1; for (int i = 0; i < 256; i++) { ret *= ++cnt[i]; ret %= 1000000007; } ret--; cout << ret << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); }
[ "assignment.value.change", "identifier.change" ]
906,211
906,212
u109256064
cpp
p03095
#pragma GCC optimize("O3") #include <algorithm> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <unordered_set> using namespace std; using QWORD = uint64_t; using SQWORD = int64_t; using DWORD = uint32_t; using SDWORD = int32_t; using WORD = uint16_t; using SWORD = int16_t; using BYTE = uint8_t; using SBYTE = int8_t; using DOUBLE = double; using FLOAT = float; #define MIN_SDWORD (-2147483648) #define MAX_SDWORD (2147483647) #define MIN_SBYTE (-128) #define MAX_SBYTE (127) #define MIN_SQWORD (0x8000000000000000) #define MAX_SQWORD (0x7FFFFFFFFFFFFFFF) #define MAX_QWORD (0xFFFFFFFFFFFFFFFF) #define MAX_DWORD (0xFFFFFFFF) #define MAX_WORD (0xFFFF) #define MAX_BYTE (0xFF) #define ArrayLength(a) (sizeof(a) / sizeof(a[0])) static inline QWORD MAX(QWORD a, QWORD b) { return a > b ? a : b; } static inline DWORD MAX(DWORD a, DWORD b) { return a > b ? a : b; } static inline SDWORD MAX(SDWORD a, SDWORD b) { return a > b ? a : b; } static inline QWORD MIN(QWORD a, QWORD b) { return a < b ? a : b; } static inline DWORD MIN(DWORD a, DWORD b) { return a < b ? a : b; } static inline SDWORD MIN(SDWORD a, SDWORD b) { return a < b ? a : b; } #define BYTE_BITS (8) #define WORD_BITS (16) #define DWORD_BITS (32) #define QWORD_BITS (64) using M_BOOL = bool; #define M_TRUE (true) #define M_FALSE (false) #define DIVISOR (1000000007) static inline void inputString(char *pcStr) { char *pcCur = pcStr; for (;;) { char c = getchar(); if (('\n' == c) || (EOF == c)) { break; } *pcCur = c; pcCur++; } *pcCur = '\0'; } static inline SQWORD inputSQWORD(void) { SQWORD sqNumber = 0; SQWORD sqMultiplier = 1; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { sqMultiplier = -1; } } if (('0' <= c) && (c <= '9')) { sqNumber *= 10LL; sqNumber += (SQWORD)(c - '0'); bRead = M_TRUE; } else { if (bRead) { return sqNumber * sqMultiplier; } } } } static inline SDWORD inputSDWORD(void) { SDWORD lNumber = 0; SDWORD lMultiplier = 1; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { lMultiplier = -1; } } if (('0' <= c) && (c <= '9')) { lNumber *= 10; lNumber += (c - '0'); bRead = M_TRUE; } else { if (bRead) { return lNumber * lMultiplier; } } } } static inline DOUBLE inputFP(void) { DOUBLE dInt = 0.0; DOUBLE dFrac = 0.0; DOUBLE dMultiplier = 1.0; DWORD dwFpCnt = 0; DOUBLE *pdCur = &dInt; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { dMultiplier = -1; } } if ('.' == c) { pdCur = &dFrac; } else if (('0' <= c) && (c <= '9')) { (*pdCur) *= 10; (*pdCur) += (DOUBLE)(c - '0'); bRead = M_TRUE; if (pdCur == &dFrac) { dwFpCnt++; } } else { if (bRead) { return dMultiplier * (dInt + dFrac / (pow((DOUBLE)10.0, (DOUBLE)dwFpCnt))); } } } } #define MAX_STR_LEN (100000) static char s_aInput[MAX_STR_LEN + 1]; static DWORD s_adwCharCnt[27]; #define NUM_ALPHABETS (24) #define ANS_MOD (1000000007) int main() { SQWORD sqInput_N = inputSQWORD(); inputString(s_aInput); for (DWORD dwIdx = 0; dwIdx < sqInput_N; dwIdx++) { char c = s_aInput[dwIdx]; s_adwCharCnt[((DWORD)c - (DWORD)'a')]++; } SQWORD sqAns = 0; for (DWORD dwIdx = 0; dwIdx < NUM_ALPHABETS; dwIdx++) { if (0 < s_adwCharCnt[dwIdx]) { SQWORD sqMul = (sqAns * (SQWORD)s_adwCharCnt[dwIdx]) % ANS_MOD; sqAns = (sqMul + sqAns) % ANS_MOD; } sqAns = (sqAns + (SQWORD)s_adwCharCnt[dwIdx]) % ANS_MOD; } printf("%lld\n", sqAns); return 0; }
#pragma GCC optimize("O3") #include <algorithm> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <set> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <unordered_set> using namespace std; using QWORD = uint64_t; using SQWORD = int64_t; using DWORD = uint32_t; using SDWORD = int32_t; using WORD = uint16_t; using SWORD = int16_t; using BYTE = uint8_t; using SBYTE = int8_t; using DOUBLE = double; using FLOAT = float; #define MIN_SDWORD (-2147483648) #define MAX_SDWORD (2147483647) #define MIN_SBYTE (-128) #define MAX_SBYTE (127) #define MIN_SQWORD (0x8000000000000000) #define MAX_SQWORD (0x7FFFFFFFFFFFFFFF) #define MAX_QWORD (0xFFFFFFFFFFFFFFFF) #define MAX_DWORD (0xFFFFFFFF) #define MAX_WORD (0xFFFF) #define MAX_BYTE (0xFF) #define ArrayLength(a) (sizeof(a) / sizeof(a[0])) static inline QWORD MAX(QWORD a, QWORD b) { return a > b ? a : b; } static inline DWORD MAX(DWORD a, DWORD b) { return a > b ? a : b; } static inline SDWORD MAX(SDWORD a, SDWORD b) { return a > b ? a : b; } static inline QWORD MIN(QWORD a, QWORD b) { return a < b ? a : b; } static inline DWORD MIN(DWORD a, DWORD b) { return a < b ? a : b; } static inline SDWORD MIN(SDWORD a, SDWORD b) { return a < b ? a : b; } #define BYTE_BITS (8) #define WORD_BITS (16) #define DWORD_BITS (32) #define QWORD_BITS (64) using M_BOOL = bool; #define M_TRUE (true) #define M_FALSE (false) #define DIVISOR (1000000007) static inline void inputString(char *pcStr) { char *pcCur = pcStr; for (;;) { char c = getchar(); if (('\n' == c) || (EOF == c)) { break; } *pcCur = c; pcCur++; } *pcCur = '\0'; } static inline SQWORD inputSQWORD(void) { SQWORD sqNumber = 0; SQWORD sqMultiplier = 1; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { sqMultiplier = -1; } } if (('0' <= c) && (c <= '9')) { sqNumber *= 10LL; sqNumber += (SQWORD)(c - '0'); bRead = M_TRUE; } else { if (bRead) { return sqNumber * sqMultiplier; } } } } static inline SDWORD inputSDWORD(void) { SDWORD lNumber = 0; SDWORD lMultiplier = 1; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { lMultiplier = -1; } } if (('0' <= c) && (c <= '9')) { lNumber *= 10; lNumber += (c - '0'); bRead = M_TRUE; } else { if (bRead) { return lNumber * lMultiplier; } } } } static inline DOUBLE inputFP(void) { DOUBLE dInt = 0.0; DOUBLE dFrac = 0.0; DOUBLE dMultiplier = 1.0; DWORD dwFpCnt = 0; DOUBLE *pdCur = &dInt; M_BOOL bRead = M_FALSE; for (;;) { char c = getchar(); if (!bRead) { if ('-' == c) { dMultiplier = -1; } } if ('.' == c) { pdCur = &dFrac; } else if (('0' <= c) && (c <= '9')) { (*pdCur) *= 10; (*pdCur) += (DOUBLE)(c - '0'); bRead = M_TRUE; if (pdCur == &dFrac) { dwFpCnt++; } } else { if (bRead) { return dMultiplier * (dInt + dFrac / (pow((DOUBLE)10.0, (DOUBLE)dwFpCnt))); } } } } #define MAX_STR_LEN (100000) static char s_aInput[MAX_STR_LEN + 1]; static DWORD s_adwCharCnt[27]; #define NUM_ALPHABETS (27) #define ANS_MOD (1000000007) int main() { SQWORD sqInput_N = inputSQWORD(); inputString(s_aInput); for (DWORD dwIdx = 0; dwIdx < sqInput_N; dwIdx++) { char c = s_aInput[dwIdx]; s_adwCharCnt[((DWORD)c - (DWORD)'a')]++; } SQWORD sqAns = 0; for (DWORD dwIdx = 0; dwIdx < NUM_ALPHABETS; dwIdx++) { if (0 < s_adwCharCnt[dwIdx]) { SQWORD sqMul = (sqAns * (SQWORD)s_adwCharCnt[dwIdx]) % ANS_MOD; sqAns = (sqMul + sqAns) % ANS_MOD; } sqAns = (sqAns + (SQWORD)s_adwCharCnt[dwIdx]) % ANS_MOD; } printf("%lld\n", sqAns); return 0; }
[ "preprocessor.define.value.change", "literal.integer.change" ]
906,215
906,216
u487476769
cpp
p03095
#include <iostream> #include <string> #include <vector> using namespace std; int main() { long long n; string s; vector<long long> v(26, 1); cin >> n >> s; for (long long i = 0; i < n; i++) { v[s[i] - 'a']++; } long long ans = 1; for (int i = 0; i < 26; i++) { ans *= v[i]; ans %= 1000000007; } cout << ans << endl; return 0; }
#include <iostream> #include <string> #include <vector> using namespace std; int main() { long long n; string s; vector<long long> v(26, 1); cin >> n >> s; for (long long i = 0; i < n; i++) { v[s[i] - 'a']++; } long long ans = 1; for (int i = 0; i < 26; i++) { ans *= v[i]; ans %= 1000000007; } cout << ans - 1 << endl; return 0; }
[ "expression.operation.binary.add" ]
906,241
906,242
u285598935
cpp
p03095
#include <bits/stdc++.h> #define pb push_back typedef long long ll; const int inf = 2e9; using namespace std; ll MOD = 1000000007; typedef pair<int, int> ii; typedef struct { int a, b, c; } iii; int n; int L[33]; vector<int> v; char S[100005]; int main() { ll ans = 0; scanf("%d%s", &n, S); for (int i = 0; i < n; i++) L[(S[i] - 'a')]++; for (int i = 0; i < 28; i++) if (L[i] > 0) v.pb(L[i]); n = v.size(); for (int i = 0; i < n; i++) ans = (ans * (v[i] + 1)) % MOD; printf("%lld\n", ans - 1); }
#include <bits/stdc++.h> #define pb push_back typedef long long ll; const int inf = 2e9; using namespace std; ll MOD = 1000000007; typedef pair<int, int> ii; typedef struct { int a, b, c; } iii; int n; int L[33]; vector<int> v; char S[100005]; int main() { ll ans = 1; scanf("%d%s", &n, S); for (int i = 0; i < n; i++) L[(S[i] - 'a')]++; for (int i = 0; i < 28; i++) if (L[i] > 0) v.pb(L[i]); n = v.size(); for (int i = 0; i < n; i++) ans = (ans * (v[i] + 1)) % MOD; printf("%lld\n", ans - 1); }
[ "literal.number.change", "variable_declaration.value.change" ]
906,243
906,244
u204082108
cpp
p03095
#include <algorithm> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define rep(i, x) for (int i = 0; i < (int)(x); i++) #define reps(i, x) for (int i = 1; i <= (int)(x); i++) #define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--) #define rreps(i, x) for (int i = ((int)(x)); i > 0; i--) #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define INF 2e9 template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } typedef long long ll; typedef std::pair<ll, ll> P; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } using namespace std; int main() { int N; string s; vector<int> p; cin >> N >> s; int v[26]; rep(i, 26) { v[i] = 0; } ll MOD = 1000000007; string str = "abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < N; i++) { int j = int(s[i] - 'a'); v[j]++; } rep(i, 26) { if (v[i] != 0) p.push_back(v[i]); } ll cnt = 1; reps(i, p.size()) { cnt *= (p[i] + 1) % MOD; } cnt -= 1; cnt = cnt % MOD; cout << cnt; }
#include <algorithm> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define rep(i, x) for (int i = 0; i < (int)(x); i++) #define reps(i, x) for (int i = 1; i <= (int)(x); i++) #define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--) #define rreps(i, x) for (int i = ((int)(x)); i > 0; i--) #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define INF 2e9 template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } typedef long long ll; typedef std::pair<ll, ll> P; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } using namespace std; int main() { int N; string s; vector<int> p; cin >> N >> s; int v[26]; rep(i, 26) { v[i] = 0; } ll MOD = 1000000007; string str = "abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < N; i++) { int j = int(s[i] - 'a'); v[j]++; } rep(i, 26) { if (v[i] != 0) p.push_back(v[i]); } ll cnt = 1; rep(i, p.size()) { cnt *= (p[i] + 1); cnt %= MOD; } cnt -= 1; cnt = cnt % MOD; cout << cnt; }
[ "identifier.change", "call.function.change", "expression.operation.binary.change", "assignment.change" ]
906,259
906,257
u150255544
cpp
p03095
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define MOD 1000000007 int main() { int n; cin >> n; string s; cin >> s; int arr['z' - 'a' + 1]; long long ret = 0; for (char i = 'a'; 'z' >= i; i++) arr[i - 'a'] = 0; for (int i = 0; n - 1 > i; i++) { long long tmp = 1; arr[s[i] - 'a']++; for (char j = 'a'; 'z' >= j; j++) { if (s[i + 1] == j) continue; int chose = 1; if (arr[j - 'a'] > 0) { chose = chose + arr[j - 'a']; } tmp = (long long)(tmp * chose) % MOD; } // cout <<tmp << endl; ret = (long long)(ret + tmp) % MOD; } ret = MOD - 1; ret = (long long)(ret + 1) % MOD; cout << ret << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define MOD 1000000007 int main() { int n; cin >> n; string s; cin >> s; int arr['z' - 'a' + 1]; long long ret = 0; for (char i = 'a'; 'z' >= i; i++) arr[i - 'a'] = 0; for (int i = 0; n - 1 > i; i++) { long long tmp = 1; arr[s[i] - 'a']++; for (char j = 'a'; 'z' >= j; j++) { if (s[i + 1] == j) continue; int chose = 1; if (arr[j - 'a'] > 0) { chose = chose + arr[j - 'a']; } tmp = (long long)(tmp * chose) % MOD; } // cout <<tmp << endl; ret = (long long)(ret + tmp) % MOD; } ret = (long long)(ret + 1) % MOD; cout << ret << endl; }
[]
906,260
906,261
u466161487
cpp
p03095
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define MOD 1000000007 int main() { int n; cin >> n; string s; cin >> s; int arr['z' - 'a' + 1]; long long ret = 0; for (char i = 'a'; 'z' > i; i++) arr[i - 'a'] = 0; for (int i = 0; n - 1 > i; i++) { long long tmp = 1; arr[s[i] - 'a']++; for (char j = 'a'; 'z' > j; j++) { if (s[i + 1] == j) continue; int chose = 1; if (arr[j - 'a'] > 0) { chose = chose + arr[j - 'a']; } tmp = (long long)(tmp * chose) % MOD; } // cout <<tmp << endl; ret = (long long)(ret + tmp) % MOD; } ret = (long long)(ret + 1) % MOD; cout << ret << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define MOD 1000000007 int main() { int n; cin >> n; string s; cin >> s; int arr['z' - 'a' + 1]; long long ret = 0; for (char i = 'a'; 'z' >= i; i++) arr[i - 'a'] = 0; for (int i = 0; n - 1 > i; i++) { long long tmp = 1; arr[s[i] - 'a']++; for (char j = 'a'; 'z' >= j; j++) { if (s[i + 1] == j) continue; int chose = 1; if (arr[j - 'a'] > 0) { chose = chose + arr[j - 'a']; } tmp = (long long)(tmp * chose) % MOD; } // cout <<tmp << endl; ret = (long long)(ret + tmp) % MOD; } ret = (long long)(ret + 1) % MOD; cout << ret << endl; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
906,262
906,261
u466161487
cpp
p03095
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define MOD 1000000007 int main() { int n; cin >> n; string s; cin >> s; int arr['z' - 'a' + 1]; int ret = 0; for (char i = 'a'; 'z' > i; i++) arr[i - 'a'] = 0; for (int i = 0; n - 1 > i; i++) { int tmp = 1; arr[s[i] - 'a']++; for (char j = 'a'; 'z' > j; j++) { if (s[i + 1] == j) continue; int chose = 1; if (arr[j - 'a'] > 0) { chose = chose + arr[j - 'a']; } tmp = (long long)(tmp * chose) % MOD; } // cout <<tmp << endl; ret = (long long)(ret + tmp) % MOD; } ret = (long long)(ret + 1) % MOD; cout << ret << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define MOD 1000000007 int main() { int n; cin >> n; string s; cin >> s; int arr['z' - 'a' + 1]; long long ret = 0; for (char i = 'a'; 'z' >= i; i++) arr[i - 'a'] = 0; for (int i = 0; n - 1 > i; i++) { long long tmp = 1; arr[s[i] - 'a']++; for (char j = 'a'; 'z' >= j; j++) { if (s[i + 1] == j) continue; int chose = 1; if (arr[j - 'a'] > 0) { chose = chose + arr[j - 'a']; } tmp = (long long)(tmp * chose) % MOD; } // cout <<tmp << endl; ret = (long long)(ret + tmp) % MOD; } ret = (long long)(ret + 1) % MOD; cout << ret << endl; }
[ "variable_declaration.type.primitive.change", "variable_declaration.type.widen.change", "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
906,263
906,261
u466161487
cpp
p03095
#include <bits/stdc++.h> #define repd(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) #define int long long typedef long long ll; using namespace std; const int MOD = 1000000007; const int INF = 1010000000; const double EPS = 1e-10; const pair<int, int> fd[] = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)}; vector<int> init(int size) { vector<int> par(size, -1); return par; } int root(int x, vector<int> &par) { if (par[x] < 0) { return x; } else { return par[x] = root(par[x], par); } } bool same(int x, int y, vector<int> &par) { return root(x, par) == root(y, par); } void unite(int x, int y, vector<int> &par) { x = root(x, par), y = root(y, par); if (same(x, y, par)) return; par[x] += par[y]; par[y] = x; } int size(int x, vector<int> &par) { return -par[root(x, par)]; } signed main() { int n; cin >> n; string s; cin >> s; int a[26]; rep(i, 26) a[i] = 0; rep(i, n) { a[s[i] - '0']++; } int ans = 1; rep(i, 26) { ans *= a[i] + 1; } cout << ans - 1 << endl; }
#include <bits/stdc++.h> #define repd(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) #define int long long typedef long long ll; using namespace std; const int MOD = 1000000007; const int INF = 1010000000; const double EPS = 1e-10; const pair<int, int> fd[] = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)}; vector<int> init(int size) { vector<int> par(size, -1); return par; } int root(int x, vector<int> &par) { if (par[x] < 0) { return x; } else { return par[x] = root(par[x], par); } } bool same(int x, int y, vector<int> &par) { return root(x, par) == root(y, par); } void unite(int x, int y, vector<int> &par) { x = root(x, par), y = root(y, par); if (same(x, y, par)) return; par[x] += par[y]; par[y] = x; } int size(int x, vector<int> &par) { return -par[root(x, par)]; } signed main() { int n; cin >> n; string s; cin >> s; int a[26]; rep(i, 26) a[i] = 0; rep(i, n) { a[s[i] - 'a']++; } int ans = 1; rep(i, 26) { ans *= a[i] + 1; ans %= MOD; } cout << ans - 1 << endl; }
[ "literal.string.change", "variable_access.subscript.index.change", "expression.operation.binary.change", "assignment.add" ]
906,264
906,265
u317754719
cpp
p03095
#include <bits/stdc++.h> using namespace std; int cnt[30]; const int MOD = 1e9 + 7; int main() { string s; int n; cin >> n >> s; for (int i = 0; i < n; i++) { cnt[s[i] - 'a']++; } long long ans = 1; for (int i = 0; i < n; i++) { ans = (ans * (cnt[i] + 1LL)) % MOD; } cout << (ans + MOD - 1) % MOD << endl; }
#include <bits/stdc++.h> using namespace std; int cnt[30]; const int MOD = 1e9 + 7; int main() { string s; int n; cin >> n >> s; for (int i = 0; i < n; i++) { cnt[s[i] - 'a']++; } long long ans = 1; for (int i = 0; i < 28; i++) { ans = (ans * (cnt[i] + 1LL)) % MOD; } cout << (ans + MOD - 1) % MOD << endl; }
[ "identifier.replace.remove", "literal.replace.add", "control_flow.loop.for.condition.change", "expression.operation.binary.change" ]
906,274
906,275
u723145084
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; cin >> N; string S; cin >> S; ll mod = 1000000007; map<char, ll> alp; for (char s = 'a'; s <= 'z'; s++) { for (ll i = 0; i < N; i++) { if (S.at(i) == s) { alp[s] += 1; // Sにおける文字毎の出現回数 } } } ll ans = 1; for (char s = 'a'; s < 'z'; s++) { ans = (ans * (alp[s] + 1)) % mod; } cout << (ans + mod - 1) % mod << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; cin >> N; string S; cin >> S; ll mod = 1000000007; map<char, ll> alp; for (char s = 'a'; s <= 'z'; s++) { for (ll i = 0; i < N; i++) { if (S.at(i) == s) { alp[s] += 1; // Sにおける文字毎の出現回数 } } } ll ans = 1; for (char s = 'a'; s <= 'z'; s++) { ans = (ans * (alp[s] + 1)) % mod; } cout << (ans + mod - 1) % mod << endl; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
906,294
906,295
u083190434
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; cin >> N; string S; cin >> S; ll mod = 1000000007; map<char, ll> alp; for (char s = 'a'; s <= 'z'; s++) { for (ll i = 0; i < N; i++) { if (S.at(i) == s) { alp[s] += 1; // Sにおける文字毎の出現回数 } } } ll ans = 1; for (char s = 'a'; s < 'z'; s++) { ans = (ans * (alp[s] + 1)) % mod; } cout << (ans - 1) % mod << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; cin >> N; string S; cin >> S; ll mod = 1000000007; map<char, ll> alp; for (char s = 'a'; s <= 'z'; s++) { for (ll i = 0; i < N; i++) { if (S.at(i) == s) { alp[s] += 1; // Sにおける文字毎の出現回数 } } } ll ans = 1; for (char s = 'a'; s <= 'z'; s++) { ans = (ans * (alp[s] + 1)) % mod; } cout << (ans + mod - 1) % mod << endl; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
906,296
906,295
u083190434
cpp
p03095
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; cin >> N; string S; cin >> S; const ll mod = 1000000007; map<char, ll> alp; for (char s = 'a'; s <= 'z'; s++) { for (ll i = 0; i < N; i++) { if (S.at(i) == s) { alp[s] += 1; // Sにおける文字毎の出現回数 } } } ll ans = 1; for (char s = 'a'; s < 'z'; s++) { ans = (ans * (alp[s] + 1)) % mod; } cout << (ans - 1) % mod << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll N; cin >> N; string S; cin >> S; ll mod = 1000000007; map<char, ll> alp; for (char s = 'a'; s <= 'z'; s++) { for (ll i = 0; i < N; i++) { if (S.at(i) == s) { alp[s] += 1; // Sにおける文字毎の出現回数 } } } ll ans = 1; for (char s = 'a'; s <= 'z'; s++) { ans = (ans * (alp[s] + 1)) % mod; } cout << (ans + mod - 1) % mod << endl; }
[ "expression.operator.compare.change", "control_flow.loop.for.condition.change", "expression.off_by_one", "expression.operation.binary.change" ]
906,297
906,295
u083190434
cpp
p03095
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e9 + 7; ll n, m; ll a[30]; using ll = long long; ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) (res *= x) %= mod; (x *= x) %= mod; n >>= 1; } return res; } int main() { string s; cin >> n >> s; ll ans = 0; for (int i = 0; i < n; i++) { a[s[i] - 'a']++; ans += ans * mod_pow(a[s[i] - 'a'], mod - 2, mod); ans %= mod; } ans--; cout << ans % mod << endl; }
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e9 + 7; ll n, m; ll a[30]; using ll = long long; ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) (res *= x) %= mod; (x *= x) %= mod; n >>= 1; } return res; } int main() { string s; cin >> n >> s; ll ans = 1; for (int i = 0; i < n; i++) { a[s[i] - 'a']++; ans += ans * mod_pow(a[s[i] - 'a'], mod - 2, mod); ans %= mod; } ans--; cout << ans % mod << endl; }
[ "literal.number.change", "variable_declaration.value.change" ]
906,322
906,323
u394482932
cpp
p03095
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++) #define rrep(i, n, m) for (int i = n; i >= m; i--) #define p(a, b) printf(a, b); #define c(s) cout << (s) << endl; #define yes cout << "Yes" << endl; #define no cout << "No" << endl; #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; #define cyn(c) cout << (c ? "Yes" : "No") << endl; #define cYN(c) cout << (c ? "YES" : "NO") << endl; #define pyn(c) printf("%s\n", c ? "Yes" : "No"); #define pYN(c) printf("%s\n", c ? "YES" : "NO"); typedef long long LL; typedef unsigned long long ULL; typedef pair<LL, LL> P; template <class T> bool contain(const std::string &s, const T &v) { return s.find(v) != std::string::npos; } int al[26] = {}; int mod = 1e9 + 7; int main() { int N; string S; cin >> N >> S; ULL ans = 1; rep(i, S.size()) { al[S[i] - 'a']++; } rep(i, 26) { ans = ((ans % mod) * (al[i] % mod)) % mod; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++) #define rrep(i, n, m) for (int i = n; i >= m; i--) #define p(a, b) printf(a, b); #define c(s) cout << (s) << endl; #define yes cout << "Yes" << endl; #define no cout << "No" << endl; #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; #define cyn(c) cout << (c ? "Yes" : "No") << endl; #define cYN(c) cout << (c ? "YES" : "NO") << endl; #define pyn(c) printf("%s\n", c ? "Yes" : "No"); #define pYN(c) printf("%s\n", c ? "YES" : "NO"); typedef long long LL; typedef unsigned long long ULL; typedef pair<LL, LL> P; template <class T> bool contain(const std::string &s, const T &v) { return s.find(v) != std::string::npos; } int al[26] = {}; int mod = 1e9 + 7; int main() { int N; string S; cin >> N >> S; ULL ans = 1; rep(i, S.size()) { al[S[i] - 'a']++; } rep(i, 26) { ans = ((ans % mod) * ((al[i] + 1) % mod)) % mod; } cout << ans - 1 << endl; }
[ "expression.operation.binary.add" ]
906,331
906,332
u098652914
cpp
p03090
#include <bits/stdc++.h> #define FR first #define SE second using namespace std; typedef pair<int, int> pr; vector<pr> ans; int main() { int n; scanf("%d", &n); int m = ((n & 1) ? n : n + 1); for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) if (i + j != n) ans.push_back(pr(i, j)); printf("%d\n", ans.size()); for (int i = 0; i < ans.size(); i++) printf("%d %d\n", ans[i].FR, ans[i].SE); return 0; }
#include <bits/stdc++.h> #define FR first #define SE second using namespace std; typedef pair<int, int> pr; vector<pr> ans; int main() { int n; scanf("%d", &n); int m = ((n & 1) ? n : n + 1); for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) if (i + j != m) ans.push_back(pr(i, j)); printf("%d\n", ans.size()); for (int i = 0; i < ans.size(); i++) printf("%d %d\n", ans[i].FR, ans[i].SE); return 0; }
[ "identifier.change", "control_flow.branch.if.condition.change" ]
906,381
906,382
u966630585
cpp
p03090
#include <bits/stdc++.h> #define pb push_back #define all(v) ((v).begin(), (v).end()) #define sortv(v) sort(all(v)) #define sz(v) ((int)(v).size()) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define umax(a, b) (a) = max((a), (b)) #define umin(a, b) (a) = min((a), (b)) #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) FOR(i, 1, n) #define rep0(i, n) FOR(i, 0, (int)(n)-1) #define FI first #define SE second #define INF 2000000000 #define INFLL 1000000000000000000LL using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int N; vector<pii> v; int main() { scanf("%d", &N); if (N % 2 == 0) { for (int i = 1; i < N; i++) { for (int j = i + 1; j <= N; j++) { if (j == N - i) continue; v.pb({i, j}); } } } else { for (int i = 1; i <= N; i++) { for (int j = i + 1; j <= N; j++) { if (j == N + 1 - i) continue; v.pb({i, j}); } } } printf("%d\n", v.size()); for (int i = 0; i < v.size(); i++) { printf("%d %d\n", v[i].first, v[i].second); } return 0; }
#include <bits/stdc++.h> #define pb push_back #define all(v) ((v).begin(), (v).end()) #define sortv(v) sort(all(v)) #define sz(v) ((int)(v).size()) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define umax(a, b) (a) = max((a), (b)) #define umin(a, b) (a) = min((a), (b)) #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define rep(i, n) FOR(i, 1, n) #define rep0(i, n) FOR(i, 0, (int)(n)-1) #define FI first #define SE second #define INF 2000000000 #define INFLL 1000000000000000000LL using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int N; vector<pii> v; int main() { scanf("%d", &N); if (N % 2 == 1) { for (int i = 1; i < N; i++) { for (int j = i + 1; j <= N; j++) { if (j == N - i) continue; v.pb({i, j}); } } } else { for (int i = 1; i <= N; i++) { for (int j = i + 1; j <= N; j++) { if (j == N + 1 - i) continue; v.pb({i, j}); } } } printf("%d\n", v.size()); for (int i = 0; i < v.size(); i++) { printf("%d %d\n", v[i].first, v[i].second); } return 0; }
[ "literal.number.change", "control_flow.branch.if.condition.change" ]
906,383
906,384
u950523274
cpp
p03090
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vector<long long>> vvll; typedef vector<pair<int, int>> vpii; typedef pair<int, int> pii; typedef long long ll; typedef pair<ll, ll> pll; #define INF 1000000000 #define MOD 1000000007 #define EPSILON 0.00001 #define f first #define s second #define pb push_back #define mp make_pair #define p_q priority_queue #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define F0R(i, a) for (int i = 0; i < (a); i++) #define RFOR(i, a, b) for (int i = (a); i >= b; i--) #define MN 105 int n; vpii e; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; FOR(i, 1, n - 1) { FOR(j, i + 1, n) { if (i + j == n + 1) continue; e.pb(mp(i, j)); } } cout << e.size() << "\n"; F0R(i, e.size()) { cout << e[i].f << " " << e[i].s << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vector<long long>> vvll; typedef vector<pair<int, int>> vpii; typedef pair<int, int> pii; typedef long long ll; typedef pair<ll, ll> pll; #define INF 1000000000 #define MOD 1000000007 #define EPSILON 0.00001 #define f first #define s second #define pb push_back #define mp make_pair #define p_q priority_queue #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define F0R(i, a) for (int i = 0; i < (a); i++) #define RFOR(i, a, b) for (int i = (a); i >= b; i--) #define MN 105 int n; vpii e; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; FOR(i, 1, n - 1) { FOR(j, i + 1, n) { if (i + j == (n / 2) * 2 + 1) continue; e.pb(mp(i, j)); } } cout << e.size() << "\n"; F0R(i, e.size()) { cout << e[i].f << " " << e[i].s << "\n"; } return 0; }
[ "control_flow.branch.if.condition.change" ]
906,385
906,386
u396284099
cpp
p03091
#include <bits/stdc++.h> #define ll long long using namespace std; template <typename tn> void read(tn &a) { tn x = 0, f = 1; char c = ' '; for (; !isdigit(c); c = getchar()) if (c == '-') f = -1; for (; isdigit(c); c = getchar()) x = x * 10 + c - '0'; a = x * f; } const int N = 1001000; int head[N], vis[N], n, m, d[N], tot, cur[N], nxt[N]; struct edge { int v, nxt; } e[N * 2]; vector<int> ans; void add(int x, int y) { e[++tot] = {y, head[x]}; head[x] = tot; } void dfs(int x) { for (int &i = cur[x]; i; i = e[i].nxt) if (!vis[i] && !vis[i ^ 1]) { vis[i] = 1; dfs(e[i].v); } ans.push_back(x); } int main() { read(n); read(m); tot = 1; for (int i = 1; i <= m; i++) { int x, y; read(x); read(y); add(x, y); add(y, x); d[x]++; d[y]++; } memcpy(cur, head, sizeof(cur)); for (int i = 1; i <= n; i++) if (d[i] & 1) { cout << "NO\n"; return 0; } dfs(1); int S = 0, tim = 0; memset(vis, 0, sizeof(vis)); for (int x : ans) { nxt[++tim] = vis[x]; vis[x] = tim; } int mn = -1, mx = -1; S = 1; for (int i = ans.size() - 1; i > 1; i--) if (nxt[i]) { if (mn < 0) { mn = mx = nxt[i]; S = 2; } else { if (i <= mx) S = 3; if (nxt[i] > mn) S = 3; mn = min(mn, nxt[i]); mx = max(mx, nxt[i]); } } if (S >= 3) puts("Yes"); else puts("No"); return 0; }
#include <bits/stdc++.h> #define ll long long using namespace std; template <typename tn> void read(tn &a) { tn x = 0, f = 1; char c = ' '; for (; !isdigit(c); c = getchar()) if (c == '-') f = -1; for (; isdigit(c); c = getchar()) x = x * 10 + c - '0'; a = x * f; } const int N = 1001000; int head[N], vis[N], n, m, d[N], tot, cur[N], nxt[N]; struct edge { int v, nxt; } e[N * 2]; vector<int> ans; void add(int x, int y) { e[++tot] = {y, head[x]}; head[x] = tot; } void dfs(int x) { for (int &i = cur[x]; i; i = e[i].nxt) if (!vis[i] && !vis[i ^ 1]) { vis[i] = 1; dfs(e[i].v); } ans.push_back(x); } int main() { read(n); read(m); tot = 1; for (int i = 1; i <= m; i++) { int x, y; read(x); read(y); add(x, y); add(y, x); d[x]++; d[y]++; } memcpy(cur, head, sizeof(cur)); for (int i = 1; i <= n; i++) if (d[i] & 1) { cout << "No\n"; return 0; } dfs(1); int S = 0, tim = 0; memset(vis, 0, sizeof(vis)); for (int x : ans) { nxt[++tim] = vis[x]; vis[x] = tim; } int mn = -1, mx = -1; S = 1; for (int i = ans.size() - 1; i > 1; i--) if (nxt[i]) { if (mn < 0) { mn = mx = nxt[i]; S = 2; } else { if (i <= mx) S = 3; if (nxt[i] > mn) S = 3; mn = min(mn, nxt[i]); mx = max(mx, nxt[i]); } } if (S >= 3) puts("Yes"); else puts("No"); return 0; }
[ "literal.string.change", "literal.string.case.change", "io.output.change" ]
906,488
906,489
u684730254
cpp
p03091
#include <bits/stdc++.h> using namespace std; int n, m, i, d[1000005], u, v, ans, head[1000005], Next[2000005], adj[2000005], k, s; bool flag = true; void Push(int u, int v) { Next[++k] = head[u]; head[u] = k; adj[k] = v; } void dfs(int i, int fa) { if ((i == u && fa != 0) || i == v) { if (i == v) ++s; return; } int j; for (j = head[i]; j != 0; j = Next[j]) if (adj[j] != fa) dfs(adj[j], i); } int main() { scanf("%d %d", &n, &m); for (i = 1; i <= m; ++i) { scanf("%d %d", &u, &v); ++d[u]; ++d[v]; Push(u, v); Push(v, u); } for (i = 1; i <= n; ++i) { ans += d[i] / 2 - 1; if (d[i] & 1) flag = false; } for (i = 1; i <= n; ++i) if (d[i] == 4) if (u == 0) u = i; else v = i; if (ans == 2 && v != 0 && flag) { dfs(u, 0); if (s > 2) flag = false; } puts(ans >= 2 && flag ? "Yes" : "No"); }
#include <bits/stdc++.h> using namespace std; int n, m, i, d[1000005], u, v, ans, head[1000005], Next[2000005], adj[2000005], k, s; bool flag = true; void Push(int u, int v) { Next[++k] = head[u]; head[u] = k; adj[k] = v; } void dfs(int i, int fa) { if ((i == u && fa != 0) || i == v) { if (i == v) ++s; return; } int j; for (j = head[i]; j != 0; j = Next[j]) if (adj[j] != fa) dfs(adj[j], i); } int main() { scanf("%d %d", &n, &m); for (i = 1; i <= m; ++i) { scanf("%d %d", &u, &v); ++d[u]; ++d[v]; Push(u, v); Push(v, u); } for (i = 1; i <= n; ++i) { ans += d[i] / 2 - 1; if (d[i] & 1) flag = false; } u = v = 0; for (i = 1; i <= n; ++i) if (d[i] == 4) if (u == 0) u = i; else v = i; if (ans == 2 && v != 0 && flag) { dfs(u, 0); if (s > 2) flag = false; } puts(ans >= 2 && flag ? "Yes" : "No"); }
[ "assignment.add" ]
906,490
906,491
u202904995
cpp
p03091
#include <bits/stdc++.h> using namespace std; #define INF 2147483647 #define INFF 9223372036854775807 #define ll long long #define REP(i, n) for (int i = 0; i < n; i++) #define REPP(i, m, n) for (int i = m; i < n; i++) #define ALL(N) (N.begin(), N.end()) #define de cout << "debug" << endl; #define pb push_back template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; vector<int> deg(n, 0); vector<vector<int>> edge(n); REP(i, m) { int a, b; cin >> a >> b; a--; b--; deg[a]++; deg[b]++; edge[a].pb(b); edge[b].pb(a); } bool flag = 0; REP(i, n) { if (deg[i] % 2 == 1) { if (flag) { cout << "Np" << endl; return 0; } flag = 1; } } REP(i, n) { if (deg[i] >= 6) { cout << "Yes" << endl; return 0; } } int d4 = 0; REP(i, n) if (deg[i] >= 4) d4++; if (d4 >= 3) { cout << "Yes" << endl; return 0; } else if (d4 == 2) { vector<int> d4s; REP(i, n) if (deg[i] == 4) d4s.pb(i); int v = d4s[0]; int w = d4s[1]; int npaths = 0; for (int x : edge[v]) { int cur = x; int p = v; while (cur != v && cur != w) { p = edge[cur][0] + edge[cur][1] - p; swap(p, cur); } if (cur == w) npaths++; } if (npaths == 2) { cout << "Yes" << endl; } else if (npaths == 2) { cout << "No" << endl; } } else if (d4 <= 1) { cout << "No" << endl; } }
#include <bits/stdc++.h> using namespace std; #define INF 2147483647 #define INFF 9223372036854775807 #define ll long long #define REP(i, n) for (int i = 0; i < n; i++) #define REPP(i, m, n) for (int i = m; i < n; i++) #define ALL(N) (N.begin(), N.end()) #define de cout << "debug" << endl; #define pb push_back template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; vector<int> deg(n, 0); vector<vector<int>> edge(n); REP(i, m) { int a, b; cin >> a >> b; a--; b--; deg[a]++; deg[b]++; edge[a].pb(b); edge[b].pb(a); } bool flag = 0; REP(i, n) { if (deg[i] % 2 == 1) { if (flag) { cout << "No" << endl; return 0; } flag = 1; } } REP(i, n) { if (deg[i] >= 6) { cout << "Yes" << endl; return 0; } } int d4 = 0; REP(i, n) if (deg[i] >= 4) d4++; if (d4 >= 3) { cout << "Yes" << endl; return 0; } else if (d4 == 2) { vector<int> d4s; REP(i, n) if (deg[i] == 4) d4s.pb(i); int v = d4s[0]; int w = d4s[1]; int npaths = 0; for (int x : edge[v]) { int cur = x; int p = v; while (cur != v && cur != w) { p = edge[cur][0] + edge[cur][1] - p; swap(p, cur); } if (cur == w) npaths++; } if (npaths == 2) { cout << "Yes" << endl; } else if (npaths == 4) { cout << "No" << endl; } } else if (d4 <= 1) { cout << "No" << endl; } }
[ "literal.string.change", "io.output.change", "literal.number.change", "control_flow.branch.if.condition.change" ]
906,509
906,508
u901397311
cpp
p03091
#define DEBUG 0 /** * File : C.cpp * Author : Kazune Takahashi * Created : 2019-5-28 15:35:36 * Powered by Visual Studio Code */ #include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ; #include <chrono> // std::chrono::system_clock::time_point start_time, end_time; #include <complex> #include <functional> #include <iomanip> // << fixed << setprecision(xxx) #include <iostream> #include <map> // if (M.find(key) != M.end()) { } #include <queue> #include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010)); #include <set> #include <stack> #include <string> // to_string(nnn) // substr(m, n) // stoi(nnn) #include <tuple> #include <vector> // start = std::chrono::system_clock::now(); // double elapsed = // std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count(); #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> using namespace std; typedef long long ll; // const int dx[4] = {1, 0, -1, 0}; // const int dy[4] = {0, 1, 0, -1}; // const int C = 1e6+10; // const ll M = 1000000007; int N, M; vector<int> V[100010]; int parent[100010]; int start = -1; int goal = -1; bool dfs(int s) { for (auto x : V[s]) { if (x != parent[s]) { if (x == start) { return false; } else if (x == goal) { return true; } parent[x] = s; if (!dfs(x)) { return false; } } } return true; } int main() { cin >> N >> M; for (auto i = 0; i < M; i++) { int a, b; cin >> a >> b; a--; b--; V[a].push_back(b); V[b].push_back(a); } bool odd = false; bool six = false; int four = 0; for (auto i = 0; i < N; i++) { int s = V[i].size(); if (s % 2 == 1) { odd = true; break; } if (s >= 6) { six = true; break; } if (s == 4) { four++; } } if (odd) { cout << "No" << endl; } else if (six) { cout << "Yes" << endl; } else if (four >= 3) { cout << "Yes" << endl; } else if (four == 2) { for (auto i = 0; i < N; i++) { if ((int)V[i].size() == 4) { if (start == -1) { start = i; } else { goal = i; break; } } } fill(parent, parent + N, -1); if (!dfs(start)) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } }
#define DEBUG 0 /** * File : C.cpp * Author : Kazune Takahashi * Created : 2019-5-28 15:35:36 * Powered by Visual Studio Code */ #include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ; #include <chrono> // std::chrono::system_clock::time_point start_time, end_time; #include <complex> #include <functional> #include <iomanip> // << fixed << setprecision(xxx) #include <iostream> #include <map> // if (M.find(key) != M.end()) { } #include <queue> #include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010)); #include <set> #include <stack> #include <string> // to_string(nnn) // substr(m, n) // stoi(nnn) #include <tuple> #include <vector> // start = std::chrono::system_clock::now(); // double elapsed = // std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count(); #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> using namespace std; typedef long long ll; // const int dx[4] = {1, 0, -1, 0}; // const int dy[4] = {0, 1, 0, -1}; // const int C = 1e6+10; // const ll M = 1000000007; int N, M; vector<int> V[100010]; int parent[100010]; int start = -1; int goal = -1; bool dfs(int s) { for (auto x : V[s]) { if (x != parent[s]) { if (x == start) { return false; } else if (x == goal) { return true; } parent[x] = s; if (!dfs(x)) { return false; } } } return true; } int main() { cin >> N >> M; for (auto i = 0; i < M; i++) { int a, b; cin >> a >> b; a--; b--; V[a].push_back(b); V[b].push_back(a); } bool odd = false; bool six = false; int four = 0; for (auto i = 0; i < N; i++) { int s = V[i].size(); if (s % 2 == 1) { odd = true; } if (s >= 6) { six = true; } if (s == 4) { four++; } } if (odd) { cout << "No" << endl; } else if (six) { cout << "Yes" << endl; } else if (four >= 3) { cout << "Yes" << endl; } else if (four == 2) { for (auto i = 0; i < N; i++) { if ((int)V[i].size() == 4) { if (start == -1) { start = i; } else { goal = i; break; } } } fill(parent, parent + N, -1); if (!dfs(start)) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { cout << "No" << endl; } }
[]
906,524
906,525
u521272340
cpp