Problem:


Score : 400 points

Problem Statement

In this problem, we only consider strings consisting of lowercase English letters.

Strings s and t are said to be isomorphic when the following conditions are satisfied:

|s| = |t| holds.

For every pair i, j, one of the following holds:

s_i = s_j and t_i = t_j.

s_i \neq s_j and t_i \neq t_j.

For example, abcac and zyxzx are isomorphic, while abcac and ppppp are not.

A string s is said to be in normal form when the following condition is satisfied:

For every string t that is isomorphic to s, s \leq t holds. Here \leq denotes lexicographic comparison.

For example, abcac is in normal form, but zyxzx is not since it is isomorphic to abcac, which is lexicographically smaller than zyxzx.

You are given an integer N.
Print all strings of length N that are in normal form, in lexicographically ascending order.

Constraints

1 \leq N \leq 10

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N

Output

Assume that there are K strings of length N that are in normal form: w_1, \ldots, w_K in lexicographical order.
Output should be in the following format:

w_1
:
w_K

Sample Input 1

1

Sample Output 1

a

Sample Input 2

2

Sample Output 2

aa
ab



Sample input:
1


Sample output:
a

Submission status: Wrong Answer

Solution code:
def create_li(li):
  if len(li) >= n:
    lis.append(li)
    return
  p = li[-1]
  ret = []
  for i in range(1, p + 2):
    cp = li[:]
    cp.append(i)
 #   print(cp)
    create_li(cp)

lis = []
  
n = int(input())
pre = [1]
create_li(pre)
lis.sort()
al = ["a","b","c","d","e","f","g","h","i","j"]
ans = set(["".join([al[id-1] for id in i]) for i in lis])
ans = list(ans)
ans.sort()
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
print('a'*n)
for i in range(n-1):
    print('a'*(n-i-1)+'b'+'a'*(i))

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    abc = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')
    print('a')
    past = [[0, 'a']]

    for i in range(1, N):
        ns = []
        for s in past:
            for j in range(s[0] + 2):
                ns.append([j, s[1] + abc[j]])
        past = ns
        for s in past:
            print(s[1])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())

cl = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", ]

rs = set()
for i in range(n):
    s = ["a"] * (n - i)
    # 右からi+1桁目以降のパターンを抽出
    rs |= set(["".join(s + list(l)) for l in itertools.product(cl[:n - 1], repeat=i)])
    # for l in  itertools.product(cl[:n],repeat=i):
    #     s+list(l)
rl = list(rs)
rl.sort()
if n != 1:
    rl.append("".join(cl[:n]))

for r in rl:
    print(r)

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = ['a','b','c','d','e','f','g','h','i','j','k',]
ans = []
#for i in range(n):
t = ['a'] * n
for i in range(2 ** n):
    s = ['a'] * n
    for j in range(n):
        if ((i >> j) & 1):
            s[n - 1 - j] = 'b'
    ans.append(''.join(s))
ans.append(''.join(t))
for i in range(1,n):
    for j in range(i,n):
        s = ['a'] * n
        s[j:n] = lis[1:n-j+1]
        ans.append(''.join(s))
        #print(s)


