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 solve():
    for row in range(H):
        for col in range(W):
            if (row < B and col < A) or (B <= row and A <= col):
                print(0, end='')
            else:
                print(1, end='')
        print()

if __name__ == "__main__":
    H, W, A, B = map(int, input().split())
    solve()

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

from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

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

if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w,a,b = map(int, input().split())
ans = [None for _ in range(h)]
for i in range(h):
    if i<b:
        ans[i] = [0]*a + [1]*(w-a)
    else:
        ans[i] = [1]*a + [0]*(w-a)
write("\n".join("".join(map(str, item)) for item in ans))

Solution (Python):
h, w, a, b = (int(x) for x in input().split())
S = [[""] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if (0 <= i < b and 0 <= j < a) or (b <= i < h and a <= j < w):
            S[i][j] = '1'
        else:
            S[i][j] = '0'

for ans in S:
    print("".join(ans))

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    H, W, A, B = in_nn()

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np
H,W,A,B=map(int, input().split())
S=np.array([["0"]*W for _  in range(H)])

S[:B, :A]="1"
S[B:, A:]="1"

for s in S:
    print("".join(s.tolist()))

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

if(a>(w//2) and b>(h//2)):
    print('No')
else:
    for i in range(h):
        if(i<b):
            print(''.join(['0' for _ in range(a)]) + ''.join(['1' for _ in range(w-a)]))
        else:
            print(''.join(['1' for _ in range(a)]) + ''.join(['0' for _ in range(w-a)]))

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

Solution (Python):
H,W,A,B=map(int,input().split())
print(*['0'*A+'1'*(W-A) if i<B else '1'*A+'0'*(W-A) for i in range(H)],sep='\n')

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())
flag=0
for i in range(h):
    if 0<=i<b: flag=1
    else: flag=0
    for j in range(w):
        if flag:
            if 0<=j<a: print(0,end="")
            else: print(1,end="")
        else:
            if 0<=j<a: print(1,end="")
            else: print(0,end="")
    print()

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

Solution (Python):


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

matrix = [[0] * w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if (i < b) ^ (j < a):
            matrix[i][j] = 1

for r in matrix:
    print(''.join(map(str, r)))

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

h,w,a,b = lr()
ans = []
tmp = ''
tmp1 = ''
for i in range(a):
    tmp = ''.join([tmp,'1'])
    tmp1 = ''.join([tmp1,'0'])
for i in range(a,w):
    tmp = ''.join([tmp, '0'])
    tmp1 = ''.join([tmp1, '1'])
for i in range(b):
    ans.append(tmp)
for i in range(b,h):
    ans.append(tmp1)
for i in range(h):
    print(ans[i])

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):
        if (i < b and j >= a) or (i >= b and j < a):
            print(1, end = "")
        else:
            print(0, end = "")
    
    print()

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

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W, A, B = map(int, input().split())
        
    res = []
    L1 = ["1"] * A + ["0"] * (W - A)
    for _ in range(B):
        res.append("".join(L1))
    L2 = ["0"] * A + ["1"] * (W - A)
    for _ in range(H - B):
        res.append("".join(L2))
    print(*res, sep="\n")


if __name__ == '__main__':
    resolve()

Solution (Python):



def main():
    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))

if __name__ == '__main__':
    main()

Solution (Python):

H,W,A,B = map(int,input().split())
blk1 = [[0]*(W-A) for _ in range(H-B)]
blk2 = [[1]*(A) for _ in range(H-B)]
blk3 = [[1]*(W-A) for _ in range(B)]
blk4 = [[0]*(A) for _ in range(B)]

for i in range(len(blk2)):
    blk1[i]=blk1[i]+blk2[i]

  
for i in range(len(blk4)):
    blk3[i]=blk3[i]+blk4[i]

blk1 = blk1+blk3



for i in range(len(blk1)):
    print(''.join(str(x) for x in blk1[i]))

Solution (Python):
def main():
    H, W, A, B = map(int, input().split())
    S = [[0] * W for _ in range(H)]
    for i in range(B):
        for j in range(W):
            if j >= A:
                S[i][j] = 1

    for i in range(A):
        for j in range(H):
            if j >= B:
                S[j][i] = 1

    for i in range(H):
        print(*S[i], sep='')




if __name__ == "__main__":
    main()

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

Solution (Python):
import sys
input = sys.stdin.readline
H, W, A, B = map(int, input().split())
res = [[0] * W for _ in range(H)]
for i in range(B):
  for j in range(A): res[i][j] = 1
for i in range(B, H):
  for j in range(A, W): res[i][j] = 1
for r in res: print("".join(list(map(str, r))))

Solution (Python):
import sys
input = sys.stdin.readline
H, W, A, B = map(int, input().split())
res = [[0] * W for _ in range(H)]
for i in range(B):
  for j in range(A): res[i][j] = 1
for i in range(B, H):
  for j in range(A, W): res[i][j] = 1
for r in res: print("".join(list(map(str, r))))

Solution (Python):


import math



from collections import deque
from collections import Counter




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):
        if (i<b and j<a) or (i>=b and j>=a):
            ans[i][j]=1
