Problem:


Score : 900 points

Problem Statement

We have a grid with (2^N - 1) rows and (2^M-1) columns.
You are asked to write 0 or 1 in each of these squares.
Let a_{i,j} be the number written in the square at the i-th row from the top and the j-th column from the left.

For a quadruple of integers (i_1, i_2, j_1, j_2) such that 1\leq i_1 \leq i_2\leq 2^N-1, 1\leq j_1 \leq j_2\leq 2^M-1, let
S(i_1, i_2, j_1, j_2) = \displaystyle \sum_{r=i_1}^{i_2}\sum_{c=j_1}^{j_2}a_{r,c}.
Then, let the oddness of the grid be the number of quadruples (i_1, i_2, j_1, j_2) such that S(i_1, i_2, j_1, j_2) is odd.

Find a way to fill in the grid that maximizes its oddness.

Constraints

N and M are integers between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N M

Output

Print numbers to write in the grid so that its oddness is maximized, in the following format:

a_{1,1}a_{1,2}\cdots a_{1,2^M-1}
a_{2,1}a_{2,2}\cdots a_{2,2^M-1}
\vdots
a_{2^N-1,1}a_{2^N-1,2}\cdots a_{2^N-1,2^M-1}

If there are multiple solutions, you can print any of them.

Sample Input 1

1 2

Sample Output 1

111

For this grid, S(1, 1, 1, 1), S(1, 1, 2, 2), S(1, 1, 3, 3), and S(1, 1, 1, 3) are odd, so it has the oddness of 4.

We cannot make the oddness 5 or higher, so this is one of the ways that maximize the oddness.



Sample input:
1 2


Sample output:
111

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(s):
        res = 0
        sum = [[0] for i in range(h+1)]
        sum[0] = [0]*(w+1)
        for y in range(h):
            for x in range(w):
                sum[y+1].append(sum[y+1][-1]^s[y][x])
        for x in range(w+1):
            for y in range(h):
                sum[y+1][x] ^= sum[y][x]
        for i1 in range(h):
            for i2 in range(i1,h):
                for j1 in range(w):
                    for j2 in range(j1,w):
                        su = sum[i2+1][j2+1]^sum[i1][j2+1]^sum[i2+1][j1]^sum[i1][j1]
                        if su:
                            res += 1
        return res
    h,w = LI()
    ans = [[1]*w for i in range(h)]
    if w < h:
        for i in range(1,w)[::2]:
            ans[i][i] = 0
            ans[h-i-1][i] = 0
    else:
        for i in range(1,h)[::2]:
            ans[i][i] = 0
            ans[i][w-i-1] = 0
    for i in ans:
        print(*i,sep = "")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
h = 2 ** n - 1
w = 2 ** m - 1

for _ in range(h):
    print("1" * w)

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(s):
        res = 0
        sum = [[0] for i in range(h+1)]
        sum[0] = [0]*(w+1)
        for y in range(h):
            for x in range(w):
                sum[y+1].append(sum[y+1][-1]^s[y][x])
        for x in range(w+1):
            for y in range(h):
                sum[y+1][x] ^= sum[y][x]
        for i1 in range(h):
            for i2 in range(i1,h):
                for j1 in range(w):
                    for j2 in range(j1,w):
                        su = sum[i2+1][j2+1]^sum[i1][j2+1]^sum[i2+1][j1]^sum[i1][j1]
                        if su:
                            res += 1
        return res
    h,w = LI()
    ans = [[1]*w for i in range(h)]
    if w < h:
        for i in range(1,w)[::2]:
            ans[i][i] = 0
            ans[h-i-1][i] = 0
    else:
        for i in range(1,h)[::2]:
            ans[i][i] = 0
            ans[i][w-i-1] = 0
    for i in ans:
        print(*i)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
nm=list(map(int, input().split())) 
n=2**nm[0]-1
m=2**nm[1]-1
a="10"
for i in range(nm[1]-1):
    a=a+a
a0=a.lstrip("1")
a1=a.rstrip("0")
for j in range(n):
    if j%2==0:
        print(a1)
    else:
        print(a0)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
for i in range(2**n-1):
    if i%2==0:
        print("1"*(2**m-1))
    else:
        print("0"*(2**m-1))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
 
odd = 0
even = 0
for i in range(1, 2**N):
    for j in range(1, 2**M):
        if i%2 == 1 and j%2 == 1:
            odd += (2**N-i)*(2**M-j)
        elif i%2 != j%2:
            even += (2**N-i)*(2**M-j)
 
if odd > even:
    s = "1"*(2**M-1)
    for _ in range(2**N-1):
        print(s)
