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
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 # 998244353 input=lambda:sys.stdin.readline().rstrip() def resolve(): n = int(input()) n -= 1 now = ['a'] for _ in range(n): next = [] for S in now: d = ord(min(S)) - ord('a') for i in range...
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 # 998244353 input=lambda:sys.stdin.readline().rstrip() def resolve(): n = int(input()) n -= 1 now = ['a'] for _ in range(n): next = [] for S in now: d = ord(max(S)) - ord('a') for i in range...
[["-", 12, 657, 31, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 657, 31, 652, 3, 4, 0, 652, 63, 22]]
5
143
N = input() mojis = ["a","b","c","d","e","f","g","h","i","j"] def append_m(moji): arr = [] for i in mojis[:len(set(moji))+1]: arr.append(moji+i) return arr arr = ["a"] for i in range(N-1): tmp = [] for j in arr: tmp += append_m(j) arr = tmp for i in arr: print(i)
N = int(input()) mojis = ["a","b","c","d","e","f","g","h","i","j"] def append_m(moji): arr = [] for i in mojis[:len(set(moji))+1]: arr.append(moji+i) return arr arr = ["a"] for i in range(N-1): tmp = [] for j in arr: tmp += append_m(j) arr = tmp for i in arr: print(i)
[["+", 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
129
#include <bits/stdc++.h> #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, n, s) for (int i = (s); i < (n); i++) #define rrep(i, n) for (int i = (n - 1); i >= 0; i--) #define rreps(i, n, s) for (int i = s; i >= n; i--) #define MOD 1000000007 using ll = long long; using namespace std; ...
#include <bits/stdc++.h> #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, n, s) for (int i = (s); i < (n); i++) #define rrep(i, n) for (int i = (n - 1); i >= 0; i--) #define rreps(i, n, s) for (int i = s; i >= n; i--) #define MOD 1000000007 using ll = long long; using namespace std; ...
[["-", 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
255
import string n = int(input()) cs = string.ascii_lowercase cm = {cs[i]:i for i in range(len(cs))} t = 1 def rec(st): global t if (len(st) >= n): print(t, ":", st) t += 1 return 0 k = max(cm[st[i]]+1 for i in range(len(st))) for c in cs[: k + 1]: rec(st+c) rec('a...
import string n = int(input()) cs = string.ascii_lowercase cm = {cs[i]:i for i in range(len(cs))} t = 1 def rec(st): global t if (len(st) >= n): print(st) t += 1 return 0 k = max(cm[st[i]]+1 for i in range(len(st))) for c in cs[: k + 1]: rec(st+c) rec('a')
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655]]
5
118
n=int(input()) ans=[] def rec(i,s): if i == n: print(s) return else: for j in range(len(set(s)) + 1): rec(i+1,s+chr(old("a")+j)) rec(1,"a")
n=int(input()) ans=[] def rec(i,s): if i == n: print(s) return else: for j in range(len(set(s)) + 1): rec(i+1,s+chr(ord("a")+j)) rec(1,"a")
[["-", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22]]
5
76
package main import ( "bufio" "fmt" "math" "os" "sort" "strconv" ) const ( MOD = int(1e9) + 7 ) // IO struct // >>>>>>> functions for io type IO struct { scanner *bufio.Scanner writer *bufio.Writer } func newIO() *IO { return &IO{ scanner: bufio.NewScanner(os.Stdin), writer: bufio.NewWriter(os.Stdou...
package main import ( "bufio" "fmt" "math" "os" "sort" "strconv" ) const ( MOD = int(1e9) + 7 ) // IO struct // >>>>>>> functions for io type IO struct { scanner *bufio.Scanner writer *bufio.Writer } func newIO() *IO { return &IO{ scanner: bufio.NewScanner(os.Stdin), writer: bufio.NewWriter(os.Stdou...
[["+", 64, 196, 0, 436, 12, 432, 0, 2, 63, 22], ["+", 0, 436, 12, 432, 0, 2, 3, 4, 0, 24], ["+", 0, 436, 12, 432, 0, 2, 3, 4, 0, 22], ["+", 0, 436, 12, 432, 0, 2, 3, 4, 0, 21], ["+", 0, 436, 12, 432, 0, 2, 3, 4, 0, 25]]
7
1,843
# D - String Equivalence from string import ascii_lowercase def dfs(n: int) -> list: if n == 1: return ["a"] cur = dfs(n - 1) result = [] for s in cur: for c in ascii_lowercase[: len(s) + 1]: result.append(s + c) return result def main(): N = int(input()) resu...
# D - String Equivalence from string import ascii_lowercase def dfs(n: int) -> list: if n == 1: return ["a"] cur = dfs(n - 1) result = [] for s in cur: for c in ascii_lowercase[: len(set(s)) + 1]: result.append(s + c) return result def main(): N = int(input()) ...
[["+", 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
112
import sys sys.setrecursionlimit(10**7) N = int(input()) N -= 1 S = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"] def dfs(s, depth, maxS): if depth == N: print(s) return for i in range(maxS+1): if i == maxS: dfs(s + S[i], depth+1, i+1) el...
import sys sys.setrecursionlimit(10**7) N = int(input()) N -= 1 S = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"] def dfs(s, depth, maxS): if depth == N: print(s) return for i in range(maxS+1): if i == maxS: dfs(s + S[i], depth+1, maxS+1) ...
[["-", 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
159
import string N = int(input()) S = string.ascii_letters[:N] S_idx = {s:i for i, s in enumerate(S)} def main(s, n): if n >= N: return print(s) idx = S_idx[s[-1]] for i in S[:idx+2]: main(s+i, n+1) main('a', 1)
import string N = int(input()) S = string.ascii_letters[:N] S_idx = {s:i for i, s in enumerate(S)} def main(s, n): if n >= N: return print(s) idx = S_idx[max(s)] for i in S[:idx+2]: main(s+i, n+1) main('a', 1)
[["+", 0, 1, 0, 662, 12, 206, 206, 652, 63, 22], ["+", 0, 662, 12, 206, 206, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 206, 206, 206, 0, 70], ["-", 0, 662, 12, 206, 206, 206, 206, 664, 17, 33], ["-", 0, 662, 12, 206, 206, 206, 206, 664, 28, 612], ["-", 0, 1, 0, 662, 12, 206, 206, 206, 0, 73], ["+", 0, 662, 12, 206, 20...
5
92
#include <algorithm> #include <iostream> using namespace std; int ans[12]; int n; void dfs(int pos, int ma) { if (pos == n + 1) { for (int i = 1; i <= n; ++i) printf("%c", ans[i] + 'a'); printf("\n"); return; } int maa; for (int i = 0; i <= ma + 1 and i < pos; i++) { ans[pos] = i; maa ...
#include <algorithm> #include <iostream> using namespace std; int ans[12]; int n; void dfs(int pos, int ma) { if (pos == n + 1) { for (int i = 1; i <= n; ++i) printf("%c", ans[i] + 'a'); printf("\n"); return; } int maa; for (int i = 0; i <= ma + 1 and i < pos; i++) { ans[pos] = i; maa ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
147
/* AUTHOR:SOURABH CREATED:14:03:20 */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ordered_set \ tree<pll, null_type, less<pll>, rb_tree_tag, \ tree_...
/* AUTHOR:SOURABH CREATED:14:03:20 */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ordered_set \ tree<pll, null_type, less<pll>, rb_tree_tag, \ tree_...
[["+", 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
273
n = int(input()) def dfs(s, mx): if len(s) == n: print(s) else: for c in [chr(ord('a') + i) for i in range(ord(mx) - ord('a') + 1)]: dfs(s + c, chr(ord(mx) + 1) if c == mx else mx) dfx('', 'a')
n = int(input()) def dfs(s, mx): if len(s) == n: print(s) else: for c in [chr(ord('a') + i) for i in range(ord(mx) - ord('a') + 1)]: dfs(s + c, chr(ord(mx) + 1) if c == mx else mx) dfs('', 'a')
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22]]
5
97
#include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; // using namespace __...
#include <algorithm> #include <cassert> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; // using namespace __...
[["+", 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
302
#include <algorithm> #include <cstdio> #include <iostream> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; const static string ASCII("abcdefghijklmnopqrstuvwxyz"); int N; void rec(string s, char mx) { if (s.size() == N) ...
#include <algorithm> #include <cstdio> #include <iostream> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; const static string ASCII("abcdefghijklmnopqrstuvwxyz"); int N; void rec(string s, char mx) { if (s.size() == N) ...
[["-", 0, 1, 0, 2, 3, 4, 0, 41, 75, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 41, 75, 22]]
1
133
#!/usr/bin/env python3 import sys from itertools import combinations def solve(N: int): d = {n:[] for n in range(1, N+1)} d[1] = [[1]] for n in range(1, N): for lst in d[n]: last_element = lst[-1] for new_element in range(1, last_element+2): d[...
#!/usr/bin/env python3 import sys from itertools import combinations def solve(N: int): d = {n:[] for n in range(1, N+1)} d[1] = [[1]] for n in range(1, N): for lst in d[n]: last_element = lst[-1] for new_element in range(1, max(lst)+2): d[n+1]...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 12, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
203
#include <stdio.h> #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __pri...
#include <stdio.h> #include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __pri...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 33], ["+", 15, 339, 51, 16, 31, 16, 12, 103, 0, 104], ["+", 15, 339, 51, 16, 31, 16, 12, 103, 0, 125], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
658
n = int(input()) alpha_dict = {} for i,c in enumerate(range(ord('A'),ord('Z')+1)): alpha_dict[i] = str(chr(c)).lower() ans = [] def dfs(s, mx, ans): if len(s) == n: ans += [s] return else: for i in range(mx+1): dfs(s+alpha_dict[i], max(i, mx+1), ans) dfs("", 0, ans) ans = sorted(ans) for a i...
n = int(input()) alpha_dict = {} for i,c in enumerate(range(ord('A'),ord('Z')+1)): alpha_dict[i] = str(chr(c)).lower() ans = [] def dfs(s, mx, ans): if len(s) == n: ans += [s] return else: for i in range(mx+1): dfs(s+alpha_dict[i], max(i+1, mx), ans) dfs("", 0, ans) ans = sorted(ans) for a i...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
139
n = int(input()) alpha_dict = {} for i,c in enumerate(range(ord('A'),ord('Z')+1)): alpha_dict[i] = str(chr(c)).lower() ans = [] def dfs(s, mx, ans): if len(s) == n: ans += [s] return else: for i in range(mx+1): dfs(s+alpha_dict[i], max(i, mx+1), ans) dfs("", 0, ans) ans = sorted(ans) for a i...
n = int(input()) alpha_dict = {} for i,c in enumerate(range(ord('A'),ord('Z')+1)): alpha_dict[i] = str(chr(c)).lower() ans = [] def dfs(s, mx, ans): if len(s) == n: ans += [s] return else: for i in range(mx+2): dfs(s+alpha_dict[i], max(i, mx), ans) dfs("", -1, ans) ans = sorted(ans) for a in...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
139
N = int(input()) w = ["a"] l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] for i in range(N - 1): w_init = w w = [] for j in range(len(w_init)): for k in range(i + 2): if w_init[j][-1] == l[k]: for m in range(k + 2): w.append(w_init[j] + l[m]) for i in range(len(w)): print(...
N = int(input()) w = ["a"] l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] for i in range(N - 1): w_init = w w = [] for j in range(len(w_init)): for k in range(i + 2): if max(w_init[j]) == l[k]: for m in range(k + 2): w.append(w_init[j] + l[m]) for i in range(len(w)): print...
[["+", 8, 196, 0, 57, 15, 666, 0, 652, 63, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["-", 0, 57, 15, 666, 0, 206, 206, 664, 17, 33], ["-", 0, 57, 15, 666, 0, 206, 206, 664, 28, 612], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0...
5
153
N = int(input()) import copy def nex(lis): li = copy.copy(lis) if len(li) == N: print(''.join([chr(97+i) for i in li])) return for x in range(li[-1]+2): li2 = copy.copy(li) li2.append(x) nex(li2) nex([0])
N = int(input()) import copy def nex(lis): li = copy.copy(lis) if len(li) == N: print(''.join([chr(97+i) for i in li])) return for x in range(max(li)+2): li2 = copy.copy(li) li2.append(x) nex(li2) nex([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
92
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */ // codeforces #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define mp make_pair #define pb push_back #define sz(v) ((int)v.size()) ...
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */ // codeforces #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define mp make_pair #define pb push_back #define sz(v) ((int)v.size()) ...
[["+", 8, 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
388
l = ['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'] #print([chr(i) for i in range(97, 97+26)]) def adder(n, s, index): if (n == 0): print(s) else: #if(n == 1): for i in range(index +2): adder...
l = ['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'] #print([chr(i) for i in range(97, 97+26)]) def adder(n, s, index): if (n == 0): print(s) else: #if(n == 1): for i in range(index +2): adder...
[["+", 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
212
N=int(input()) A=[] B=[[] for i in range(N+1)] B[0].append("") for i in range(N): A.append(chr(97+i)) for j in B[i]: for k in A: B[i+1].append(j+k) for i in B[N]: count=ord("a") yes=1 for j in range(N): if ord(i[j])<=count+1: count=max(count,ord(i[j])) ...
N=int(input()) A=[] B=[[] for i in range(N+1)] B[0].append("") for i in range(N): A.append(chr(97+i)) for j in B[i]: for k in A: B[i+1].append(j+k) for i in B[N]: count=ord("a") yes=1 for j in range(N): if ord(i[j])<=count+1: count=max(count,ord(i[j])) ...
[["-", 0, 57, 75, 76, 8, 196, 0, 116, 0, 117], ["-", 8, 196, 0, 57, 75, 76, 8, 196, 0, 35], ["+", 0, 57, 75, 76, 8, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 75, 76, 8, 196, 0, 35]]
5
152
import sys input = lambda: sys.stdin.readline().rstrip() input_nums = lambda: list(map(int, input().split())) from collections import deque N = int(input()) s = 'a' queue = deque() queue.append(s) # for i in range(N): while True: a = queue.popleft() if len(a) == N: queue.append(a) break ori...
import sys input = lambda: sys.stdin.readline().rstrip() input_nums = lambda: list(map(int, input().split())) from collections import deque N = int(input()) s = 'a' queue = deque() queue.append(s) while True: a = queue.popleft() if len(a) == N: queue.append(a) break origin = a a = max(a...
[["+", 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
169
// https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_d #include <bits/stdc++.h> #if LOCAL #include "dump.hpp" #else #define dump(...) #endif using namespace std; using ll = long long; const ll LINF = 0x1fffffffffffffff; #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) templ...
// https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_d #include <bits/stdc++.h> #if LOCAL #include "dump.hpp" #else #define dump(...) #endif using namespace std; using ll = long long; const ll LINF = 0x1fffffffffffffff; #define FOR(i, a, b) for (ll i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) templ...
[["+", 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], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
306
$n = gets.to_i $str = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] def go(strr, store) if strr.size != $n then store.each{ |s| go(strr + s, store) } go(strr + $str[store.size], store + [$str[store.size]]) else puts str end end go('a', ['a'])
$n = gets.to_i $str = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] def go(strr, store) if strr.size != $n then store.each{ |s| go(strr + s, store) } go(strr + $str[store.size], store + [$str[store.size]]) else puts strr end end go('a', ['a'])
[["-", 0, 121, 75, 95, 0, 652, 3, 4, 0, 22], ["+", 0, 121, 75, 95, 0, 652, 3, 4, 0, 22]]
4
117
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REP1(i, a, b) for (int i = a; i <= (int)(b); i++) #define ALL(x) begin(x), end(x) #define PB push_back using namespace std; typedef int64_t LL; typedef vector<int> VI; typedef pair<int, int> PII; template <class T> inline bool chmax(...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REP1(i, a, b) for (int i = a; i <= (int)(b); i++) #define ALL(x) begin(x), end(x) #define PB push_back using namespace std; typedef int64_t LL; typedef vector<int> VI; typedef pair<int, int> PII; template <class T> inline bool chmax(...
[["+", 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
341
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<string> vs; typedef pair<ll, ll> pair_t; using Graph = vector<vector<ll>>; #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) /***** define constant start *******/ const ll MOD = 1...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vl; typedef vector<string> vs; typedef pair<ll, ll> pair_t; using Graph = vector<vector<ll>>; #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) /***** define constant start *******/ const ll MOD = 1...
[["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["+", 0, 30, 0, 14, 49, 53, 54, 55, 0, 25], ["+", 36, 36, 0, 30, 0, 14, 8, 9, 0, 45], ["+", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0,...
1
493
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> pii; typedef pair<ll, bool> pi...
#include <algorithm> #include <cmath> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; typedef pair<ll, ll> pii; typedef pair<ll, bool> pi...
[["-", 3, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
1,819
n=int(input()) patterns = ["a"] for _ in range(n-1): last_patterns = patterns.copy() patterns = [] for string in last_patterns: useful_str = alpha[:len(set(string))+1] for str_ in useful_str: patterns.append(string + str_) for pat in patterns: print(pat)
alpha = "abcdefghij" n=int(input()) patterns = ["a"] for _ in range(n-1): last_patterns = patterns.copy() patterns = [] for string in last_patterns: useful_str = alpha[:len(set(string))+1] for str_ in useful_str: patterns.append(string + str_) for pat in patterns: print(pat)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 654], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 6], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 655]]
5
78
N = int(input()) a = [[[0]]] k = 0 while k < N-1: c = a[k] a.append([]) for r in c: for i in range(r[-1]+2): x = r + [i] a[k+1].append(x) k += 1 A = a[-1] for s in A: ans = "" for i in range(N): ans += chr(s[i]+97) print(ans)
N = int(input()) a = [[[0]]] k = 0 while k < N-1: c = a[k] a.append([]) for r in c: for i in range(max(r)+2): x = r + [i] a[k+1].append(x) k += 1 A = a[-1] for s in A: ans = "" for i in range(N): ans += chr(s[i]+97) print(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
119
//参考:http://ehafib.hatenablog.com/entry/2015/12/23/164517 //インクルード #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setp...
//参考:http://ehafib.hatenablog.com/entry/2015/12/23/164517 //インクルード #include <algorithm> //sort,二分探索,など #include <bitset> //固定長bit集合 #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setp...
[["+", 0, 7, 15, 16, 12, 16, 12, 16, 17, 72], ["+", 0, 7, 15, 16, 12, 16, 12, 16, 12, 13]]
1
293
n = int(input()) A = ['a'] for i in range(n-1): B = A[i:] for j in B: # A.append("".join(j) + j[-1]) # A.append("".join(j) + chr(ord(j[-1]) + 1)) for i in range(ord("a"), ord(j[-1]) + 2): A.append("".join(j) + chr(i)) A = sorted(A) for i in A: if len(i) == n: p...
n = int(input()) A = ['a'] for i in range(n-1): B = A[i:] for j in B: for i in range(ord("a"), ord(max(j)) + 2): A.append("".join(j) + chr(i)) A = sorted(A) for i in A: if len(i) == n: print(i)
[["+", 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
103
/* -*- coding: utf-8 -*- * * d.cc: D - String Equivalence */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> ...
/* -*- coding: utf-8 -*- * * d.cc: D - String Equivalence */ #include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> ...
[["+", 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
182
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> V; #define rep(a, j, n) for (ll i = a; i < j; i = i + n) typedef pair<ll, ll> P; const ll mod = 1000000007; const ll INF = 1000000009; ll i; vector<string> a = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"}; typedef pai...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> V; #define rep(a, j, n) for (ll i = a; i < j; i = i + n) typedef pair<ll, ll> P; const ll mod = 1000000007; const ll INF = 1000000009; ll i; vector<string> a = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"}; typedef pai...
[["+", 0, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 0, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
478
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, m, n) for (int i = m; i < n; i++) ll mod = 1e9 + 7; int main() { int n; cin >> n; queue<string> q; q.push("a"); rep(i, 0, n - 1) { int a = q.size(); rep(j, 0, a) { string s = q.front(); ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define rep(i, m, n) for (int i = m; i < n; i++) ll mod = 1e9 + 7; int main() { int n; cin >> n; queue<string> q; q.push("a"); rep(i, 0, n - 1) { int a = q.size(); rep(j, 0, a) { string s = q.front(); ...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
209
// きさま! 見ているなッ! #include <algorithm> #include <array> #include <iostream> #include <limits> #include <list> #include <map> #include <math.h> #include <memory> #include <queue> #include <set> #include <stdio.h> #include <string> #include <thread> #include <unordered_map> #include <vector> using namespace std; using ll...
// きさま! 見ているなッ! #include <algorithm> #include <array> #include <iostream> #include <limits> #include <list> #include <map> #include <math.h> #include <memory> #include <queue> #include <set> #include <stdio.h> #include <string> #include <thread> #include <unordered_map> #include <vector> using namespace std; using ll...
[["+", 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
191
import sys input = sys.stdin.readline sys.setrecursionlimit(10**5) N = int(input()) def rec(i, m, ar) : if i == N : print(''.join(chr(s + 97) for s in ar)) return for j in range(min(m + 1, N)) : rec(i + 1, j + 1, ar + [j]) rec(0, 0, [])
import sys input = sys.stdin.readline sys.setrecursionlimit(10**5) N = int(input()) def rec(i, m, ar) : if i == N : print(''.join(chr(s + 97) for s in ar)) return for j in range(min(m + 1, N)) : rec(i + 1, max(m, j + 1), ar + [j]) rec(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
100
#include <bits/stdc++.h> using namespace std; #define int long long #define y1 zzz #define fi first #define se second #define PII pair<int, int> #define PII2 pair<int, PII> #define PII3 pair<PII, int> #define PII4 pair<PII, PII> #define all(x) (x).begin(), (x).end() #define pb push_back int n, color[20], ans; set<strin...
#include <bits/stdc++.h> using namespace std; #define int long long #define y1 zzz #define fi first #define se second #define PII pair<int, int> #define PII2 pair<int, PII> #define PII3 pair<PII, int> #define PII4 pair<PII, PII> #define all(x) (x).begin(), (x).end() #define pb push_back int n, color[20], ans; set<strin...
[["+", 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], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
205
#include <bits/stdc++.h> using namespace std; // macro #define rep(i, n) for (int i = 0; i < n; i++) #define ll long long #define all(v) v.begin(), v.end() // code starts void dep(int depth, string &u, int n, int bmax) { if (depth == n) { cout << u << endl; return; } else { for (int i = 0; i <= bmax +...
#include <bits/stdc++.h> using namespace std; // macro #define rep(i, n) for (int i = 0; i < n; i++) #define ll long long #define all(v) v.begin(), v.end() // code starts void dep(int depth, string &u, int n, int bmax) { if (depth == n) { cout << u << endl; return; } else { for (int i = 0; i <= bmax +...
[["+", 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
165
#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; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int getRand(int l, int r) { uniform_int_distribution<int> uid(l, r); return uid(rng); } #de...
#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; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int getRand(int l, int r) { uniform_int_distribution<int> uid(l, r); return uid(rng); } #de...
[["+", 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
328
#include <bits/stdc++.h> #define pb push_back using namespace std; const int NR = 2e5 + 5; ifstream in("viitor.in"); ofstream out("viitor.out"); vector<char> st; vector<vector<char>> sol; int n; void rec(int poz, int high) { int i, maxim = 0; if (poz == n + 1) { sol.pb(st); return; } for (i = 0; i <= mi...
#include <bits/stdc++.h> #define pb push_back using namespace std; const int NR = 2e5 + 5; ifstream in("viitor.in"); ofstream out("viitor.out"); vector<char> st; vector<vector<char>> sol; int n; void rec(int poz, int high) { int i, maxim = 0; if (poz == n + 1) { sol.pb(st); return; } for (i = 0; i <= mi...
[["+", 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
259
#include <stdio.h> int n, f; char s[15], c; void dfs(int x) { if (x == n) { printf("%s\n", s); return; } int t[10]; for (int i = 0; i < 10; i++) t[i] = 0; for (int i = 0; i < x; i++) { c = s[i]; if (t[c - 'a'] == 0) { s[x] = c; dfs(x + 1); } t[c - 'a'] = 1; } f = 0;...
#include <stdio.h> int n, f; char s[15]; void dfs(int x) { if (x == n) { printf("%s\n", s); return; } int t[10]; char c; for (int i = 0; i < 10; i++) t[i] = 0; for (int i = 0; i < x; i++) { c = s[i]; if (t[c - 'a'] == 0) { s[x] = c; dfs(x + 1); } t[c - 'a'] = 1; } ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22]]
1
202
#include <bits/stdc++.h> using namespace std; const int N = 14; int n; int s[N]; void dfs(int len, int up) { if (len == n + 1) { for (int i = 1; i <= n; i++) putchar(s[i] + 'a'); putchar('\n'); return; } for (int i = 0; i <= up; i++) { s[len] = i; dfs(len + 1, min(25, up + 1)); } } int...
#include <bits/stdc++.h> using namespace std; const int N = 14; int n; int s[N]; void dfs(int len, int up) { if (len == n + 1) { for (int i = 1; i <= n; i++) putchar(s[i] + 'a'); putchar('\n'); return; } for (int i = 0; i <= up; i++) { s[len] = i; dfs(len + 1, min(25, max(up, i + 1))); ...
[["+", 3, 4, 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], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
139
// clang-format off #include <bits/stdc++.h> using namespace std; #define int long long #define stoi stoll using pii = pair<int,int>; using vi = vector<int>; using vvi = vector<vi>; #define all(c) begin(c), end(c) #define rall(c) rbegin(c), rend(c) #define fore(x, c) for(auto &&x : c) #define rep(i, a, n) for(int i = a...
// clang-format off #include <bits/stdc++.h> using namespace std; #define int long long #define stoi stoll using pii = pair<int,int>; using vi = vector<int>; using vvi = vector<vi>; #define all(c) begin(c), end(c) #define rall(c) rbegin(c), rend(c) #define fore(x, c) for(auto &&x : c) #define rep(i, a, n) for(int i = 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
651
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e, i, j; string s; void rec(int q, int w) { if (q > a) { cout << s << endl; return; } for (i = 0; i < w; i++) { s.push_back('a' + i); rec(q + 1, w); ; s.pop_back(); } s.push_back('a' + w); rec(q + 1, w + 1); s.pop_back()...
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e, i, j; string s; void rec(int q, int w) { if (q > a) { cout << s << endl; return; } for (int i = 0; i < w; i++) { s.push_back('a' + i); rec(q + 1, w); ; s.pop_back(); } s.push_back('a' + w); rec(q + 1, w + 1); s.pop_ba...
[["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40]]
1
162
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using vb = vector<bool>; using vs = vector<string>; typedef pair<ll, ll> P; #define bit(n) (1LL << (n)) //#define int long l...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using vb = vector<bool>; using vs = vector<string>; typedef pair<ll, ll> P; #define bit(n) (1LL << (n)) //#define int long l...
[["-", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22]]
1
973
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <vector> using namespace std; typedef long long LL; LL n, a[15], cnc = 0; void dfs(LL dep, LL num) { if (dep >= n) { cnc++; for (LL i = 0; i < n; i++) cout << (char)(a[i] + 'a' - 1); cout << '\n';...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <vector> using namespace std; typedef long long LL; LL n, a[15], cnc = 0; void dfs(LL dep, LL num) { if (dep >= n) { cnc++; for (LL i = 0; i < n; i++) cout << (char)(a[i] + 'a' - 1); cout << '\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
163
import sys sys.setrecursionlimit(10**9) ordA = ord('a') N = int(input()) def dfs(i, sSt): if i == N: # print(Ss) ans = ''.join([chr(ordA+S) for S in Ss]) anss.append(ans) else: for s in range(0, sSt+2): Ss[i] = s dfs(i+1, s) anss = [] Ss = [0] * N dfs(1...
import sys sys.setrecursionlimit(10**9) ordA = ord('a') N = int(input()) def dfs(i, sSt): if i == N: # print(Ss) ans = ''.join([chr(ordA+S) for S in Ss]) anss.append(ans) else: for s in range(0, sSt+2): Ss[i] = s dfs(i+1, max(s, sSt)) anss = [] Ss = [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, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
122
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <unordered_map> #incl...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <string> #include <unordered_map> #incl...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22]]
1
340
/* AuThOr GaRyMr */ #include <bits/stdc++.h> #define rb(a, b, c) for (int a = b; a <= c; ++a) #define rl(a, b, c) for (int a = b; a >= c; --a) #define LL long long #define IT iterator #define PB push_back #define II(a, b) make_pair(a, b) #define FIR first #define SEC second #define FREO freopen("check.out", "w", stdout...
/* AuThOr GaRyMr */ #include <bits/stdc++.h> #define rb(a, b, c) for (int a = b; a <= c; ++a) #define rl(a, b, c) for (int a = b; a >= c; --a) #define LL long long #define IT iterator #define PB push_back #define II(a, b) make_pair(a, b) #define FIR first #define SEC second #define FREO freopen("check.out", "w", stdout...
[["+", 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
237
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; using ll = long long; constexpr ll mod = 1000000007; constexpr int inf = 1000000000; constexpr ll linf = 1000000000000000000; int n; vector<string> ans; void solve(int i, string s, char mx) { if (i == n) { ans.push_back(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) using namespace std; using ll = long long; constexpr ll mod = 1000000007; constexpr int inf = 1000000000; constexpr ll linf = 1000000000000000000; int n; vector<string> ans; void solve(int i, string s, char mx) { if (i == n) { ans.push_back(...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 72], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
190
import sys sys.setrecursionlimit(10 ** 7) N = int(input()) L = list("abcdefghij") def nasu(x, n, e): if n == N: print(x) return for i in range(e + 1): if i == n: nasu(x + L[i], n + 1, e + 1) else: nasu(x + L[i], n + 1, e) nasu("", 0, 0)
import sys sys.setrecursionlimit(10 ** 7) N = int(input()) L = list("abcdefghij") def nasu(x, n, e): if n == N: print(x) return for i in range(e + 1): if i == e: nasu(x + L[i], n + 1, e + 1) else: nasu(x + L[i], n + 1, e) nasu("", 0, 0)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
104
def sol(k): def gen(d, cur, s): if d == k: yield s return for i in range(0, cur+1): yield from gen(d+1, i+1, s+chr(97+i)) return gen(0, 0, '') def main(): k = int(input()) for x in sol(k): print(x) if __name__ == '__main__': main()
def sol(k): def gen(d, cur, s): if d == k: yield s return for i in range(0, cur+1): yield from gen(d+1, max(cur, i+1), s+chr(97+i)) return gen(0, 0, '') def main(): k = int(input()) for x in sol(k): print(x) if __name__ == '__main__': m...
[["+", 0, 286, 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
102
#include <bits/stdc++.h> #define f(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> #define F first #define S second #define int long long #define mod 1000000007 #define mmod 998244353 #define all(v) v.begin(), v.end() using namespace std; int mypow(int a, int b, int c) { if (b == 0) return 1; if (b %...
#include <bits/stdc++.h> #define f(i, n) for (int i = 0; i < n; i++) #define P pair<int, int> #define F first #define S second #define int long long #define mod 1000000007 #define mmod 998244353 #define all(v) v.begin(), v.end() using namespace std; int mypow(int a, int b, int c) { if (b == 0) return 1; 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
194
// Author : Sarthak Kapoor #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define rep(i, n) for (int i = 0; i < n; ++i) #define repa(i, a, n) for (int i = a; i < n; ++i) #define repr(i, n) for (int i = n - 1; i >= 0; --i) #define repba(i, b, a) for (in...
// Author : Sarthak Kapoor #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define rep(i, n) for (int i = 0; i < n; ++i) #define repa(i, a, n) for (int i = a; i < n; ++i) #define repr(i, n) for (int i = n - 1; i >= 0; --i) #define repba(i, b, a) for (in...
[["+", 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
312
// May this submission get accepted #include <bits/stdc++.h> // エイリアス using ll = long signed long; using ull = long unsigned long; using ld = long double; using namespace std; // エイリアス (補完・コンパイルが重くなる) // #include <boost/multiprecision/cpp_int.hpp> // using mll = boost::multiprecision::cpp_int; // 汎用マクロ #define ALL_O...
// May this submission get accepted #include <bits/stdc++.h> // エイリアス using ll = long signed long; using ull = long unsigned long; using ld = long double; using namespace std; // エイリアス (補完・コンパイルが重くなる) // #include <boost/multiprecision/cpp_int.hpp> // using mll = boost::multiprecision::cpp_int; // 汎用マクロ #define ALL_O...
[["+", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
1
1,243
// // Created by Hideaki Imamura on 2020-03-14. // #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline boo...
// // Created by Hideaki Imamura on 2020-03-14. // #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline boo...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
514
#include <iostream> #include <set> #include <string> #include <vector> using namespace std; bool check(string &s1, string &s2, int pos) { int l1 = s1.size(); int l2 = s2.size(); if (pos >= 0) { for (int i = 0; i < min(l1 - pos, l2); ++i) { char c1 = s1[i + pos]; char c2 = s2[i]; if (c1 == '...
#include <iostream> #include <set> #include <string> #include <vector> using namespace std; bool check(string &s1, string &s2, int pos) { int l1 = s1.size(); int l2 = s2.size(); if (pos >= 0) { for (int i = 0; i < min(l1 - pos, l2); ++i) { char c1 = s1[i + pos]; char c2 = s2[i]; if (c1 == '...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 51, 16, 31, 2, 3, 4, 0, 91, 17, 33]]
1
662
import itertools import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 A, B, C = [sys.stdin.buffer.readline().decode().rstrip() for _ in range(3)] A = list(map(ord, A)) B = list(map(ord,...
import itertools import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 A, B, C = [sys.stdin.buffer.readline().decode().rstrip() for _ in range(3)] A = list(map(ord, A)) B = list(map(ord,...
[["-", 15, 679, 12, 23, 0, 679, 12, 206, 51, 22], ["+", 15, 679, 12, 23, 0, 679, 12, 206, 51, 22]]
5
734
#include <bits/stdc++.h> using namespace std; int op[11] = {0}; int n; void dfs(int x, int m) { if (x == n) { for (int i = 0; i <= min(25, max(op[x - 1] + 1, m)); i++) { for (int j = 1; j < n; j++) printf("%c", 'a' + op[j]); printf("%c\n", 'a' + i); } return; } for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; int op[11] = {0}; int n; void dfs(int x, int m) { if (x == n) { for (int i = 0; i <= min(25, max(op[x - 1] + 1, m + 1)); i++) { for (int j = 1; j < n; j++) printf("%c", 'a' + op[j]); printf("%c\n", 'a' + i); } return; } for (int i = 0...
[["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
216
#include <bits/stdc++.h> using namespace std; #define INF 1000000007 #define LINF (1LL << 60) #define PI 3.14159265358979 typedef long long i64; typedef pair<i64, i64> P; inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return ...
#include <bits/stdc++.h> using namespace std; #define INF 1000000007 #define LINF (1LL << 60) #define PI 3.14159265358979 typedef long long i64; typedef pair<i64, i64> P; inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; } template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return ...
[["+", 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
265
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair #define pb push_back #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int cn = 1; vector<int> ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mp make_pair #define pb push_back #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int cn = 1; vector<int> ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13]]
1
212
import sys readline = sys.stdin.readline res = [] def fill(K, f): if K.count(-1) == 0: res.append(K) return else: idx = [] for i in range(N): if K[i] == -1: idx.append(i) kc = len(idx) for S in range(1, 1<<kc): if not S & ...
import sys readline = sys.stdin.readline res = [] def fill(K, f): if K.count(-1) == 0: res.append(K) return else: idx = [] for i in range(N): if K[i] == -1: idx.append(i) kc = len(idx) for S in range(1, 1<<kc): if not S & ...
[["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]]
5
191
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) #define get_unique(x) x.erase(unique(all(x)), x.end()); typedef long long ll; typedef complex<do...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) #define get_unique(x) x.erase(unique(all(x)), x.end()); typedef long long ll; typedef complex<do...
[["-", 15, 16, 12, 16, 31, 2, 63, 118, 28, 22], ["-", 15, 16, 12, 16, 31, 2, 63, 118, 17, 131], ["-", 15, 16, 12, 16, 31, 2, 63, 118, 119, 120], ["-", 15, 16, 12, 16, 31, 2, 3, 4, 0, 24], ["-", 15, 16, 12, 16, 31, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22]]
1
374
s = 'abcdefghij' sg = s.__getitem__ def dfs(ans): if len(ans) == n: print(''.join(map(sg, ans))) return for i in range(ans[-1] + 2): ans.append(i) dfs(ans) ans.pop() n = int(input()) dfs([0])
s = 'abcdefghij' sg = s.__getitem__ def dfs(ans): if len(ans) == n: print(''.join(map(sg, ans))) return for i in range(max(ans) + 2): ans.append(i) dfs(ans) ans.pop() n = int(input()) dfs([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
83
#include <bits/stdc++.h> #define ll long long #define fornum(A, B, C) for (A = B; A < C; ++A) #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; ///////////////////////////////////////////////////// ll N; ll i, j, k; ll mk[20]; void calc(ll n, ll r) { ll i; if (n == N) { fornum(i, 0, ...
#include <bits/stdc++.h> #define ll long long #define fornum(A, B, C) for (A = B; A < C; ++A) #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; ///////////////////////////////////////////////////// ll N; ll i, j, k; ll mk[20]; void calc(ll n, ll r) { ll i; if (n == N) { fornum(i, 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
155
#include <bits/stdc++.h> using namespace std; #define INF_LL (int64)1e18 #define INF (int32)1e9 #define REP(i, n) for (int64 i = 0; i < (n); i++) #define FOR(i, a, b) for (int64 i = (a); i < (b); i++) #define all(x) x.begin(), x.end() #define fs first #define sc second using int32 = int_fast32_t; using uint32 = uint_...
#include <bits/stdc++.h> using namespace std; #define INF_LL (int64)1e18 #define INF (int32)1e9 #define REP(i, n) for (int64 i = 0; i < (n); i++) #define FOR(i, a, b) for (int64 i = (a); i < (b); i++) #define all(x) x.begin(), x.end() #define fs first #define sc second using int32 = int_fast32_t; using uint32 = uint_...
[["+", 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
505
#include <algorithm> #include <array> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stac...
#include <algorithm> #include <array> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctype.h> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stac...
[["-", 28, 2, 3, 4, 0, 69, 341, 342, 0, 22], ["+", 28, 2, 3, 4, 0, 69, 341, 342, 0, 22]]
1
8,157
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; vector<string> str(3); // str[i].substr(k) と str[j] の matching (i != j) ...
#include <algorithm> #include <cmath> #include <functional> #include <iostream> #include <numeric> #include <set> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; vector<string> str(3); // str[i].substr(k) と str[j] の matching (i != j) ...
[["+", 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
484
#include <algorithm> #include <bitset> #include <cassert> #include <ciso646> #include <cmath> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <ciso646> #include <cmath> #include <complex> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include ...
[["-", 49, 50, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 13]]
1
1,663
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #define _USE_MATH_DEFINES #include <functional> #include <math.h> using namespace std; #define rep(i, x) for (ll i = 0; i < x; i++) #define repn(i, x) for (ll i...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #define _USE_MATH_DEFINES #include <functional> #include <math.h> using namespace std; #define rep(i, x) for (ll i = 0; i < x; i++) #define repn(i, x) for (ll i...
[["-", 12, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["-", 12, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 12, 16, 12, 2, 3, 4, 0, 16, 31, 22]]
1
588
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n)-1; i >= 0; i--) #define range(a) a.begin(), a.end() ll f(ll n, ll a, ll b, ll c, ll d) { if (a > c) { a = n - 1 - a; c = n - 1 - c; } if (b > d) { b ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n)-1; i >= 0; i--) #define range(a) a.begin(), a.end() ll f(ll n, ll a, ll b, ll c, ll d) { if (a > c) { a = n - 1 - a; c = n - 1 - c; } if (b > d) { b ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
677
#line 1 "base.hpp" // 6 #ifndef __clang__ #pragma GCC optimize("O3") #endif void solve( #ifdef GCJ_CASE long long case_id #endif ); #if defined(EBUG) && !defined(ONLINE_JUDGE) #define debug true #define _GLIBCXX_DEBUG // #define _LIBCPP_DEBUG 0 #define _LIBCPP_DEBUG2 0 #else #define NDEBUG #define debug false #endi...
#line 1 "base.hpp" // 6 #ifndef __clang__ #pragma GCC optimize("O3") #endif void solve( #ifdef GCJ_CASE long long case_id #endif ); #if defined(EBUG) && !defined(ONLINE_JUDGE) #define debug true #define _GLIBCXX_DEBUG // #define _LIBCPP_DEBUG 0 #define _LIBCPP_DEBUG2 0 #else #define NDEBUG #define debug false #endi...
[["-", 0, 1, 0, 16, 12, 16, 31, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 16, 31, 2, 63, 22]]
1
2,774
#include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; #define rep(i, n) for (int i = 0; i < int(n); i++) #define rep1(i, n) for (int i = 1; i <= int(n); i++) #define per(i, n) for (int i = int(n) - 1; i >= 0; i--) #define per1(i, n) for (int i = int(n); i > 0; i--) #define all(c...
#include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; #define rep(i, n) for (int i = 0; i < int(n); i++) #define rep1(i, n) for (int i = 1; i <= int(n); i++) #define per(i, n) for (int i = int(n) - 1; i >= 0; i--) #define per1(i, n) for (int i = int(n); i > 0; i--) #define all(c...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
936
s = input() if len(s)%2 == 0: for i in len(s)//2: if s[2*i] != "h" and s[2*i+1] != "i": print("No") exit() print("Yes") else: print("No")
s = input() if len(s)%2 == 0: for i in range(len(s)//2): if s[2*i] != "h" or s[2*i+1] != "i": print("No") exit() print("Yes") else: print("No")
[["+", 0, 57, 64, 196, 0, 7, 12, 652, 63, 22], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 25], ["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 354]]
5
73
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) //#define DEBUG #ifdef DEBUG #define DEBUG_PRINT(fm, ...) \ do { \ std::printf("%s:%d(%s)", __FILE__, __LINE__, __func_...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) //#define DEBUG #ifdef DEBUG #define DEBUG_PRINT(fm, ...) \ do { \ std::printf("%s:%d(%s)", __FILE__, __LINE__, __func_...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
204
string = input() for i in range(len(string)): if i % 2 == 0: if string[i] == 'h': continue else: print('No') break elif i % 2 == 1: if string[i] == 'i': continue else: print('No') break else: if len(strin...
string = input() for i in range(len(string)): if i % 2 == 0: if string[i] == 'h': continue else: print('No') break elif i % 2 == 1: if string[i] == 'i': continue else: print('No') break else: if len(strin...
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
94
s = input() if len(s) < 2: print('No') else: ans = "Yes" for i in range(len(s)): if i % 2 == 0 and s[i] != 'h': ans = "No" break if i % 2 == 1 and s[i] != 'i': ans = "No" break print(ans)
s = input() if len(s) % 2 == 1: print('No') else: ans = "Yes" for i in range(len(s)): if i % 2 == 0 and s[i] != 'h': ans = "No" break if i % 2 == 1 and s[i] != 'i': ans = "No" break print(ans)
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
85
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで // vector<vector<ll>> piyo(tate,vector<ll> (yoko)); #include <bits/stdc++.h> #define mod 1000000007 #define INF 1000000000 #define ll long long #define ln cout << endl; #define Yes cout << "Yes" << endl; #define No cout << "No" << endl; #define double long double #define REP...
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで // vector<vector<ll>> piyo(tate,vector<ll> (yoko)); #include <bits/stdc++.h> #define mod 1000000007 #define INF 1000000000 #define ll long long #define ln cout << endl; #define Yes cout << "Yes" << endl; #define No cout << "No" << endl; #define double long double #define REP...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
153
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define P pair<ll, ll> int main() { string s; bool ans = 0; if (s == "hi") ans = 1; if (s == "hihi") ans = 1; if (s == "hihihi") ans = 1; if (s == "hihihihi") ans = 1; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define P pair<ll, ll> int main() { string s; cin >> s; bool ans = 0; if (s == "hi") ans = 1; if (s == "hihi") ans = 1; if (s == "hihihi") ans = 1; if (s == "hihihihi") ...
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
118
s = input() if s == "hi" * len(s) // 2: print("Yes") else: print("No")
s = input() if s == "hi" * (len(s) // 2): print("Yes") else: print("No")
[["+", 0, 57, 15, 666, 0, 657, 12, 23, 0, 24], ["+", 0, 57, 15, 666, 0, 657, 12, 23, 0, 25]]
5
33
s = input() n = s.count("hi") print("Yes" if n*2 == len(n) else "No")
s = input() n = s.count("hi") print("Yes" if n*2 == len(s) else "No")
[["-", 0, 41, 0, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 41, 0, 666, 0, 652, 3, 4, 0, 22]]
5
34
///----> bismillahir rahmanir rahim <---- -- { ^ _ ^ } /// { ^_^ } { ^ _ ^ } #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; /// VECTOR<VECTOR<INT>NAME>NAME 2 typedef vector<vl> vvl; /// LONG LONG typedef pair<int, int> ...
///----> bismillahir rahmanir rahim <---- -- { ^ _ ^ } /// { ^_^ } { ^ _ ^ } #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; /// VECTOR<VECTOR<INT>NAME>NAME 2 typedef vector<vl> vvl; /// LONG LONG typedef pair<int, int> ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
493
#include <bits/stdc++.h> #define PI 3.14159265359 #define rep(i, a, n) for (int i = a; i < (int)n; ++i) #define SZ(x) ((int)(x).size()) // size() unsigned -> int #define descsort(a) sort(a.begin(), a.end(), std::greater<int>()) using namespace std; typedef long long ll; const ll INF = 1e9 + 7; int main(void) { stri...
#include <bits/stdc++.h> #define PI 3.14159265359 #define rep(i, a, n) for (int i = a; i < (int)n; ++i) #define SZ(x) ((int)(x).size()) // size() unsigned -> int #define descsort(a) sort(a.begin(), a.end(), std::greater<int>()) using namespace std; typedef long long ll; const ll INF = 1e9 + 7; int main(void) { stri...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
174
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> #include <vector> using namespace std; long long MOD = 1e9 + 7; int MAX_INT = 1e9; int main(void) { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string S; cin >> S; string hitachi = ""; for (int i = 0; i...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <string> #include <vector> using namespace std; long long MOD = 1e9 + 7; int MAX_INT = 1e9; int main(void) { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string S; cin >> S; string hitachi = ""; for (int i = 0; i...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
122
s = gets.chomp x = s.length / 2 if s == 'hi' * x puts 'Yes' else 'No' end
s = gets.chomp x = s.length / 2 if s == 'hi' * x puts 'Yes' else puts 'No' end
[["+", 0, 493, 0, 121, 75, 95, 0, 652, 735, 22]]
4
29
#include <bits/stdc++.h> using namespace std; //#define cerr if (false) cerr #define db(x) cerr << #x << "=" << x << endl #define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl #define db3(x, y, z) \ cerr << #x << "=" << x << "," << #y << "=...
#include <bits/stdc++.h> using namespace std; //#define cerr if (false) cerr #define db(x) cerr << #x << "=" << x << endl #define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl #define db3(x, y, z) \ cerr << #x << "=" << x << "," << #y << "=...
[["+", 0, 2, 3, 4, 0, 41, 15, 16, 17, 106], ["+", 3, 4, 0, 41, 15, 16, 12, 16, 31, 22], ["+", 3, 4, 0, 41, 15, 16, 12, 16, 17, 60], ["+", 0, 41, 15, 16, 12, 16, 12, 5, 0, 62], ["+", 0, 41, 15, 16, 12, 16, 12, 5, 0, 6]]
1
173
s = input() n = len(s) if n == 1: print("No") exit(0) for i in range(n): if i % 2 == 0: if s[i] != "h": print("No") break elif s[i] != "i": print("No") break else: print("Yes")
s = input() n = len(s) if n % 2 == 1: print("No") exit(0) for i in range(n): if i % 2 == 0: if s[i] != "h": print("No") break elif s[i] != "i": print("No") break else: print("Yes")
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
83
import sys s = input() if len(s)%2 == 1: print('No') sys.exit() for i in range(len(s)//2): if s[2*i:2*i+1] != 'hi': print('No') sys.exit() print('Yes')
import sys s = input() if len(s)%2 == 1: print('No') sys.exit() for i in range(len(s)//2): if s[2*i:2*i+2] != 'hi': print('No') sys.exit() print('Yes')
[["-", 15, 666, 0, 206, 206, 663, 0, 657, 12, 612], ["+", 15, 666, 0, 206, 206, 663, 0, 657, 12, 612]]
5
76
#include <iostream> #include <string> using namespace std; int main() { string t; string r; string s; cin >> t; int l = t.size() / 2; for (int i = 0; i < l; i++) { s += "hi"; } if (s == t) r = "yes"; else r = "no"; cout << r << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { string t; string r; string s; cin >> t; int l = t.size() / 2; for (int i = 0; i < l; i++) { s += "hi"; } if (s == t) r = "Yes"; else r = "No"; cout << r << endl; return 0; }
[["-", 0, 57, 64, 1, 0, 11, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 11, 12, 5, 0, 6], ["-", 75, 76, 0, 1, 0, 11, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 11, 12, 5, 0, 6]]
1
88
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; if ((S == "hi") || (S == "hihi") || (S == "hihihi") || (S == "hihihihi") || (S == "hihihihi")) { cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; if ((S == "hi") || (S == "hihi") || (S == "hihihi") || (S == "hihihihi") || (S == "hihihihihi")) { cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; }
[["-", 51, 16, 12, 23, 0, 16, 12, 5, 0, 6], ["+", 51, 16, 12, 23, 0, 16, 12, 5, 0, 6]]
1
85
s = input() p = "No" a = 0 if len(s) % 2 == 0: for i in range(len(s)//2+1): if str(s[a]+s[a+1]) == "hi": p = "Yes" a = a + 2 else: p = "No" break; print(p)
s = input() p = "No" a = 0 if len(s) % 2 == 0: for i in range(len(s)//2): if str(s[a]+s[a+1]) == "hi": p = "Yes" a = a + 2 else: p = "No" break; print(p)
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
81
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <random> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)n; i++) int main() { string s; cin >> s; if (s.size() % 2 == 0)...
#include <algorithm> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <random> #include <string> #include <vector> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)n; i++) int main() { string s; cin >> s; if (s.size() % 2 != 0)...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79]]
1
154
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string hitachi; for (int i = 0; i < 3; i++) { hitachi += "hi"; if (s == hitachi) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string hitachi; for (int i = 0; i < 5; i++) { hitachi += "hi"; if (s == hitachi) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
71
#include <stdio.h> #include <string.h> int main() { char s[11]; scanf("%s", s); int flag = 0; for (int i = 0; i < strlen(s); i++) { if (strlen(s) == 1) { printf("No"); return 0; } if (i % 2 == 0) { if (s[i] != 'h') { printf("No"); return 0; } } else if (s...
#include <stdio.h> #include <string.h> int main() { char s[11]; scanf("%s", s); int flag = 0; for (int i = 0; i < strlen(s); i++) { if (strlen(s) % 2 == 1) { printf("No"); return 0; } if (i % 2 == 0) { if (s[i] != 'h') { printf("No"); return 0; } } else i...
[["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 13]]
0
137
//#pragma once #include <algorithm> #include <bitset> #include <cctype> #include <cstdlib> // srand,rand #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stdio.h> #include <stdl...
//#pragma once #include <algorithm> #include <bitset> #include <cctype> #include <cstdlib> // srand,rand #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stdio.h> #include <stdl...
[["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
1,967
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const ll MOD = 1e9 + 7; const ll MOD2 = 998244353; const ll LINF = 1e18; #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define next asdnext #define prev asdprev #define MP...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const ll MOD = 1e9 + 7; const ll MOD2 = 998244353; const ll LINF = 1e18; #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define next asdnext #define prev asdprev #define MP...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
250
<?php $line = fgets(STDIN); if (preg_match("/hi{1,}/", $line)) { echo 'Yes'; } else { echo 'No'; } ?>
<?php $line = fgets(STDIN); if (preg_match("/^(hi){1,}$/", $line)) { echo 'Yes'; } else { echo 'No'; } ?>
[["-", 0, 613, 3, 3, 0, 28, 0, 609, 0, 610], ["+", 0, 613, 3, 3, 0, 28, 0, 609, 0, 610]]
6
37
S = input() for i in range(1, 6): if S == 'hi' * i: print('Yes') break print('No')
S = input() for i in range(1, 6): if S == 'hi' * i: print('Yes') exit() print('No')
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
37