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):
def main():
    H, W, A, B = map(int, input().split())

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

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

    for line in lines:
        print("".join(map(str, line)))

if __name__ == '__main__':
    main()

Solution (Python):
import bisect
import math
import sys
from collections import Counter, defaultdict, deque
from copy import copy, deepcopy
from heapq import heapify, heappop, heappush
from itertools import combinations, permutations
from queue import Queue

read = sys.stdin.read
readline = sys.stdin.readline 
readlines = sys.stdin.readlines 

def SI():
    return int(readline())
def MI():
    return map(int, readline().split())
def MLI():
    return map(int, open(0).read().split())

inf = float("inf")


def main():
    H, W, A, B = MI()
    ret = [[0] * A + [1] * (W - A)] * B \
    	+ [[1] * A + [0] * (W - A)] * (H - B)
    for row in ret:
        row = [str(i) for i in row]
        row = ''.join(row)
        print(row)
        

if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    H, W, A, B = [int(x) for x in input().split()]

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


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



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




    

if __name__ == '__main__':
    main()

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

Solution (Python):
def main():
  h,w,a,b=map(int,input().split())
  
  ans=[]
  ans+=["0"*a + "1"*(w-a) + "\n"]*b
  ans+=["1"*a + "0"*(w-a) + "\n"]*(h-b)
  print("".join(ans)[:-1])
  
if __name__=="__main__":
  main()

Solution (Python):
from sys import stdin
h,w,b,a = map(int,stdin.readline().rstrip().split())
li = []
for i in range(a):
    s = "0"*b+"1"*(w-b)
    li.append(s)
for j in range(h-a):
    s = "1"*b+"0"*(w-b)
    li.append(s)
for i in li:
    print(i)

Solution (Python):


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

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

for i in range(H):
    for j in range(W):
        if i>=B and j<A:
            s[i][j] = '1'
        elif i<B and j>=A:
            s[i][j] = '1'

for ss in s:
    tmps = ''.join(ss)
    print(tmps)

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

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

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

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

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def calc(N):
    return sum(int(x) for x in str(N))


def main():
    
    H, W, A, B = Scanner.map_int()
    if A * 2 > W or B * 2 > H:
        print("No")
        return
    ans = [[0 for _ in range(W)]for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if w < A and h < B:
                ans[h][w] = 1
            elif w >= A and h >= B:
                ans[h][w] = 1
            else:
                ans[h][w] = 0
    for h in range(H):
        print(*ans[h], sep="")
    return


if __name__ == "__main__":
    main()

Solution (Python):
import sys


def main():
    H,W,A,B = map(int,input().split())
    u = ["0" for _ in range(A)] + ["1" for _ in range(W-A)]
    _u = ["1" for _ in range(A)] + ["0" for _ in range(W-A)]
    
    for _ in range(B):
        print("".join(u))
    for _ in range(H-B):
        print("".join(_u))

if __name__ == "__main__":
    main()

Solution (Python):
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W, A, B = lr()
list1 = '0' * (W-A) + '1' * A
for i in range(H-B):
    print(list1)

list2 = '1' * (W-A) + '0' * A
for i in range(B):
    print(list2)

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

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

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


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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    h, w, wa, hb = list(map(int, input().strip().split()))
    for i in range(h):
        if i < hb:
            print('0' * wa + '1' * (w-wa))
        else:
            print('1' * wa + '0' * (w-wa))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

h, w, a, b = na()
d1 = [1, 0]
d2 = [0, 1]

c = d1
for i in range(h):
    if i == b:
        c = d2
    for j in range(w):
        if j >= a:
            print(c[1], end='')
        else:
            print(c[0], end='')
    print()

Solution (Python):
import sys

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

if A > -(-W//2) or B > -(-H//2):
	print("No")
	sys.exit()

orig_x = []
orig_y = []
for i in range(W):
	if i < A:
		orig_x.append(1)
		orig_y.append(0)
	else:
		orig_x.append(0)
		orig_y.append(1)

ans = []
for i in range(H):
	if i < B:
		ans.append(orig_x)
	else:
		ans.append(orig_y)

for i in range(H):
	for j in range(W):
		if j == W-1:
			print(ans[i][j])
		else:
			print(ans[i][j], end="")

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    h, w, a, b = LI()
    ans = [0,1]
    for y in range(h):
        for x in range(w):
            i = (x < a) ^ (y >= b)
            print(ans[i], end="")
        print()
    return



if __name__ == '__main__':
    solve()

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

H, W, A, B = MAP()

grid = list2d(H, W, '0')
for i in range(H):
    for j in range(W):
        if (i < B and j < A) or (i >= B and j >= A):
            grid[i][j] = '1'

for i in range(H):
    print(''.join(grid[i]))

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

for col in range(H):
    a = grid[col]
    anscol = ''
    for e in a:
        anscol += str(e)
    print(anscol)

Solution (Python):
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key


def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()

def main():
    H, W, A, B = rip()
    a = [['0'] * W for i in range(H)]
    for i in range(B):
        for j in range(A):
            a[i][j] = '1'
    for i in range(B,H):
        for j in range(A,W):
            a[i][j] = '1'
    for i in range(H):
        print(''.join(a[i]))


if __name__ == "__main__":
    main()

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

Solution (Python):
import sys
readline = sys.stdin.readline
H, W, B, A = map(int, readline().split())

S = [[0]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if not ((i < A) ^ (j < B)):
            S[i][j] = 1
print('\n'.join([''.join(map(str, a)) for a in S]))

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):
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) 
rs = lambda: stdin.readline().rstrip()  

H, W, A, B = rl()
answer = ['0'*(W-A) + '1'*A for _ in range(H-B)]
answer += ['1'*(W-A) + '0'*A for _ in range(B)]
for x in answer:
    print(*x, sep='')

Solution (Python):
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) 
rs = lambda: stdin.readline().rstrip()  