else:
    L2 = []
    for i in range(2**M-1):
        L2.append(str(i%2))
    s1 = "1"*(2**M-1)
    s2 = "".join(L2)
    for i in range(2**N-1):
        if i%2 == 0:
            print(s1)
        else:
            print(s2)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys


N,M = map(int,input().split())

for i in range(2**N-1):
    for j in range(2**M-1):
        print(1,end='')
    print()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
for i in range(int(2**n-1)):
  s=1
  for j in range(int(2**m-2)):
    s=s*10+1
  print(s)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

for i in range(2**N - 1):
  ans = []
  for j in range(2**M-1):
    if j == 2**(M-1)-1 and i == 2**(N-1)-1:
      ans.append('1')
    elif j == 2**(M-1)-1 or i == 2**(N-1)-1:
      ans.append('0')
    else:
      ans.append('1')
  print("".join(ans))

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    if i==0 or i==n-1:
        print("0"*m)
    else:
        print("0"*m)

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    N=2**N-1
    M=2**M-1
    
    ans = [[1 for i in range(M)] for j in range(N)]
    ans[0][0]=0
    for a in ans:
        print(*a,sep="")
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = (int(i) for i in input().split())
    A = [[1 for j in range(2**M-1)] for i in range(2**N-1)]
    for i in range(2**N-1):
        for j in range(2**M-1):
            if N == M and i == N//2 and j == M//2:
                print(0, end="")
                continue
            print(1, end="")
        print()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    if i==0 or i==n-1:
        print("1"*m)
    else:
        if i%2==1:
            print("1"*m)
        else:
            print("1"+"0"*(m-2)+"1")

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
for i in range(2**n-1):
    print("1"*(2**m-1))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))

L = [0] * (2 ** M - 1)
L[0] = 1
L[-1] = 1
R = [0] * (2 ** M - 1)

for i in range(2 ** N - 1):
  if i == 0 or i == 2 ** N - 2:
    print("".join(list(map(str, L))))
  else:
    print("".join(list(map(str, R))))

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    if i==0 or i==n-1:
        print("1"*m)
    else:
        print("1"*m)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = [[1 for j in range(2**m-1)] for i in range(2**n-1)]
if n == 1:
  print(*ans[0],sep="")
  exit()
if m == 1:
  for i in range(2**n-1):
    print(1)
  exit()
for i in range(2**n-1):
  for j in range(2**m-1):
    if i%2 != j%2:
      ans[i][j] = 0
    if (abs(i%8) == 3) ^ (abs(j%8) == 3):
      ans[i][j] = 1
    if (abs(i%8) == 3) and (abs(j%8) == 3):
      ans[i][j] = 0
for arr in ans:
  print(*arr,sep="")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

for i in range(2**N - 1):
  ans = []
  for j in range(2**M-1):
    if j == 2**(M-1)-1 and i == 2**(N-1)-1:
      ans.append('0')
    else:
      ans.append('1')
  print("".join(ans))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = [[1 for j in range(2**m-1)] for i in range(2**n-1)]
for i in range(2**n-1):
  for j in range(2**m-1):
    if i%2 != j%2:
      ans[i][j] = 0
    if (abs(i%8) == 3) ^ (abs(j%8) == 3):
      ans[i][j] = 1
for arr in ans:
  print(*arr,sep="")

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())

if N == M:
    L1 = []
    L2 = []
    for i in range(2**M-1):
        L1.append(str((i+1)%2))
        L2.append(str(i%2))
    s1 = "".join(L1)
    s2 = "".join(L2)
    for i in range(2**N-1):
        if i%2 == 0:
            print(s1)
        else:
            print(s2)
else:
    L = ["0"]*(2**M-1)
    for i in range(2**M-1):
        if i%(2**N) == 0:
            L[i] = "1"
    for i in range(2**N-1):
        print("".join(L))
        L.pop(-1)
        t = ["0"]
        if (i+1)%(2**N) == 0:
            t[0] = "1"
        L = t + L

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

a = ['1']*(2**m-1)
b = ['1']*(2**m-1)

for i in range(2**m-1):
    if i % 2 != 0:
        b[i] = '0'


