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
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c; cin >> a >> b >> c; if (a + b - c >= 0) { cout << "No" << endl; return 0; } if ((a + b - c) * (a + b - c) > 4 * a * b) { cout << "Yes" << endl; } else cout << "N0" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c; cin >> a >> b >> c; if (a + b - c >= 0) { cout << "No" << endl; return 0; } if ((a + b - c) * (a + b - c) > 4 * a * b) { cout << "Yes" << endl; } else cout << "No" << endl; return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
96
import sys a, b, c = map(int, sys.stdin.readline().split()) if c <= a + b: print('No') if 4 * a * b < (c - a - b) ** 2: print('Yes') else: print('No')
import sys a, b, c = map(int, sys.stdin.readline().split()) if c <= a + b: print('No') elif 4 * a * b < (c - a - b) ** 2: print('Yes') else: print('No')
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 75, 665, 0, 683]]
5
68
<?php list($a, $b, $c) = ints(); if($c-$a-$b <= 0)echo "Yes"; echo ($c-$a-$b)*($c-$a-$b)-4*$a*$b>0 ? "Yes": "No"; function str(){ return trim(fgets(STDIN)); } function ints(){ return array_map("intval", explode(" ", trim(fgets(STDIN)))); } function int(){ return intval(trim(fgets(STDIN))); } function chmax(&$a,$...
<?php list($a, $b, $c) = ints(); if($c-$a-$b <= 0){echo "No";exit;} echo ($c-$a-$b)*($c-$a-$b)-4*$a*$b>0 ? "Yes": "No"; function str(){ return trim(fgets(STDIN)); } function ints(){ return array_map("intval", explode(" ", trim(fgets(STDIN)))); } function int(){ return intval(trim(fgets(STDIN))); } function chmax...
[["+", 36, 36, 0, 493, 0, 57, 8, 9, 0, 45], ["-", 0, 493, 0, 57, 8, 608, 0, 609, 0, 610], ["+", 0, 57, 8, 9, 0, 608, 0, 609, 0, 610], ["+", 0, 493, 0, 57, 8, 9, 0, 608, 0, 35], ["+", 0, 493, 0, 57, 8, 9, 0, 1, 0, 141], ["+", 36, 36, 0, 493, 0, 57, 8, 9, 0, 46]]
6
828
//{{{ #include <bits/stdc++.h> using namespace std; const string truename = "Yes"; const string falsename = "No"; struct IoSetup { IoSetup() { cin.tie(nullptr); // ios::sync_with_stdio(false); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); }; } ioSetup; //{{{ rep rrep loop ...
//{{{ #include <bits/stdc++.h> using namespace std; const string truename = "Yes"; const string falsename = "No"; struct IoSetup { IoSetup() { cin.tie(nullptr); // ios::sync_with_stdio(false); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); }; } ioSetup; //{{{ rep rrep loop ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
2,544
#include <bits/stdc++.h> #define int long long #define uint unsigned int #define ld long double #define showoff \ ios::sync_with_stdio(false); \ cin.tie(0); ...
#include <bits/stdc++.h> #define int long long #define uint unsigned int #define ld long double #define showoff \ ios::sync_with_stdio(false); \ cin.tie(0); ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 72], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
254
#include <bits/stdc++.h> using namespace std; using ll = long long; ll N; void dfs(string s, char mx) { if (s.size() == N) { cout << s << '\n'; return; } for (char c = 'a'; c <= mx + 1; c++) { dfs(s + c, max((int)c, mx + 1)); } } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >>...
#include <bits/stdc++.h> using namespace std; using ll = long long; ll N; void dfs(string s, char mx) { if (s.size() == N) { cout << s << '\n'; return; } for (char c = 'a'; c <= mx + 1; c++) { dfs(s + c, max(c + 0, mx + 0)); } } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> ...
[["-", 3, 4, 0, 2, 3, 4, 0, 74, 0, 24], ["-", 0, 2, 3, 4, 0, 74, 39, 77, 39, 40], ["-", 3, 4, 0, 2, 3, 4, 0, 74, 0, 25], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
126
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) // int main(){ // A /* vector<int> a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; int K; cin>>K; cout<<a[K-1]<<endl; */ // B /* long long H,W; cin>>H>>W; if(H==1||W==1)...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) // int main(){ // A /* vector<int> a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; int K; cin>>K; cout<<a[K-1]<<endl; */ // B /* long long H,W; cin>>H>>W; if(H==1||W==1)...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
126
N = int(input()) chl = "abcdefghijk" chli = { 'a':0, 'b':1, 'c':2, 'd':3, 'e':4, 'f':5, 'g':6, 'h':7, 'i':8, 'j':9 } def ret(M): if M == 1: return "a" retl = [] for stra in ret(M-1): maxi = min(chli[stra[-1]] + 2, 10) cand = chl[:maxi] for ch in cand: retl.append(stra + ...
N = int(input()) chl = "abcdefghijk" chli = { 'a':0, 'b':1, 'c':2, 'd':3, 'e':4, 'f':5, 'g':6, 'h':7, 'i':8, 'j':9 } def ret(M): if M == 1: return "a" retl = [] for stra in ret(M-1): maxi = min(chli[sorted(stra)[-1]] + 2, 10) cand = chl[:maxi] for ch in cand: retl.append...
[["+", 0, 657, 31, 206, 206, 206, 51, 652, 63, 22], ["+", 31, 206, 206, 206, 51, 652, 3, 4, 0, 24], ["+", 31, 206, 206, 206, 51, 652, 3, 4, 0, 25]]
5
159
from string import ascii_lowercase as alph def gen_pattern(N, pre=""): for c in alph[:ord(max(pre or "\x60"))-0x5f]: pattern = pre+c if len(pattern) == N: yield pattern else: yield from gen_pattern(N, pattern) for pattern in gen_pattern(3): print(pattern)
from string import ascii_lowercase as alph def gen_pattern(N, pre=""): for c in alph[:ord(max(pre or "\x60"))-0x5f]: pattern = pre+c if len(pattern) == N: yield pattern else: yield from gen_pattern(N, pattern) for pattern in gen_pattern(int(input())): print(pattern)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
75
from string import ascii_lowercase as alph def gen_pattern(N, pre="", m=-1): for i, c in enumerate(alph[:m+2]): pat = pre+c if len(pattern) == N: yield pattern else: yield from gen_pattern(N, pat, max(i,m)) for pattern in gen_pattern(int(input())): print(pattern)
from string import ascii_lowercase as alph def gen_pattern(N, pre="", m=-1): for i, c in enumerate(alph[:m+2]): pat = pre+c if len(pat) == N: yield pat else: yield from gen_pattern(N, pat, max(i,m)) for pattern in gen_pattern(int(input())): print(pattern)
[["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 286, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 286, 0, 22]]
5
87
from itertools import product, combinations_with_replacement N=int(input()) s="abcdefghij" def get_gen(a, N): for c in s[:s.index(max(a))+2]: t = a+c if len(t) == N: print(t) else: get_gen(t,N) get_gen("a", N)
from itertools import product, combinations_with_replacement N=int(input()) s="abcdefghij" def get_gen(a, N): for c in s[:s.index(max(a))+2 if a else 1]: t = a+c if len(t) == N: print(t) else: get_gen(t,N) get_gen("", N)
[["+", 0, 7, 12, 206, 206, 663, 0, 41, 0, 121], ["+", 0, 7, 12, 206, 206, 663, 0, 41, 0, 22], ["+", 0, 7, 12, 206, 206, 663, 0, 41, 0, 95], ["+", 0, 7, 12, 206, 206, 663, 0, 41, 0, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
79
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) #define all(a) (a).begin(), (a).end() #define dunk(a) cout << (a) << endl #define rall(a) (a).rbegin(), (a).rend() const int INF = 2e9; using namespace std; using Graph = vector<vector<int>>; typedef pair<int, int> P; typedef long long ll; int n; ...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); ++i) #define all(a) (a).begin(), (a).end() #define dunk(a) cout << (a) << endl #define rall(a) (a).rbegin(), (a).rend() const int INF = 2e9; using namespace std; using Graph = vector<vector<int>>; typedef pair<int, int> P; typedef long long ll; int n; ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
157
#include <stdio.h> int N; void makestr(char *str, int cnt, char max) { if (cnt == N) { printf("%s\n", str); } else { for (char add = 'a'; add <= max; add++) { str[cnt] = add; if (add == max) makestr(str, cnt + 1, 1 + max); else makestr(str, cnt + 1, max); } } } int...
#include <stdio.h> int N; void makestr(char *str, int cnt, char max) { if (cnt == N) { printf("%s\n", str); } else { for (char add = 'a'; add <= max; add++) { str[cnt] = add; if (add == max) makestr(str, cnt + 1, 1 + max); else makestr(str, cnt + 1, max); } } } int...
[["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 8, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 1, 0, 11, 12, 103, 0, 104], ["+", 0, 7, 8, 1, 0, 11, 12, 103, 0, 44]]
0
152
N = int(input()) alphabet_list = [chr(i) for i in range(97, 97 + N)] import collections previous_list = ["a"] for i in range(1, N): out_list = [] for a in previous_list: # print(len(collections.Counter(a))) for al in alphabet_list[:len(collections.Counter(a))+2]: # print(a + al) ...
N = int(input()) alphabet_list = [chr(i) for i in range(97, 97 + N)] import collections previous_list = ["a"] for i in range(1, N): out_list = [] for a in previous_list: # print(len(collections.Counter(a))) for al in alphabet_list[:len(collections.Counter(a))+1]: # print(a + al) ...
[["-", 0, 7, 12, 206, 206, 663, 0, 657, 12, 612], ["+", 0, 7, 12, 206, 206, 663, 0, 657, 12, 612]]
5
96
N = int(input()) char = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] def search(arr): global N, char if len(arr) == N: ans = ''.join([char[x] for x in arr]) print(ans) return else: for i in range(arr[-1] + 2): arr_next = arr + [i] search(arr_next) search([0])
N = int(input()) char = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] def search(arr): global N, char if len(arr) == N: ans = ''.join([char[x] for x in arr]) print(ans) return else: for i in range(max(arr) + 2): arr_next = arr + [i] search(arr_next) search([0])
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 73], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25...
5
125
#include <bits/stdc++.h> #include <stdlib.h> #include <string> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define inf 1001001001 #define mod 1000000007 #define pi 3.141592653589793 int nx[4] = {0, -1, 0, 1}; int ny[4] = {-1, 0, 1, 0}; ll gcd(ll a, ll b) { if (b > ...
#include <bits/stdc++.h> #include <stdlib.h> #include <string> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define inf 1001001001 #define mod 1000000007 #define pi 3.141592653589793 int nx[4] = {0, -1, 0, 1}; int ny[4] = {-1, 0, 1, 0}; ll gcd(ll a, ll b) { if (b > ...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
216
// https://ei1333.github.io/luzhiled/ // http://beet-aizu.hatenablog.com/entry/2017/01/04/113233 // http://www.prefield.com/algorithm/ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; using vd = vector<ld>; using vs = vector<string>; using vb = vector<bo...
// https://ei1333.github.io/luzhiled/ // http://beet-aizu.hatenablog.com/entry/2017/01/04/113233 // http://www.prefield.com/algorithm/ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; using vd = vector<ld>; using vs = vector<string>; using vb = vector<bo...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
801
import sys sys.setrecursionlimit(10**8) alpha = "abcdefghij" ans = [] N = int(input()) def get_right(S): alpha_idx = 0 for i in range(len(S)): idx = S.find(alpha[i]) if idx > 0: alpha_idx = idx return alpha_idx + 2 def dfs(S): if len(S) == N: ans.append(S) els...
import sys sys.setrecursionlimit(10**8) alpha = "abcdefghij" ans = [] N = int(input()) def get_right(S): alpha_idx = 0 for i in range(len(S)): flag = S.find(alpha[i]) if flag > 0: alpha_idx = i return alpha_idx + 2 def dfs(S): if len(S) == N: ans.append(S) els...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22]]
5
138
#include <bits/stdc++.h> using namespace std; vector<string> ans; void dfs(int l = 1, int n = 0, string s = "") { if (l == 0) { ans.push_back(s); return; } for (int i = 0; i <= n; i++) { s.push_back('a' + i); dfs(l - 1, i + 1, s); s.pop_back(); } } int main() { int n; cin >> n; dfs...
#include <bits/stdc++.h> using namespace std; vector<string> ans; void dfs(int l = 1, int n = 0, string s = "") { if (l == 0) { ans.push_back(s); return; } for (int i = 0; i <= n; i++) { s.push_back('a' + i); dfs(l - 1, max(n, i + 1), s); s.pop_back(); } } int main() { int n; cin >> n...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
130
#include <bits/stdc++.h> using namespace std; // 総数を1000000007(素数)で割った余り const long long mod = 1e9 + 7; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define ull unsigned long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vc vector<char> #define vs vec...
#include <bits/stdc++.h> using namespace std; // 総数を1000000007(素数)で割った余り const long long mod = 1e9 + 7; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define ull unsigned long long #define ld long double #define vi vector<int> #define vll vector<ll> #define vc vector<char> #define vs vec...
[["-", 3, 4, 0, 41, 64, 23, 0, 16, 31, 22], ["+", 3, 4, 0, 41, 64, 23, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 41, 75, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 41, 75, 22]]
1
302
n=int(input()) abc='abcdefghij' def dfs(i,a,s): if i==n: print(s) else: for j in range(0,a+1): dfs(i+1,j+1,s+abc[j]) dfs(0,0,'')
n=int(input()) abc='abcdefghij' def dfs(i,a,s): if i==n: print(s) else: for j in range(0,a+1): dfs(i+1,max(a,j+1),s+abc[j]) dfs(0,0,'')
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
72
/** * 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...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
384
n=int(input()) a=[[] for _ in range(n)] a[0]="a" al=["a","b","c","d","e","f","g","h","i","j"] b=[[] for _ in range(n)] b[0]=[1] for i in range(1,n): for j in range(len(a[i-1])): for k in range(b[i-1][j]+1): a[i].append(a[i-1][j]+al[k]) if b[i-1][j]<=i+1: b[i].append(b...
n=int(input()) a=[[] for _ in range(n)] a[0]="a" al=["a","b","c","d","e","f","g","h","i","j"] b=[[] for _ in range(n)] b[0]=[1] for i in range(1,n): for j in range(len(a[i-1])): for k in range(b[i-1][j]+1): a[i].append(a[i-1][j]+al[k]) if b[i-1][j]>=k+1: b[i].append(b...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22]]
5
240
// g++ -std=c++14 test.cpp -o test.out #include <algorithm> #include <bitset> #include <cassert> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <utility> #include <vector> ...
// g++ -std=c++14 test.cpp -o test.out #include <algorithm> #include <bitset> #include <cassert> #include <functional> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <utility> #include <vector> ...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
204
N = int(input()) alphabets = "abcdefghijklmnopqrstuvwxyz" def dfs(s, max_idx): if len(s) == N: print(s) return else: for i in range(0, max_idx+1): t = s t = t + alphabets[i] dfs(t, max(i, max_idx)) dfs("a", 1)
N = int(input()) alphabets = 'abcdefghijklmnopqrstuvwxyz' def dfs(s, max_idx): if len(s) == N: print(s) return else: for i in range(0, max_idx+2, 1): t = s t = t + alphabets[i] dfs(t, max(i, max_idx)) dfs("", -1)
[["-", 0, 656, 0, 1, 0, 662, 12, 557, 0, 654], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 654], ["-", 0, 656, 0, 1, 0, 662, 12, 557, 0, 655], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 655], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", ...
5
78
#include <iostream> #include <string> int N; using namespace std; void dfs(string s, char mx) { if (s.length() == N) cout << s << endl; else { for (int i = 'a'; i <= mx; i++) { if (i == mx) dfs(s += i, mx + 1); else dfs(s += i, mx); } } } int main() { cin >> N; dfs("...
#include <iostream> #include <string> int N; using namespace std; void dfs(string s, char mx) { if (s.length() == N) cout << s << endl; else { for (char i = 'a'; i <= mx; i++) { if (i == mx) dfs(s + i, mx + 1); else dfs(s + i, mx); } } } int main() { cin >> N; dfs("...
[["-", 75, 76, 0, 9, 0, 7, 10, 43, 39, 40], ["+", 75, 76, 0, 9, 0, 7, 10, 43, 39, 40], ["-", 64, 1, 0, 2, 3, 4, 0, 11, 17, 107], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 11, 17, 107], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72]]
1
109
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; const double eps = 1e-8; const int NINF = 0xc0c0c0c0; const int INF = 0x3f3f3f3f; const ll mod = 1e9 + 7; const ll maxn = 1e6 + 5; int n, a[100]; void dfs(int p, int lim) { if (p == n + 1) { for (int i = 1; i <= n; i++...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; const double eps = 1e-8; const int NINF = 0xc0c0c0c0; const int INF = 0x3f3f3f3f; const ll mod = 1e9 + 7; const ll maxn = 1e6 + 5; int n, a[100]; void dfs(int p, int lim) { if (p == n + 1) { for (int i = 1; i <= n; i++...
[["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]]
1
191
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from math import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 n=int(input()) al=[chr(ord('a') + ...
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from math import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 n=int(input()) al=[chr(ord('a') + ...
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 73], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25...
5
220
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; // const ull mod = 1e9 + 7; const ll mod = 1e9 + 7; #define REP(i, n) for (int i = 0; i < (int)n; ++i) // debug #define dump(x) ce...
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; // const ull mod = 1e9 + 7; const ll mod = 1e9 + 7; #define REP(i, n) for (int i = 0; i < (int)n; ++i) // debug #define dump(x) ce...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
534
N = int(input()) lst = [] m = 0 temp = [[0]] while temp: p = temp.pop() if len(p)==N: lst.append(p) else: for i in range(p[-1]+2): s = p[:] s.append(i) temp.append(s) lst.sort() abc = 'abcdefghij' for l in lst: print(*[abc[i] for i in l], sep='')
N = int(input()) lst = [] m = 0 temp = [[0]] while temp: p = temp.pop() if len(p)==N: lst.append(p) else: for i in range(max(p)+2): s = p[:] s.append(i) temp.append(s) lst.sort() abc = 'abcdefghij' for l in lst: print(*[abc[i] for i in l], sep='')
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 73], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25...
5
114
#include <algorithm> #include <cmath> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++) #define REPR(i, n)...
#include <algorithm> #include <cmath> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define REP(i, n) for (ll i = 0; i < n; i++) #define REPR(i, n)...
[["+", 0, 2, 3, 4, 0, 2, 63, 118, 17, 131], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
1
192
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n + 1; i++) #define sort(A) sort(A.begin(), A.end()) #define reverse(A) reverse(A.begin(), A.end()); typedef long long ll; int n; void dfs(string s, char mc) { if (s.size() == n) { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i < n + 1; i++) #define sort(A) sort(A.begin(), A.end()) #define reverse(A) reverse(A.begin(), A.end()); typedef long long ll; int n; void dfs(string s, char mc) { if (s.size() == n) { ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
127
n = int(input()) def dfs(s): if len(s) == n: print(s) else: for i in range(ord(s[len(s) - 1]) - ord('a') + 2): dfs(s + chr(i + ord('a'))) s = 'a' dfs(s)
n = int(input()) def dfs(s): if len(s) == n: print(s) else: for i in range(ord(max(s)) - ord('a') + 2): dfs(s + chr(i + ord('a'))) s = 'a' dfs(s)
[["-", 31, 657, 31, 652, 3, 4, 0, 206, 51, 22], ["-", 31, 657, 31, 652, 3, 4, 0, 206, 0, 70], ["-", 3, 4, 0, 206, 206, 657, 31, 652, 63, 22], ["+", 31, 657, 31, 652, 3, 4, 0, 652, 63, 22], ["-", 31, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["-", 31, 652, 3, 4, 0, 206, 206, 657, 12, 612], ["-", 31, 657, 31, 652, 3, 4, 0, 2...
5
81
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define all(v) (v).begin(), (v).end() #define fi first #define se second #define sz(x) ((int)(x).size()) using ll = long long; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define MOD 1000000007 c...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define all(v) (v).begin(), (v).end() #define fi first #define se second #define sz(x) ((int)(x).size()) using ll = long long; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define MOD 1000000007 c...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
245
#include <algorithm> #include <array> #include <cmath> #include <iostream> #include <memory> #include <numeric> #include <string> #include <utility> #include <vector> using namespace std; //変数デバッグ #define DEB(variable) cout << #variable << '=' << variable << endl // for簡易表記(引数ミス防止) #define FOR(LoopVariable, numberOFbe...
#include <algorithm> #include <array> #include <cmath> #include <iostream> #include <memory> #include <numeric> #include <string> #include <utility> #include <vector> using namespace std; //変数デバッグ #define DEB(variable) cout << #variable << '=' << variable << endl // for簡易表記(引数ミス防止) #define FOR(LoopVariable, numberOFbe...
[["-", 0, 2, 3, 4, 0, 23, 0, 41, 75, 22], ["+", 0, 2, 3, 4, 0, 23, 0, 41, 75, 22]]
1
205
n = int(input()) A = ['a'] S = 'abcdefghij' for _ in range(n-1): A = [ a + s for a in A for s in S[:len(a) + 1]] print('\n'.join(A))
n = int(input()) A = 'a' S = 'abcdefghij' for _ in range(n-1): A = [ a + s for a in A for s in S[:len(set(a)) + 1]] print('\n'.join(A))
[["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 70], ["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 73], ["+", 0, 657, 31, 652, 3, 4, 0, 652, 63, 22], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
65
n = int(input()) A = ['a'] S = 'abcdefghij' for _ in range(n-1): A = [ a + s for a in A for s in S[:len(a) + 1]] print('\n'.join(A))
n = int(input()) A = ['a'] S = 'abcdefghij' for _ in range(n-1): A = [ a + s for a in A for s in S[:len(set(a)) + 1]] print('\n'.join(A))
[["+", 0, 657, 31, 652, 3, 4, 0, 652, 63, 22], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
65
def f(n, count=0, i=0, lst=[]): global ans if count == n: s = "" for j in range(count): s += chr(ord("a") + lst[j]) ans.append(s) return if i == 0: lst.append(i) f(n, count + 1, i=i+1, lst=lst) else: for j in range(i + 1): f...
def f(n, count=0, i=0, lst=[]): global ans if count == n: s = "" for j in range(count): s += chr(ord("a") + lst[j]) ans.append(s) return if i == 0: lst.append(i) f(n, count + 1, i=i+1, lst=lst) else: for j in range(i + 1): f...
[["+", 0, 653, 51, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 653, 51, 652, 3, 4, 0, 657, 12, 612]]
5
165
N = int(input()) ans = [] def next_chr(ch): res = [] g = ord(ch) - ord("a") + 2 for i in range(g): res.append(chr(ord("a")+i)) return res def answer(s, i): if i == N: ch = next_chr(max(s)) for m in ch: ans.append("".join([s, m])) else: i += 1 ...
N = int(input()) ans = [] def next_chr(ch): res = [] g = ord(ch) - ord("a") + 2 for i in range(g): res.append(chr(ord("a")+i)) return res def answer(s, i): if i == N: ch = next_chr(max(s)) for m in ch: ans.append("".join([s, m])) else: i += 1 ...
[["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 662, 12, 652, 3, 4, 0, 206, 0, 70], ["-", 12, 652, 3, 4, 0, 206, 206, 664, 17, 33], ["-", 12, 652, 3, 4, 0, 206, 206, 664, 28, 612], ["-", 0, 662, 12, 652, 3, 4, 0, 206, 0, 73], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
178
N = int(input()) answer = [(97, 'a')] for _ in range(N - 1): new_answer = [] for i, j in answer: for k in range(97, i + 1): new_answer.append((k, j + chr(k))) new_answer.append((i+1,j+chr(i+1))) answer = new_answer[:] answer = [j for _, j in answer] answer.sort() print('\n'.joi...
N = int(input()) answer = [(97, 'a')] for _ in range(N - 1): new_answer = [] for i, j in answer: for k in range(97, i + 1): new_answer.append((i, j + chr(k))) new_answer.append((i+1,j+chr(i+1))) answer = new_answer[:] answer = [j for _, j in answer] answer.sort() print('\n'.joi...
[["-", 0, 1, 0, 652, 3, 4, 0, 660, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 660, 0, 22]]
5
119
alpha_small_ = [chr(i) for i in range(97, 97+26)] #アルファベッドの小文字 n = int(input()) ans = [] def solve(now,i): if len(now) == n: ans.append(now) return for j in range(i+1): solve(now+alpha_small_[j],j+1) solve("a",1) for x in sorted(ans): print(x)
alpha_small_ = [chr(i) for i in range(97, 97+26)] #アルファベッドの小文字 n = int(input()) ans = [] def solve(now,i): if len(now) == n: ans.append(now) return for j in range(i+1): solve(now+alpha_small_[j],max(i,j+1)) solve("a",1) for x in sorted(ans): print(x)
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
98
#include <bits/stdc++.h> #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rrepi(i, a, b) for (int i = ((int)(b)-1); i >= (a); --i) #define rep(i, n) repi(i, 0, n) #define rrep(i, n) rrepi(i, 0, n) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define ZERO(x) memset(x, 0, s...
#include <bits/stdc++.h> #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rrepi(i, a, b) for (int i = ((int)(b)-1); i >= (a); --i) #define rep(i, n) repi(i, 0, n) #define rrep(i, n) rrepi(i, 0, n) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define ZERO(x) memset(x, 0, s...
[["+", 0, 30, 0, 122, 8, 123, 0, 124, 0, 32], ["+", 0, 30, 0, 122, 8, 123, 0, 124, 365, 13]]
1
760
import string def generate(n, res, cur = None, alphabet = None): if cur is None: cur = [] if alphabet is None: alphabet = list(string.ascii_lowercase)[::-1] if n == 0: res.append(''.join(cur)) return for i in range(len(cur)): cur.append(cur[i]) generate(n...
import string def generate(n, res, cur = None, alphabet = None): if cur is None: cur = [] if alphabet is None: alphabet = list(string.ascii_lowercase)[::-1] if n == 0: res.append(''.join(cur)) return for i in range(len(cur)): cur.append(cur[i]) generate(n...
[["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
165
N = int(input()) W = 'abcdefghij' ans = set() for i in range(1,N+1): if i == 1: ans.add('a') else: tmp = set() for a in ans: index = W.index(sorted(list(a))[-1]) for i in range(index+2): tmp.add(a+W[i]) ans = tmp for a in ans: print(a)
N = int(input()) W = 'abcdefghij' ans = set() for i in range(1,N+1): if i == 1: ans.add('a') else: tmp = set() for a in ans: index = W.index(sorted(list(a))[-1]) for i in range(index+2): tmp.add(a+W[i]) ans = tmp for a in sorted(ans): print(a)
[["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25]]
5
106
def main(n): if n == 1: return ['a'] else: ans = [] for a in main(n-1): b = '`' while b <= a[-1]: b = chr(ord(b) + 1) ans.append(a + str(b)) return ans N = int(input()) L = main(N) for i in L: print(i)
def main(n): if n == 1: return ['a'] else: ans = [] for a in main(n-1): b = '`' while b <= max(a): b = chr(ord(b) + 1) ans.append(a + str(b)) return ans N = int(input()) L = main(N) for i in L: print(i)
[["+", 8, 196, 0, 52, 15, 666, 0, 652, 63, 22], ["+", 0, 52, 15, 666, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 52, 15, 666, 0, 206, 0, 70], ["-", 0, 52, 15, 666, 0, 206, 206, 664, 17, 33], ["-", 0, 52, 15, 666, 0, 206, 206, 664, 28, 612], ["-", 8, 196, 0, 52, 15, 666, 0, 206, 0, 73], ["+", 0, 52, 15, 666, 0, 652, 3, 4, 0...
5
94
#include <algorithm> #include <iostream> #include <string> using namespace std; void dict(char *word, int current, int cm, int n) { int i; for (i = 0; i <= cm; i++) { word[current] = 'a' + i; if (current == n - 1) { int j; for (j = 0; j < n; j++) cout << word[j]; cout << endl; ...
#include <algorithm> #include <iostream> #include <string> using namespace std; void dict(char *word, int current, int cm, int n) { int i; for (i = 0; i <= cm; i++) { word[current] = 'a' + i; if (current == n - 1) { int j; for (j = 0; j < n; j++) cout << word[j]; cout << endl; ...
[["-", 0, 2, 3, 4, 0, 16, 31, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
150
def deep(d,i,s) if d == $n $ans.push(s.join) return end (0..i).each do |j| s.push($t[j]) deep(d+1,j+1,s) s.pop end end $ans = [] $t = "abcdefghijkllm".split("") $n = gets.to_i deep(0,0,[]) puts $ans.sort
def deep(d,i,s) if d == $n $ans.push(s.join) return end (0..i).each do |j| s.push($t[j]) deep(d+1,[i,j+1].max,s) s.pop end end $ans = [] $t = "abcdefghijkllm".split("") $n = gets.to_i deep(0,0,[]) puts $ans.sort
[["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 70], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 73], ["+", 8, 736, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 8, 736, 0, 652, 3, 4, 0, 652, 735, 22]]
4
93
from collections import deque N = int(input()) alpha = ['a','b','c','d','e','f','g','h','i','j'] ans = [] stack = deque(['a']) while stack: if len(stack[-1]) == N: break s = stack.pop() s_list = list(s) index = alpha.index(s_list[-1]) for i in range(index+2): stack.appendleft(s+alp...
from collections import deque N = int(input()) alpha = ['a','b','c','d','e','f','g','h','i','j'] ans = [] stack = deque(['a']) while stack: if len(stack[-1]) == N: break s = stack.pop() s_list = sorted(list(s)) index = alpha.index(s_list[-1]) for i in range(index+2): stack.appendle...
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
154
from string import ascii_lowercase def resolve(): n = int(input()) l = [[0]] for i in range(1, n): ll = [] for j in l: for k in range(j[-1] + 2): ll.append(j + [k]) l = ll for i in l: print("".join([ascii_lowercase[x] for x in i])) if __name_...
from string import ascii_lowercase def resolve(): n = int(input()) l = [[0]] for i in range(1, n): ll = [] for j in l: for k in range(max(j) + 2): ll.append(j + [k]) l = ll for i in l: print("".join([ascii_lowercase[x] for x in i])) if __name...
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 73], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25...
5
104
#include <iostream> #include <string> #include <vector> using namespace std; void func(int num, int N, int max, string s) { if (num > N) { cout << s << endl; } else { for (int i = 'a'; i < max + 1; i++) { if (i == max) { func(num + 1, N, max + 1, s + (char)i); } else { func(num ...
#include <iostream> #include <string> #include <vector> using namespace std; void func(int num, int N, int max, string s) { if (num > N) { cout << s << endl; } else { for (int i = 'a'; i < max + 1; i++) { if (i == max) { func(num + 1, N, max + 1, s + (char)i); } else { func(num ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
143
n = int(input()) strings = ["a"] for i in range(n-1): newstrings = [] for s in strings: mx = ord('a') for char in s: mx = max(mx, ord(char)) for c in range(ord('a'),mx+2): newstrings.append(s+chr(c)) strings = newstrings print(strings)
n = int(input()) strings = ["a"] for i in range(n-1): newstrings = [] for s in strings: mx = ord('a') for char in s: mx = max(mx, ord(char)) for c in range(ord('a'),mx+2): newstrings.append(s+chr(c)) strings = newstrings for s in strings: ...
[["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
93
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ll long long #define pb push_back #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define rs(v, n) v.resize(n) #define hell 100000...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ll long long #define pb push_back #define vi vector<ll int> #define all(a) (a).begin(), (a).end() #define F first #define S second #define rs(v, n) v.resize(n) #define hell 100000...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
549
#include <algorithm> #include <bitset> #include <cmath> #include <cstdint> #include <functional> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define N_TIMES(i, n) for (u...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdint> #include <functional> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define N_TIMES(i, n) for (u...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
207
#include <algorithm> #include <bitset> #include <cmath> #include <cstdint> #include <functional> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define N_TIMES(i, n) for (u...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdint> #include <functional> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define N_TIMES(i, n) for (u...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
246
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; // vector<string> s; int max_n; void dfs(int n, string t, int m) { char tmp; for (int i = 0; i < (max_n - n) + 1; i++) { tmp = 97 + i; if (i <= m + 1) { string p = t + tmp; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; // vector<string> s; int max_n; void dfs(int n, string t, int m) { char tmp; for (int i = 0; i < (max_n - n) + 1; i++) { tmp = 97 + i; if (i <= m + 1) { string p = t + tmp; ...
[["+", 64, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
157
#include <algorithm> #include <iostream> #include <map> #include <vector> using ll = unsigned long long; using mymap = std::map<std::pair<char, int>, std::vector<std::string>>; mymap memo; std::vector<std::string> f(char c, char max_c, int depth) { if (depth == 1) { std::string s; s.push_back(c); retur...
#include <algorithm> #include <iostream> #include <map> #include <vector> using ll = unsigned long long; using mymap = std::map<std::pair<char, int>, std::vector<std::string>>; mymap memo; std::vector<std::string> f(char c, char max_c, int depth) { if (depth == 1) { std::string s; s.push_back(c); retur...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
245
/*by freesteed*/ #include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define pb push_back #define fill(x, c) memset(x, c, sizeof(x)) #define fi first #define se second #define sz(A) (int)(A.size()) #define all(x) (x).begin(), (x).end() #define caset ...
/*by freesteed*/ #include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < n; i++) #define pb push_back #define fill(x, c) memset(x, c, sizeof(x)) #define fi first #define se second #define sz(A) (int)(A.size()) #define all(x) (x).begin(), (x).end() #define caset ...
[["-", 0, 14, 8, 9, 0, 1, 0, 191, 39, 78], ["-", 8, 9, 0, 1, 0, 191, 51, 83, 0, 45], ["-", 51, 83, 0, 2, 3, 4, 0, 25, 0, 46], ["-", 36, 36, 0, 30, 0, 14, 8, 9, 0, 46]]
1
375
import random as rng import itertools as it import collections as col import heapq as hq import sys import copy as cp sys.setrecursionlimit(10**9) def dump_impl(*objects): print(*objects, file=sys.stderr) def dump_dummy(*objects): pass dump = dump_impl if "DEBUG" in sys.argv else dump_dummy def f(s, m, ...
import random as rng import itertools as it import collections as col import heapq as hq import sys import copy as cp sys.setrecursionlimit(10**9) def dump_impl(*objects): print(*objects, file=sys.stderr) def dump_dummy(*objects): pass dump = dump_impl if "DEBUG" in sys.argv else dump_dummy def f(s, m, ...
[["+", 3, 4, 0, 41, 0, 666, 0, 657, 17, 33], ["+", 3, 4, 0, 41, 0, 666, 0, 657, 12, 612]]
5
162
n = int(input()) def print_from_l(l): print(''.join(map(lambda s:chr(97+s), l))) def g(l): if len(l) == n: print_from_l(l) else: for i in range(l[-1]+2): g(l + [i]) g([0])
n = int(input()) def print_from_l(l): print(''.join(map(lambda s:chr(97+s), l))) def g(l): if len(l) == n: print_from_l(l) else: for i in range(max(l)+2): g(l + [i]) g([0])
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 73], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25...
5
85
n = int(input()) a = [0]*n def print_str(): for i in reversed(a): print(chr(97+i), end='') print() print_str() while True: for i in range(n-1): if a[i] <= a[i+1]: a[i] += 1 for j in range(i): a[j] = 0 print_str() break els...
n = int(input()) a = [0]*n def print_str(): for i in reversed(a): print(chr(97+i), end='') print() print_str() while True: for i in range(n-1): if a[i] <= max(a[i+1:]): a[i] += 1 for j in range(i): a[j] = 0 print_str() break ...
[["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
101
# -*- coding: utf-8 -*- from collections import deque import copy str_list_befor = ['0', '1', '2','3','4','5', '6', '7','8','9'] str_list_after = ['a', 'b', 'c','d','e','f', 'g', 'h','i','j'] n = int(input()) dq = deque() dq.append([0]) if n > 1: for i in range(n-1): # print("i: " + str(i)) for j ...
# -*- coding: utf-8 -*- from collections import deque import copy str_list_befor = ['0', '1', '2','3','4','5', '6', '7','8','9'] str_list_after = ['a', 'b', 'c','d','e','f', 'g', 'h','i','j'] n = int(input()) dq = deque() dq.append([0]) if n > 1: for i in range(n-1): # print("i: " + str(i)) for j ...
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 73], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25...
5
252
import math N = int(input()) ZL = [[] for _ in range(N)] ZL[0].append([0]) for i in range(1, N): for szl in ZL[i - 1]: n1 = szl[-1] for j in range(n1 + 2): ZL[i].append(szl + [j]) def func(i): if i == 0: return "a" if i == 1: return "b" if i == 2: r...
import math N = int(input()) ZL = [[] for _ in range(N)] ZL[0].append([0]) for i in range(1, N): for szl in ZL[i - 1]: n1 = max(szl) for j in range(n1 + 2): ZL[i].append(szl + [j]) def func(i): if i == 0: return "a" if i == 1: return "b" if i == 2: ...
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 662, 12, 206, 0, 70], ["-", 0, 1, 0, 662, 12, 206, 206, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 206, 206, 664, 28, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 206, 0, 73], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
238
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
[["+", 0, 11, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 64, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 13]]
1
517
#include <bits/stdc++.h> using namespace std; #define REP(i, x, n) for (int i = x; i < (int)n; i++) #define rep(i, n) REP(i, 0, n) #define sp(p) cout << setprecision(16) << fixed << p << endl; #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define SORT(a) sort(all(a)) #define RSORT(a) sort(rall(...
#include <bits/stdc++.h> using namespace std; #define REP(i, x, n) for (int i = x; i < (int)n; i++) #define rep(i, n) REP(i, 0, n) #define sp(p) cout << setprecision(16) << fixed << p << endl; #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define SORT(a) sort(all(a)) #define RSORT(a) sort(rall(...
[["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 103, 0, 104], ["+", 8, 9, 0, 43, 49, 50, 51, 103, 0, 125]]
1
621
n=int(input()) tree = [[0,1]] for _ in range(n-1): tree = [ t+[i] for t in tree for i in range(1,t[-1]+2) ] for t in tree: print( "".join([chr(ord("a")+tt-1) for tt in t[1:] ] ) )
n=int(input()) tree = [[0,1]] for _ in range(n-1): tree = [ t+[i] for t in tree for i in range(1,max(t)+2) ] for t in tree: print( "".join([chr(ord("a")+tt-1) for tt in t[1:] ] ) )
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 73], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25...
5
92
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair<int, int>;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, n) for (int i = n - 1; i >= 0; --i) #define fi first #define se second using namespace std; using lint = long long; using uint = unsigned int; using ulint = unsigned long long; using ldouble = long double; using pii = pair<int, int>;...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
448
#include <algorithm> #include <cstdlib> #include <iostream> using namespace std; string s; int n; void dfs(int depth, int last) { if (depth == n) { cout << s << "\n"; return; } for (int i = 0; i <= last + 1; i++) { s[depth] = 'a' + i; dfs(depth + 1, i); } } int main() { cin >> n; for (in...
#include <algorithm> #include <cstdlib> #include <iostream> using namespace std; string s; int n; void dfs(int depth, int last) { if (depth == n) { cout << s << "\n"; return; } for (int i = 0; i <= last + 1; i++) { s[depth] = 'a' + i; dfs(depth + 1, max(last, i)); } } int main() { cin >> n...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
126
#include <bits/stdc++.h> using namespace std; int n; char a[110]; void f(int here, int last) { if (here == n) { printf("%s\n", a); return; } for (int i = 0; i <= last + 1; i++) { a[here] = i + 'a'; f(here + 1, i); } } int main(void) { scanf("%d", &n); f(0, -1); return 0; }
#include <bits/stdc++.h> using namespace std; int n; char a[110]; void f(int here, int last) { if (here == n) { printf("%s\n", a); return; } for (int i = 0; i <= last + 1; i++) { a[here] = i + 'a'; f(here + 1, max(last, i)); } } int main(void) { scanf("%d", &n); f(0, -1); return 0; ...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
111
l = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n"] n = int(input()) ans = [[] for i in range(n)] ans[0].append("a") for i in range(1,n): print(ans) for j in ans[i-1]: a = 0 for k in j: a = max(a,ord(k)-ord("a")) for k in range(a+2): an = j + l[k] ...
l = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n"] n = int(input()) ans = [[] for i in range(n)] ans[0].append("a") for i in range(1,n): for j in ans[i-1]: a = 0 for k in j: a = max(a,ord(k)-ord("a")) for k in range(a+2): an = j + l[k] ans...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
189
import sys sys.setrecursionlimit(10**5+10) alp = 'abcdefghij' N = int(input()) ans = [] def an(i,now,s): global ans if i == N: ans.append(s) else: for j in range(i+1): if j > now+1: continue an(i+1,j,s+alp[j]) an(0,0,'') ans.sort() for i in an...
import sys sys.setrecursionlimit(10**5+10) alp = 'abcdefghij' N = int(input()) ans = [] def an(i,now,s): global ans if i == N: ans.append(s) else: for j in range(i+1): if j > now+1: continue an(i+1,max(j,now),s+alp[j]) an(0,0,'') ans.sort() fo...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
110
import sys n = int(input()) memo_ls = [{i : [] for i in range(11)} for j in range(11)] alpha = "abcdefghijklmnopqrstuvwxyz" #memo_ls[i][j] : i個をjに分ける方法 memo_ls[1][1] = ["a"] for i in range(1,10): for j in range(11): if j > i: continue else: for v in memo_ls[i][j]: ...
import sys n = int(input()) memo_ls = [{i : [] for i in range(11)} for j in range(11)] alpha = "abcdefghijklmnopqrstuvwxyz" #memo_ls[i][j] : i個をjに分ける方法 memo_ls[1][1] = ["a"] for i in range(1,10): for j in range(11): if j > i: continue else: for v in memo_ls[i][j]: ...
[["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
178
import sys input = sys.stdin.readline sys.setrecursionlimit(1000000) from collections import deque, Counter def getN(): return int(input()) def getList(): return list(map(int, input().split())) import math def res(n, cur, ln, k): if ln == n: print(cur) return for i in range(k+2): ...
import sys input = sys.stdin.readline sys.setrecursionlimit(1000000) from collections import deque, Counter def getN(): return int(input()) def getList(): return list(map(int, input().split())) import math def res(n, cur, ln, k): if ln == n: print(cur) return for i in range(k+2): ...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
145
N = int(input()) my_list = [] for i in range(N): if i == 0: my_list.append("a") continue new_list = [] while my_list: s = my_list.pop(0) for j in range(ord("a"), ord(s[-1]) + 2): new_list.append(s + chr(j)) my_list += new_list my_list.sort() [print(s) for s ...
N = int(input()) my_list = [] for i in range(N): if i == 0: my_list.append("a") continue new_list = [] while my_list: s = my_list.pop(0) for j in range(ord("a"), ord(max(s)) + 2): new_list.append(s + chr(j)) my_list += new_list my_list.sort() [print(s) for s...
[["+", 0, 657, 31, 652, 3, 4, 0, 652, 63, 22], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 657, 31, 652, 3, 4, 0, 206, 0, 70], ["-", 31, 652, 3, 4, 0, 206, 206, 664, 17, 33], ["-", 31, 652, 3, 4, 0, 206, 206, 664, 28, 612], ["-", 0, 657, 31, 652, 3, 4, 0, 206, 0, 73], ["+", 31, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
102
#include <bits/stdc++.h> using namespace std; char alphas[26] = {'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'}; int N, x = 0; vector<string> a; void dfs(string S, int n) { if (S.size() == N) ...
#include <bits/stdc++.h> using namespace std; char alphas[26] = {'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'}; int N, x = 0; vector<string> a; void dfs(string S, int n) { if (S.size() == N) ...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
257
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int n; char p[20]; void dfs(int a, int tot) { if (tot == n) { for (int i = 0; i < n; i++) printf("%c", p[i]); cout << endl; return; } for (int i = 0; i <= min(a + 1, tot); i++) { p[tot] = 'a' + i; dfs(i, tot...
#include <algorithm> #include <cstdio> #include <iostream> using namespace std; int n; char p[20]; void dfs(int a, int tot) { if (tot == n) { for (int i = 0; i < n; i++) printf("%c", p[i]); cout << endl; return; } for (int i = 0; i <= min(a + 1, tot); i++) { p[tot] = 'a' + i; dfs(max(a,...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
133
#include <algorithm> #include <cmath> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <vector> using namespace std; #define LOCAL 1 #define UPLOAD 2 #define ll long long const long long INF = 1LL << 60; template <class T = long long> T input() { T x; cin >> x; return x; } temp...
#include <algorithm> #include <cmath> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <vector> using namespace std; #define LOCAL 1 #define UPLOAD 2 #define ll long long const long long INF = 1LL << 60; template <class T = long long> T input() { T x; cin >> x; return x; } temp...
[["-", 8, 9, 0, 338, 12, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 338, 12, 2, 3, 4, 0, 22]]
1
420
#include "bits/stdc++.h" using namespace std; typedef long long ll; // run : ctrl + c template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } int n; void dfs(int p, string...
#include "bits/stdc++.h" using namespace std; typedef long long ll; // run : ctrl + c template <class T> bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, T b) { if (b < a) { a = b; return 1; } return 0; } int n; void dfs(int p, string...
[["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
202
N = int(input()) L = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] ans = [] def f(List, n): if n == N: s = "" for l in List: s += L[l] ans.append(s) return None for i in range(List[-1]+2): f(List+[i], n+1) f([0], 1) ans.sort() for a in ans: ...
N = int(input()) L = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] ans = [] def f(List, n): if n == N: s = "" for l in List: s += L[l] ans.append(s) return None for i in range(max(List)+2): f(List+[i], n+1) f([0], 1) ans.sort() for a in ans: ...
[["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 70], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 17, 33], ["-", 3, 4, 0, 657, 31, 206, 206, 664, 28, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 206, 0, 73], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25...
5
139
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> const int MOD = 1e9 + 7; typedef long long ll; using namespace std; int main() { int n; cin >> n; string s = "aabcdefghijklmnopqrstuvwxyz"; vector<p...
#include <algorithm> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <string> #include <vector> const int MOD = 1e9 + 7; typedef long long ll; using namespace std; int main() { int n; cin >> n; string s = "aabcdefghijklmnopqrstuvwxyz"; vector<p...
[["-", 3, 4, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 3, 4, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
240
N = input() def DFS(s, mx): if len(s) == N: print(s) return c = 'a' while c <= chr(ord(mx)+1): t = s + c DFS(t, chr(max(ord(c), ord(mx)))) c = chr(ord(c) + 1) DFS("", chr(ord('a')-1))
N = int(input()) def DFS(s, mx): if len(s) == N: print(s) return c = 'a' while c <= chr(ord(mx)+1): t = s + c DFS(t, chr(max(ord(c), ord(mx)))) c = chr(ord(c) + 1) DFS("", chr(ord('a')-1))
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
97
#include <bits/stdc++.h> using namespace std; int N; void dfs(string s, char cm) { if (s.size() == N) { cout << s << endl; } else { for (char c = 'a'; c <= cm; c++) { char cc = c; if (cc == cm) cc++; dfs(s + c, cc); } } } int main() { cin >> N; dfs("", 'a'); }
#include <bits/stdc++.h> using namespace std; int N; void dfs(string s, char cm) { if (s.size() == N) { cout << s << endl; } else { for (char c = 'a'; c <= cm; c++) { char cc = cm; if (c == cm) cc = cm + 1; dfs(s + c, cc); } } } int main() { cin >> N; dfs("", 'a'); }
[["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 64, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, ...
1
102
n = gets.chomp.to_i if n == 1 puts 'a' exit end ans = [] alf = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] ans.push('a') (n-1).times do next_ans = [] ans.each do |a| l = a.split('').last ne = l.succ alf.each do |al| if ne >= al next_ans.push(a + al) end end end ans...
n = gets.chomp.to_i if n == 1 puts 'a' exit end ans = [] alf = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] ans.push('a') (n-1).times do next_ans = [] ans.each do |a| ne = a.split('').sort.last.succ alf.each do |al| if ne >= al next_ans.push(a + al) end end end ans = ne...
[["-", 0, 652, 196, 737, 8, 736, 0, 662, 31, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 31, 22], ["+", 0, 662, 12, 652, 486, 652, 486, 652, 735, 22], ["+", 8, 736, 0, 662, 12, 652, 486, 652, 17, 131], ["-", 0, 652, 196, 737, 8, 736, 0, 662, 0, 32], ["-", 196, 737, 8, 736, 0, 662, 12, 652, 486, 22]]
4
146
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define repto(i, n) for (int i = 0; i <= (n); i++) #define all(c) (c).begin(), (c).end() #define uniq(c) c.erase(unique(all(c)), (c).end()) #define _1 first #define _2 second #...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define repto(i, n) for (int i = 0; i <= (n); i++) #define all(c) (c).begin(), (c).end() #define uniq(c) c.erase(unique(all(c)), (c).end()) #define _1 first #define _2 second #...
[["-", 28, 23, 0, 27, 28, 2, 63, 118, 28, 22], ["+", 28, 23, 0, 27, 28, 2, 63, 118, 28, 22]]
1
287
#include <bits/stdc++.h> #define FOR(i, m, n) for (int i = m; i < (n); i++) #define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, n, 0) #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define print(ele) cout << (ele) << endl #define pri...
#include <bits/stdc++.h> #define FOR(i, m, n) for (int i = m; i < (n); i++) #define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, n, 0) #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define print(ele) cout << (ele) << endl #define pri...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
210
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline(...
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline(...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
369
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using ull = long long unsigned; using P = pair<int, int>; const int INF = 1001001; int n; int dfs(string s, int i) { if (s.size() == n) { cout << s << endl; return 0; } for (char c = 'a'; c...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using ull = long long unsigned; using P = pair<int, int>; const int INF = 1001001; int n; int dfs(string s, int i) { if (s.size() == n) { cout << s << endl; return 0; } for (char c = 'a'; c...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
149
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define inf 0x3f3f3f3f #define all(A) A.begin(), A.end() #define allr(A) A.rbegin(), A.rend() #define MOD 1000000007 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n; void dfs(string s, char c) { if (s.size() ...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define inf 0x3f3f3f3f #define all(A) A.begin(), A.end() #define allr(A) A.rbegin(), A.rend() #define MOD 1000000007 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n; void dfs(string s, char c) { if (s.size() ...
[["-", 75, 76, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 22]]
1
191
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < (int)b; i++) #define rep(i, n) REP(i, 0, n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) ...
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for (int i = a; i < (int)b; i++) #define rep(i, n) REP(i, 0, n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) ...
[["+", 0, 42, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
401
# coding: utf-8 n = int(input()) alphas = "abcdefghij" init_str = "" def standard(moji, x): if len(moji) == n: print(moji) else: for j in range(x): if j == x: standard(moji + alphas[j], i + 1) else: standard(moji + alphas[j], i) standar...
# coding: utf-8 n = int(input()) alphas = "abcdefghij" init_str = "" def standard(moji, x): # print("standard({},{})".format(moji,x)) if len(moji) == n: print(moji) else: for j in range(x+1): if j == x: # print("j == x") standard(moji + alphas[j]...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
85
#include <bits/stdc++.h> using namespace std; int n; void printout(vector<char> v, char c, int letters) { v.push_back(c); if (v.size() == n) { for (int i = 0; i < n; ++i) cout << v[i]; cout << '\n'; } else { for (int i = 0; i <= letters; ++i) { if (i == 0) printout(v, 'a' + i, let...
#include <bits/stdc++.h> using namespace std; int n; void printout(vector<char> v, char c, int letters) { v.push_back(c); if (v.size() == n) { for (int i = 0; i < n; ++i) cout << v[i]; cout << '\n'; } else { for (int i = 0; i <= letters; ++i) { if (i == letters) printout(v, 'a' + ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
174
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) using namespace std; typedef long long ll; int N; void dfs(string s, char cmax) { if (s.size() == N) { cout << s << endl; } else { for (char c = 'a'; c <= cmax; c++) { dfs(s + c, c...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) #define rep1(i, n) for (int i = 1; i <= n; ++i) using namespace std; typedef long long ll; int N; void dfs(string s, char cmax) { if (s.size() == N) { cout << s << endl; } else { for (char c = 'a'; c <= cmax; c++) { dfs(s + c, c...
[["-", 0, 41, 64, 74, 51, 23, 0, 16, 31, 22], ["+", 0, 41, 64, 74, 51, 23, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 41, 75, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 41, 75, 22]]
1
139
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < (a + n); i++) #define var auto using namespace std; using ll = long long; int n; char c[11]; void f2(int k, int character) { if (k == n) { cout << c << endl; return; } rep(i, 0, k) { c[k] = 'a' + i; f2(k + 1, character); } c...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < (a + n); i++) #define var auto using namespace std; using ll = long long; int n; char c[11]; void f2(int k, int character) { if (k == n) { cout << c << endl; return; } rep(i, 0, character) { c[k] = 'a' + i; f2(k + 1, character); ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
135
#include <bits/stdc++.h> #define ll long long #define ld long double #define ft first #define sd second #define pb push_back using namespace std; const long long mod = 1e9 + 7; long long power(long long a, long long b, long long m = mod) { long long x = 1; while (b) { if (b & 1) { x = 1ll * x * a % m; ...
#include <bits/stdc++.h> #define ll long long #define ld long double #define ft first #define sd second #define pb push_back using namespace std; const long long mod = 1e9 + 7; long long power(long long a, long long b, long long m = mod) { long long x = 1; while (b) { if (b & 1) { x = 1ll * x * a % m; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 16, 31, 103, 0, 104], ["+", 0, 2, 3, 4, 0, 16, 31, 103, 0, 125], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 2, 3, 4, 0, 69, 3...
1
318
al=[chr(ord('a') + i) for i in range(26)] def dfs2(N, f): if len(f) == N: return f else: result = "" f_index = [al.index(i) for i in f] for i in range(max(f_index) +1 + 1):#追加できるのは(f+1) + 1 result +=dfs(N, f + al[i]) return result N = int(input()) ans = dfs2...
al=[chr(ord('a') + i) for i in range(26)] def dfs(N, f): if len(f) == N: return f else: result = "" f_index = [al.index(i) for i in f] for i in range(max(f_index) +1 + 1):#追加できるのは(f+1) + 1 result +=dfs(N, f + al[i]) return result N = int(input()) ans = dfs(N...
[["-", 36, 36, 36, 36, 0, 656, 0, 14, 141, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 14, 141, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]]
5
142
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; cin >> N; queue<pair<string, int>> table; table.push({"a", 1}); if (N == 1) { cout << 'a' << endl; } else { for (int i = 1; i < N; i++) { while (true) { pair<string, int> t = table.front(); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N; cin >> N; queue<pair<string, int>> table; table.push({"a", 1}); if (N == 1) { cout << 'a' << endl; } else { for (int i = 1; i < N; i++) { while (true) { pair<string, int> t = table.front(); ...
[["-", 0, 2, 3, 4, 0, 83, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 83, 0, 2, 63, 22], ["-", 0, 83, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 83, 0, 2, 3, 4, 0, 16, 12, 22]]
1
230
import copy n = int(input()) ary_list = [] def f(ary, max_num): if len(ary) == n: ary_list.append(ary) return for i in range(max_num + 2): next_ary = copy.copy(ary) next_ary.append(i) f(next_ary, max_num + 1 if i == max_num else 0) f([], -1) str_list = [] for i in ran...
import copy n = int(input()) ary_list = [] def f(ary, max_num): if len(ary) == n: ary_list.append(ary) return for i in range(max_num + 2): next_ary = copy.copy(ary) next_ary.append(i) f(next_ary, max_num + (1 if i == max_num + 1 else 0)) f([], -1) str_list = [] for i ...
[["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 12, 23, 0, 41, 0, 666, 0, 657, 17, 72], ["+", 12, 23, 0, 41, 0, 666, 0, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
156
#include <bits/stdc++.h> #define ll long long using namespace std; // input int N; void dfs(string s, char mx) { if (s.length() == N) { cout << s << endl; return; } else { for (char c = 'a'; c <= mx + 1; c++) { dfs(s + c, (c > mx) ? c : mx); } } } int main() { cin.tie(0); ios::sync_w...
#include <bits/stdc++.h> #define ll long long using namespace std; // input int N; void dfs(string s, char mx) { if (s.length() == N) { cout << s << endl; return; } else { for (char c = 'a'; c <= mx; c++) { dfs(s + c, (c == mx) ? c + 1 : mx); } } } int main() { cin.tie(0); ios::sync_...
[["-", 0, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 0, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 3, 4, 0, 41, 15, 23, 0, 16, 17, 47], ["+", 3, 4, 0, 41, 15, 23, 0, 16, 17, 60], ["+", 0, 2, 3, 4, 0, 41, 64, 16, 17, 72], ["+", 0, 2, 3, 4, 0, 41, 64, 16, 12, 13]]
1
118
CH = ["Z","a","b","c","d","e","f","g","h","i","j"] def next_ch(n,s,index) if n == 1 puts s else for i in 1..index+1 next_ch(n-1,s+CH[i],i) end end end n = gets.to_i next_ch(n,"a",1)
CH = ["Z","a","b","c","d","e","f","g","h","i","j"] def next_ch(n,s,index) if n == 1 puts s else for i in 1..index+1 next_ch(n-1,s+CH[i],[index,i].max) end end end n = gets.to_i next_ch(n,"a",1)
[["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 70], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 486, 516, 0, 73], ["+", 8, 170, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 8, 170, 0, 652, 3, 4, 0, 652, 735, 22]]
4
104
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define countof(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rep2(i, n) for (int i = 1; i <= (n); ++i) #define rrep2(i, n) for (int i ...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define countof(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = (n)-1; i >= 0; --i) #define rep2(i, n) for (int i = 1; i <= (n); ++i) #define rrep2(i, n) for (int i ...
[["-", 0, 57, 64, 9, 0, 338, 8, 9, 0, 46], ["+", 0, 57, 64, 9, 0, 338, 8, 9, 0, 46]]
1
429
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; string s; void rec(int n, char MAX) { if (n == 0) { cout << s << endl; return; } for (int i = 9; i >= 0; i--) { bool ok = false; char tmp = s.back(); if (i >= 2) { if ((MAX...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; string s; void rec(int n, char MAX) { if (n == 0) { cout << s << endl; return; } for (int i = 9; i >= 0; i--) { bool ok = false; char tmp = s.back(); if (i >= 2) { if ((MAX...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
1
219