ans.sort()
d = set()
for i in ans:
    if i[0] == 'a':
        if not i in d:
            print(i)
            d.add(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [ [] for _ in range(11) ]
a[0].append("a")

alp = "abcdefghijklmn"
for i in range(1, 10):
    for aa in a[i-1]:
        for c in alp[:i+1]:
            if ord(aa[-1])+1 < ord(c): break

            a[i].append(aa+c)

for ans in a[n-1]:
    print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
cs = 'abcdefghijklmn'
cm = {cs[i]:i for i in range(len(cs))}

def rec(string, l):
    if (l >= n):
        print(string)
        return 0
    now = string[-1]
    k = cm[now] + 2
    for c in cs[:k]:
        rec(string + c,l+1)

rec('a',1)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = ['a']
moji = ['a','b','c','d','e','f','g','h','i','j']
count = 1
while count < N:
    tmp = []
    for i in ans:
        for k in range(len(set(list(i)))+1):
            tmp.append(i+moji[k])
    count += 1
    ans = tmp
print(sorted(ans))

Submission status: Wrong Answer

Solution code:
'''0000
0001
0010
0011
0100
0101
0110
0111'''

print('''aaaa
aaab
aaba
aabb
abaa
abab
abba
abbb''')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right


N = read_a_int()


moji = 'abcdefghij'
candi = []
moji = moji[:N]


def dfs(now, i, j):
    # j....一つ前の文字のidx
    # 文字を作って返す
    if i == N:
        candi.append(now)
        return
        # return now
    dfs(now + moji[j], i + 1, j)
    if i != 0:
        dfs(now + moji[j + 1], i + 1, j + 1)


dfs('', 0, 0)

print(*sorted(candi), sep='\n')
# for i in range(1, N + 1):  # 何番目まで使うか
#     mojisyu = moji[:i]  # ここで使う文字種類
#     # 文字種類でaを先頭にできるだけ標準形を列挙したい
#     for j in range(1, i):

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = ['a','b','c','d','e','f','g','h','i','j','k',]
ans = []
#for i in range(n):
t = ['a'] * n
for i in range(2 ** n):
    s = ['a'] * n
    for j in range(n):
        if ((i >> j) & 1):
            s[n - 1 - j] = 'b'
    ans.append(''.join(s))
ans.append(''.join(t))
for i in range(1,n):
    for j in range(i,n):
        s = ['a'] * n
        s[j:n] = lis[1:n-j+1]
        ans.append(''.join(s))
        print(s)


ans.sort()
d = set()
for i in ans:
    if i[0] == 'a':
        if not i in d:
            print(i)
            d.add(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = "bcdefghijk"
if n == 1:
    print("a")
elif n == 2:
    print("aa")
    print("ab")
elif n == 3:
    print("aaa")
    print("aab")
    print("aba")
    print("abb")
    print("abc")

Submission status: Wrong Answer

Solution code:
def func2(n):
    if n == 1:
        return "a"
    ll = []
    for head in func2(n-1):
        for tail in [chr(i + 97) for i in range(2) ]:
           ll.append(head + tail)
    return ll

def func3(n):
    if n == 3:
        return ["abc"]
    ll = []
    for head in func3(n-1):
        for tail in [chr(i + 97) for i in range(3) ]:
           ll.append(head + tail)
    return ll

def func4(n):
    if n == 4:
        return ["abcd"]
    ll = []
    for head in func4(n-1):
        for tail in [chr(i + 97) for i in range(4) ]:
           ll.append(head + tail)
    return ll
  
def func2(n):
    if n == 1:
        return "a"
    ll = []
    for head in func2(n-1):
        for tail in [chr(i + 97) for i in range(2) ]:
           ll.append(head + tail)
    return ll

def func3(n):
    if n == 3:
        return ["abc"]
    ll = []
    for head in func3(n-1):
        for tail in [chr(i + 97) for i in range(3) ]:
           ll.append(head + tail)
    return ll

def func4(n):
    if n == 4:
        return ["abcd"]
    ll = []
    for head in func4(n-1):
        for tail in [chr(i + 97) for i in range(4) ]:
           ll.append(head + tail)
    return ll

Submission status: Wrong Answer

Solution code:
n=int(input())

def saiki(l,n):
  tmp=[]
  for limit,s in enumerate(l):
    for i in range(n):
      if i>=limit+2: break
      tmp.append(s+chr(ord('a')+i))
  return tmp

ans=['a']
for i in range(1,n):
  ans=saiki(ans,i+1)
print(*ans,sep='\n')

Submission status: Wrong Answer

Solution code:
n = int(input())

results = []
if n == 1:
    results = ["a"]
elif n == 2:
    results = ["aa", "ab"]
elif n == 3:
    results = ["aaa", "aab", "aba", "abb", "abc"]
elif n == 4:
    results = ["aaaa", "aaab", "aabb", "aabc", "abbb", "abbc", "abcb", "abcc", "abcd"]

for result in results:
    print(result)

Submission status: Wrong Answer

Solution code:
n = int(input())

text = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

if n == 1:
    print("a")
elif n == 2:
    print("aa\nab")
else:
    old = []
    old.append(["aa"])
    old.append(["ab"])
    for i in range(2, n):
        result = []
        for j in range(2, i + 2):
            if j == 2:
                tmp = []
                result.append([old[0][0] + 'a'])
                result.append([old[0][0] + 'b'])
            else:
                tmp = []
                for txt in old[j - 2]:
                    for k in range(j):
                        tmp.append(txt + text[k])
                result.append(tmp)
        old = result
    for rows in old:
        for row in rows:
            print(row)

Submission status: Wrong Answer

Solution code:
n = int(input())
tb = 'abcdefghijklmnopqrstuvwxyz'
ans = []

def output(s, itb):
    global n
    global tb

    for i in range(n - len(s)):
        t = s + tb[itb] * (i + 1)
        if len(t) == n:
            ans.append(t)
        elif len(t) < n:
            output(t, itb + 1)

output('', 0)
for a in sorted(ans):
    print(a)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
N = int(input())
N -= 1

S = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]


def dfs(s, depth, maxS):

    if depth == N:
        print(s)
        return

    for i in range(maxS+1):
        dfs(s + S[i], depth+1, i+1)


dfs("a", 0, 1)

Submission status: Wrong Answer

Solution code:
a = int(input())
i=0
j=1
k=1
l=1
m=1
o=1
p=1
q=1
r=1

while a-i>0:
  for n in range(a-i):
    print("a",end="")
  for n in range(i):
    print("b",end="")
  print("\n")
  i=i+1
while a-j-1>0:
  print("a",end="")
  for n in range(a-j-1):
    print("b",end="")
  for n in range(j):
    print("c",end="")
  print("\n")
  j=j+1
while a-k-2>0:
  print("ab",end="")
  for n in range(a-k-2):
    print("c",end="")
  for n in range(k):
    print("d",end="")
  print("\n")
  k=k+1
while a-l-3>0:
  print("abc",end="")
  for n in range(a-l-3):
    print("d",end="")
  for n in range(l):
    print("e",end="")
  print("\n")
  l=l+1
while a-m-4>0:
  print("abcd",end="")
  for n in range(a-m-4):
    print("e",end="")
  for n in range(m):
    print("f",end="")
  print("\n")
  m=m+1
while a-o-5>0:
  print("abcde",end="")
  for n in range(a-o-5):
    print("f",end="")
  for n in range(o):
    print("g",end="")
  print("\n")
  o=o+1
while a-p-6>0:
  print("abcdef",end="")
  for n in range(a-p-6):
    print("g",end="")
  for n in range(p):
    print("h",end="")
  print("\n")
  p=p+1
while a-q-7>0:
  print("abcdefg",end="")
  for n in range(a-q-7):
    print("h",end="")
  for n in range(q):
    print("i",end="")
  print("\n")
  q=q+1
while a-r-8>0:
  print("abcdefgh",end="")
  for n in range(a-r-8):
    print("i",end="")
  for n in range(r):
    print("j",end="")
  print("\n")
  r=r+1

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
alpha = ["a","b","c","d","e","f","g","h","i","j"]
selection = alpha[0:n]
my_list = [i for i in list(itertools.product(selection,repeat=n)) if i[0] == "a"]
my_list.sort()
for t in my_list:
    print("".join(t))

Submission status: Wrong Answer

Solution code:
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, n):
    if(len(s) == n):
        print(s)
        return
    for i in range(m):
        # dump(i)
        f(s+chr(i+ord('a')), m if i < m else (m+1), n)