H, W, A, B = rl()
answer = ['0'*(W-A) + '1'*A for _ in range(H-B)]
answer += ['1'*(W-A) + '0'*A for _ in range(B)]
for x in answer:
    print(*x, sep='')

Solution (Python):
h, w, a, b = map(int, input().split())
s = [[1 for _ in range(a)] + [0 for _ in range(w-a)] for _ in range(b)]
for _ in range(h-b):
  s.append([0 for i in range(a)] + [1 for i in range(w-a)])
for i in range(h):
  print(''.join(list(map(str, s[i]))))

Solution (Python):
H , W , A , B = map(int,input().split())
before = 1
after = 0
for i in range(H):
    ans_row = []
    if i == B:
        before = 0
        after = 1
    for j in range(W):
        if A <= j:
            ans_row.append(before)
        else:
            ans_row.append(after)
    print(*ans_row , sep = "")

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

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

X = np.zeros((H,W),np.int8)

X[:B,:A] = 1
X[B:,A:] = 1

print('\n'.join(''.join(row) for row in X.astype(str)))

Solution (Python):
h,w,a,b=map(int,input().split())
a-=1
b-=1
ans=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if (i>b and j>a) or (i<=b and j<=a):
      ans[i][j]=1
for x in ans:
  print(*x,sep="")

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

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

Solution (Python):

import sys


def solve(H: int, W: int, A: int, B: int):
    answer = [["0"]*W for _ in range(H)]
    for i in range(H):
        for j in range(W):
            if i < B:
                if j < A:
                    answer[i][j] = "0"
                else:
                    answer[i][j] = "1"
            else:
                if j < A:
                    answer[i][j] = "1"
                else:
                    answer[i][j] = "0"

    for i in range(H):
        print(''.join(answer[i]))                
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  
    W = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    solve(H, W, A, B)

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
import numpy as np

H,W,A,B = (int(x) for x in input().split())
mt = np.zeros((H,W))
for j in range(B):
  for i in range(A):
    print(0, end="")
  for i in range(W-A):
    print(1, end="")
  print()
for j in range(H-B):
  for i in range(A):
    print(1, end="")
  for i in range(W-A):
    print(0, end="")
  print()

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

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


if __name__ == "__main__":
    main()

Solution (Python):
H,W,A,B = map(int,input().split())
for i in range(B):
    S = []
    for j in range(A):
        S.append('0')
    for j in range(A,W):
        S.append('1')
    print(''.join(S))
