Problem:
 Score : 300 points    Problem Statement We have a square grid with H rows and W columns.
Snuke wants to write 0 or 1 in each of the squares.
Here, all of the following conditions have to be satisfied:   For every row, the smaller of the following is A : the number of 0 s contained in the row, and the number of 1 s contained in the row. (If these two numbers are equal, “the smaller” should be read as “either”.)  For every column, the smaller of the following is B : the number of 0 s contained in the column, and the number of 1 s contained in the column.   Determine if these conditions can be satisfied by writing 0 or 1 in each of the squares. If the answer is yes, show one way to fill the squares so that the conditions are satisfied.      Constraints  1 \leq H,W \leq 1000  0 \leq A  2 \times A \leq W  0 \leq B  2 \times B \leq H  All values in input are integers.         Input Input is given from Standard Input in the following format:  H  W  A  B       Output If the conditions cannot be satisfied by writing 0 or 1 in each of the squares, print -1 .  If the conditions can be satisfied, print one way to fill the squares so that the conditions are satisfied, in the following format:  s_{11}s_{12}\cdots s_{1W}  s_{21}s_{22}\cdots s_{2W}  \vdots  s_{H1}s_{H2}\cdots s_{HW}   Here s_{ij} is the digit written in the square at the i -th row from the top and the j -th column from the left in the grid.  If multiple solutions exist, printing any of them will be accepted.        Sample Input 1 3 3 1 1      Sample Output 1 100
010
001  Every row contains two 0 s and one 1 , so the first condition is satisfied.
Also, every column contains two 0 s and one 1 , so the second condition is satisfied.       Sample Input 2 1 5 2 0      Sample Output 2 01010

Solution (Python):
H, W, A, B = map(int, input().split())
s = '1' * A + '0' * (W - A)
for _ in range(H - B):
    print(s)
s = '0' * A + '1' * (W - A)
for _ in range(B):
    print(s)

Solution (Python):
import collections

def show():
    for h in range(H):
        print("".join(map(str, ans[h])))

H, W, A, B = list(map(int, input().split()))

ans = collections.Counter()
for h in range(H):
    ans[h] = [0 for w in range(W)]

row = [0 for w in range(W)]
reverse_row = [1 for w in range(W)]
for a in range(A):
    row[a] = 1
    reverse_row[a] = 0
    
for h in range(H):
    if(h < B):
        ans[h] = row
    else:
        ans[h] = reverse_row
        
show()

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(h):
    if i<b:
        print("1"*a+"0"*(w-a))
    else:
        print("0"*a+"1"*(w-a))

Solution (Python):
h, w, a, b = map(int, input().split())
for _ in range(b):
    print('1' * a + '0' * (w - a))
for _ in range(h - b):
    print('0' * a + '1' * (w - a))

Solution (Python):
H, W, A, B = map(int, input().split())

if A > min(A, W - A):
    print('No')
elif B > min(B, H - B):
    print('No')