n = int(input())
dump(n)
ans = set()
# for si in f('a', 2, n):
#    pass  # print(si)
f('a', 2, n)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = []
from string import ascii_letters
from itertools import combinations
for g in range(N):
    if g == 0:
        ans.append(ascii_letters[0]*N)
        continue
    for l in combinations(range(N-1), g):
        t = ""
        for i, v in enumerate(l):
            m = ascii_letters[i]
            if i - 1 < 0:
                n = l[i] + 1
            else:
                n = l[i] - l[i-1] + 1
            t += (m * n)
        t += ascii_letters[i+1] * (N - len(t))
        ans.append(t)

#print(ans)
for i in sorted(ans):
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 1:
  print('a')
elif n == 2:
  print('aa\nab')
elif n == 3:
  print('aaa\naab\naba\nabb\nabc')
elif n == 4:
  print('aaaa\naaab\naaba\naabb\naabc\nabaa\nabab\nabac\nabba\nabbb\nabbc\nabca\nabcb\nabcc\nabcd')
elif n == 5:
  print('aaaaa\naaaab\naaaba\naaabb\naaabc\naabaa\naabab\naabac\naabba\naabbb\naabbc\naabca\naabcb\naabcc\naabcd\nabaaa\nabaab\nabaac\nababa\nababb\nababc\nabaca\nabacb\nabacc\nabacd\nabbaa\nabbab\nabbac\nabbba\nabbbb\nabbbc\nabbca\nabbcb\nabbcc\nabbcd\nabcaa\nabcab\nabcac\nabcad\nabcba\nabcbb\nabcbc\nabcbd\nabcca\nabccb\nabccc\nabccd\nabcda\nabcdb\nabcdc\nabcdd\nabcde')

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    p = int(input())
    lis = []
    if p == 1:
        print("a")
    else:
        for i in range(2,p+1):
            n = (2 ** (i-1)) - 1
            lis1 = []
            for j in range(n+1):
                lis1.append(format(j,"b").zfill(i))
            lis.append(lis1)
        lis_cor = [lis[0]]
        for i in range(1,len(lis)):
            lisnew = []
            for j in range(len(lis[i])):
                num = lis[i][j].count("1")
                if num > 1:
                    for x in lis_cor[num-2]:
                        x1 = str(int(x) + int(lis[i][j]))
                        lisnew.append(x1.zfill(i+2))
                else:
                    lisnew.append(lis[i][j])
            lis_cor.append(lisnew)
        str_lis = ["a","b","c","d","e","f","g","h","i","j","k"]
        st = ""
        lis_cor1 = list(set(lis_cor[p-2]))
        st_l = []
        for y in lis_cor1:
            for j in range(len(y)):
                st1 = str_lis[int(y[j])]
                st += st1
            st_l.append(st)
            st = ""
        
        st_l.sort()
        for x in st_l:
            print(x)
            



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())

