problem_id
stringlengths
6
6
language
stringclasses
2 values
original_status
stringclasses
3 values
original_src
stringlengths
19
243k
changed_src
stringlengths
19
243k
change
stringclasses
3 values
i1
int64
0
8.44k
i2
int64
0
8.44k
j1
int64
0
8.44k
j2
int64
0
8.44k
error
stringclasses
270 values
stderr
stringlengths
0
226k
p02609
C++
Runtime Error
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl "\n" #define ll long long #define sz(s) (int)(s.size()) #define INF 0x3f3f3f3f3f3f3f3fLL #define all(v) v.begin(), v.end() #define watch(x) cout << (#x) << " = " << x << endl const int dr[]{-1, -1, 0, 1, 1, 1, 0...
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define endl "\n" #define ll long long #define sz(s) (int)(s.size()) #define INF 0x3f3f3f3f3f3f3f3fLL #define all(v) v.begin(), v.end() #define watch(x) cout << (#x) << " = " << x << endl const int dr[]{-1, -1, 0, 1, 1, 1, 0...
replace
58
60
58
64
0
p02609
C++
Runtime Error
// aising2020_d #include <bits/stdc++.h> #ifdef LOCAL #include "../cxx-prettyprint/prettyprint.hpp" #endif using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; #define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i)) #define REPN(i, m, n) for (int(i) = m; (i) < (int)(n...
// aising2020_d #include <bits/stdc++.h> #ifdef LOCAL #include "../cxx-prettyprint/prettyprint.hpp" #endif using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; #define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i)) #define REPN(i, m, n) for (int(i) = m; (i) < (int)(n...
replace
194
195
194
196
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int ll; typedef unsigned long long int sll; typedef long double ld; #define A 1000000007 #define D 100000000000000ll #define B 998244353ll #define C 1000000000000000000ll #define M 4000...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int ll; typedef unsigned long long int sll; typedef long double ld; #define A 1000000007 #define D 100000000000000ll #define B 998244353ll #define C 1000000000000000000ll #define M 4000...
insert
66
66
66
87
0
Time : 56.766ms
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long M; long long BigMod(long long b, long long m) { long long a = 2; a %= m; long long res = 1; while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res; } long long f(long long n) { long long step = 0; ...
#include <bits/stdc++.h> using namespace std; long long M; long long BigMod(long long b, long long m) { if (m == 0) return 0; long long a = 2; a %= m; long long res = 1; while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res; } long long f(long long...
insert
6
6
6
8
0
p02609
C++
Runtime Error
// In the name of God // #include <bits/stdc++.h> #define ll long long #define all(x) (x).begin(), (x).end() #define pii pair<int, int> using namespace std; const ll mod = 998244353; int power(ll x, ll y, ll p) { if (y == 0) { return 1 % p; } ll res = 1; // Initialize result x = x % p; // Update x if it ...
// In the name of God // #include <bits/stdc++.h> #define ll long long #define all(x) (x).begin(), (x).end() #define pii pair<int, int> using namespace std; const ll mod = 998244353; int power(ll x, ll y, ll p) { if (y == 0) { return 1 % p; } ll res = 1; // Initialize result x = x % p; // Update x if it ...
replace
71
72
71
73
0
p02609
C++
Runtime Error
#pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <numeric> #...
#pragma GCC optimize("O3") #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <iomanip> #include <iostream> #include <istream> #include <iterator> #include <list> #include <map> #include <numeric> #...
replace
130
131
130
134
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; vector<int64_t> memo; int64_t f(int64_t n) { if (n == 0) { return 0; } if (memo[n] != -1) { return memo[n]; } return memo[n] = (f(n % __builtin_popcountll(n)) + 1); } // a^b % modを求める int64_t MODpow(int64_t a, int64_t b, int64_t mod) { int64_t result ...
#include <bits/stdc++.h> using namespace std; vector<int64_t> memo; int64_t f(int64_t n) { if (n == 0) { return 0; } if (memo[n] != -1) { return memo[n]; } return memo[n] = (f(n % __builtin_popcountll(n)) + 1); } // a^b % modを求める int64_t MODpow(int64_t a, int64_t b, int64_t mod) { int64_t result ...
insert
44
44
44
63
0
p02609
C++
Runtime Error
/* Author: Dinesh Verra College: ABV-IIITM Date: 10/07/2020 */ #include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; using namespace std; typedef long long ll; typedef unsigned long long ull; #define cu continue #define br break #define...
/* Author: Dinesh Verra College: ABV-IIITM Date: 10/07/2020 */ #include <bits/stdc++.h> // #include <boost/multiprecision/cpp_int.hpp> // using namespace boost::multiprecision; using namespace std; typedef long long ll; typedef unsigned long long ull; #define cu continue #define br break #define...
replace
80
82
80
86
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) (x).begin(), (x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) typedef pair<int, int> PI; typedef pair<int, pair<int, int>> PII; static const int INF = 1010000000000000017LL; static const double eps = 1...
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) (x).begin(), (x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) typedef pair<int, int> PI; typedef pair<int, pair<int, int>> PII; static const int INF = 1010000000000000017LL; static const double eps = 1...
replace
99
100
99
100
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define IO \ { \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define IO \ { \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
replace
44
45
44
45
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using Edge = int; using Graph = vector<vector<Edge>>; #define REP(i, n) for (int i = 0; i < (n); ++i) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) const ll MOD = 1000000007; const ll nmax = 8; const ll IN...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Edge = int; using Graph = vector<vector<Edge>>; #define REP(i, n) for (int i = 0; i < (n); ++i) #define SORT(v) sort((v).begin(), (v).end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) const ll MOD = 1000000007; const ll nmax = 8; const ll IN...
replace
195
200
195
199
0
p02609
C++
Runtime Error
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define bit(n, k) (((ll)n >> (ll)k) & 1) /*nのk bit目*/ #define pb push_back #define eb emplace_back #define SZ(x) ((ll)(x).size()) #define all(x) (x).begin(), (x).end() #de...
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define bit(n, k) (((ll)n >> (ll)k) & 1) /*nのk bit目*/ #define pb push_back #define eb emplace_back #define SZ(x) ((ll)(x).size()) #define all(x) (x).begin(), (x).end() #de...
replace
109
110
109
111
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define MAX 510000 #define rrep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep(i, n) for (ll i = 1; i <= (ll)(n); i++) #define dcout cout << fixed << setprecision(15); #define mp make_pair #define pb push_back using namespace std; typedef long long int ll;...
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define MAX 510000 #define rrep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep(i, n) for (ll i = 1; i <= (ll)(n); i++) #define dcout cout << fixed << setprecision(15); #define mp make_pair #define pb push_back using namespace std; typedef long long int ll;...
replace
180
181
180
183
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = int64_t; int pcount(int x) { return __builtin_popcount(x); } int f(int x) { int ans = 1; int tmp; if (x == 0) { return ans; } while (x) { tmp = pcount(x); x %= tmp; ans++; } return ans; } int main() { int n; cin >> n; string...
#include <bits/stdc++.h> using namespace std; using ll = int64_t; int pcount(int x) { return __builtin_popcount(x); } int f(int x) { int ans = 1; int tmp; if (x == 0) { return ans; } while (x) { tmp = pcount(x); x %= tmp; ans++; } return ans; } int main() { int n; cin >> n; string...
replace
37
44
37
56
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> mp; ll inf = 1e9; ll func(ll v) { ll cnt = 0; ll ans = 0; while (v != 0) { cnt = 0; for (ll i = 0; i < 64; i++) if ((v >> i) & 1) cnt++; v %= cnt; ans++; } return ans; } int main() { ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> mp; ll inf = 1e9; ll func(ll v) { ll cnt = 0; ll ans = 0; while (v != 0) { cnt = 0; for (ll i = 0; i < 64; i++) if ((v >> i) & 1) cnt++; v %= cnt; ans++; } return ans; } int main() { ...
replace
34
35
34
36
0
p02609
C++
Runtime Error
/* -*- coding: utf-8 -*- * * d.cc: D - Anything Goes to Zero */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <se...
/* -*- coding: utf-8 -*- * * d.cc: D - Anything Goes to Zero */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <se...
replace
78
83
78
86
0
p02609
C++
Runtime Error
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author Ido Kessler */ #include <algorithm> #include <bitset> #include <cassert> #include <cstdint> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <qu...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author Ido Kessler */ #include <algorithm> #include <bitset> #include <cassert> #include <cstdint> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <qu...
replace
419
427
419
431
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e5 + 10, mod = 1e9 + 7; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int f[N]; f[0] = 0; for (int i = 1; i < N; i++) { f[i] = f[i % __buil...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int N = 2e5 + 10, mod = 1e9 + 7; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int f[N]; f[0] = 0; for (int i = 1; i < N; i++) { f[i] = f[i % __buil...
insert
24
24
24
40
0
p02609
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; // Inserted snippets: io, root #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; template <typename H> bool chmin(H &v1, const H v2) { ...
#include "bits/stdc++.h" using namespace std; // Inserted snippets: io, root #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; template <typename H> bool chmin(H &v1, const H v2) { ...
replace
74
75
74
76
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; long long modpow(long long n, long long k, long long MOD) { long long ans = 1; n %= MOD; while (k > 0) { if (k & 1) ans = (ans * n) % MOD; k >>= 1; n = (n * n) % MOD; } return ans; } int rem(int n, string s, int pp) { if (pp <= 0) return ...
#include <bits/stdc++.h> using namespace std; long long modpow(long long n, long long k, long long MOD) { long long ans = 1; n %= MOD; while (k > 0) { if (k & 1) ans = (ans * n) % MOD; k >>= 1; n = (n * n) % MOD; } return ans; } int rem(int n, string s, int pp) { if (pp <= 0) return ...
replace
52
56
52
61
0
p02609
C++
Runtime Error
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> int main() { int N; std::string X; std::cin >> N >> X; const int popcount = std::count(X.begin(), X.end(), '1'); std::map<int, int> x_map; std::vector<std::map<int, int>> digit_map(N); for (int mod = std::max(1, p...
#include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> int main() { int N; std::string X; std::cin >> N >> X; const int popcount = std::count(X.begin(), X.end(), '1'); std::map<int, int> x_map; std::vector<std::map<int, int>> digit_map(N); for (int mod = std::max(1, p...
replace
28
29
28
29
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) #define get_unique(x) x.erase(unique(all(x)), x.end()); typedef long long ll; typedef complex<do...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) #define get_unique(x) x.erase(unique(all(x)), x.end()); typedef long long ll; typedef complex<do...
insert
46
46
46
48
0
p02609
C++
Runtime Error
#include <algorithm> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <vector> #define _USE_MATH_DEFINES #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #...
#include <algorithm> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <vector> #define _USE_MATH_DEFINES #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #...
replace
149
150
149
153
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define ull unsigned long long #define f first #define s second typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ordered_set ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define ull unsigned long long #define f first #define s second typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ordered_set ...
insert
108
108
108
112
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll N; string X; ll g[400001]; ll f[400001]; ll calc(ll m) { if (m == 0) return 0; ll ret = 0; for (auto &x : X) { ret *= 2; ret += x - '0'; ret %= m; } return ret; } int main() { cin >> N; cin >...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; ll N; string X; ll g[400001]; ll f[400001]; ll calc(ll m) { if (m == 0) return 0; ll ret = 0; for (auto &x : X) { ret *= 2; ret += x - '0'; ret %= m; } return ret; } int main() { cin >> N; cin >...
replace
48
49
48
50
0
p02609
C++
Runtime Error
#include <iostream> #ifdef MBP #include "stdc++.h" #else #include <bits/stdc++.h> #endif #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define REP(i, n) for (long long int i = 0, i##_len = (n); i < i##_len; ++i) #define REP1(i, n) for (long long int i = 1, i##_len = (n); i <= i##_len; ...
#include <iostream> #ifdef MBP #include "stdc++.h" #else #include <bits/stdc++.h> #endif #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define REP(i, n) for (long long int i = 0, i##_len = (n); i < i##_len; ++i) #define REP1(i, n) for (long long int i = 1, i##_len = (n); i <= i##_len; ...
replace
172
173
172
200
0
p02609
C++
Runtime Error
#include <algorithm> #include <bitset> #include <chrono> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; typedef long double ld; #define fastInp ...
#include <algorithm> #include <bitset> #include <chrono> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; typedef long double ld; #define fastInp ...
replace
77
79
77
81
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int f[N], ans[N]; char s[N]; int main() { int n, sum = 0, s1, s2, sum1 = 0, sum2 = 0, d1 = 1, d2 = 1; scanf("%d%s", &n, s); for (int i = 0; s[i]; i++) sum += (s[i] ^= 0x30); s1 = sum - 1, s2 = sum + 1; f[0] = 1; for (int i = 1; i <= s2...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int f[N], ans[N]; char s[N]; int main() { int n, sum = 0, s1, s2, sum1 = 0, sum2 = 0, d1 = 1, d2 = 1; scanf("%d%s", &n, s); for (int i = 0; s[i]; i++) sum += (s[i] ^= 0x30); s1 = sum - 1, s2 = sum + 1; f[0] = 1; for (int i = 1; i <= s2...
replace
27
28
27
30
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using ll = long long; using ull = unsigned long long; using namespace std; constexpr int inf = 1 << 30; constexpr int mo = 1e9 + 7; constexpr ll infl = 1ll << 60; map<int, int> m; string s; int n; int culc(int num) { if (num == 0) return 0; if (num == 1) return 1; if (m.count(num...
#include <bits/stdc++.h> using ll = long long; using ull = unsigned long long; using namespace std; constexpr int inf = 1 << 30; constexpr int mo = 1e9 + 7; constexpr ll infl = 1ll << 60; map<int, int> m; string s; int n; int culc(int num) { if (num == 0) return 0; if (num == 1) return 1; if (m.count(num...
replace
44
45
44
46
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i < (int)(n); i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define debug(var) \ do { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, n) for (int i = 1; i < (int)(n); i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define debug(var) \ do { ...
replace
87
88
87
90
0
p02609
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <vector> #define REP(i, n) for (int i = 0; (i) < (n); ++(i)) #define FOR(i, n) for (int i = 1; (i) <= (n); ++(i)) #define dump(x) cout << #x << " =...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <vector> #define REP(i, n) for (int i = 0; (i) < (n); ++(i)) #define FOR(i, n) for (int i = 1; (i) <= (n); ++(i)) #define dump(x) cout << #x << " =...
replace
30
31
30
31
0
p02609
C++
Runtime Error
#pragma target("avx") #pragma optimize("O3") #include <bits/stdc++.h> using ll = int_fast64_t; using P = std::pair<ll, ll>; using PP = std::pair<ll, P>; using V = std::vector<ll>; template <typename T> using pq = std::priority_queue<T>; template <typename T> using rpq = std::priority_queue<T, std::vector<T>, std::great...
#pragma target("avx") #pragma optimize("O3") #include <bits/stdc++.h> using ll = int_fast64_t; using P = std::pair<ll, ll>; using PP = std::pair<ll, P>; using V = std::vector<ll>; template <typename T> using pq = std::priority_queue<T>; template <typename T> using rpq = std::priority_queue<T, std::vector<T>, std::great...
insert
53
53
53
77
0
p02609
C++
Runtime Error
// Author: AnandRaj doubleux #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vpii; typedef pair<ll, ll> pll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<pll> vpl...
// Author: AnandRaj doubleux #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vpii; typedef pair<ll, ll> pll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<pll> vpl...
replace
103
137
103
128
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int deal(int x) { int res = 0; while (x) { res++; x = x % __builtin_popcount(x); } return res; } int n, p1 = -1, p2 = 1, x1, x2; char s[200005]; int pw1[200005], pw2[200005]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin...
#include <bits/stdc++.h> using namespace std; int deal(int x) { int res = 0; while (x) { res++; x = x % __builtin_popcount(x); } return res; } int n, p1 = -1, p2 = 1, x1, x2; char s[200005]; int pw1[200005], pw2[200005]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin...
replace
38
39
38
42
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <typename T1, typename T2> bool chmin(T1 &a, T2 b) { if (a <= b) return 0; a = b; return 1; } template <typename T1, typename T2> bool chmax(T1 &a, T2 b) { if (a >= b) return 0; a = b; return 1; } int dx[4] = {0, 1, -1, 0};...
#include <bits/stdc++.h> using namespace std; typedef long long ll; template <typename T1, typename T2> bool chmin(T1 &a, T2 b) { if (a <= b) return 0; a = b; return 1; } template <typename T1, typename T2> bool chmax(T1 &a, T2 b) { if (a >= b) return 0; a = b; return 1; } int dx[4] = {0, 1, -1, 0};...
replace
75
76
75
77
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p_ll; template <class T> void debug(T itr1, T itr2) { auto now = itr1; while (now < itr2) { cout << *now << " "; now++; } cout << endl; } #define repr(i, from, to) for (ll i = (ll)from; i < (ll)to; i++) #define al...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p_ll; template <class T> void debug(T itr1, T itr2) { auto now = itr1; while (now < itr2) { cout << *now << " "; now++; } cout << endl; } #define repr(i, from, to) for (ll i = (ll)from; i < (ll)to; i++) #define al...
replace
87
88
87
88
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; template <typename T> inline void readin(T &x) { x = 0; T fh = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1; for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); x *= fh; } template <typena...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void readin(T &x) { x = 0; T fh = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1; for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); x *= fh; } template <typena...
replace
71
74
71
75
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; using ll = long long; template <class T, class U> using P = pair<T, U>; template <class T> using Heap = priority_queue<T>; template <class T> using heaP = priority_queue<T, vector<T>...
#include <bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; using ll = long long; template <class T, class U> using P = pair<T, U>; template <class T> using Heap = priority_queue<T>; template <class T> using heaP = priority_queue<T, vector<T>...
replace
89
90
89
91
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; using namespace __gnu_pbds; #define fastio \ ios_base::sync_with_stdio(0); ...
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace std::chrono; using namespace __gnu_pbds; #define fastio \ ios_base::sync_with_stdio(0); ...
insert
113
113
113
117
-11
p02609
C++
Runtime Error
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <stdio.h> #include <string.h> #include <vector> typedef long long ll; constexpr long long INFLL = 1e18; using namespace std; int f(int temp) { if (temp == 0) { return 0; } else { retur...
#include <algorithm> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <stdio.h> #include <string.h> #include <vector> typedef long long ll; constexpr long long INFLL = 1e18; using namespace std; int f(int temp) { if (temp == 0) { return 0; } else { retur...
insert
48
48
48
51
0
p02609
C++
Runtime Error
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <vector> typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define sz(a) (int)a.size() usin...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string.h> #include <string> #include <vector> typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define sz(a) (int)a.size() usin...
replace
61
65
61
67
0
p02609
C++
Runtime Error
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #include <limits.h> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <cl...
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #include <limits.h> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <cl...
replace
111
112
111
112
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; typedef vector<ll> VI; typedef vector<VI> VVI; const ll MOD = 1000000007; const ll INF = 1e18; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() int main() { int n; cin >> n; string s; ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; typedef vector<ll> VI; typedef vector<VI> VVI; const ll MOD = 1000000007; const ll INF = 1e18; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() int main() { int n; cin >> n; string s; ...
insert
20
20
20
45
0
p02609
C++
Runtime Error
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(pp, nn) for (int ii = pp; ii < nn; ++ii) #define vi vector<int> #define vll vector<ll> #define vs vector<string> string int_to_string(int x) { stringstream ss; ss << x; string ni = ss.str(); return n...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(pp, nn) for (int ii = pp; ii < nn; ++ii) #define vi vector<int> #define vll vector<ll> #define vs vector<string> string int_to_string(int x) { stringstream ss; ss << x; string ni = ss.str(); return n...
replace
95
96
95
96
0
p02609
C++
Runtime Error
#include <iostream> #include <string> #include <vector> int main() { int n; int sum = 0; std::string S; std::cin >> n >> S; for (int i = 0; i < n; i++) { if (S[i] == '1') sum++; } // 例外処理 if (sum == 0) { for (int i = 0; i < n; i++) { std::cout << 1 << std::endl; } return 0;...
#include <iostream> #include <string> #include <vector> int main() { int n; int sum = 0; std::string S; std::cin >> n >> S; for (int i = 0; i < n; i++) { if (S[i] == '1') sum++; } // 例外処理 if (sum == 0) { for (int i = 0; i < n; i++) { std::cout << 1 << std::endl; } return 0;...
replace
25
26
25
27
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) typedef long long ll; typedef pair<ll, ll> P; int dfs(int n) { if (n == 0) { return 0; } int now = n; int co = 0; while (now > 0) { if (now % 2 ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) typedef long long ll; typedef pair<ll, ll> P; int dfs(int n) { if (n == 0) { return 0; } int now = n; int co = 0; while (now > 0) { if (now % 2 ...
replace
60
62
60
66
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define lli long long int using namespace std; #define mod2 1000000007 #define MOD 1000000037 #define mod1 998244353 #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL);...
#include <bits/stdc++.h> #define lli long long int using namespace std; #define mod2 1000000007 #define MOD 1000000037 #define mod1 998244353 #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(NULL);...
replace
35
36
35
36
0
p02609
C++
Runtime Error
#include "bits/stdc++.h" using namespace std; using ll = unsigned long long; using Pii = pair<int, int>; using Pll = pair<ll, ll>; #define rep(i, begin, n) for (int i = begin; i < n; i++) #define repe(i, begin, n) for (int i = begin; i <= n; i++) #define repr(i, begin, n) for (int i = begin; i > begin - n; i--) #define...
#include "bits/stdc++.h" using namespace std; using ll = unsigned long long; using Pii = pair<int, int>; using Pll = pair<ll, ll>; #define rep(i, begin, n) for (int i = begin; i < n; i++) #define repe(i, begin, n) for (int i = begin; i <= n; i++) #define repr(i, begin, n) for (int i = begin; i > begin - n; i--) #define...
replace
62
63
62
68
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vector<pll> vll; typedef map<int, int> mii; typedef vector<char> ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vector<pll> vll; typedef map<int, int> mii; typedef vector<char> ...
replace
106
107
106
107
0
p02609
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <functional> #include <iostream> #include <limits> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define rep0(i, n) for...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <functional> #include <iostream> #include <limits> #include <map> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define rep0(i, n) for...
insert
85
85
85
119
-6
*** stack smashing detected ***: terminated
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define rep(a, b, c) for (int a = b; a <= c; a++) #define per(a, b, c) for (int a = b; a >= c; a--) #define ios \ ; \ ios::sync_with_stdio(false); ...
#include <bits/stdc++.h> #define rep(a, b, c) for (int a = b; a <= c; a++) #define per(a, b, c) for (int a = b; a >= c; a--) #define ios \ ; \ ios::sync_with_stdio(false); ...
replace
67
68
67
69
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define repd(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) using ll = long long; using ld = long double; #define int ll #define double ld #define VARNAME(v) #v using P = pair<int, int>; constexpr int MOD = 1000000007; // constexpr int MOD = 99824...
#include <bits/stdc++.h> using namespace std; #define repd(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) repd(i, 0, n) using ll = long long; using ld = long double; #define int ll #define double ld #define VARNAME(v) #v using P = pair<int, int>; constexpr int MOD = 1000000007; // constexpr int MOD = 99824...
insert
178
178
178
197
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int pop_count(int bits) { bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); return (bits & 0x...
#include <bits/stdc++.h> using namespace std; int pop_count(int bits) { bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); return (bits & 0x...
replace
22
23
22
26
0
p02609
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <utilit...
#include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <utilit...
replace
58
60
58
60
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; #ifdef _DEBUG inline void dump() { cerr << endl; } template <typename Head> void dump(Head &&head) { cerr << head; dump(); } template <typename Head, typename... Tail> void dump(Head &&head, Tail &&....
#include <bits/stdc++.h> using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) typedef long long ll; #ifdef _DEBUG inline void dump() { cerr << endl; } template <typename Head> void dump(Head &&head) { cerr << head; dump(); } template <typename Head, typename... Tail> void dump(Head &&head, Tail &&....
replace
88
91
88
94
0
p02609
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <vector> #define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <vector> #define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(...
insert
35
35
35
37
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define ll long long #define MODV 1000000007 #define INFLL LLONG_MAX // 9223372036854775807 #define EPS 1e-9 #define rep(i, n) for (ll i = 0, i##_len = (ll)(n); i < i##_len; i++) #define repf(i, n) for (ll i = 1, i##_len = (ll)(n + 1); i < i##_len; i++) #define all(v) v.begin(), v.end() #define...
#include <bits/stdc++.h> #define ll long long #define MODV 1000000007 #define INFLL LLONG_MAX // 9223372036854775807 #define EPS 1e-9 #define rep(i, n) for (ll i = 0, i##_len = (ll)(n); i < i##_len; i++) #define repf(i, n) for (ll i = 1, i##_len = (ll)(n + 1); i < i##_len; i++) #define all(v) v.begin(), v.end() #define...
delete
65
67
65
65
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> const long long INF = 1LL << 60; const long long MOD = 1000000007; const double PI = acos(-1.0); #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n - 1); i >= 0; --i) #define perm(c) ...
#include <bits/stdc++.h> const long long INF = 1LL << 60; const long long MOD = 1000000007; const double PI = acos(-1.0); #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = (n - 1); i >= 0; --i) #define perm(c) ...
replace
160
161
160
161
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; using PLL = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repn(i, n) for (int i = 0; i <= (int)(n); i++) #define srep(i, l, n) for (int i = l; i < (int)(n); i++) #define sre...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<int, int>; using PLL = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repn(i, n) for (int i = 0; i <= (int)(n); i++) #define srep(i, l, n) for (int i = l; i < (int)(n); i++) #define sre...
replace
89
91
89
92
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // ゼロになる時が例外 int main() { int n; cin >> n; vector<int> A; string S; cin >> S; for (const auto &s : S) A.push_back(s - '0'); int cnt = 0; for (const auto &a : A) { if (a == 1) cnt++; } vector<int> D(n); if (cnt == 1) { for (int i =...
#include <bits/stdc++.h> using namespace std; // ゼロになる時が例外 int main() { int n; cin >> n; vector<int> A; string S; cin >> S; for (const auto &s : S) A.push_back(s - '0'); int cnt = 0; for (const auto &a : A) { if (a == 1) cnt++; } vector<int> D(n); if (cnt == 1) { for (int i =...
insert
29
29
29
35
0
p02609
C++
Runtime Error
#include <algorithm> #include <cassert> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define repi(i, a, b) for (ll i = (a); i < (b); ++i) #define rep(i, a) repi(i, 0, ...
#include <algorithm> #include <cassert> #include <cstdio> #include <cstdlib> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define repi(i, a, b) for (ll i = (a); i < (b); ++i) #define rep(i, a) repi(i, 0, ...
replace
109
113
109
114
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define pb push_back #define sz size() #define ll long long ll binpow(ll a, ll b, ll mod) { a %= mod; ll res = 1ll; while (b > 0) { if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1; } return res; } int main() { ios_base::sync_with_s...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define sz size() #define ll long long ll binpow(ll a, ll b, ll mod) { a %= mod; ll res = 1ll; while (b > 0) { if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1; } return res; } int main() { ios_base::sync_with_s...
replace
57
58
57
58
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int MAX = 200010; int main() { int n; string x; cin >> n >> x; int pc = 0; rep(i, n) { if ((x[i] - '0')) pc++; } vector<int> base_0(n), base_1(n); base_0[n - 1] = 1; bas...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; const int MAX = 200010; int main() { int n; string x; cin >> n >> x; int pc = 0; rep(i, n) { if ((x[i] - '0')) pc++; } vector<int> base_0(n), base_1(n); base_0[n - 1] = 1; bas...
replace
30
31
30
32
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, s, n) for (int i = s; i < (int)(n); i++) int pcnt(int x) { return __builtin_popcount(x); } int f(int x) { if (x == 0) return 0; else return f(x % pcnt(x)) + 1; } int main() { int n, pc = 0; st...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, s, n) for (int i = s; i < (int)(n); i++) int pcnt(int x) { return __builtin_popcount(x); } int f(int x) { if (x == 0) return 0; else return f(x % pcnt(x)) + 1; } int main() { int n, pc = 0; st...
insert
32
32
32
34
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i)) #define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i)) #define rep(i, n) For((i), 0, (n)) #define rrep(i, n) rFor((i), (n), 0) #define fi first #define se second using namespace std; typedef long long lint; typ...
#include <bits/stdc++.h> #define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i)) #define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i)) #define rep(i, n) For((i), 0, (n)) #define rrep(i, n) rFor((i), (n), 0) #define fi first #define se second using namespace std; typedef long long lint; typ...
replace
70
72
70
76
0
p02609
C++
Runtime Error
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #include <limits.h> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <cl...
#include <algorithm> #include <cassert> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> #include <limits.h> using namespace std; typedef long long ll; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <cl...
insert
124
124
124
128
0
p02609
C++
Runtime Error
#include <iostream> #include <vector> using namespace std; int main() { int n; scanf("%d", &n); vector<int> ans(n); for (int i = 1; i < n; i++) { int b = 0, t = i; while (t) { b += (t & 1); t >>= 1; } if (i % b == 0) ans[i] = 1; else ans[i] = ans[i % b] + 1; } ...
#include <iostream> #include <vector> using namespace std; int main() { int n; scanf("%d", &n); vector<int> ans(n); for (int i = 1; i < n; i++) { int b = 0, t = i; while (t) { b += (t & 1); t >>= 1; } if (i % b == 0) ans[i] = 1; else ans[i] = ans[i % b] + 1; } ...
replace
35
41
35
42
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, a, b) for (int i = a; i <= b; ++i) #define filei freopen("input.txt", "r", stdin); #define fileo freopen("output.txt", "w", stdout); #d...
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, a, b) for (int i = a; i <= b; ++i) #define filei freopen("input.txt", "r", stdin); #define fileo freopen("output.txt", "w", stdout); #d...
replace
63
65
63
65
0
p02609
Python
Runtime Error
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): N = int(readline()) X = readline().rstrip().decode("utf-8") nx = int(X, 2) ans = [0] * N oc = X.count("1") if oc - 1 != 0: mx = nx % (oc - 1) f = ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): N = int(readline()) X = readline().rstrip().decode("utf-8") nx = int(X, 2) ans = [0] * N oc = X.count("1") if oc - 1 != 0: mx = nx % (oc - 1) f = ...
insert
31
31
31
32
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1000000007; const ll INF = 10000000000000; #define all(v) v.begin(), v.end() ll modPow(ll a, ll n, ll p) { if (n == 0) return 1; // 0乗にも対応する場合 if (n =...
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<ll, ll>; const ll MOD = 1000000007; const ll INF = 10000000000000; #define all(v) v.begin(), v.end() ll modPow(ll a, ll n, ll p) { if (n == 0) return 1; // 0乗にも対応する場合 if (n =...
replace
41
43
41
45
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define int long long int pw(int n, int k, int MOD) { assert(k >= 0); int res = 1; while (k) { if (k & 1) (res *= n) %= MOD; (n *= n) %= MOD; k >>= 1; } return res; } int f(string s, int a) { int res = 0, t = 1; reverse(s.begin(), s.end()); ...
#include <bits/stdc++.h> using namespace std; #define int long long int pw(int n, int k, int MOD) { assert(k >= 0); int res = 1; while (k) { if (k & 1) (res *= n) %= MOD; (n *= n) %= MOD; k >>= 1; } return res; } int f(string s, int a) { if (a == 0) return -1; int res = 0, t = 1; ...
insert
16
16
16
18
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> const double pi = 3.141592653589793238462643383279; using namespace std; // typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<long long, long long> PLL; typedef pair<int, PII>...
#include <bits/stdc++.h> const double pi = 3.141592653589793238462643383279; using namespace std; // typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<long long, long long> PLL; typedef pair<int, PII>...
insert
116
116
116
152
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; int v[200010], r[200010]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; string s; cin >> s; int pcnt = 0; for (int i = 0; i < n; i++) ...
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; int v[200010], r[200010]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; string s; cin >> s; int pcnt = 0; for (int i = 0; i < n; i++) ...
replace
48
49
48
50
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; // 定数 const long long MOD1 = 1000000007; const long long MOD2 = 998244353; const long double PI = 3.1415926535897932; const long long MAXLL = 9223372036854775807; const long long INF = 2305843009213693951; const long long dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const long long...
#include <bits/stdc++.h> using namespace std; // 定数 const long long MOD1 = 1000000007; const long long MOD2 = 998244353; const long double PI = 3.1415926535897932; const long long MAXLL = 9223372036854775807; const long long INF = 2305843009213693951; const long long dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const long long...
replace
155
156
155
161
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; long long MOD = 1000000000 + 7; ll pow2mod(ll x, ll y) { // 2^x を yで割ったあまり ll ret = 0; if (y == 0) return 0; if (y == 1) return 0; if (x == 0) return 1; if (x == 1) return 2 % y; if (x % 2 ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; long long MOD = 1000000000 + 7; ll pow2mod(ll x, ll y) { // 2^x を yで割ったあまり ll ret = 0; if (y == 0) return 0; if (y == 1) return 0; if (x == 0) return 1; if (x == 1) return 2 % y; if (x % 2 ...
replace
77
78
77
82
0
0 0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> using pv = vector<pair<T, U>>; template <typename T> using matrix = vector<vector<T>>; template <typename T> using pque = priority_queue<T>; template <typename T> using lpque = priority_queue<T, vector<T>, greater<T>>; using ll = long lon...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> using pv = vector<pair<T, U>>; template <typename T> using matrix = vector<vector<T>>; template <typename T> using pque = priority_queue<T>; template <typename T> using lpque = priority_queue<T, vector<T>, greater<T>>; using ll = long lon...
insert
138
138
138
154
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> /* snippet: useful macros and functions */ #define ARC(i, a, b) for (Int i = (a); i < (b); ++i) #define RC(i, n) ARC(i, 0, n) #define ARCH(i, a, b) for (Int i = (a)-1; i >= (b); --i) #define RCH(i, n) ARCH(i, n, 0) #define ALL(v) v.begin(), v.end() template <class T> T rng(const T &a, const T ...
#include <bits/stdc++.h> /* snippet: useful macros and functions */ #define ARC(i, a, b) for (Int i = (a); i < (b); ++i) #define RC(i, n) ARC(i, 0, n) #define ARCH(i, a, b) for (Int i = (a)-1; i >= (b); --i) #define RCH(i, n) ARCH(i, n, 0) #define ALL(v) v.begin(), v.end() template <class T> T rng(const T &a, const T ...
insert
157
157
157
176
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define mt make_tuple #define ff first #define ss second #define pii pair<int, int> #define pll pair<ll, ll> #define testcase() \ int t; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define mt make_tuple #define ff first #define ss second #define pii pair<int, int> #define pll pair<ll, ll> #define testcase() \ int t; ...
insert
73
73
73
75
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define FOR(i, l, r) for (i = l; i < r; i++) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define P pair<ll, ll> #define F first #define S second ll A = 0, B = 0, N, x; ll Q(ll &i, string &S, vector<ll> &F, vector<ll> &G) { if...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define FOR(i, l, r) for (i = l; i < r; i++) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define P pair<ll, ll> #define F first #define S second ll A = 0, B = 0, N, x; ll Q(ll &i, string &S, vector<ll> &F, vector<ll> &G) { if...
replace
57
58
57
58
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define LOCAL using namespace std; template <typename A, typename B> ostream &operator<<(ostream &out, const pair<A, B> &a) { out << "(" << a.first << "," << a.second << ")"; return out; } template <typename T, size_t N> ostream &operator<<(ostream &out, const array<T, N> &a) { out << "["...
#include <bits/stdc++.h> #define LOCAL using namespace std; template <typename A, typename B> ostream &operator<<(ostream &out, const pair<A, B> &a) { out << "(" << a.first << "," << a.second << ")"; return out; } template <typename T, size_t N> ostream &operator<<(ostream &out, const array<T, N> &a) { out << "["...
insert
102
102
102
121
0
p02609
C++
Runtime Error
// I make this just for fun because i'm done // Aimi Haraguni >> Konomi Suzuki >> Yui >> Ikimono Gakari >> Garnidelia >> // Kalafina >> Eir Aoi. .. dude? problems that involves any kind of persistent // data structures are the best of the best, are not them? // #pragma GCC optimize ("Ofast,unroll-loops") // #pragma...
// I make this just for fun because i'm done // Aimi Haraguni >> Konomi Suzuki >> Yui >> Ikimono Gakari >> Garnidelia >> // Kalafina >> Eir Aoi. .. dude? problems that involves any kind of persistent // data structures are the best of the best, are not them? // #pragma GCC optimize ("Ofast,unroll-loops") // #pragma...
replace
127
128
127
134
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; int main() { int N; string X; cin >> N >> X; int PopCount(0); for (int i = 0; i < N; ++i) { if (X[i] == '1') ++PopCount; } vector<int> pMod(N, 1), nMod(N, 1); for (int i = N - 2; i >= 0; --i) { pMod[i] = (pMod[i + 1] << 1) % (PopCount + 1); ...
#include <bits/stdc++.h> using namespace std; int main() { int N; string X; cin >> N >> X; int PopCount(0); for (int i = 0; i < N; ++i) { if (X[i] == '1') ++PopCount; } vector<int> pMod(N, 1), nMod(N, 1); for (int i = N - 2; i >= 0; --i) { pMod[i] = (pMod[i + 1] << 1) % (PopCount + 1); ...
replace
17
18
17
19
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> 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; } const int mod = 1e9 ...
#include <bits/stdc++.h> using namespace std; #include <iomanip> #include <math.h> 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; } const int mod = 1e9 ...
insert
51
51
51
55
0
p02609
C++
Runtime Error
#include <algorithm> #include <iomanip> #include <iostream> using namespace std; long long mod_pow(long long x, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) { res = res * x % mod; } x = x * x % mod; n >>= 1; } return res; } int main() { std::cin.tie(0); ...
#include <algorithm> #include <iomanip> #include <iostream> using namespace std; long long mod_pow(long long x, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) { res = res * x % mod; } x = x * x % mod; n >>= 1; } return res; } int main() { std::cin.tie(0); ...
replace
35
36
35
36
0
p02609
C++
Runtime Error
/* Created by Rahul Goel. */ /*******************************************************************************/ #include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <u...
/* Created by Rahul Goel. */ /*******************************************************************************/ #include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <u...
replace
118
119
118
120
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> /*#ifndef M_PI #define M_PI 3.14159265358979323846 #endif */ using namespace std; #define m 1000000001 #define rep(i, a, b) for (int i = a; i < b; ++i) #define repb(i, a, b) for (int i = a; i >= b; --i) #define repv(arr) for (auto it = arr[i].begin(); it != arr[i].end(); ++it) #define vi v...
#include <bits/stdc++.h> /*#ifndef M_PI #define M_PI 3.14159265358979323846 #endif */ using namespace std; #define m 1000000001 #define rep(i, a, b) for (int i = a; i < b; ++i) #define repb(i, a, b) for (int i = a; i >= b; --i) #define repv(arr) for (auto it = arr[i].begin(); it != arr[i].end(); ++it) #define vi v...
insert
76
76
76
77
0
p02609
C++
Runtime Error
#define _USE_MATH_DEFIMES #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <ioman...
#define _USE_MATH_DEFIMES #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <ioman...
replace
93
96
93
101
0
p02609
C++
Runtime Error
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author aajisaka */ #include <bits/stdc++.h> using namespace std; void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author aajisaka */ #include <bits/stdc++.h> using namespace std; void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...
replace
71
72
71
72
0
p02609
C++
Runtime Error
#include <algorithm> #include <iostream> #include <string> using namespace std; int v[2][200010], res[200010]; int f(int n) { int res = 0; while (n > 0) { n %= __builtin_popcount(n); ++res; } return res; } int main() { int n; cin >> n; string x; cin >> x; int d = count(begin(x), end(x), '1'...
#include <algorithm> #include <iostream> #include <string> using namespace std; int v[2][200010], res[200010]; int f(int n) { int res = 0; while (n > 0) { n %= __builtin_popcount(n); ++res; } return res; } int main() { int n; cin >> n; string x; cin >> x; int d = count(begin(x), end(x), '1'...
replace
32
34
32
35
0
p02609
C++
Runtime Error
#pragma optimization_level 3 #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx") #include <bits/stdc++.h> using namespace std; #define fastio \ ios::sync_with_stdi...
#pragma optimization_level 3 #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx") #include <bits/stdc++.h> using namespace std; #define fastio \ ios::sync_with_stdi...
replace
73
75
73
77
0
p02609
C++
Runtime Error
/*Bismillahir Rahmanir Rahim*/ //{ #include <bits/stdc++.h> #include <ext/numeric> using namespace std; using __gnu_cxx::power; using ll = long long; using ull = unsigned long long; using ld = long double; const ll llinf = (1ll << 61) - 1; const double eps = 1e-6, ldeps = 1e-9; struct Dbg { static constexpr auto &os ...
/*Bismillahir Rahmanir Rahim*/ //{ #include <bits/stdc++.h> #include <ext/numeric> using namespace std; using __gnu_cxx::power; using ll = long long; using ull = unsigned long long; using ld = long double; const ll llinf = (1ll << 61) - 1; const double eps = 1e-6, ldeps = 1e-9; struct Dbg { static constexpr auto &os ...
insert
89
89
89
91
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef vector<ld> vd; typedef vector<ll> vll; typedef vector<string> vstr; typedef vector<vector<ll>> vvll; typedef vector<pair<ll, ll>> vpll; typedef priority_queue<ll, vector<ll>, greater<ll>> spql...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef vector<ld> vd; typedef vector<ll> vll; typedef vector<string> vstr; typedef vector<vector<ll>> vvll; typedef vector<pair<ll, ll>> vpll; typedef priority_queue<ll, vector<ll>, greater<ll>> spql...
insert
124
124
124
128
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> //Carefully Crafted by hetp111 using namespace std; #define int long long #define double long double #define all(v) (v).begin(), (v).end() #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define vii vector<pii> #define MOD 1000000007 #define MOD2 998244353 #define MOD3 ...
#include <bits/stdc++.h> //Carefully Crafted by hetp111 using namespace std; #define int long long #define double long double #define all(v) (v).begin(), (v).end() #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define vii vector<pii> #define MOD 1000000007 #define MOD2 998244353 #define MOD3 ...
replace
80
81
80
81
0
p02609
C++
Runtime Error
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include ...
replace
48
49
48
49
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll MOD = 1000000007; ll n; string s; ll b; ll p, m; ll ans[200005]; int main(void) { cin >> n >> s; if (s == "1") { cout << 0 << endl; return 0; } for (int i = 0; i < n; i++) { if (s[i] == '1') b+...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll MOD = 1000000007; ll n; string s; ll b; ll p, m; ll ans[200005]; int main(void) { cin >> n >> s; if (s == "1") { cout << 0 << endl; return 0; } for (int i = 0; i < n; i++) { if (s[i] == '1') b+...
replace
70
71
70
73
0
p02609
C++
Runtime Error
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
replace
178
179
178
180
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) #define fore(i, a) for (auto &i : a) #define all(x) (x).begin(), (x).end() // #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(fal...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < b; i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) #define fore(i, a) for (auto &i : a) #define all(x) (x).begin(), (x).end() // #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(fal...
insert
78
78
78
100
0
p02609
C++
Runtime Error
#include <bits/stdc++.h> using namespace std; #define ll long long #define power 210000 int rm[power] = {}, rp[power] = {}; void Initialize(int c) { rm[0] = 1; rp[0] = 1; for (int i = 1; i < power; i++) { rm[i] = (rm[i - 1] * 2) % (c - 1); rp[i] = (rp[i - 1] * 2) % (c + 1); } } int main() { int n; s...
#include <bits/stdc++.h> using namespace std; #define ll long long #define power 210000 int rm[power] = {}, rp[power] = {}; void Initialize(int c) { rm[0] = 1; rp[0] = 1; for (int i = 1; i < power; i++) { rm[i] = (rm[i - 1] * 2) % (c - 1); rp[i] = (rp[i - 1] * 2) % (c + 1); } } int main() { int n; s...
insert
21
21
21
45
0
p02609
C++
Runtime Error
#include <cstdio> int n; char x[200005]; int popcount(int x) { if (x == 0) { return 0; } if (x % 2 == 0) { return popcount(x / 2); } else { return popcount(x / 2) + 1; } } int f(int s) { int t = 1; while (s) { s %= popcount(s); t++; } return t; } int pow(int x, int y, int z) { ...
#include <cstdio> int n; char x[200005]; int popcount(int x) { if (x == 0) { return 0; } if (x % 2 == 0) { return popcount(x / 2); } else { return popcount(x / 2) + 1; } } int f(int s) { int t = 1; while (s) { s %= popcount(s); t++; } return t; } int pow(int x, int y, int z) { ...
insert
54
54
54
58
0
p02609
C++
Runtime Error
#include <stdio.h> #include <stdlib.h> #include <fstream> #include <iomanip> #include <iostream> #include <sstream> #include <stdint.h> #include <string.h> #define _USE_MATH_DEFINES #include <math.h> #include <deque> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #i...
#include <stdio.h> #include <stdlib.h> #include <fstream> #include <iomanip> #include <iostream> #include <sstream> #include <stdint.h> #include <string.h> #define _USE_MATH_DEFINES #include <math.h> #include <deque> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #i...
replace
125
126
125
126
0