for i in range(B,H):
    S = []
    for j in range(A):
        S.append('1')
    for j in range(A,W):
        S.append('0')
    print(''.join(S))

Solution (Python):
g,r,a,b=map(int,input().split())
l=["".join(["0" if (retu<a and gyou<b)or(retu>=a and gyou>=b) else "1" for retu in range(r)])for gyou in range(g)]
print(*l,sep="\n")

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

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

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

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

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

A, B = B, A
for y in range(A) :
    for x in range(B, W) :
        ret[y][x] = '1'

for y in range(A, H) :
    for x in range(B) :
        ret[y][x] = '1'
        
for y in range(H) :
    print(''.join(ret[y]))

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

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

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

r1 = "0" * a + "1" * (w - a)
r2 = "1" * a + "0" * (w - a)

for _ in range(b):
    print(r1)
for _ in range(h - b):
    print(r2)

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

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

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

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

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

Solution (Python):
h,w,a,b=map(int,input().split())
l=[['0']*w for _ 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):
    print("".join(map(str,l[i])))

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


H, W, A, B = list(map(int, sys.stdin.buffer.readline().split()))

ans = np.zeros((H, W), dtype='U1')
ans[:B, :A] = '1'
ans[:B, A:] = '0'
ans[B:, A:] = '1'
ans[B:, :A] = '0'
print('\n'.join(map(lambda r: ''.join(r), ans)))

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

for i in ans:
  print(i)

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

Solution (Python):
h, w, a, b = map(int, input().split())
ans = []
for _ in range(h):
    ans.append([0 for __ in range(w)])
for i in range(b):
    for j in range(w):
        ans[i][j] = (ans[i][j]+1)%2
for i in range(a):
    for j in range(h):
        ans[j][i] = (ans[j][i]+1)%2
for i in range(h):
    for j in range(w):
        if j != w-1:
            print(ans[i][j], end="")
        else:
            print(ans[i][j])

Solution (Python):
H,W,A,B=map(int,input().split())
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):
H, W, A, B = map(int, input().split())

t = [[0]*A + [1]*(W-A)]*B + [[1]*A + [0]*(W-A)]*(H-B)

for t_i in t:
    print(*t_i, sep="")

Solution (Python):

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

for hi in range(h):
    if hi<b:
        line = ["1"]*a + ["0"]*(w-a)
    else:
        line = ["0"]*a + ["1"]*(w-a)
    print("".join(line))

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

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

ans=[[0]*W for _ in range(H)]
for i in range(A):
  for j in range(B):
    ans[j][i]=1

for i in range(A,W):
  for j in range(B,H):
    ans[j][i]=1
    
for i in ans:
  print("".join(map(str,i)))

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

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

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)

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

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

Solution (Python):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

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

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

Solution (Python):
def main():
    h,w,a,b = map(int,input().split()) 
    x=[["0" for _ in range(w)] for _ in range(h)]
    for i in range(a):
        for j in range(b):
            x[j][i]="1"
    for i in range(w-a):
        for j in range(h-b):
            x[b+j][a+i]="1"
    for i in range(len(x)):
        print(''.join(x[i]))
if __name__ == "__main__":
    main()

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

s1 = "0"*a+"1"*(w-a)
s2 = "1"*a + "0"*(w-a)
for _ in range(b):
    print(s1)
for _ in range(h-b):
    print(s2)

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

s = 1
t = 0

for i in range(h):
    res = []
    if s == 1 and i >= b:
        s,t = t,s
    for j in range(w):
        if j < a:
            res.append(s)
        else:
            res.append(t)
    else:
        print(*res, sep="")

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

hbar = H - B
wbar = W - A

s = '0' * A + '1' * wbar
sbar = '1' * A + '0' * wbar
for i in range(B):
  print(s)
for i in range(hbar):
  print(sbar)

Solution (Python):
import numpy as np

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

grid = np.zeros((H, W), np.int8)
grid[:, :A] ^= 1
grid[:B] ^= 1

print('\n'.join(''.join(row) for row in grid.astype(str)))

Solution (Python):
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    h, w, a, b = list(map(int, input().rstrip('\n').split()))
    for i in range(h):
        if i < b:
            print("".join(["0"] * a + ["1"] * (w - a)))
        else:
            print("".join(["1"] * a + ["0"] * (w - a)))