cl = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", ]


rs=set()
for i in range(n):
    s= ["a"]*(n-i)
    #右からi+1桁目以降のパターンを抽出
    rs |= set(["".join(s + list(l)) for l in itertools.product(cl[:n-1], repeat=i)])
    # for l in  itertools.product(cl[:n],repeat=i):
    #     s+list(l)
rl=list(rs)
rl.sort()
rl.append("".join(cl[:n]))

for r in rl:
    print(r)

Submission status: Wrong Answer

Solution code:
N = int(input())
def to_str(n):
    s = [chr(i + 97) for i in reversed(n)]
    s = "".join(s)
    return s
n = [0] * N
n_max = list(reversed(list(range(N))))

s = to_str(n)
print(s)
while True:
    for j in range(N-1):
        if n[j] < n[j+1]+1:
            n[j] += 1
            for k in range(j):
                n[k] = 0
            s = to_str(n)
            print(s)
            break
    if n == n_max:
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
lis = ['a','b','c','d','e','f','g','h','i','j','k',]
ans = []
#for i in range(n):
t = ['a'] * n
for i in range(2 ** n):
    s = ['a'] * n
    for j in range(n):
        if ((i >> j) & 1):
            s[n - 1 - j] = 'b'
    ans.append(''.join(s))
ans.append(''.join(t))
for i in range(1,n):
    for j in range(i,n):
        s = ['a'] * n
        s[j:n] = lis[1:n-j+1]
        ans.append(''.join(s))
        print(s)


