Buggy python submission (verdict: Runtime Error):
height,width,a,b = map(int,input().split())
table = [['0' for i in range(width)] for j in range(height)]
replacement = a*height
i = 0
j = 0
while replacement != 0:
    # print('replace:',i,j)
    table[i][j] = '1'
    replacement -= 1
    if replacement%a == 0:
        # print('shift')
        i += 1
        # print(i)
    j += 1
# print('made table:',table)
flag = []
for j in range(width):
    x = sum(int(table[i][j]) for i in range(height)) 
    flag += [b == min(x,height-x)]
if all(flag):
    for i in range(height):
        print(''.join(table[i]))
else:
    print('No')

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

# height,width,a,b = map(int,input().split())
# if a != 0 and b != 0:
#     table = [['0' for i in range(width)] for j in range(height)]
#     replacement = a*height
#     i = 0
#     j = 0
#     while replacement != 0:
#         # print('replace:',i,j)
#         table[i][j] = '1'
#         replacement -= 1
#         if replacement%a == 0:
#             # print('shift')
#             i += 1
#             # print(i)
#         j =(j+1)%width
        
#     # print('made table:',table)
#     flag = []
#     for j in range(width):
#         x = sum(int(table[i][j]) for i in range(height)) 
#         flag += [b == min(x,height-x)]
#     if all(flag):
#         for i in range(height):
#             print(''.join(table[i]))
#     else:
#         print('No')
# else:
#     if a == 0:
#         for i in range(b):
#             print('1'*width)
#         for i in range(height-b):
#             print('0'*width)
#     else:
#         for i in range(height):
#             print('1'*a+'0'*(width-a))

Buggy python submission (verdict: Runtime Error):
height,width,a,b = map(int,input().split())
table = [[0 for i in range(width)] for j in range(height)]
replacement = a*height
i = 0
j = 0
while replacement != 0:
    # print('replace:',i,j)
    table[i][j] = 1
    replacement -= 1
    if replacement%a == 0:
        # print('shift')
        i += 1
        # print(i)
    j += 1
# print('made table:',table)
flag = []
for j in range(width):
    x = sum(table[i][j] for i in range(height)) 
    flag += [b == min(x,height-x)]
if all(flag):
    print(table)
else:
    print('No')

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

# height,width,a,b = map(int,input().split())
# if a != 0 and b != 0:
#     table = [['0' for i in range(width)] for j in range(height)]
#     replacement = a*height
#     i = 0
#     j = 0
#     while replacement != 0:
#         # print('replace:',i,j)
#         table[i][j] = '1'
#         replacement -= 1
#         if replacement%a == 0:
#             # print('shift')
#             i += 1
#             # print(i)
#         j =(j+1)%width
        
#     # print('made table:',table)
#     flag = []
#     for j in range(width):
#         x = sum(int(table[i][j]) for i in range(height)) 
#         flag += [b == min(x,height-x)]
#     if all(flag):
#         for i in range(height):
#             print(''.join(table[i]))
#     else:
#         print('No')
# else:
#     if a == 0:
#         for i in range(b):
#             print('1'*width)
#         for i in range(height-b):
#             print('0'*width)
#     else:
#         for i in range(height):
#             print('1'*a+'0'*(width-a))