else:
    table = [[None] * W for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if i < B and j < A:
                table[i][j] = 1
            elif B <= i and A <= j:
                table[i][j] = 1
            else:
                table[i][j] = 0
    
    for i in range(H):
        print(''.join(map(str, table[i])))

Solution (Python):
H, W, A, B = [int(hwab) for hwab in input().split()]

for h in range(H):
  if 0 <= h < B:
    row = "1"*A + "0"*(W - A)
  else: 
    row = "0"*A + "1"*(W - A)
  
  print(row)

Solution (Python):
import sys
import heapq
import bisect

mod = 10**9+7
dd = ((-1,0),(1,0),(0,-1),(0,1))

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def S(): return(sys.stdin.readline()[:-1])
def IR(n): return([I() for _ in range(n)])

def GCD(a,b):
    while b!=0:
        a,b = b,a%b
    return a

def LCM(a,b):
    return a * b // GCD(a,b)

def main():
    H,W,A,B = LI()
    ans = [[0] * W for _ in range(H)]

    for w in range(W):
        for h in range(H):
            if (w<A and h<B) or (A<=w and B<=h):
                ans[h][w] = 1

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


if __name__ == "__main__":
    main()

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(H, W, A, B):
    T = [[0] * W for _ in range(H)]

    for i in range(H):
        for j in range(W):
            if j < A and i < B:
                T[i][j] = 0
            elif j < A:
                T[i][j] = 1
            elif j >= A and i < B:
                T[i][j] = 1
            else:
                T[i][j] = 0
    for r in T:
        print(''.join(map(str, r)))


def main():
    H, W, A, B = read_int_n()
    (slv(H, W, A, B))


if __name__ == '__main__':
    main()

Solution (Python):
h, w, a, b = map(int, input().split())

for i in range(b):
    print("1" * a + "0" * (w - a))
for i in range(h - b):
    print("0" * a + "1" * (w - a))

Solution (Python):

h,w,a,b=map(int,input().split())
p=[0]*h
q=[0]*w
for i in range(h):
	d=""
	for j in range(w):
		if p[i]+1<=w-a and q[j]+1<=h-b:
			p[i]+=1
			q[j]+=1
			d+="1"
		else:
			d+="0"	
	print(d)

Solution (Python):
import numpy as np
[H,W,A,B] = list(map(int,input().split()))

output = np.zeros((H,W))
output[0:(H-B),0:A]=1
output[(H-B):,A:]=1

for i in range(H):
    out = ""
    for j in range(W):
        out += str(int(output[i,j]))
    print(out)

Solution (Python):
H,W,A,B=map(int,input().split())
for i in range(B):
  print('1'*A, end="")
  print('0'*(W-A))
for i in range(H-B):
  print('0'*A, end="")
  print('1'*(W-A))

Solution (Python):
H, W, A, B = list(map(int, input().split()))

h = -1
w = -1
for i in range(1, H + 1):
  for j in range(1, W + 1):
    if i * A + (H - i) * (W - A) == j * B + (W - j) * (H - B):
      h = i
      w = j
      break
  else:
    continue
  break
if h == -1:
  print("No")
  exit()


L = ["1"] * A + ["0"] * (W - A)
for i in range(B):
  print("".join(L))

L = ["0"] * A + ["1"] * (W - A) 
for i in range(H - B):
  print("".join(L))

Solution (Python):
h, w, a, b = map(int, input().split())

for i in range(b):
    print('1'*a + '0'*(w-a))
for i in range(h-b):
    print('0' * a + '1' * (w - a))

Solution (Python):


def main():
    H, W, A, B = map( int, input().split())
    ANS = [ ['0']*W for _ in range(H)]
    now = 0
    A2 = 2*A
    B2 = 2*B
    if A == 0:
        for _ in range(B):
            print('1'*W)
        for _ in range(H-B):
            print('0'*W)
        return
    if B == 0:
        ans = '1'*A + '0'*(W-A)
        for _ in range(H):
            print(ans)
        return
            
    for i in range(H):
        if i >= B2:
            now = 0
        elif i % B2 >= B:
            now = A
        else:
            now = 0
        for j in range(W):
            if j >= A2:
               if now == 0:
                   ANS[i][j] = '1'
            elif (j+now)%A2 < A:
                ANS[i][j] = '1'
    for i in range(H):
        print( ''.join(ANS[i]))
if __name__ == '__main__':
    main()

Solution (Python):
h, w, a, b = map(int, input().split())

ans = [''.join([str(int((j < a) ^ (i < b))) for j in range(w)]) for i in range(h)]

print('\n'.join(ans))

Solution (Python):
H, W, A, B = list(map(int, input().split()))

if A != 0 and B != 0:
    S = [1] * A + [0] * (W - A)
    T = [0] * A + [1] * (W - A)
    for _ in range(B):
        print(''.join(map(str, S)))
    for _ in range(H - B):
        print(''.join(map(str, T)))

elif A != 0 and B == 0:
    S = [1] * A + [0] * (W - A)
    for _ in range(H):
        print(''.join(map(str, S)))

elif A == 0 and B != 0:
    S = [1] * W
    T = [0] * W
    for _ in range(B):
        print(''.join(map(str, S)))
    for _ in range(H - B):
        print(''.join(map(str, T)))

else:
    S = [1] * W
    for _ in range(H):
        print(''.join(map(str, S)))

Solution (Python):
H,W,A,B = map(int, input().split())

L = [[0 for j in range(W)] for i in range(H)]
for i in range(B):
    for j in range(A):
        L[i][j] = 1
        
for i in range(B,H):
    for j in range(A,W):
        L[i][j] = 1
        
for i in range(H):
    ans = ""
    for j in range(W):
        ans += str(L[i][j])
    print(ans)

Solution (Python):

h, w, a, b = map(int, input().split())
s = [[0 for i in range(w)] for i in range(h)]
for i in range(a):
    s[0][i] = 1
for j in range(h):
    for i in range(w):
        if (b == 0) | (j < b):
            s[j][i] = s[0][i]
        else:
            s[j][i] = 1-s[0][i]
for i in range(h):
    print("".join(map(str, s[i])))

Solution (Python):
H, W, A, B = map(int, input().split())

def print_masu(masu):
    for h in masu:
        for w in h:
            print(w, end='')
        print()

masu = [[0] * W for _ in range(H)]

for i, h in enumerate(range(H)):
    for j, w in enumerate(range(W)):
        if i < B and j < A or i >= B and j >= A:
            masu[h][w] = 1

print_masu(masu)

Solution (Python):
import sys


		
def main():
	h,w,a,b = map(int, input().split())
	
	pp='1'*(w-a)+'0'*a
	bb='0'*(w-a)+'1'*a
	
	for _ in range(h-b):
		print(pp)
	for _ in range(b):
		print(bb)
	return 
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):
inpl = lambda: list(map(int,input().split()))
H, W, A, B = inpl()
line = []
for w in range(A):
    line.append(1)