ans.sort()
for i in ans:
    if i[0] == 'a':
        print(i)

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 

cs = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k']

n = load()

def printmx(mx, n):
    s = ['' for _ in range(n)]
    for i, m in enumerate(mx):
        for j in m:
            s[j] = cs[i]
    print(''.join(s))


if n == 1:
    print('a')
    exit()

mx = [deque() for _ in range(n)]
for i in range(n):
    mx[0].append(i)

for i in range(1, n):
    while len(mx[i-1]) > 1:
        # print(mx)
        printmx(mx,n)
        mx[i].appendleft(mx[i-1].pop())
# print(mx)
printmx(mx, n)

Submission status: Wrong Answer

Solution code:
min_char = "abcdefghij"

def dtype(start, num):
    string_array = []
    if num > 0:
        for m in range(num):
            string = ""
            for _ in range(num-m):
                string += min_char[start]
            part_array = dtype(start+1, m)
            if part_array:
                for part in part_array:
#                    print(string+part)
                    string_array.append(string+part)
            else:
                string_array.append(string)
    return string_array

###
# main
if(__name__ == '__main__'):
    # input
    n = int(input())

    accomplishment = dtype(0, n)

    # output
    for ans in accomplishment:
        print(ans)
# else:
    # do nothing

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 1:
    print('a')
elif n == 2:
    print('aa')
    print('ab')
elif n == 3:
    print('aaa')
    print('aab')
    print('abb')
elif n == 4:
    print('aaaa')
    print('aaab')
    print('aabb')
    print('abbb')
elif n == 5:
    print('aaaaa')
    print('aaaab')
    print('aaabb')
    print('aabbb')
    print('abbbb')
elif n == 6:
    print('aaaaaa')
    print('aaaaab')
    print('aaaabb')
    print('aaabbb')
    print('aabbbb')
    print('abbbbb')
elif n == 7:
    print('aaaaaaa')
    print('aaaaaab')
    print('aaaaabb')
    print('aaaabbb')
    print('aaabbbb')
    print('aabbbbb')
    print('abbbbbb')
elif n == 8:
    print('aaaaaaaa')
    print('aaaaaaab')
    print('aaaaaabb')
    print('aaaaabbb')
    print('aaaabbbb')
    print('aaabbbbb')
    print('aabbbbbb')
    print('abbbbbbb')
elif n == 9:
    print('aaaaaaaaa')
    print('aaaaaaaab')
    print('aaaaaaabb')
    print('aaaaaabbb')
    print('aaaaabbbb')
    print('aaaabbbbb')
    print('aaabbbbbb')
    print('aabbbbbbb')
    print('abbbbbbbb')
else:
    print('aaaaaaaaaa')
    print('aaaaaaaaab')
    print('aaaaaaaabb')
    print('aaaaaaabbb')
    print('aaaaaabbbb')
    print('aaaaabbbbb')
    print('aaaabbbbbb')
    print('aaabbbbbbb')
    print('aabbbbbbbb')
    print('abbbbbbbbb')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = "bcdefghijk"
if n == 1:
    print("a")
elif n == 2:
    print("aa")
    print("ab")
elif n == 5:
    print("aaaab")
    print("aaaac")
    print("aaaad")
    print("aaaae")
    print("aaaaf")

Submission status: Wrong Answer

Solution code:
import string
import copy
def dfs(n):
    if n == N:
        tmp = copy.deepcopy(nlst)
        if nlst[0] != 0:
            anslst.append(tmp)
        return
    for i in range(2):
        nlst[n] = i
        dfs(n + 1)
    return


N = int(input())
anslst = []
nlst = [0] * N
wordlst = string.ascii_lowercase
dfs(0)
wlst = []
for i in anslst:
    index = 0
    w = ''
    for j in i:
        if j == 1:
            w += 'a'
        else:
            w += wordlst[1 + index]
            index += 1
    wlst.append(w)