for i in range(h):
	L=[str(x) for x in ans[i]]
	L="".join(L)
	print(L)

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):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

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


l,r=0,a

for i in range(h):
    for j in range(w):
        if l<=j<r:
            if i<b:
                lst[i][j]="0"
            else:
                lst[i][j]="1"
        else:
            if i<b:
                lst[i][j]="1"
            else:
                lst[i][j]="0"

for i in range(h):
    print("".join(lst[i]))

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())
l=[[] for i in range(h)]
mode=True
for i in range(h):
  if i>=b:
    mode=False
  for j in range(w):
    if mode:
      if j<a:l[i].append("1")
      else:l[i].append("0")
    else:
      if j<a:l[i].append("0")
      else:l[i].append("1")
for li in l:
  print("".join(li))

Solution (Python):



from fractions import gcd














import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
h,w,a,b = readInts()
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("1"*a+"0"*(w-a))
for i in range(h-b):
    print("0"*a+"1"*(w-a))

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





H,W,A,B = IL()

for i in range(B):
  print(str(1)*A+str(0)*(W-A))
for i in range(H-B):
  print(str(0)*A+str(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))

Solution (Python):

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    H, W, A, B = ZZ()
    ans = [[0] * W for _ in range(H)]
    for i in range(B):
        for j in range(A): ans[i][j] = 1
    for i in range(B, H):
        for j in range(A, W): ans[i][j] = 1
    for i in range(H): print(*ans[i], sep='')

    return

if __name__ == '__main__':
    main()

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

grid = [["0" for _ in range(W)] for _ 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):
            grid[i][j] = "1"

for row in grid:
    print("".join(row))

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 l:
    print(*i, sep="")

Solution (Python):

H,W,A,B = map(int,input().split())
for i in range(H):
    for j in range(W):
        print((int(i<B)+int(j<A))%2,sep='',end='')
    print('')

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

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

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

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

current = [i for i in range(a)]
cnt = 0
for i in range(h):
    if i < b:
        s = [str(0) if i < a else str(1) for i in range(w)]
    else:
        s = [str(1) if i < a else str(0) for i in range(w)]
    print(''.join(s))

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

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

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

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):
        if i < B and j < A:
            Ans[i][j] = 1
        if i >= B and j >= A:
            Ans[i][j] = 1
        print(Ans[i][j], end='')
    print()

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

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

for i in range(a,w):
  for j in range(b):
    ans[j][i]=1
for i in range(a):
  for j in range(b,h):
    ans[j][i]=1
    
for i in range(h):
  for j in range(w):
    print(ans[i][j],end="")
  print()

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

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(B,H):
  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-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())
x = '1'*a + '0'*(w-a)
xinv = '0'*a + '1'*(w-a)
for i in range(h):
  row = x if i < b else xinv
  print(row)

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

    g = [[0] * W for _ in range(H)]
    for r in range(H):
        for c in range(W):
            g[r][c] = int((c < A) ^ (r >= B))

    for row in g:
        print(*row, sep='')


if __name__ == '__main__':
    main()

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

Solution (Python):
h,w,a,b=map(int,input().split())
plus=[0 if i<a else 1 for i in range(w)]
minus=[1 if i<a else 0 for i in range(w)]

for i in range(h):
    if i<b:
        print(*plus,sep="")
    else:
        print(*minus,sep="")

Solution (Python):
def convert(s): 
  
    
    new = "" 
  
    
    for x in s: 
        new += x  
  
    
    return new 

h,w,a,b=map(int,input().split())
k=[]
for i in range(a):
  k.append('0')
for i in range(w-a):
  k.append('1')
k=convert(k)
t=[]
for i in range(a):
  t.append('1')
for i in range(w-a):
  t.append('0')
t=convert(t)
for i in range(b):
  print(k)
for i in range(h-b):
  print(t)

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

ans=[]
base="0"*A+"1"*(W-A)
nbase="1"*A+"0"*(W-A)

for i in range(B):
    ans.append(base)
for i in range(H-B):
    ans.append(nbase)

for i in range(H):
    print(ans[i])

Solution (Python):
H, W, A, B = map(int, input().split())
row = [A, W-A]
col = [B, H-B]
ans = ''
for i in [0, 1]:
    for y in range(col[i]):
        for j in [0, 1]:
            for x in range(row[j]):
                ans += str(j^i)
        ans +='\n'
print(ans)

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())

ans = []

for i in range(B):
    lst = [1]*A + [0] *(W-A)
    print(*lst, sep='')
for i in range(H-B):
    lst = [0]*A + [1] *(W-A)
    print(*lst, sep='')

Solution (Python):


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

for h_tmp in range(h):
    for w_tmp in range(w):
        if (w_tmp < a and h_tmp < b) or (w_tmp >= a and h_tmp >= b):
            print(0, end="")
        else:
            print(1, end="")
    print()

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

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





if b>h//2:
    print("No")
    exit()
if a>w//2:
    print("No")
    exit()


mapss=[[0]*w for _ in range(h)]

for y in range(b):
    for x in range(a):
        mapss[y][x]=1

