buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <functional> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <bitset> #include <deque> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #in...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <functional> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> #define _USE_MATH_DEFINES #include <bitset> #include <deque> #include <iostream> #include <list> #include <map> #include <math.h> #include <queue> #in...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 12, 13]]
1
447
#include <algorithm> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> typedef unsigned long long ULLONG; typedef long long LLONG; static const LLONG MOD_NUM = 1000000007; template <class ...
#include <algorithm> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> typedef unsigned long long ULLONG; typedef long long LLONG; static const LLONG MOD_NUM = 1000000007; template <class ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68]]
1
269
#include <bits/stdc++.h> using namespace std; mt19937_64 rng(58); typedef long long ll; string name(ll n) { if (n == 0) return ""; return name(n / 26ll) + char('a' + (n - 1ll) % 26ll); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin >> n; cout << name(n)...
#include <bits/stdc++.h> using namespace std; mt19937_64 rng(58); typedef long long ll; string name(ll n) { if (n == 0) return ""; return name((n - 1) / 26ll) + char('a' + (n - 1ll) % 26ll); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin >> n; cout << n...
[["+", 31, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 31, 2, 3, 4, 0, 16, 31, 23, 0, 25]]
1
101
n=int(input()) t="abcdefghijklmnopqrstuvwxyz" def f(n): if n<=26:return t[n-1] return f(n//26)+t[(n-1)%26] print(f(n))
n=int(input()) t="abcdefghijklmnopqrstuvwxyz" def f(n): if n<=26:return t[n-1] return f((n-1)//26)+t[(n-1)%26] print(f(n))
[["+", 31, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 23, 0, 657, 12, 612], ["+", 31, 652, 3, 4, 0, 657, 31, 23, 0, 25]]
5
56
N = int(input()) name = '' while N != 0: name = chr(ord('a') + (N-1) % 26)+name N = N // 26 print(name)
N = int(input()) name = '' while N != 0: name = chr(ord('a') + (N-1) % 26)+name N = (N-1) // 26 print(name)
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25]]
5
47
import string k=list(string.ascii_lowercase) n=int(input()) l=[] while n>0: l.append(n%26) n=n//26 l.reverse() x="" for i in l: x+=k[i-1] print(x)
import string k=list(string.ascii_lowercase) n=int(input()) l=[] while n>0: l.append(n%26) n=(n-1)//26 l.reverse() x="" for i in l: x+=k[i-1] print(x)
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25]]
5
66
#include <bits/stdc++.h> using namespace std; // conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // math //--------...
#include <bits/stdc++.h> using namespace std; // conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } // math //--------...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
982
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author Alexander Agulenko */ #include <cstdlib> #include <ctime> #include <fstream> #include <iostream> /** * This solution uses cpplib (prewritten code library) * More info: https://github.com/agul/algolib/tree/master/c...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author Alexander Agulenko */ #include <cstdlib> #include <ctime> #include <fstream> #include <iostream> /** * This solution uses cpplib (prewritten code library) * More info: https://github.com/agul/algolib/tree/master/c...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13]]
1
3,963
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecursionlimit(500...
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecursionlimit(500...
[["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["-", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
180
import java.io.*; import java.util.*; import java.math.*; public class Main { static long mod = 1000000007l; static int max = Integer.MAX_VALUE, min = Integer.MIN_VALUE; static long maxl = Long.MAX_VALUE, minl = Long.MIN_VALUE; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
import java.io.*; import java.util.*; import java.math.*; public class Main { static long mod = 1000000007l; static int max = Integer.MAX_VALUE, min = Integer.MIN_VALUE; static long maxl = Long.MAX_VALUE, minl = Long.MIN_VALUE; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
[["-", 64, 196, 0, 1, 0, 11, 12, 16, 31, 252], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 31, 252]]
3
2,565
#include <bits/stdc++.h> using namespace std; const string abc = "abcdefghijklmnopqrstuvwxyz"; int main() { long long N; cin >> N; string ans = ""; while (N > 0) { ans = abc[N % 26 - 1] + ans; N /= 26; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const string abc = "abcdefghijklmnopqrstuvwxyz"; int main() { long long N; cin >> N; string ans = ""; while (N > 0) { N--; ans = abc[N % 26] + ans; N /= 26; } cout << ans << endl; return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
68
#include <bits/stdc++.h> using namespace std; #define int long long int #define sp(x) setprecision(x) #define bp(x) __builtin_popcount(x) #define ld long double #define f(i, j, n) for (int i = j; i <= n; i++) #define r(i, n, j) for (int i = n; i >= j; i--) #define all(container) container.begin(), container.end() #def...
#include <bits/stdc++.h> using namespace std; #define int long long int #define sp(x) setprecision(x) #define bp(x) __builtin_popcount(x) #define ld long double #define f(i, j, n) for (int i = j; i <= n; i++) #define r(i, n, j) for (int i = n; i >= j; i--) #define all(container) container.begin(), container.end() #def...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
173
n=int(input()) s='' while n: s=chr(96+n%26)+s n//=26 print(s)
n=int(input()) s='' while n: n-=1 s=chr(97+n%26)+s n//=26 print(s)
[["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["-", 12, 657, 31, 652, 3, 4, 0, 657, 31, 612], ["+", 12, 657, 31, 652, 3, 4, 0, 657, 31, 612]]
5
34
#include <bits/stdc++.h> using namespace std; #define int long long #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 all(x) (x).begin(), (x).end() #define uniq(x) (x).erase(unique(all(x)), (x).end()) #define bit(n) (1LL << (n)) #define cdiv(a, b) (((a)...
#include <bits/stdc++.h> using namespace std; #define int long long #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 all(x) (x).begin(), (x).end() #define uniq(x) (x).erase(unique(all(x)), (x).end()) #define bit(n) (1LL << (n)) #define cdiv(a, b) (((a)...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 12, 13]]
1
584
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; string s; while (n) { s.push_back('a' + ((n - 1) % 26)); n /= 26; } reverse(s.begin(), s.end()); cout << s << '\n'; }
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; string s; while (n) { s.push_back('a' + ((n - 1) % 26)); n--; n /= 26; } reverse(s.begin(), s.end()); cout << s << '\n'; }
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
98
n=gets.to_i s=[*?a..?z]*'' res='' while n>0 res+=s[n%26-1] n/=26 end puts res.reverse
n=gets.to_i s=[*?a..?z]*'' res='' while n>0 n-=1 res+=s[n%26] n/=26 end puts res.reverse
[["+", 0, 493, 0, 89, 8, 170, 0, 755, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 755, 17, 110], ["+", 0, 493, 0, 89, 8, 170, 0, 755, 12, 612], ["-", 8, 170, 0, 755, 12, 742, 0, 738, 17, 33], ["-", 8, 170, 0, 755, 12, 742, 0, 738, 12, 612]]
4
42
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { long long n; cin >> n; long long a, b; a = n; string ans = ""; while (n > 0) { a = (n - 1) / 26; b = (n - 1) % 26; char tmp = 'a' + b; ans = ans + tmp; n = a; } cout << ans; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) int main() { long long n; cin >> n; long long a, b; a = n; string ans = ""; while (n > 0) { a = (n - 1) / 26; b = (n - 1) % 26; char tmp = 'a' + b; ans = tmp + ans; n = a; } cout << ans; ...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
98
A = input() def num2alpha(num): if num<=26: return chr(64+num) elif num%26==0: return num2alpha(num//26-1)+chr(90) else: return num2alpha(num//26)+chr(64+num%26) ans =num2alpha(int(A)) print(ans)
A = input() def num2alpha(num): if num<=26: return chr(64+num) elif num%26==0: return num2alpha(num//26-1)+chr(90) else: return num2alpha(num//26)+chr(64+num%26) ans =num2alpha(int(A)) print(ans.lower())
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
75
#define _CRT_SECURE_NO_WARNINGS #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <fstream> #include <func...
#define _CRT_SECURE_NO_WARNINGS #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <fstream> #include <func...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
679
// #include "pch.h" #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> typedef ...
// #include "pch.h" #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> typedef ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22]]
1
440
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using st = string; using ch = char; typedef pair<ll, ll> P; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<P> vP; typedef vector<ch> vc; typedef vector<vc> vvc; #define FOR(i, a, b) for (l...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using st = string; using ch = char; typedef pair<ll, ll> P; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<P> vP; typedef vector<ch> vc; typedef vector<vc> vvc; #define FOR(i, a, b) for (l...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
230
#include <bits/stdc++.h> using namespace std; void printString(long long int n) { char str[1000001]; // To store result (Excel column name) long long int i = 0; // To store current index in str which is result while (n > 0) { // Find remainder long long int rem = n % 26; // If remainder is 0, the...
#include <bits/stdc++.h> using namespace std; void printString(long long int n) { char str[1000001]; long long int i = 0; while (n > 0) { long long int rem = n % 26; if (rem == 0) { str[i++] = 'z'; n = (n / 26) - 1; } else { str[i++] = (rem - 1) + 'a'; n = n / 26; } } ...
[["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125]]
1
157
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector<char> x(20, '#'); int it = 0; while (n > 0) { x.at(it) = ((n - 1) % 26) + 'a'; n /= 26; it++; } for (int i = 19; i >= 0; i--) { if (x.at...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector<char> x(20, '#'); int it = 0; while (n > 0) { x.at(it) = ((n - 1) % 26) + 'a'; n--; n /= 26; it++; } for (int i = 19; i >= 0; i--) { ...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
139
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = int64_t; using pint = pair<int, int>; int main() { ll n; cin >> n; string ans; while (n > 0) { int t = n % 26; if (t == 0) t = 26; char c = 'a' + t - 1; ans += c; n /= 26; } ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = int64_t; using pint = pair<int, int>; int main() { ll n; cin >> n; string ans; while (n > 0) { int t = n % 26; if (t == 0) t = 26; char c = 'a' + t - 1; ans += c; --n; n /= 2...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
110
// BECAUSE ONE TRUTH PREVAILS #include <bits/stdc++.h> using namespace std; #define LL unsigned long long int string convert(LL A) { string Ans = ""; while (A) { LL x = (A % 26 ? A % 26 : 26) + 96; Ans = (char)x + Ans; if (x == 90) { A = (A / 26) - 1; } else { A = A / 26; } } ret...
// BECAUSE ONE TRUTH PREVAILS #include <bits/stdc++.h> using namespace std; #define LL unsigned long long int string convert(LL A) { string Ans = ""; while (A) { LL x = (A % 26 ? A % 26 : 26) + 96; Ans = (char)x + Ans; if (x == 122) { A = (A / 26) - 1; } else { A = A / 26; } } re...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
108
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define int long long #define inf ((ll)1e18) #define double long double #define ull unsigned long long #define mod 1000000007 #define vi vector<ll> #define extreme inline #define ppi pair<ll, pair<ll, ll>> #define pb p...
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define int long long #define inf ((ll)1e18) #define double long double #define ull unsigned long long #define mod 1000000007 #define vi vector<ll> #define extreme inline #define ppi pair<ll, pair<ll, ll>> #define pb p...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125]]
1
281
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) using namespace std; using ll = long long; const double PI = acos(-1); template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; } int main() { ll n; cin >> n; string s = ""; whi...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) using namespace std; using ll = long long; const double PI = acos(-1); template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; } int main() { ll n; cin >> n; string s = ""; whi...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
136
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; string res = ""; while (n) { int rem = n % 26; if (rem == 0) { res += 'Z'; n = n / 26 - 1; } else { res += char(rem - 1 + 'a'); n /= 26; } } reverse(res.begin(), res.end()); cout << r...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; string res = ""; while (n) { int rem = n % 26; if (rem == 0) { res += 'z'; n = n / 26 - 1; } else { res += char(rem - 1 + 'a'); n /= 26; } } reverse(res.begin(), res.end()); cout << r...
[["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125]]
1
102
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pil = pair<int, ll>; using uint = unsigned int; template <typename T> using Graph = vector<vector<T>>; const ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pli = pair<ll, int>; using pil = pair<int, ll>; using uint = unsigned int; template <typename T> using Graph = vector<vector<T>>; const ...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
185
N = int(input()) D = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] A = [] while True: T = (N-1) % 26 N = N // 26 A.append(D[T]) if N == 0: break A = reversed(A) print("".join(A))
N = int(input()) D = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] A = [] while True: T = (N-1) % 26 N = (N-1) // 26 A.append(D[T]) if N == 0: break A = reversed(A) print("".join(A))
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25]]
5
167
#include <bits/stdc++.h> using namespace std; #define ll long long #define int long long #define ff first #define ss second #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define pqb priority_queue<int> #define pqs priority_queue<int, vi, greater<int>> #define setbits(x) __...
#include <bits/stdc++.h> using namespace std; #define ll long long #define int long long #define ff first #define ss second #define pb push_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define pqb priority_queue<int> #define pqs priority_queue<int, vi, greater<int>> #define setbits(x) __...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
252
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin >> N; vector<char> A; while (N > 0) { A.push_back('a' + (N - 1) % 26); N /= 26; } reverse(A.begin(), A.end()); int len = A.size(); for (int i = 0; i < len; i++) { cout << A.at(i); } cout << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin >> N; vector<char> A; while (N > 0) { A.push_back('a' + (N - 1) % 26); N--; N /= 26; } reverse(A.begin(), A.end()); int len = A.size(); for (int i = 0; i < len; i++) { cout << A.at(i); } cout << endl; return...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
110
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using uint = unsigned int; int main() { ll n; cin >> n; string s; while (n > 0) { int m = n % 26; s.push_back('a' + m - 1); n /= 26; } string s2(s.rbegin(), s.rend()); cout << s...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using uint = unsigned int; int main() { ll n; cin >> n; string s; while (n > 0) { n--; int m = n % 26; // if (m == 0) // s.push_back('z'); // else s.push_back('a' + m); ...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
99
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; string s = ""; while (n > 0) { long long j = n % 26; if (j == 0) { j = 26; } s.push_back((char)('a' - 1 + j)); if (n == 26) { break; } n /= 26; } reverse(s.begin(), s.end()); co...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; string s = ""; while (n > 0) { long long j = n % 26; if (j == 0) { j = 26; n--; } s.push_back((char)('a' - 1 + j)); if (n == 26) { break; } n /= 26; } reverse(s.begin(), s.en...
[["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
110
#include <iostream> #include <vector> using namespace std; vector<char> alpha = { 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', }; int main() { int64_t N; cin >> N; string ans; for (; 0 < N;) { ans = alpha[N % 26]...
#include <iostream> #include <vector> using namespace std; vector<char> alpha = { 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', }; int main() { int64_t N; cin >> N; string ans; for (; 0 < N;) { ans = alpha[N % 26]...
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25]]
1
170
#include <bits/stdc++.h> using namespace std; void input() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } #define endl "\n" #define ll long long int #define vll vector<ll> #define pb push_back #define pll pair<ll, ll> #define mp(a, b) make_pair(a, b) #define ...
#include <bits/stdc++.h> using namespace std; void input() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } #define endl "\n" #define ll long long int #define vll vector<ll> #define pb push_back #define pll pair<ll, ll> #define mp(a, b) make_pair(a, b) #define ...
[["-", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6], ["+", 8, 9, 0, 43, 49, 50, 51, 5, 0, 6]]
1
297
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin >> n; string ans = ""; while (n >= 1) { int p = n % 26; if (!p) p = 26; n /= 26; ans += 'a' + p - 1; } reverse(ans.begin(), ans.end()); cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin >> n; string ans = ""; while (n >= 1) { int p = n % 26; if (!p) p = 26; n -= p; n /= 26; ans += 'a' + p - 1; } reverse(ans.begin(), ans.end()); cout << ans; return 0; }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
90
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using Graph = vector<vector<ll>>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++) #define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--) const int dx[4] = {1, 0, -1, 0...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; using Graph = vector<vector<ll>>; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++) #define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--) const int dx[4] = {1, 0, -1, 0...
[["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
291
#include <stdio.h> int main() { long n, i; char ans[20]; scanf("%ld", &n); for (i = 0; n > 0; i++) { ans[i] = 'a' + n % 26 - 1; n /= 26; } for (i--; i >= 0; i--) printf("%c", ans[i]); puts(""); return 0; }
#include <stdio.h> int main() { long n, i; char ans[20]; scanf("%ld", &n); for (i = 0; n > 0; i++) { n--; ans[i] = 'a' + n % 26; n /= 26; } for (i--; i >= 0; i--) printf("%c", ans[i]); puts(""); return 0; }
[["+", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
0
96
#include <algorithm> #include <iostream> #include <string> using namespace std; #include <cmath> #include <iomanip> #include <map> #include <numeric> #include <queue> #include <set> #include <vector> using ll = long long; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vs = vector<string>; ...
#include <algorithm> #include <iostream> #include <string> using namespace std; #include <cmath> #include <iomanip> #include <map> #include <numeric> #include <queue> #include <set> #include <vector> using ll = long long; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using vs = vector<string>; ...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
295
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; //#define int long long // signed main(){ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; vector<int> s; while (n > 0) { ll tmp = n % 26; n /= 26; s.emplace_back(tmp); } ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; //#define int long long // signed main(){ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; vector<int> s; while (n > 0) { n--; ll tmp = n % 26; n /= 26; s.emplace_back(t...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
137
# i番目は26 ^ i個 # i番目までの個数は 26 * (26 ^ i - 1) / 25 n = int(input()) _ = 96 # 桁数 ans = '' while True: a, b = divmod(n, 26) #print(a, b) if b == 0: b = 26 ans += str(chr(b + _)) if a == 0: break n = a print(ans[::-1])
# i番目は26 ^ i個 # i番目までの個数は 26 * (26 ^ i - 1) / 25 n = int(input()) _ = 96 # 桁数 ans = '' while True: a, b = divmod(n, 26) #print(a, b) if b == 0: b = 26 a -= 1 ans += str(chr(b + _)) if a == 0: break n = a print(ans[::-1])
[["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612]]
5
70
N = int(input()) a = ord('a') M = 1000000000000001 ans = '' while N != 0: ans = chr(a + N % 26 - 1) + ans N //= 26 print(ans)
N = int(input()) a = ord('a') M = 1000000000000001 ans = '' while N != 0: N -= 1 ans = chr(a + N % 26) + ans N //= 26 print(ans)
[["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["-", 12, 657, 31, 652, 3, 4, 0, 657, 17, 33], ["-", 12, 657, 31, 652, 3, 4, 0, 657, 12, 612]]
5
49
n=int(input()) def num2(num): if num<=26: return chr(num+64) elif num%26==0: return num2(num//26-1)+chr(90) else: return num2(num//26)+chr(64+num%26) print(num2(n))
n=int(input()) def num2(num): if num<=26: return chr(num+96) elif num%26==0: return num2(num//26-1)+chr(122) else: return num2(num//26)+chr(96+num%26) print(num2(n))
[["-", 0, 37, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 37, 0, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 37, 0, 657, 12, 652, 3, 4, 0, 612], ["+", 0, 37, 0, 657, 12, 652, 3, 4, 0, 612], ["-", 0, 657, 12, 652, 3, 4, 0, 657, 31, 612], ["+", 0, 657, 12, 652, 3, 4, 0, 657, 31, 612]]
5
72
#include <bits/stdc++.h> #define INF 2e9 #define MOD 1000000007 #define MOD9 998244353 #define intMAX 51000; #define PI 3.14159265359 using namespace std; typedef long long llong; typedef long double ldouble; using Graph = vector<vector<int>>; int main() { llong N; cin >> N; bool flag = true; llong remain = 0...
#include <bits/stdc++.h> #define INF 2e9 #define MOD 1000000007 #define MOD9 998244353 #define intMAX 51000; #define PI 3.14159265359 using namespace std; typedef long long llong; typedef long double ldouble; using Graph = vector<vector<int>>; int main() { llong N; cin >> N; bool flag = true; llong remain = 0...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
1
166
aalphabets = [""] + [s for s in "abcdefghijklmnopqrstuvwxyz"] s = int(input()) nums = [] while s > 0: nums.append((s - 1) % 26 + 1) s = (s - 1) // 26 res = "" for _ in range(len(nums)): res = res + alphabets[nums.pop()] print(res)
alphabets = [""] + [s for s in "abcdefghijklmnopqrstuvwxyz"] s = int(input()) nums = [] while s > 0: nums.append((s - 1) % 26 + 1) s = (s - 1) // 26 res = "" for _ in range(len(nums)): res = res + alphabets[nums.pop()] print(res)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]]
5
87
#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...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13]]
1
234
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define DEBUG(x) cout << '>' ...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstring> #include <functional> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define DEBUG(x) cout << '>' ...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]]
1
391
n = int(input()) a = "abcdefghijklmnopqrstuvwxyz" now = 0 tnp = 0 for i in range(1,1000): x = now + 26**i if (n<=x): tnp = i break now = x x = n - now ans = "" for i in range(i): if i==0: ans = a[x%26-1] + ans else: ans = a[x%26] + ans x = (x-1) // 26 print(ans) ...
n = int(input()) a = "abcdefghijklmnopqrstuvwxyz" now = 0 tnp = 0 for i in range(1,1000): x = now + 26**i if (n<=x): tnp = i break now = x x = n - now ans = "" for i in range(i): #print(x) if i==0: ans = a[x%26-1] + ans else: ans = a[x%26-1] + ans x = (x-1) //...
[["+", 0, 662, 12, 657, 31, 206, 206, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 206, 206, 657, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612]]
5
109
n = int(input()) result = "" while n > 0: x = n%26 if x==0: result = result+"w" n -= 26 else: result = result + chr(96+x) n -= x n //= 26 print(result[::-1])
n = int(input()) result = "" while n > 0: x = n%26 if x==0: result = result+"z" n -= 26 else: result = result + chr(96+x) n -= x n //= 26 print(result[::-1])
[["-", 0, 1, 0, 662, 12, 657, 12, 557, 0, 6], ["+", 0, 1, 0, 662, 12, 657, 12, 557, 0, 6]]
5
65
n = int(input()) alphabet = 'abcdefghijklmnopqrstuvwxyz' n -= 1 ans = '' while n >= 0: ans += alphabet[n % 26] n //= 26 n -= 1 print(ans)
n = int(input()) alphabet = 'abcdefghijklmnopqrstuvwxyz' n -= 1 ans = '' while n >= 0: ans = alphabet[n % 26] + ans n //= 26 n -= 1 print(ans)
[["-", 0, 52, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
43
N=int(input()) #26真数 abc=list("abcdefghijklmnopqrstuvwxyz") ans="" while True: ans=abc[N%26-1]+ans if N<27: break N=N//26 print(ans)
N=int(input()) #26真数 abc=list("abcdefghijklmnopqrstuvwxyz") ans="" while True: ans=abc[N%26-1]+ans #print(ans,N) if N<27: break N=(N-1)//26 print(ans)
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25]]
5
51
n=int(input()) ans = "" while(n > 0): ans += chr(ord("a")-1 + n%26) n = n//26 print(ans[::-1])
n=int(input()) ans = "" while(n > 0): n -= 1 ans += chr(ord("a") + n%26) n = n//26 print(ans[::-1])
[["+", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 52, 8, 196, 0, 1, 0, 677, 12, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 17, 33], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612]]
5
51
#include <bits/stdc++.h> using namespace std; #define int long long int #define vi vector<int> #define vvi vector<vi> #define read(a) \ for (int i = 0; i < n; i++) \ cin >> a[i]; #define print(a) ...
#include <bits/stdc++.h> using namespace std; #define int long long int #define vi vector<int> #define vvi vector<vi> #define read(a) \ for (int i = 0; i < n; i++) \ cin >> a[i]; #define print(a) ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
136
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(x) (x).begin(), (x).end() using namespace std; const int INF = 1145141919, MOD = 1e9 + 7; const int64_t LINF = 8931145141919364364, LMOD = 998244353; // const int dy[]={0,-1,0,1,1,-1,-1,1}; // const int dx[]={1,0,-1,0,1,1,-1,-1}; int ma...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define all(x) (x).begin(), (x).end() using namespace std; const int INF = 1145141919, MOD = 1e9 + 7; const int64_t LINF = 8931145141919364364, LMOD = 998244353; // const int dy[]={0,-1,0,1,1,-1,-1,1}; // const int dx[]={1,0,-1,0,1,1,-1,-1}; int ma...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 11, 12, 74, 51, 23, 0, 16, 17, 33], ["-", 0, 11, 12, 74, 51, 23, 0, 16, 12, 13]]
1
117
#include <bits/stdc++.h> #define gcd(m, n) __gcd(m, n) #define lcm(m, n) m *(n / gcd(m, n)) #define fast \ std::ios_base::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #define gcd(m, n) __gcd(m, n) #define lcm(m, n) m *(n / gcd(m, n)) #define fast \ std::ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125], ["+", 64, 9, 0, 1, 0, 11, 12, 103, 0, 125]]
1
298
#include <bits/stdc++.h> using namespace std; int main() { string s; long long n; cin >> n; while (n) { s = (char)('a' + (int)((n - 1) % 26)) + s; n /= 26; } cout << s; }
#include <bits/stdc++.h> using namespace std; int main() { string s; long long n; cin >> n; while (n--) { s = (char)('a' + (int)(n % 26)) + s; n /= 26; } cout << s; }
[["+", 8, 9, 0, 52, 15, 339, 51, 27, 17, 68], ["-", 51, 23, 0, 16, 12, 74, 51, 23, 0, 24], ["-", 51, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["-", 51, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["-", 12, 74, 51, 23, 0, 16, 31, 23, 0, 25]]
1
63
#include <bits/stdc++.h> using namespace std; #define rep(i, ini, n) for (int i = ini; i < n; i++) #define _rep(i, ini, n) for (int i = ini; i >= n; i--) #define ToEnd(a) a.begin(), a.end() uint64_t MOD = 1000000007; int main() { int64_t N; cin >> N; string ans; while (1) { ans += 'a' + N % 26 - 1; i...
#include <bits/stdc++.h> using namespace std; #define rep(i, ini, n) for (int i = ini; i < n; i++) #define _rep(i, ini, n) for (int i = ini; i >= n; i--) #define ToEnd(a) a.begin(), a.end() uint64_t MOD = 1000000007; int main() { int64_t N; cin >> N; string ans; while (1) { N--; ans += 'a' + N % 26; ...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
100
#include <bits/stdc++.h> #define simplify \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define int long long #define endl "\...
#include <bits/stdc++.h> #define simplify \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define int long long #define endl "\...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
119
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i, x, n) for (ll i = x; i < n; i++) #define sort(v) sort(v.begin(), v.end()); const ll mod = 1E9 + 7; int main() { ll n; cin >> n; string ans; while (n != 0) { ll r = n % 26 - 1; char x = char(r + 97); ans += x; n =...
#include <bits/stdc++.h> using namespace std; #define ll long long #define loop(i, x, n) for (ll i = x; i < n; i++) #define sort(v) sort(v.begin(), v.end()); const ll mod = 1E9 + 7; int main() { ll n; cin >> n; string ans; while (n != 0) { ll r = (n - 1) % 26; char x = char(r + 97); ans += x; n...
[["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 109], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
111
#pragma region header #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define int long long #define all(a) begin(a), end(a) #define rall(a) rbegin(a), rend(a) #define mp make_pair #define mt make_tuple #define rep1(i, n) for (decltype(+n) i = 0; i < (n); i++) #define rrep1(i, n) for (auto i = n - 1; i > static_c...
#pragma region header #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define int long long #define all(a) begin(a), end(a) #define rall(a) rbegin(a), rend(a) #define mp make_pair #define mt make_tuple #define rep1(i, n) for (decltype(+n) i = 0; i < (n); i++) #define rrep1(i, n) for (auto i = n - 1; i > static_c...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 33], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
2,126
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; #define idfc \ ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) //#define ll long long #define pb emplace_back #define mp make_pair #define nt _ll128 #defin...
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; #define idfc \ ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) //#define ll long long #define pb emplace_back #define mp make_pair #define nt _ll128 #defin...
[["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46]]
1
167
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include ...
[["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
867
#include <bits/stdc++.h> #define ll unsigned long long int #define loop(i, a, b) for (i = a; i < b; i++) #define mod 100000007 #define INF 1000000000000 #define pb push_back #define lim 200001 using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll i, n, cnt = 0; cin >> n; vect...
#include <bits/stdc++.h> #define ll long long int #define loop(i, a, b) for (i = a; i < b; i++) #define mod 100000007 #define INF 1000000000000 #define pb push_back #define lim 200001 using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll i, n, cnt = 0; cin >> n; vector<ll> an...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
452
#include <algorithm> #include <bitset> #include <climits> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long int; const ll MOD = 1e9 + 5; ll mod_pow(ll k, ll p) { if (k == 0) { return 1 % p; } if (k == 1) { return 2 % p; } if (k % 2 == 0...
#include <algorithm> #include <bitset> #include <climits> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; using ll = long long int; const ll MOD = 1e9 + 5; ll mod_pow(ll k, ll p) { if (k == 0) { return 1 % p; } if (k == 1) { return 2 % p; } if (k % 2 == 0...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 13], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 13]]
1
763
/* ID: alec3 LANG: C++14 PROG: frac1 CLASSIFICATION: flood fill */ #include <bits/stdc++.h> #define check(x) cout << (#x) << ": " << x << " "; #define io \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
/* ID: alec3 LANG: C++14 PROG: frac1 CLASSIFICATION: flood fill */ #include <bits/stdc++.h> #define check(x) cout << (#x) << ": " << x << " "; #define io \ ios_base::sync_with_stdio(0); \ cin.tie(0); ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 16, 12, 69, 28, 69, 341, 342, 0, 22], ["-", 31, 23, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 31, ...
1
662
def pc(x): return format(x, 'b').count('1') N = int(input()) X = input() Xo = int(X, 2) count = 0 ans = 0 ori = pc(Xo) X = list(X) Xp = Xo%(ori + 1) if ori == 1: Xm = 0 else: Xm = Xo % (ori - 1) # for i in range(N-1, -1, -1): for i in range(N): if ori == 1 and X[i] == '1': print(0) ...
def pc(x): return format(x, 'b').count('1') N = int(input()) X = input() Xo = int(X, 2) count = 0 ans = 0 ori = pc(Xo) X = list(X) Xp = Xo%(ori + 1) if ori == 1: Xm = 0 else: Xm = Xo % (ori - 1) # for i in range(N-1, -1, -1): for i in range(N): if ori == 1 and X[i] == '1': print(0) ...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612]]
5
206
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int using namespace __gnu_pbds; typedef tree<pair<ll, pair<ll, ll>>, null_type, less<pair<ll, pair<ll, ll>>>, rb_tree_tag, tree_order_statistics_node_update> ...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int using namespace __gnu_pbds; typedef tree<pair<ll, pair<ll, ll>>, null_type, less<pair<ll, pair<ll, ll>>>, rb_tree_tag, tree_order_statistics_node_update> ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 33], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["-", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 33], [...
1
641
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; // a^n mod を計算する long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } long lon...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; // a^n mod を計算する long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } long lon...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
594
def main(): N = int(input()) X = input() def popcount(x): '''xの立っているビット数をカウントする関数 (xは64bit整数)''' # 2bitごとの組に分け、立っているビット数を2bitで表現する x = x - ((x >> 1) & 0x5555555555555555) # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる x = (x & 0x3333333333333333) + ((x >> 2) & 0x...
def main(): N = int(input()) X = input() def popcount(x): '''xの立っているビット数をカウントする関数 (xは64bit整数)''' # 2bitごとの組に分け、立っているビット数を2bitで表現する x = x - ((x >> 1) & 0x5555555555555555) # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる x = (x & 0x3333333333333333) + ((x >> 2) & 0x...
[["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
448
#include <bits/stdc++.h> #define WHOLE(v) (v).begin(), (v).end() #define REV_WHOLE(v) (v).rbegin(), (v).rend() using i64 = int64_t; using namespace std; template <class F> auto recursive(F f) { return [f](auto... a) { return f(f, a...); }; } template <class T> using rev_priority_queue = priority_queue<T, vector<T>, g...
#include <bits/stdc++.h> #define WHOLE(v) (v).begin(), (v).end() #define REV_WHOLE(v) (v).rbegin(), (v).rend() using i64 = int64_t; using namespace std; template <class F> auto recursive(F f) { return [f](auto... a) { return f(f, a...); }; } template <class T> using rev_priority_queue = priority_queue<T, vector<T>, g...
[["-", 0, 11, 12, 16, 12, 23, 0, 41, 15, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 41, 15, 22]]
1
814
def resolve(): N = int(input()) X = input() Xint = int(X,2) popX = X.count("1") if popX == 1: idx = (N-1) - X.find("1") for i in range(N): if i == idx: print(0) else: if i != N-1: if X[-1] == "0": ...
def resolve(): N = int(input()) X = input() Xint = int(X,2) popX = X.count("1") if popX == 1: idx = X.find("1") for i in range(N): if i == idx: print(0) else: if i != N-1: if X[-1] == "0": ...
[["-", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["-", 0, 662, 12, 657, 31, 23, 0, 657, 31, 22], ["-", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["-", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["-", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33]]
5
301
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; string x; cin >> n >> x; vector<int> f(n + 1, 0); for (int i = 1; i <= n; i++) { int c = 0; for (int j = 1; j <= i; j <<= 1) { if ((i & j) > 0) { c++; } } f[i] = f[i % c] + 1...
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int n; string x; cin >> n >> x; vector<int> f(n + 1, 0); for (int i = 1; i <= n; i++) { int c = 0; for (int j = 1; j <= i; j <<= 1) { if ((i & j) > 0) { c++; } } f[i] = f[i % c] + 1...
[["+", 31, 69, 341, 342, 0, 16, 31, 16, 31, 22], ["+", 31, 69, 341, 342, 0, 16, 31, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
601
#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++) ...
[["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 25]]
1
378
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits.h> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits.h> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #...
[["+", 12, 2, 3, 4, 0, 16, 31, 23, 0, 25], ["-", 12, 16, 12, 2, 3, 4, 0, 23, 0, 25]]
1
1,818
from sys import stdin,stdout def INPUT():return list(int(i) for i in stdin.readline().split()) def inp():return stdin.readline() def out(x):return stdout.write(x) import math ###############################################################################\ def power(a,p,m): if m==0: return 0 res=1 wh...
from sys import stdin,stdout def INPUT():return list(int(i) for i in stdin.readline().split()) def inp():return stdin.readline() def out(x):return stdout.write(x) import math ###############################################################################\ def power(a,p,m): if m==0: return 0 res=1 wh...
[["-", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
424
import sys import itertools # import numpy as np import time import math import heapq from collections import defaultdict sys.setrecursionlimit(10 ** 7) INF = 10 ** 18 MOD = 10 ** 9 + 7 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # map(int, input().split()...
import sys import itertools # import numpy as np import time import math import heapq from collections import defaultdict sys.setrecursionlimit(10 ** 7) INF = 10 ** 18 MOD = 10 ** 9 + 7 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # map(int, input().split()...
[["-", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612]]
5
410
def popcount(x): return bin(x).count("1") n=int(input()) s=input() X=int(s,2) one_cnt=popcount(X) modp=X%(one_cnt+1) modm=X%(one_cnt-1) if one_cnt-1!=0 else 0 for i in range(n): if s[i]=="1": if cnt==1: print(0) continue else: num=(modm-pow(2,n-i-1,one_c...
def popcount(x): return bin(x).count("1") n=int(input()) s=input() X=int(s,2) one_cnt=popcount(X) modp=X%(one_cnt+1) modm=X%(one_cnt-1) if one_cnt-1!=0 else 0 for i in range(n): if s[i]=="1": if one_cnt-1==0: print(0) continue else: num=(modm-pow(2,n-i-1,o...
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 60], ["+", 64, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 64, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 612]]
5
178
#include <bits/stdc++.h> using namespace std; struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } fast; template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); } // long long m...
#include <bits/stdc++.h> using namespace std; struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } fast; template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); } // long long m...
[["-", 51, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["+", 51, 16, 31, 23, 0, 16, 31, 16, 17, 72]]
1
946
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) x.begin(), x.end() #define mod 1000000007 typedef long long ll; int main() { ll n; cin >> n; string str; cin >> str; vector<ll> modsPlus(200001, 1); vector<ll> modsMinus(200001, 1); ll sumPlu...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) x.begin(), x.end() #define mod 1000000007 typedef long long ll; int main() { ll n; cin >> n; string str; cin >> str; vector<ll> modsPlus(200001, 1); vector<ll> modsMinus(200001, 1); ll sumPlu...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
538
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.UncheckedIOException; import java.lang.reflect.Array; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Deque; import java.util.Objects; import java.util.regex.Pa...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.UncheckedIOException; import java.lang.reflect.Array; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Deque; import java.util.Objects; import java.util.regex.Pat...
[["-", 64, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["+", 64, 196, 0, 57, 15, 15, 0, 16, 17, 79]]
3
1,199
#include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for (int w = 0; w < (p); w++) #define fx(p) for (int x = 0; x < (p); x++) #define fy(p) for (int y = 0; y < (p); y++) #define fz(p) for (int z = 0; z < (p); z++) #define fyg(p, g) for (int y = (g); y < (p); y++) #define fzg(p, g) for (int...
#include <bits/stdc++.h> using namespace std; #define ll long long #define fw(p) for (int w = 0; w < (p); w++) #define fx(p) for (int x = 0; x < (p); x++) #define fy(p) for (int y = 0; y < (p); y++) #define fz(p) for (int z = 0; z < (p); z++) #define fyg(p, g) for (int y = (g); y < (p); y++) #define fzg(p, g) for (int...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
1
634
#include <stdio.h> int f[200200], a[200200]; int n; char s[200200]; int main() { for (int i = 1; i < 200200; i++) { int t = i, pc = 0; while (t) pc++, t -= t & (-t); f[i] = f[i % pc] + 1; } scanf("%d %s", &n, s); int pc = 0; for (int j = 0; j < n; j++) if (s[j] == '1') pc++; ...
#include <stdio.h> int f[200200], a[200200]; int n; char s[200200]; int main() { for (int i = 1; i < 200200; i++) { int t = i, pc = 0; while (t) pc++, t -= t & (-t); f[i] = f[i % pc] + 1; } scanf("%d %s", &n, s); int pc = 0; for (int j = 0; j < n; j++) if (s[j] == '1') pc++; ...
[["+", 75, 76, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 75, 76, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
433
#include <iostream> using namespace std; const int MAXN = 2e5 + 10; int n; char s[MAXN]; int v[MAXN]; int p[2][MAXN]; int b[2], g[2]; int r[MAXN]; int main() { cin >> n >> s; int cnt = 0; for (int i = 0; i < n; ++i) { v[i] = s[i] - '0'; cnt += v[i]; } if (cnt > 1) b[1] = cnt - 1; else b[1] ...
#include <iostream> using namespace std; const int MAXN = 2e5 + 10; int n; char s[MAXN]; int v[MAXN]; int p[2][MAXN]; int b[2], g[2]; int r[MAXN]; int main() { cin >> n >> s; int cnt = 0; for (int i = 0; i < n; ++i) { v[i] = s[i] - '0'; cnt += v[i]; } if (cnt >= 1) b[1] = cnt - 1; else b[1]...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
496
// Author rahuliitkgp /*A thing of beauty is a joy forever, Its loveliness increases, it will never pass into nothingness.*/ // Men at Work :) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int ll; #define setbits(x) __builtin_popc...
// Author rahuliitkgp /*A thing of beauty is a joy forever, Its loveliness increases, it will never pass into nothingness.*/ // Men at Work :) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long int ll; #define setbits(x) __builtin_popc...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
646
def popcount(n): return bin(n).count('1') N=int(input()) X=input() xl=list(X) X=int(X,2) a=popcount(X) #1が減った時 if a==1: xi=0 else: xi=X%(a-1) #1が増えたとき xd=X%(a+1) for i in range(N): if xl[i]=='1': if a==1: print(0) continue else: k=pow(2,N-1-i,a-1) ...
def popcount(n): return bin(n).count('1') N=int(input()) X=input() xl=list(X) X=int(X,2) a=popcount(X) #1が減った時 if a==1: xd=0 else: xd=X%(a-1) #1が増えたとき xi=X%(a+1) for i in range(N): if xl[i]=='1': if a==1: print(0) continue else: k=pow(2,N-1-i,a-1...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]]
5
192
#include <bits/stdc++.h> #define _USE_MATH_DEFINES using namespace std; #define ll long long int #define pb push_back #define rep(i, j, n) for (ll i = j; i < n; i++) #define pre(i, j, n) for (ll i = j; i >= n; i--) #define all(x) x.begin(), x.end() typedef pair<int, int> pii; typedef pair<ll, ll> pl; typedef vector<in...
#include <bits/stdc++.h> #define _USE_MATH_DEFINES using namespace std; #define ll long long int #define pb push_back #define rep(i, j, n) for (ll i = j; i < n; i++) #define pre(i, j, n) for (ll i = j; i >= n; i--) #define all(x) x.begin(), x.end() typedef pair<int, int> pii; typedef pair<ll, ll> pl; typedef vector<in...
[["+", 12, 16, 31, 23, 0, 16, 31, 16, 31, 22], ["+", 12, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["-", 12, 16, 31, 23, 0, 16, 31, 16, 12, 22]]
1
663
import sys def input(): return sys.stdin.readline().strip() n=int(input()) xs=input() xj=xs.count("1") x=int(xs,2) xip=x%(xj+1) if xj!=1: xim=x%(xj-1) #i1=1<<n for i in range(n-1,-1,-1): # i1=i1>>1 # xi=x^i1 # if xi==0: # print(0) # continue if xs[n-1-i]=="0": pxi=xj+1 # ...
import sys def input(): return sys.stdin.readline().strip() n=int(input()) xs=input() xj=xs.count("1") x=int(xs,2) xip=x%(xj+1) if xj!=1: xim=x%(xj-1) for i in range(n-1,-1,-1): if xs[n-1-i]=="0": pxi=xj+1 i2=pow(2,i,pxi) xi=(xip+i2)%pxi elif xj==1: print(0) contin...
[["-", 0, 662, 12, 657, 31, 23, 0, 657, 31, 22], ["-", 0, 662, 12, 657, 31, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 31, 22], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33]]
5
219
#include <bits/stdc++.h> #define rep(i, N) for (ll(i) = 0; (i) < (N); (i)++) #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) using namespace std; typedef long long ll; typedef pair<int, int> P; const int mod = 1000000007; const int INF = 1001001001; int popcnt(int x) { return __builtin_popcountll(x...
#include <bits/stdc++.h> #define rep(i, N) for (ll(i) = 0; (i) < (N); (i)++) #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) using namespace std; typedef long long ll; typedef pair<int, int> P; const int mod = 1000000007; const int INF = 1001001001; int popcnt(int x) { return __builtin_popcountll(x...
[["+", 8, 9, 0, 37, 0, 16, 31, 2, 63, 22], ["+", 0, 37, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 25]]
1
344
#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...
[["-", 49, 50, 51, 41, 15, 23, 0, 16, 12, 13], ["+", 49, 50, 51, 41, 15, 23, 0, 16, 12, 13]]
1
787
#include <bits/stdc++.h> using namespace std; long mpow(long a, long b, long mod) { long res = 1; while (b > 0) { if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1; } return res; } int f(int n) { return n % __builtin_popcount(n); } int main() { int N; string S; cin >> N >> S; ...
#include <bits/stdc++.h> using namespace std; long mpow(long a, long b, long mod) { long res = 1; while (b > 0) { if (b & 1) res = res * a % mod; a = a * a % mod; b >>= 1; } return res; } int f(int n) { return n % __builtin_popcount(n); } int main() { int N; string S; cin >> N >> S; ...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]]
1
436
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define rep(i, n) \ ; \ for (long long i = 0; i < (n); i++) using ll = long long; using P = pair<long long, long lon...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define rep(i, n) \ ; \ for (long long i = 0; i < (n); i++) using ll = long long; using P = pair<long long, long lon...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 64, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 64, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
1
497
// #pragma GCC target("avx,avx2,fma") // #pragma GCC optimization ("Ofast") // #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // template <typename T> // using o_s...
// #pragma GCC target("avx,avx2,fma") // #pragma GCC optimization ("Ofast") // #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // template <typename T> // using o_s...
[["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 13]]
1
635
def func(z,c): if c == 0: z = 0 else: z = z%c a = bin(z) b = 0 for i in range(len(a)): if a[i] == "1": b += 1 return z,b n = int(input()) x = input() c = 0 sw = 0 for i in range(n): if x[i] == "1": c += 1 s0 = int(x,2)%(c+1) if c <= 1: s1 = 0 ...
def func(z,c): if c == 0: z = 0 else: z = z%c a = bin(z) b = 0 for i in range(len(a)): if a[i] == "1": b += 1 return z,b n = int(input()) x = input() c = 0 for i in range(n): if x[i] == "1": c += 1 s0 = int(x,2)%(c+1) if c <= 1: s1 = 0 else: ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
284
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_str(): return readline().strip() def slv(N, X): C = X.count...
# -*- coding: utf-8 -*- import sys # sys.setrecursionlimit(10**6) # buff_readline = sys.stdin.buffer.readline buff_readline = sys.stdin.readline readline = sys.stdin.readline INF = 2**62-1 def read_int(): return int(buff_readline()) def read_str(): return readline().strip() def slv(N, X): C = X.count...
[["+", 75, 76, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
295
#include <iostream> #include <string> #define MAX 200000 using namespace std; /* popcount(n) f(n) = n%popcount(n)が0になるまで */ long long n; string X; void f(long long k, long long n) { if (n == 0) cout << k << endl; else { // cは1の個数 long long m = n, c = 0; while (m) { c += m & 1; m >>= ...
#include <iostream> #include <string> #define MAX 200000 using namespace std; /* popcount(n) f(n) = n%popcount(n)が0になるまで */ long long n; string X; void f(long long k, long long n) { if (n == 0) cout << k << endl; else { // cは1の個数 long long m = n, c = 0; while (m) { c += m & 1; m >>= ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
585
#include <bits/stdc++.h> using namespace std; #define FAST \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define REP(i, a...
#include <bits/stdc++.h> using namespace std; #define FAST \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define REP(i, a...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
564
import sys sys.setrecursionlimit(10**6) def f(n): if n == 0: return 1 p = n % (bin(n).count('1')) return f(p) + 1 def main(input, print): N = int(input()) X = list(map(int, list(input()))) ans = [0] * N pcnt = 0 for i in range(N): if X[i] == 1: pcnt += 1 ...
import sys sys.setrecursionlimit(10**6) def f(n): if n == 0: return 1 p = n % (bin(n).count('1')) return f(p) + 1 def main(input, print): N = int(input()) X = list(map(int, list(input().strip()))) ans = [0] * N pcnt = 0 for i in range(N): if X[i] == 1: pc...
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
262
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード //ループ #define rep(i, n) for (int i = 0; i < (n); i++) //普通のループ #define repr(i, n) for (int i = n; i >= 0; i--) //逆ループ //型名省略 typedef long long ll; //値 static const ll MX = 100005; static const ll MX_ll = 1e18; const double PI = acos(-1); //π using namespace std; //ソート #d...
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード //ループ #define rep(i, n) for (int i = 0; i < (n); i++) //普通のループ #define repr(i, n) for (int i = n; i >= 0; i--) //逆ループ //型名省略 typedef long long ll; //値 static const ll MX = 100005; static const ll MX_ll = 1e18; const double PI = acos(-1); //π using namespace std; //ソート #d...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
367
#include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int popcount(int x) { vector<int> a; while (x != 0) { a.emplace_back(x % 2); x /= 2; } int res = 0; for (auto p : a) { if (p == 1) { res++; } } return res; } int f(int x) { if (x == 0)...
#include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; int popcount(int x) { vector<int> a; while (x != 0) { a.emplace_back(x % 2); x /= 2; } int res = 0; for (auto p : a) { if (p == 1) { res++; } } return res; } int f(int x) { if (x == 0)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
500