wlst.sort()
for i in wlst:
    print(i)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import numpy as np

al = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]

def solve(N: int):
    
    def p_out(ppp):
        print("".join([al[p] for p in ppp]))

    def rec_ad(token, ttl):

        if ttl != 0:
            rec_ad(token + [max(token)], ttl - 1)
            rec_ad(token + [max(token)+1], ttl - 1)
        else :
            p_out(token)

    rec_ad([0], N-1)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    list = [97] * N
    count = 0
    for i in range(0, (2 ** N)-1):
        if count == N:
            break
        s = format(i, '0{}b'.format(N))

        for j, k in enumerate(s):
            list[j] += int(k)
            print(chr(list[j]), end="")
        print(end="\n")
        count += 1


    return 0


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
l = ['a', 'b', 'c', 'd','e','f','g','h','i','j']

if n == 1:
    print("a")

if n == 2:
    print("aa")
    print("ab")
    
if n >= 3:
    for v in itertools.product(l[:n - 1], repeat = n-1):
        if v[0] != l[n -2]:
            print("a" + "".join(v))
        else:
            break
    print("".join(l[:n]))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
n=INT()
a=["a" for i in range(n)]
if n!=5:
    exit()
def f(num):
    global n,a
    if num==n:
        print("".join([str(n) for n in a]))
        return
    elif num==1:
        a[num]="a"
        f(num+1)
        a[num]="b"
        f(num+1)
    else:
        a[num]="a"
        f(num+1)
        a[num]="b"
        f(num+1)
        if a.index("b")!=num:
            a[num]="c"
            f(num+1)
f(1)

Submission status: Wrong Answer

Solution code:
def chg(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

N = int(input())
li = list("abcdefghij")

for i in range(10**5):
    mm = str(chg(i,N)).zfill(N)
    cnt = -1
    li1 = []
    for j in range(N):
        a = int(mm[j])
        if str(a) in li1:
            continue
        elif a-1==cnt:
            cnt += 1
            li1.append(str(a))
            continue
        break
    else:
        for j in range(N):
            print(li[int(mm[j])],end="")
        print()
    # print(mm)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    print("a" * N)
    for i in range(N - 1, 0, -1):
        s = ("a" * i) + "b"
        # if i == N - 1:
        #     print(s)
        r_len = N - 1 - i
        for j in range((r_len + 1) ** r_len):
            nokori = j
            s2 = s
            prev_val = set()
            for k in range(r_len):
                if k == r_len - 1:
                    val = nokori
                else:
                    val = nokori // ((r_len + 1) ** (r_len - k - 1))
                prev_val.add(val)
                nokori = nokori % ((r_len + 1) ** (r_len - k - 1))
                s2 += alph[val]
                if val >= 3 and not val - 1 in prev_val:
                    break
            else:
                print(s2)
    if N >= 3:
        for i in range(N):
            print(alph[i], end="")
        print()



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
alphabets = list('Zabcdefghijklmn')
s = ['a']
for i in range(2, N + 1):
    subset = alphabets[1:i + 1]
    # s = [s[j] + k for k in subset for j in range(len(s))]
    s = [s[j] + k for j in range(len(s)) for k in subset]

sorted_s = sorted(s)
# for i, j in zip(s, sorted_s):
# print(i, j, i == j)
print(*sorted_s, sep='\n')

Submission status: Wrong Answer

Solution code:
def create_li(li):
  if len(li) >= n:
    lis.append(li)
    return
  p = li[-1]
  ret = []
  for i in range(1, p + 2):
    cp = li[:]
    cp.append(i)
 #   print(cp)
    create_li(cp)

lis = []
  
n = int(input())
pre = [1]
create_li(pre)
lis.sort()
al = ["a","b","c","d","e","f","g","h","i","j"]
for i in lis:
  ans = "".join([al[id-1] for id in i])
  print(ans)

Submission status: Wrong Answer

Solution code:
print('''aaaa
aaab
aaba
aabb
abaa
abab
abba
abbb
abca
abcb''')

Submission status: Wrong Answer

Solution code:
d = int(input())
chars = '_abcdefghij'


def solve(L, depth):
    if depth == d:
        print(''.join([chars[i] for i in L]))
        L.pop()
        return
    else:
        for i in range(1, L[depth - 1] + 2):
            L.append(i)
            solve(L, depth + 1)
        L.pop()


solve([1], 1)

Submission status: Wrong Answer

Solution code:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = list(map(int, input().split()))
    #a = [input().split() for i in range(n)]
    #a = [int(input()) for i in range(n)]
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    n=int(input())
    s = ('a','b','c','d','e','f','g','h','i','j')
    s = s[:n]
    if n==1:
        print('a')
        return 0
    if n==2:
        print('aa')
        print('ab')
        return 0
    import itertools
    for i in list(itertools.combinations_with_replacement(s, n)):
        if i[0] < 'b':
            print(*i, sep="")
            if len(set(i)) == n:
                return 0 
        else:
            return 0

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
from decimal import *
#input = sys.stdin.readline


#N=int(input())

#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]

N=int(input())
lst=[i for i in range(1,N)]
lst2=[[] for i in range(N)]
lst2[0].append([0])

for l in lst:
    for i in range(l+1):
        for l2 in lst2[l-1]:
            lst2[l].append(l2+[i])

lst2=lst2[-1]
lst2=sorted(["".join([chr(m+ord("a"))for m in l]) for l in lst2 ])
for i in lst2:
    print(i)

Submission status: Wrong Answer

Solution code:
# input1 = list(map(int, (input().split())))

s = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]