for y in range(b,h):
    for x in range(a,w):
        mapss[y][x]=1


for item in mapss:
    print("".join(map(str,item)))

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

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

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

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

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

for i in range(h):
  if i+1 <= b:
    s = "0"*a + "1"*(w-a)
  else:
    s = "1"*a + "0"*(w-a)
    
  ans.append(s)
  
for i in range(h):
  print(ans[i])

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

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    H,W,A,B=MI()
    if H!=1 and W!=1:
        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
                else:
                    pass
                
        for i in range(H):
            print(''.join(map(str, s[i])))
    else:
        if H==1:
            ans=([1]*A)+([0]*(W-A))
            print(''.join(map(str,ans)))
        else:
            for i in range(H):
                if i<B:
                    print(1)
                else:
                    print(0)
            

main()

Solution (Python):
import sys


import math
import collections



import fractions

import copy

import decimal

import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





def main():
    h, w, a, b = ns()

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


if __name__ == '__main__':
    main()

Solution (Python):
def main():

    H, W, A, B = map(int, input().split())
    isfound = False
    for m in range(H+1):
        for n in range(W+1):
            if m*A + (H-m)*(W-A) == n*B + (W-n)*(H-B):
                isfound = True
                p, q = m, n
                break
        if isfound:
            break
    if not isfound:
        return "No"

    count = [B for _ in range(q)] + [H-B for _ in range(W-q)]

    for i in range(p):
        temp = []
        cnt = A
        for j in range(W):
            if count[j] > 0 and cnt > 0:
                cnt -= 1
                count[j] -= 1
                temp.append(1)
            else:
                temp.append(0)
        print("".join(map(str, temp)))

    for i in range(H-p):
        temp = []
        cnt = W-A
        for j in range(W):
            if count[j] > 0 and cnt > 0:
                cnt -= 1
                count[j] -= 1
                temp.append(1)
            else:
                temp.append(0)
        print("".join(map(str, temp)))


if __name__ == '__main__':
    main()

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

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


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 colchange(x):
    if x==1:
        return 0
    elif x==0:
        return 1
H,W,A,B=map(int,input().split())
table=[[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(0,A):
        table[i][j]=colchange(table[i][j])
for i in range(0,B):
    for j in range(W):
        table[i][j]=colchange(table[i][j])

for i in range(H):
    print(*table[i],sep="")

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


for i in range(h):
    if i<b:
        ansi = [0]*a+[1]*(w-a)
    else:
        ansi = [1]*a+[0]*(w-a)
    print(*ansi,sep='')

Solution (Python):
import numpy as np
*s,a,b=map(int, input().split());p=np.ones(s,dtype=np.int);p[:b,:a]=0;p[b:,a:]=0;print("\n".join("".join(q)for q in p.astype(str)))

Solution (Python):
import numpy as np
*s, a, b = map(int, input().split())
p = np.ones(s, dtype=np.int)
p[:b,:a] = 0
p[b:,a:] = 0
print('\n'.join(''.join(q) for q in p.astype(str)))

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w,a,b=map(int,input().split())
    S=[]
    for i in range(b):
        S.append("1"*a+"0"*(w-a))
    for i in range(h-b):
        S.append("0"*a+"1"*(w-a))   
    for i in range(h):
        print(S[i])

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w,a,b=map(int,input().split())
    S=[]
    for i in range(b):
        S.append("1"*a+"0"*(w-a))
    for i in range(h-b):
        S.append("0"*a+"1"*(w-a))   
    for i in range(h):
        print(S[i])

if __name__=='__main__':
    main()

Solution (Python):


from itertools import combinations

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

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

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

if H == 1:
    ans = "1"*A + "0"*(W-A)
    print(ans)
    exit()

if W == 1:
    for _ in range(B):
        print(1)
    for _ in range(H-B):
        print(0)
    exit()

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

for i in range(B):
    for j in range(A):
        ans[i][j] = 1

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

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

Solution (Python):
import sys
from collections import Counter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

h,w,a,b=mp()
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())

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

Solution (Python):
import sys

input = sys.stdin.readline


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

    line = [0] * A + [1] * (W - A)
    X = "".join(map(str, line))
    ans = [""] * H
    for i in range(H):
        if i == B:
            X = "".join(map(lambda x: str(x ^ 1), line))
        ans[i] = X

    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

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 = (int(x) for x in input().split())
for i in range(B):
    print(('1'*(W-A)).zfill(W))
for i in range(H-B):
    print(('1'*A).ljust(W,'0'))

Solution (Python):


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

ans=[]
for b in range(B):
    ans.append(["1"]*A+["0"]*(W-A))
for b in range(H-B):
    ans.append(["0"]*A+["1"]*(W-A))

for item in ans:
    print("".join(item))

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())
s = [[0 for _ in range(w)] for __ in range(h)]

for i in range(a):
    for j in range(b):
        s[j][i] = 1

for i in range(w-a):
    for j in range(h-b):
        s[b+j][a+i] = 1

for i in range(h):
    print(''.join([str(x) for x in s[i]]))

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))