if __name__ == '__main__':
    solve()

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

for i in range(h):
    if i<b:
        for k in range(a):
            print(1,end='')
        for l in range(w-a):
            print(0,end='')
        print()
    if i>=b:
        for k in range(a):
            print(0,end='')
        for l in range(w-a):
            print(1,end='')
        print()

Solution (Python):
import sys
h, w, a, b = [int(i) for i in sys.stdin.readline().split()]
res = []
res.append(("0" * a + "1" * (w - a) + "\n") * b)
res.append(("1" * a + "0" * (w - a) + "\n") * (h-b))
print("".join(res))

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
H, W, B, A = map(int, input().split())
grid = [[0]*W for _ in range(H)]

for row in range(H):
    for col in range(W):
        if (row < A and col < B) or (row >= A and col >= B):
            grid[row][col] = 1
for l in grid:
    print("".join(map(str, l)))

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(" "))
if H//2 < B or W//2 < A:
  print("No")
else:
  s = "0" * A + "1" * (W - A) 
  for i in range(B):
    print(s)
  s = list(s)
  
  for i in range(len(s)):
    if s[i] == "1":
      s[i] = "0"
    elif s[i] == "0":
      s[i] = "1"
  s = "".join(s)
  for i in range(B,H):
    print(s)

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

ans = []

for _ in range(H - B):
    a = ['0'] * (W - A)
    a.extend(['1'] * A)
    ans.append(a)
for _ in range(B):
    a = ['1'] * (W - A)
    a.extend(['0'] * A)
    ans.append(a)

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

Solution (Python):
h, w, a, b = map(int,input().split())
A = [[0] * w for i in range(h)]
for i in range(h):
    for j in range(w):
        A[i][j] = int((j < a) ^ (i < b))

for i in range(h):
    print("".join([str(j) for j in A[i]]))

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

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

for i in range(h):
    for j in range(w):
        if i < b and j < a:
            print('1',end = '')
        elif i >= b and j >= a:
            print('1',end='')
        else:
            print('0',end = '')
    print('')

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    h, w, a, b = list(map(int, input().rstrip('\n').split()))
    for i in range(h):
        if i < b:
            t = ["0"] * a
            s = ["1"] * (w - a)
            print("".join(t + s))
        else:
            t = ["1"] * a
            s = ["0"] * (w - a)
            print("".join(t + s))


if __name__ == '__main__':
    slove()

Solution (Python):
H, W, A, B = map(int, input().split())
print("\n".join(["1" * A + "0" * (W - A)] * B + ["0" * A + "1" * (W - A)] * (H - B)))

Solution (Python):
h,w,a,b = map(int, input().split(' '))
result = []
if h < b or w < a:
    print(0)
else:
    for i in range(b):
        r = [0 if x < a else 1 for x in range(w)]
        result.append(r)
    for i in range(b, h):
        r = [1 if x < a else 0 for x in range(w)]
        result.append(r)
    for i in result:
        print(''.join(map(str, i)))

Solution (Python):
def solve():
    H,W,A,B=map(int,input().split())
    data=[[0]*W for i in range(H)]
    for i in range(B):
        for j in range(A):
            data[i][j]=1
    for i in range(B,H):
        for j in range(A,W):
            data[i][j]=1
    return data

data=solve()
for i in data:
    print(''.join(map(str,i)))

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())
for i in range(b):
  print("0"*a + "1"*(w-a))
for i in range(h-b):
  print("1"*a + "0"*(w-a))

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

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

S='0'*A+'1'*(W-A)
S1='1'*A+'0'*(W-A)

for i in range(H):
    if i<=B-1:
        print(S)
    else:
        print(S1)

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

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

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

a = '0' * A + '1' * (W - A)
b = '1' * A + '0' * (W - A)

for i in range(B):
    print(a)
for i in range(H-B):
    print(b)

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

a = ['0']*A + ['1'] * (W - A)
b = ['1']*A + ['0'] * (W - A)

for i in range(B):
    print(''.join(a))
for i in range(H-B):
    print(''.join(b))

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 i in range(h):
    if i<b:
        print("1"*a+"0"*(w-a))
    else:
        print("0"*a+"1"*(w-a))