N = int(input())

# for i in range(N):
print("aaa")
print("aab")
print("aba")
print("abb")
print("abc")

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
n=INT()
a=["a" for i in range(n)]
if n!=3:
    exit()
def f(num):
    global n,a
    if num==n:
        print("".join([str(n) for n in a]))
        return
    elif num==1:
        a[num]="a"
        f(num+1)
        a[num]="b"
        f(num+1)
    else:
        a[num]="a"
        f(num+1)
        a[num]="b"
        f(num+1)
        if a.index("b")!=num:
            a[num]="c"
            f(num+1)
f(1)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
n = int(input())
li = ["a","b","c","d","e","f","g","h","i","j"]
ans = []
anss = "a"*(n-1)
for i in range(n):
    anss = "a"*(n-1)
    anss += li[i]
    ans.append(anss)
for i in range(n):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
print(int(input()))

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    p = int(input())
    lis = []
    if p == 1:
        print("a")
    else:
        for i in range(2,p+1):
            n = (2 ** (i-1)) - 1
            lis1 = []
            for j in range(n+1):
                lis1.append(format(j,"b").zfill(i))
            lis.append(lis1)
        lis_cor = [lis[0]]
        for i in range(1,len(lis)):
            lisnew = []
            for j in range(len(lis[i])):
                num = lis[i][j].count("1")
                if num > 1:
                    for x in lis_cor[num-2]:
                        x1 = str(int(x) + int(lis[i][j]))
                        lisnew.append(x1.zfill(i+2))
                else:
                    lisnew.append(lis[i][j])
            lis_cor.append(lisnew)
        str_lis = ["a","b","c","d","e","f","g","h","i","j","k"]
        st = ""
        lis_cor1 = list(set(lis_cor[p-2]))
        lis_cor1.sort()
        for y in lis_cor1:
            for j in range(len(y)):
                st1 = str_lis[int(y[j])]
                st += st1
            print(st)
            st = ""
            



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [ [] for _ in range(11) ]
a[0].append("a")

alp = "abcdefghijklmn"
for i in range(1, 10):
    for aa in a[i-1]:
        for c in alp[:i+1]:
            a[i].append(aa+c)

for ans in a[n-1]:
    print(ans)