for w in range(W-A):
    line.append(0)
linestr = ''.join(list(map(str, line)))
for h in range(B):
    print(linestr)

line = []
for w in range(A):
    line.append(0)
for w in range(W-A):
    line.append(1)
linestr = ''.join(list(map(str, line)))
for h in range(H-B):
    print(linestr)

Solution (Python):
h, w, a, b = map(int, input().split())

memo = [[0 for _ in range(w)] for i in range(h)]

for i in range(b):
    for j in range(w):
        if j < a:
            memo[i][j] = 1
        else:
            memo[i][j] = 0

for i in range(b, h):
    for j in range(w):
        if j < a:
            memo[i][j] = 0
        else:
            memo[i][j] = 1

for mi in memo:
    ans = ""
    for i in mi:
        ans += str(i)
    print(ans)

Solution (Python):
import numpy as np
from collections import defaultdict
from functools import reduce




H, W, A, B = map(int, input().split())

for _ in range(B):
    print("1"*A+"0"*(W-A))

for _ in range(H-B):
    print("0"*A+"1"*(W-A))

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    h,w,a,b=map(int,input().split())
    s='1'*a+'0'*(w-a)
    t='0'*a+'1'*(w-a)
    for i in range(b):
        print(s)
    for i in range(h-b):
        print(t)
resolve()

Solution (Python):
H, W, A, B = list(map(int, input().split()))
A_limit = W//2
B_limit = H//2

if A_limit < A or B_limit < B:
    print("No")
    
else:
    A_li = ["1" if i < A else "0" for i in range(W)]
    not_A_li = ["0" if i < A else "1" for i in range(W)]

    for _ in range(H-B):
        print("".join(A_li))
    
    for _ in range(B):
        print("".join(not_A_li))

Solution (Python):
H,W,A,B = map(int,input().split())

base = "".join(["0" if w < A else "1" for w in range(W)])
rev = "".join(["1" if w < A else "0" for  w in range(W)])

for i in range(H):
	print(base if i < B else rev)

Solution (Python):