for i in range(2**n-1):
    if i % 2 == 0:
        print(''.join(a))
    else:
        print(''.join(b))

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    if i==0 or i==n-1:
        print("1"*m)
    else:
        if i%2==1:
            print("1"+"01"*(m//2))
        else:
            print("1"+"10"*(m//2-1)+"11")

Submission status: Wrong Answer

Solution code:
def main():
    N, M = (int(i) for i in input().split())
    A = [[1 for j in range(2**M-1)] for i in range(2**N-1)]
    for i in range(2**N-1):
        for j in range(2**M-1):
            print(A[i][j], end="")
        print()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N,M = inpl()
H = 2**N-1
W = 2**M-1

ans = [[-1] * W for _ in range(H)]
for i in range(W):
    for j in range(H):
        ans[j][i] = (i%2)^(j%2)^1


for a in ans:
    print("".join(map(str,a)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if n == 1:
    print('1' * (2 ** m - 1))
    exit()
if m == 1:
    print('\n'.join('1' * (2 ** n - 1)))
    exit()
ans = []
ans.append('1' * (2 ** m - 2) + '0')
ans.extend(['1' + '0' * (2 ** m - 3) + '1'] * (2 ** n - 3))
ans.append('0' + '1' * (2 ** m - 3) + '0')
print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

a = ['1']*(2**m-1)
b = ['1']*(2**m-1)

for i in range(2**m-1):
    if i % 2 == 0:
        b[i] = '0'


for i in range(2**n-1):
    if i % 2 == 0:
        print(''.join(a))
    else:
        print(''.join(b))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))

L = [1] * (2 ** M - 1)
for i in range(2 ** N - 1):
  print("".join(list(map(str, L))))

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    N=2**N-1
    M=2**M-1
    ans = [[1 if j&1 else (i&1)^1 for i in range(M)] for j in range(N)]
    for a in ans:
        print(*a,sep="")
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

for i in range(2**N - 1):
  ans = []
  for j in range(2**M-1):
    ans.append('1')
  print("".join(ans))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

a = ['1']*(2**m-1)
b = ['1']*(2**m-1)

for i in range(2**m-1):
    if i % 2 == 0:
        b[i] == '0'

for i in range(2**n-1):
    if i % 2 == 0:
        print(''.join(a))
    else:
        print(''.join(b))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if n == 1:
    print('1' * (2 ** m - 1))
    exit()
if m == 1:
    print('\n'.join('1' * (2 ** n - 1)))
    exit()
ans = []
ans.append('0' + '1' * (2 ** m - 3) + '0')
ans.extend(['1' + '0' * (2 ** m - 3) + '1'] * (2 ** n - 3))
ans.append('0' + '1' * (2 ** m - 2))
print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
def examA():
    S = SI()
    if len(S)%2==1:
        print("No")
        return
    for i in range(len(S)//2):
        if S[i*2:i*2+2]!="hi":
            print("No")
            return
    print("Yes")
    return

def examB():
    a, b, M = LI()
    A = LI()
    B = LI()
    D = [LI()for _ in range(M)]
    ans = min(A) + min(B)
    for x,y,c in D:
        cur = A[x-1]+B[y-1]-c
        ans = min(ans,cur)
    print(ans)
    return

def examC():
    def bfs(n, e, fordfs):
        # 点の数、スタートの点、有向グラフ
        W = [-1] * n
        # 各点の状態量、最短距離とか,見たかどうかとか
        W[e] = 0
        que = deque()
        que.append(e)
        while que:
            now = que.popleft()
            nowW = W[now]
            for ne in fordfs[now]:
                if W[ne] == -1:
                    W[ne] = nowW + 1
                    que.append(ne)
        return W
    N = I()
    V = [[]for _ in range(N)]
    for _ in range(N-1):
        a, b = LI()
        a -= 1
        b -= 1
        V[a].append(b)
        V[b].append(a)
    L = bfs(N,0,V)
    #print(L)
    odd = 0
    for l in L:
        if l==-1:
            print(-1)
            return
        if l%2==1:
            odd += 1
    G = []
    if odd*2<N:
        for i in range(N):
            if L[i]%2==1:
                G.append(i)
    else:
        for i in range(N):
            if L[i]%2==0:
                G.append(i)

    used = [False]*(N+1)
    ans = [0]*N
    if N//3>=len(G):
        cur = 3
        for g in G:
            ans[g] = cur
            used[cur] = True
            cur += 3
        cur = 1
        for i in range(N):
            if ans[i]!=0:
                continue
            while(used[cur]):
                cur += 1
            ans[i] = cur
            used[cur] = True
    else:
        cur = 1
        for g in G:
            ans[g] = cur
            used[cur] = True
            cur += 3
            if cur>N:
                cur = 3
        cur = 1
        for i in range(N):
            if ans[i]!=0:
                continue
            while(used[cur]):
                cur += 1
            ans[i] = cur
            used[cur] = True
    print(" ".join(map(str,ans)))
    return

def examD():
    N, T = LI()


    ans = 0
    print(ans)
    return

def examE():
    N, M = LI()
    H = 2**N-1; W = 2**M -1
    ans = [[0]*W for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if not (h%N)==(w%M):
                continue
            ans[h][w] = 1
    for v in ans:
        print("".join(map(str,v)))
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examE()

"""

"""

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    if i==0 or i==n-1:
        print("1"*m)
    else:
        if i%2==0:
            print("1"+"01"*(m//2))
        else:
            print("1"+"10"*(m//2-1)+"11")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
n = 2 ** N - 1
m = 2 ** M - 1
A = [[0] * m for i in range(n)]
B = [[0] * m for i in range(n)]
for i in range(n):
    for j in range(m):
        x = (i + j) % 2
        if x == 0:
            A[i][j] = 1
        else:
            A[i][j] = 0
for i in range(n):
  B[i] =  [str(a) for a in A[i]]
for i in range(n):
  L=''.join(B[i])
  print(L)

Submission status: Wrong Answer

Solution code:
def main():
	a,b = map(int,input().split())
	o = "10"*600
	e = "01"*600
	l = 2**b-1
	if a ==1 or b == 1:
		for i in range(2**a-1):
			if i % 2 == 0:
				print(o[:l])
			else:
				print(e[:l])
	else:
		for i in range(2**a-1):
			if i % 2 == 0:
				print(e[:l])
			else:
				print(o[:l])


main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

def main():
    if n == m:
        flag = False
        for i in range(pow(2,n)-1):
            for j in range(pow(2,m)-1):
                if i ==0 or j==0:
                    print(1, end='')
                elif i==pow(2,n)-2 or j==pow(2,m)-2:
                    print(1, end='')
                else:
                    if flag:
                        print(1, end='')
                    else:
                        print(0, end='')
                    flag = not flag
            print()
        return 0
    flag = True
    for i in range(pow(2,n)-1):
        for j in range(pow(2,m)-1):
            if flag:
                print(1, end='')
            else:
                print(0, end='')
            flag = not flag
        print()
    return 0
main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = []
for i in range(2**N - 1):
    if i%2 == 0:
        print(''.join(['1'] * (2**M - 1)))
    elif i%4 == 1:
        print(''.join([str(j%2) for j in range(2**M - 1)]))
    else:
        print(''.join([str((j+1)%2) for j in range(2**M - 1)]))

Submission status: Wrong Answer

Solution code:
def examA():
    S = SI()
    if len(S)%2==1:
        print("No")
        return
    for i in range(len(S)//2):
        if S[i*2:i*2+2]!="hi":
            print("No")
            return
    print("Yes")
    return

def examB():
    a, b, M = LI()
    A = LI()
    B = LI()
    D = [LI()for _ in range(M)]
    ans = min(A) + min(B)
    for x,y,c in D:
        cur = A[x-1]+B[y-1]-c
        ans = min(ans,cur)
    print(ans)
    return

def examC():
    def bfs(n, e, fordfs):
        # 点の数、スタートの点、有向グラフ
        W = [-1] * n
        # 各点の状態量、最短距離とか,見たかどうかとか
        W[e] = 0
        que = deque()
        que.append(e)
        while que:
            now = que.popleft()
            nowW = W[now]
            for ne in fordfs[now]:
                if W[ne] == -1:
                    W[ne] = nowW + 1
                    que.append(ne)
        return W
    N = I()
    V = [[]for _ in range(N)]
    for _ in range(N-1):
        a, b = LI()
        a -= 1
        b -= 1
        V[a].append(b)
        V[b].append(a)
    L = bfs(N,0,V)
    #print(L)
    odd = 0
    for l in L:
        if l==-1:
            print(-1)
            return
        if l%2==1:
            odd += 1
    G = []
    if odd*2<N:
        for i in range(N):
            if L[i]%2==1:
                G.append(i)
    else:
        for i in range(N):
            if L[i]%2==0:
                G.append(i)

    used = [False]*(N+1)
    ans = [0]*N
    if N//3>=len(G):
        cur = 3
        for g in G:
            ans[g] = cur
            used[cur] = True
            cur += 3
        cur = 1
        for i in range(N):
            if ans[i]!=0:
                continue
            while(used[cur]):
                cur += 1
            ans[i] = cur
            used[cur] = True
    else:
        cur = 1
        for g in G:
            ans[g] = cur
            used[cur] = True
            cur += 3
            if cur>N:
                cur = 3
        cur = 1
        for i in range(N):
            if ans[i]!=0:
                continue
            while(used[cur]):
                cur += 1
            ans[i] = cur
            used[cur] = True
    print(" ".join(map(str,ans)))
    return

def examD():
    N, T = LI()


    ans = 0
    print(ans)
    return

def examE():
    N, M = LI()
    H = 2**N-1; W = 2**M -1
    ans = [[0]*W for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if (h%N)==N-1 and (w%M)==M-1:
                continue
            ans[h][w] = 1
    for v in ans:
        print("".join(map(str,v)))
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examE()

"""

"""

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = []
for i in range(2**N - 1):
    if i%2 == 1:
        print(''.join(['1'] * (2**M - 1)))
    else:
        print(''.join([str(j%2) for j in range(2**M - 1)]))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = [[1 for j in range(2**m-1)] for i in range(2**n-1)]
if n == 1:
  print(*ans[0],sep="")
  exit()
if m == 1:
  for i in range(2**n-1):
    print(1)
  exit()
for i in range(2**n-1):
  for j in range(2**m-1):
    if i%2 == j%2:
      ans[i][j] = 0
for arr in ans:
  print(*arr,sep="")

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    N=2**N-1
    M=2**M-1
    ans = [[1 for i in range(M)] for j in range(N)]
    for a in ans:
        print(*a,sep="")
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    if i==0 or i==n-1:
        print("1"*m)
    else:
        print("1"+"0"*(m-2)+"1")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

for i in range(2**N - 1):
  ans = []
  for j in range(2**M-1):
    if j % 2 == 0 and i % 2 == 0:
      ans.append('1')
    elif j % 2 == 1 and i % 2 == 1:
      ans.append('1')
    else:
      ans.append('0')
  print("".join(ans))

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1
print("1"*m)
for i in range(n-2):
    print("1"+"0"*(m-2)+"1")

print("1"*m)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
X, Y = 2 ** N - 1, 2 ** M - 1
for i in range(X):
  for j in range(Y):
    print(1, end = '')
  print()

Submission status: Wrong Answer

Solution code:
def mi():return map(int,input().split())
n,m=mi()
n=pow(2,n)-1
m=pow(2,m)-1

for i in range(n):
    print("1"*m)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())

a = ['1']*(2**m-1)

for i in range(2**n-1):
    print(''.join(a))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = []
for i in range(2**N - 1):
    if i%2 == 0:
        print(''.join(['1'] * (2**M - 1)))
    else:
        print(''.join([str((j+1)%2) for j in range(2**M - 1)]))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = []
for i in range(2**N - 1):
    if i%2 == 0:
        print(''.join(['1'] * (2**M - 1)))
    else:
        print(''.join([str(j%2) for j in range(2**M - 1)]))

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())

odd = 0
even = 0
for i in range(1, 2**N):
    for j in range(1, 2**M):
        if i%2 == 1 and j%2 == 1:
            odd += (2**N-i)*(2**M-j)
        elif i%2 != j%2:
            even += (2**N-i)*(2**M-j)

if odd > even:
    s = "1"*(2**M-1)
    for _ in range(2**N-1):
        print(s)
else:
    L1 = []
    L2 = []
    for i in range(2**M-1):
        L1.append(str((i+1)%2))
        L2.append(str(i%2))
    s1 = "".join(L1)
    s2 = "".join(L2)
    for i in range(2**N-1):
        if i%2 == 0:
            print(s1)
        else:
            print(s2)

Submission status: Wrong Answer

Solution code:
def main():
	a,b = map(int,input().split())
	o = "10"*600
	e = "01"*600
	l = 2**b-1
	for i in range(2**a-1):
		if i % 2 == 0:
			print(o[:l])
		else:
			print(e[:l])

main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans = []
ans.append('0' + '1' * (2 ** m - 2))
ans.extend(['1' + '0' * (2 ** m - 2)] * (2 ** n - 2))
print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
N, M = (int(i) for i in input().split())

for i in range(2**N - 1):
    if (i+1) % 4 != 0:
        print("".join(["1"] * (2**M - 1)))
    else:
        print("".join([str((j + 1) % 2) for j in range(2**M - 1)]))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ans = [[1 for j in range(2**m-1)] for i in range(2**n-1)]
if n == 1:
  print(*ans[0],sep="")
  exit()
if m == 1:
  for i in range(2**n-1):
    print(1)
  exit()
for i in range(2**n-1):
  for j in range(2**m-1):
    if i%2 == j%2 == 1:
      ans[i][j] = 0
for arr in ans:
  print(*arr,sep="")

Submission status: Wrong Answer

Solution code:
N, M = (int(i) for i in input().split())

for i in range(2**N - 1):
    if i % 2 == 0:
        print("".join(["1"] * (2**M - 1)))
    else:
        print("".join([str((j + 1) % 2) for j in range(2**M - 1)]))