h, w, a, b = map(int, input().split())
ans = [[0] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        ans[i][j] = 0 + (j <= a - 1) ^ (i > b - 1)
for x in ans:
    print(*x, sep='')

Solution (Python):
h, w, a, b = map(int, input().split())

row_0 = '0' * a + '1' * (w - a)
row_1 = '1' * a + '0' * (w - a)

for _ in range(b):
    print(row_0)

for _ in range(h - b):
    print(row_1)

Solution (Python):
H, W, A, B = map(int,input().split())

if (A==0 and B==0):
    pr = ['0']*W
    pr =''.join(pr)
    for h in range(H):
        print(pr)
    exit()

pr = []
pr2 = []
for w in range(A):
    pr.append('0')
    pr2.append('1')
for w in range(W-A):
    pr.append('1')
    pr2.append('0')
pr = ''.join(pr)
pr2 = ''.join(pr2)

for h in range(B):
    print(pr)

for h in range(H-B):
    print(pr2)

Solution (Python):
H, W, A, B = map(int, input().strip().split())

if A * 2 <= W and B * 2 <= H:
	row = []
	for x in range(W):
		if x < A:
			row.append("1")
		else:
			row.append("0")
	row_str = "".join(row)
	for y in range(B):
		print(row_str)
	
	row = []
	for x in range(W):
		if x < A:
			row.append("0")
		else:
			row.append("1")
	row_str = "".join(row)
	for y in range(H - B):
		print(row_str)
else:
	print("No")

Solution (Python):
H,W,A,B = list(map(int, input().split()))

row = ''
for i in range(B):
    for j in range(A):
        row += '0'
    for j in range(W-A):
        row += '1'
    print(row)
    row = ''
for i in range(H-B):
    for j in range(A):
        row += '1'
    for j in range(W-A):
        row += '0'
    print(row)
    row = ''

Solution (Python):
h,w,a,b = map(int,input().split())
a1="0"*a + "1"*(w-a)
a2="1"*a + "0"*(w-a)
for i in range(h):
    if i<b:print(a1)
    else:print(a2)

Solution (Python):



from collections import Counter,deque


from sys import stdin,setrecursionlimit

import heapq


setrecursionlimit(10**6)
input=stdin.readline

h,w,a,b=map(int,input().split())
ans=[]
for i in range(b):
    ans.append("1"*a+"0"*(w-a))
for i in range(h-b):
    ans.append("0"*a+"1"*(w-a))
print(*ans,sep="\n")

Solution (Python):



import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w,a,b = LI()
lst = [[0]*w for _ in range(h)]
for i in range(h):
    if i < b:
        for j in range(w):
            if j < a:
                lst[i][j] = 1
    else:
        for j in range(w):
            if j >= a:
                lst[i][j] = 1
for i in range(h):
    lst[i] = ''.join(map(str,lst[i]))
    print(lst[i])

Solution (Python):
H, W, A, B = list(map(int, input().split()))
for _ in range(B):
    print('0' * A + '1' * (W - A))
for _ in range(H - B):
    print('1' * A + '0' * (W - A))

Solution (Python):
h,w,a,b=map(int,input().split())
c=[]
for i in range(b):
    c.append("1"*a+"0"*(w-a))
for i in range(h-b):
    c.append("0"*a+"1"*(w-a))
print(*c,sep="\n")

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log 
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
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():
    H,W,A,B = MI()
    
    
    
    
    ans = []
    for h in range(H):
        if h <B:
            S = "1"*A + "0"*(W-A)
        else:
            S = "0"*A + "1"*(W-A)
        ans.append(S)
    print(*ans,sep="\n")

if __name__ == '__main__':
    main()

Solution (Python):
H, W, A, B = [int(x) for x in input().split()]
ans = [[0 for _ in range(W)] for _ in range(H)]
for i in range(B):
    ans[i] = [int(not ans[i][j]) for j in range(W)]
for i in range(A):
    for j in range(H):
        ans[j][i] = int(not ans[j][i])
for row in ans:
    for val in row:
        print(val, end='')
    print('')

Solution (Python):
H,W,A,B = map(int,input().split())
for i in range(H):
    if i<B:
        row = "1"*A + "0"*(W-A)
    else:
        row = "0"*A + "1"*(W-A)
    print(row)

Solution (Python):
h, w, a, b = map(int, input().split())
s1 = ["0" if i < a else "1" for i in range(w)]
s2 = ["1" if i < a else "0" for i in range(w)]
for i in range(h):
    if i < b:
        print("".join(s1))
    else:
        print("".join(s2))

Solution (Python):
H, W, A, B = map(int, input().split())
for _ in range(B):
  print('1' * (W - A) + '0' * A)
for _ in range(H - B):
  print('0' * (W - A) + '1' * A)

Solution (Python):
def InputToInt():
    A = input().split()
    for i in range(len(A)):
        A[i] = int(A[i])
    return A
    
if __name__ == '__main__':
    H, W, A, B = InputToInt()
    for i in range(H):
        for j in range(W):
            if (j < A) ^ (i < B):
                print('1', end = '')
            else:
                print('0', end = '')
        print('')

Solution (Python):
H, W, A, B = list(map(int, input().split()))
for _ in range(B):
  print('1'*A + '0'*(W-A))
for _ in range(H-B):
  print('0'*A + '1'*(W-A))

Solution (Python):
h,w,a,b = map(int,input().split())
r = "1"*a+"0"*(w-a)
rp = "0"*a+"1"*(w-a)
for i in range(b): print(r)
for i in range(h-b): print(rp)

Solution (Python):
h,w,a,b = map(int,input().split())
for _ in range(b):
  print('0' * a + '1' * (w-a))
for _ in range(h-b):
  print('1' * a + '0' * (w-a))

Solution (Python):
h,w,a,b=map(int,input().split())

s=[[0]*w for i in range(h)]
for i in range(a):
    for j in range(b):
        s[j][i]=1
for i in range(a,w):
    for j in range(b,h):
        s[j][i]=1
for i in range(h): 
    print(''.join(map(str, s[i])))

Solution (Python):
H,W,A,B=map(int,input().split())
L=[0]*W
for _ in range(B):print("1"*A+"0"*(W-A))
for _ in range(H-B):print("0"*A+"1"*(W-A))

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(b):
  print("1"*a+"0"*(w-a))
for i in range(h-b):
  print("0"*a+"1"*(w-a))

Solution (Python):



import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline


h,w,a,b = [int(i) for i in readline().split()]


ans = [[0]*w for i in range(h)]

for i in range(b):
    ans[i][:w-a] = [1]*(w-a)
for i in range(b,h):
    ans[i][w-a:] = [1]*(a)

for i in ans:
    print(*i,sep="")

Solution (Python):
H,W,A,B = map(int, input().split())
ans = [[0 for i in range(W)] for j in range(H)]

for i in range(H):
    if i<B:
        for j in range(A):
            ans[i][j] = 1
        for j in range(A,W):
            ans[i][j] = 0
    else:
        for j in range(A):
            ans[i][j] = 0
        for j in range(A,W):
            ans[i][j] = 1

for a in ans:
    print(*a, sep='')

Solution (Python):
H, W, A, B=map(int, input().split())
mat=[[0 for j in range(W)] for i in range(H)]
for i in range(B):
  for j in range(A):
    mat[i][j]=1
for i in range(B, H):
  for j in range(A, W):
    mat[i][j]=1
for i in range(H):
  print("".join(str(e) for e in mat[i]))

Solution (Python):
H, W, A, B = map(int, input().split())

for _ in range(H - B):
    print('1' * A + '0' * (W - A))
for _ in range(B):
    print('0' * A + '1' * (W - A))

Solution (Python):
H, W, A, B = map(int, input().split())


def f():
    if H // 2 < B or W // 2 < A:
        return False, None

    s0 = "1" * A + "0" * (W - A)
    s1 = "0" * A + "1" * (W - A)

    F = [s0] * B + [s1] * (H - B)
    return True, F


can, field = f()
if can:
    for f in field:
        print(f)
else:
    print("No")

Solution (Python):
h, w, a, b = map(int, input().split())

ans = []

for i in range(b):
    line = [1]*a + [0] * (w-a)
    ans.append(line)

for j in range(h-b):
    line = [0] * a + [1] * (w-a)
    ans.append(line)

for i in range(h):
    line = ''.join(map(str, ans[i]))
    print(line)

Solution (Python):
H,W,A,B = map(int,input().split())
for i in range(H):
    rowInvert = i >= B
    row = []
    for j in range(W):
        colInvert = j >= A
        invert = rowInvert ^ colInvert
        if invert:
            v = "1"
        else:
            v = "0"
        row.append(v)
    print("".join(row))

Solution (Python):
h,w,a,b = map(int, input().split())

s0 = '0'*a + '1'*(w-a)
s1 = '1'*a + '0'*(w-a)

for i in range(h-b):
    print(s0)

for i in range(b):
    print(s1)

Solution (Python):
h, w, a, b = map(int, input().split())
for i in range(h - b):
    print("0" * a + "1" * (w - a))
for i in range(b):
    print("1" * a + "0" * (w - a))

Solution (Python):
h,w,a,b=map(int,input().split())
l=[['0' for i in range(w)] for j in range(h)]
if b==0:
  for i in range(h):
    for j in range(w):
      if j<a:
        l[i][j]='1'
elif a==0:
  for i in range(h):
    if i<b:
      for j in range(w):
        l[i][j]='1'
else:
  for i in range(h):
    if i<b:
      for j in range(w):
        if j<a:
          l[i][j]='1'
    else:
      for j in range(w):
        if j>=a:
          l[i][j]='1'
for i in range(h):
  print(''.join(l[i]))

Solution (Python):
h, w, a, b = map(int, input().split())
for i in range(h):
  s = [0]*a+[1]*(w-a)
  t = [1]*a+[0]*(w-a)
  if i < b:
    print("".join(map(str, s)))
  else:
    print("".join(map(str, t)))

Solution (Python):
H, W, A, B = map(int, input().split())

for _ in range(H-B):
    print(''.join(["1"] * A + ["0"] * (W-A)))
for _ in range(B):
    print(''.join(["0"] * A + ["1"] * (W-A)))

Solution (Python):
H,W,A,B = map(int,input().split(' '))

for i in range(H):
	if i < B:
		row = '1'*A + '0'*(W-A)
	else:
		row = '0'*A + '1'*(W-A)
	print(row)

Solution (Python):
h,w,a,b = map(int,input().split())
for _ in range(b):
  l = []
  for _ in range(a):
    l.append("0")
  for _ in range(w-a):
    l.append("1")
  jo = "".join(l)
  print(jo)
for _ in range(h-b):
  l = []
  for _ in range(a):
    l.append("1")
  for _ in range(w-a):
    l.append("0")
  jo = "".join(l)
  print(jo)

Solution (Python):
H,W,A,B=map(int,input().split())
for _ in range(B):
    print("1"*A+"0"*(W-A))
for _ in range(H-B):
    print("0"*A+"1"*(W-A))

Solution (Python):
H,W,A,B = tuple(map(int,input().split()))
if  B<=H//2 and A <= W//2:
    for i in range(B):
        print("0"*A + "1"*(W-A))
    for i in range(H-B):
        print("1"*A + "0"*(W-A))
else:
    print("No")

Solution (Python):
h, w, a, b = map(int, input().split())

ans = [[]*w for i in range(h)]

for i in range(h):
    for j in range(w):
        if j < a and i < b:
            ans[i].append(1)
        elif j < a and i >= b:
            ans[i].append(0)
        elif j >= a and i < b:
            ans[i].append(0)
        elif j >= a and i >= b:
            ans[i].append(1)
for i in range(h):
    print("".join(map(str, ans[i])))

Solution (Python):
H, W, A, B = map(int, input().split())

ansss = [[1]*(A) + [0]*(W-A) for _ in range(B)]
ansss += [[0]*(A) + [1]*(W-A) for _ in range(H-B)]

print('\n'.join([''.join(map(str, anss)) for anss in ansss]))

Solution (Python):
h, w, a, b = map(int, input().split())

for i in range(h):
    tmp = []
    for j in range(w):
        if i < b and j < a:
            tmp.append('1')
        elif b <= i and j < a:
            tmp.append('0')
        elif i < b and a <= j:
            tmp.append('0')
        elif b <= i and a <= j:
            tmp.append('1')

    print(''.join(tmp))

Solution (Python):
H,W,A,B = map(int,input().split())
for h in range(H):
    if h<B:
        print("1"*A + "0"*(W-A))
    else:
        print("0"*A + "1"*(W-A))

Solution (Python):
H, W, A, B = [int(_) for _ in input().split()]
for _ in range(B):
    print('0' * A + '1' * (W - A))
for _ in range(H - B):
    print('1' * A + '0' * (W - A))

Solution (Python):
h, w, a, b = [int(_) for _ in input().split(' ')]

for i in range(h):
    if i < b:
        print('1' * (w - a) + '0' * a)
    else:
        print('0' * (w - a) + '1' * a)

Solution (Python):
import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')

h,w,a,b = map(int,input().split())
if a > w // 2 or b > h // 2:
    print('No')
    exit()
l = [0] * (w - a) + [1] * a
for i in range(h):
    for j in l:
        p = j ^ (i < b)
        print(p, end = '')
    print()

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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 A():
    h,w,a,b = LI()
    ans = [1]*a+[0]*(w-a)
    ans_ = [0]*a+[1]*(w-a)
    for i in range(h):
        if i < b:
            print(*ans,sep = "")
        else:
            print(*ans_,sep = "")
    return


def B():

    return


def C():

    return


def D():

    return


def E():

    return


def F():

    return


if __name__ == "__main__":
    A()

Solution (Python):
def main():
    h, w, a, b = map(int, input().split())
    if a > w/2 or b > h/2:
        print("No")
        exit()

    for i in range(h - b):
        s = ""
        for j in range(w):
            if j >= a:
                s += "0"
            else:
                s += "1"
        print(s)
    for i in range(h - b, h):
        s = ""
        for j in range(w):
            if j >= a:
                s += "1"
            else:
                s += "0"
        print(s)


if __name__ == '__main__':
    main()

Solution (Python):

H,W,A,B = map(int,input().split())

if A * 2 > W or B * 2 > H:
    print ("No")

else:

    ans = ""

    for i in range(W-A):
        ans += "0"

    for i in range(A):
        ans += "1"

    for i in range(H-B):
        print (ans)

    ans = ""

    for i in range(W-A):
        ans += "1"
    for i in range(A):
        ans += "0"

    for i in range(B):
        print (ans)

Solution (Python):
H, W, A, B = map(int, input().split())
for i in range(H-B):
    print("0"*(W-A)+"1"*A)
for i in range(B):
    print("1"*(W-A)+"0"*A)

Solution (Python):
h,w,a,b=[int(j) for j in input().split()]
ans=[]
for i in range(h-b):
    print("1"*a+"0"*(w-a))
for i in range(b):
    print("0"*a+"1"*(w-a))

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())

def main():
    H,W,A,B = mis()
    for i in range(H):
        if i < B:
            print('0'*A + '1'*(W-A))
        else:
            print('1'*A + '0'*(W-A))

main()

Solution (Python):
H, W, A, B = map(int, input().split())




for _ in range(H-B):
    print("0" * (W-A) + "1" * A)
for _ in range(B):
    print("1" * (W-A) + "0" * A)

Solution (Python):
h,w,a,b = map(int,input().split())
if b > h//2 or a > w//2:
    print("No")
    exit(0)
for _ in range(h-b):
    print("0"*(w-a) + "1"*a)
for _ in range(b):
    print("1"*(w-a) + "0"*a)

Solution (Python):
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())

H,W,A,B = inpl()

ans = [['0']*W for _ in range(H)]

for y in range(H):
    for x in range(W):
        if x < A and y < B:
            ans[y][x] = '1'
        elif x >= A and y >= B:
            ans[y][x] = '1'

for a in ans:
    print(''.join(a))

Solution (Python):
def main():
    H, W, A, B = map(int, input().split())
    for _ in range(B):
        ans = "1" * A + "0" * (W-A)
        print(ans)
    for _ in range(H-B):
        ans = "0" * A + "1" * (W-A)
        print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
H,W,A,B = map(int,input().split())

even = "0"*A+"1"*(W-A)
odd = "1"*A+"0"*(W-A)

for i in range(B):
    print(odd)
    print(even)
for i in range(H-2*B):
    print(odd)

Solution (Python):
H, W, A, B = map(int, input().split())

S = "0" * A + "1" * (W-A)
T = "1" * A + "0" * (W-A)
for _ in range(B):
    print(S)
for _ in range(H-B):
    print(T)