Harryxun/stf_run huggingface dataset:
def count(n,x):
    print(n,x)
    if x<=n:
        return 0
    elif x>=2**(n+2)-2-n:
        return 2**(n+1)-1
    elif 2**(n+2)-3 > 2*x:
        return count(n-1,x-1)
    else:
        return 2**n + count(n-1,x-2**(n+1)+1)

n,x=map(int,input().split())
print(count(n,x))

### FIXED CODE ###

def count(n,x):
    if x<=n:
        return 0
    elif x>=2**(n+2)-3-n:
        return 2**(n+1)-1
    elif 2**(n+2)-3 > 2*x:
        return count(n-1,x-1)
    else:
        return 2**n + count(n-1,x-2**(n+1)+1)

n,x=map(int,input().split())
print(count(n,x))
n = int(input())

li = [3,5,7,11,13]
ans = 0
for i in range(1,n+1):
    cnt = 0
    for j in range(10):
        if i%li[j]==0:
            cnt += 1
    if cnt ==3:
        ans +=1

if n>=135:
    ans += 1
if n>=189:
    ans += 1

print(ans)

### FIXED CODE ###

n = int(input())

li = [3,5,7,11,13]
ans = 0
for i in range(1,n+1):
    cnt = 0
    for j in range(5):
        if i%li[j]==0:
            cnt += 1
    if cnt ==3:
        ans +=1

if n>=135:
    ans += 1
if n>=189:
    ans += 1

print(ans)
import math
a,b,c,d = map(int,input().split())
e = (c * d) // math.gcd(c, d)
x = b//c - (a-1)//c
y = b//d - (a-1)//d
z = b//e- (a-1)//e
print(b-a+1-(x+y-z))


### FIXED CODE ###

from fractions import gcd
a,b,c,d = map(int,input().split())
e = (c * d) // gcd(c, d)
x = b//c - (a-1)//c
y = b//d - (a-1)//d
z = b//e- (a-1)//e
print(b-a+1-(x+y-z))
a, b = map(int, input().split())

c = 1
for i in range(20):
    if b > c:
        c += a-1
    else:
        break
print(-(-c // a-1)-1)

### FIXED CODE ###

a,b,c = input()
d,e,f = input()
count = 0
if a == d:
    count+= 1
if b == e:
    count+= 1
if c == f:
    count+= 1
print(count)
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(input()) for _ in range(D)]

v = 0
last = [0 for _ in range(26)]

for i in range(D):
    last[t[i]-1] = i+1
    v += s[i][t[i]-1]
    for j in range(26):
        v -= c[j]*(d-last[j])
    print(v)


### FIXED CODE ###

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(input()) for _ in range(D)]

v = 0
last = [-1 for _ in range(26)]

for d in range(D):
    last[t[d]-1] = d
    v += s[d][t[d]-1]
    for j in range(26):
        v -= c[j]*(d-last[j])
    print(v)
n,k = map(int,input().split())
ls_h = list(map(int,input().split()))
temp_min = 99999999
ls_cos = [0]*n
ls_cos[1] = abs(ls_h[1]-ls_h[0])
# print(ls_h)
for i in range(min(k,n)):
    ls_cos[i] = abs(ls_h[i]-ls_h[0])

k = min(k,n)
for i in range(k,n):
    temp_min = 99999999
    for j in range(1,k+1):
        # print(i,j)
        temp_min = min(temp_min,ls_cos[i-j]+abs(ls_h[i]-ls_h[i-j]))
    ls_cos[i] = temp_min
#     print(ls_cos)
# print(ls_cos)
print(ls_cos[-1])



### FIXED CODE ###

n = int(input())
ls_h = list(map(int,input().split()))
ls_cos = [0]*n
ls_cos[1] = abs(ls_h[1]-ls_h[0])
for i in range(2,n):
    ls_cos[i] = min(ls_cos[i-2]+abs(ls_h[i]-ls_h[i-2]) , ls_cos[i-1]+abs(ls_h[i]-ls_h[i-1]))

print(ls_cos[-1])
from decimal import Decimal, getcontext

getcontext().prec = 99


def resolve():
    R = int(input())

    print(Decimal(R * 2 * math.pi))


resolve()

### FIXED CODE ###

import math

from decimal import Decimal, getcontext

getcontext().prec = 99


def resolve():
    R = int(input())

    print(R * 2 * math.pi)


resolve()
n, k = (input().split())
n = list(map(int, n));
dSet = set(map(int, input().split()))
okList = [i for i in range(10) if i not in dSet]
i = len(n)
while i >= 0:
    i -= 1
    if n[i] in okList:
        continue
    for y in okList:
        if n[i] < y:
            n[i] = y
            j = i+1
            while j < len(n):
                n[j] = okList[0]
                j += 1

            break
    else:
        if i - 1 < 0:
            n = [0] + n
            i += 1
        n[i - 1] += 1
        j = i
        while j < len(n):
            n[j] = okList[0]
            j += 1
print(int("".join(list(map(str, n)))))


### FIXED CODE ###

a, b, c = (map(int, input().split()))

m = {5: 0, 7: 0}
m[a] = m[a] + 1
m[b] = m[b] + 1
m[c] = m[c] + 1
if m[5] == 2 and m[7] == 1:
    print("YES")
else:
    print("NO")
sentence = raw_input()
ans = []

for i in range(26):
  ans.append(0)

for string in sentence:
  string = string.strip()
  for s in string:
    s = s.lower()
    key = ord(s) - ord('a')
    if 0 <= key <= 25:
      ans[key] += 1

for i in range(len(ans)):
  print('{} : {}".format(chr(ord('a') + i), ans) 

### FIXED CODE ###

import sys
 
text = sys.stdin.readlines()
ans = []
for i in range(26):
    ans.append(0)
for i in text:
    i = i.strip()
    for j in i:
        j = j.lower()
        key = ord(j) - ord("a")
        if 0 <= key <= 25:
            ans[key] += 1
for i in range(len(ans)):
    print "{} : {}".format(chr(ord("a") + i), ans[i])
import sys

MOD = 1000000007  # type: int

def solve(S: str):
    N = len(S)
    dp = [[0 for _ in range(13)] for _ in range(len(S))]
    if S[N-1] != '?':
        dp[0][int(S[N-1])] = 1
    else:
        dp[0] = [1,1,1,1,1,1,1,1,1,1,0,0,0]
    for i in range(1, len(S)):
        ii = len(S) - i - 1
        for j in range(13):
            if S[ii] == '?':
                for ll in range(10):
                    kk = (ll * 10 ** i) % 13
                    dp[i][j] += dp[i-1][(13 + j - kk)%13]
                    dp[i][j] %= MOD
            else:
                x = int(S[ii])
                m = x * 10 ** i % 13
                dp[i][j] = dp[i-1][(13+k-m)%13]
                dp[i][j] %= MOD
    print(dp[len(S)-1][5])
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(S: str):
    N = len(S)
    dp = [[0 for _ in range(13)] for _ in range(len(S))]
    if S[N-1] != '?':
        dp[0][int(S[N-1])] = 1
    else:
        dp[0] = [1,1,1,1,1,1,1,1,1,1,0,0,0]
    ten = [1]
    for i in range(1, len(S)):
        ten.append(ten[-1] * 10 % 13)
        ii = len(S) - i - 1
        for j in range(13):
            if S[ii] == '?':
                for ll in range(10):
                    kk = ll * ten[i] % 13
                    dp[i][j] += dp[i-1][(13 + j - kk)%13]
                    dp[i][j] %= MOD
            else:
                x = int(S[ii])
                m = x * ten[i] % 13
                dp[i][j] = dp[i-1][(13+j-m)%13]
                dp[i][j] %= MOD
    print(dp[len(S)-1][5])
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()
n = int(input())
alist = list(map(int,input().split()))
from collections import Counter
adic = Counter(alist)
count = 0
for key,value in adic:
  if int(key) <= value:
    count+=(value-int(key))
  else:
    count+=value
print(count)

### FIXED CODE ###

n = int(input())
alist = list(map(int,input().split()))
from collections import Counter
adic = Counter(alist)
count = 0
for k,v in adic.items():
  if int(k) <= v:
    count+=(v-int(k))
  else:
    count+=v
print(count)
from heapq import *

T = [[10**18 for _ in range(2451)] for _ in range(N)]

act = [[] for _ in range(N)]

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

for i in range(M):
  U, V, A, B = tuple(map(int, input().split()))
  maxV = max(maxV, A)
  U -= 1
  V -= 1
  act[U] += [(V, A, B)]
  act[V] += [(U, A, B)]

for i in range(N):
  C, D = tuple(map(int, input().split()))
  act[i] += [(i, -C, D)]

que = [(0, 0, S)]

while que:
  (currentT, n, coins) = heappop(que)
  for m, cost, t in act[n]:
    # もし「払える金額で」「最小時間T[移動先][所持金]を更新できるとき」に値を更新、キューに状態を追加。
    if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:
      T[m][min(2450, coins - cost)] = currentT + t
      heappush(que, (currentT + t, m, min(2450, coins - cost)))

for i in range(1, N):
  print(min(T[i]))

### FIXED CODE ###

from heapq import *

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

T = [[10**18 for _ in range(2451)] for _ in range(N)]

act = [[] for _ in range(N)]

for i in range(M):
  U, V, A, B = tuple(map(int, input().split()))
  U -= 1
  V -= 1
  act[U] += [(V, A, B)]
  act[V] += [(U, A, B)]

for i in range(N):
  C, D = tuple(map(int, input().split()))
  act[i] += [(i, -C, D)]

que = [(0, 0, S)]

while que:
  (currentT, n, coins) = heappop(que)
  for m, cost, t in act[n]:
    # もし「払える金額で」「最小時間T[移動先][所持金]を更新できるとき」に値を更新、キューに状態を追加。
    if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:
      T[m][min(2450, coins - cost)] = currentT + t
      heappush(que, (currentT + t, m, min(2450, coins - cost)))

for i in range(1, N):
  print(min(T[i]))
#!/usr/bin/env python3
import sys
import math
sys.setrecursionlimit(10**8)
from bisect import bisect_left


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()

    # 愚直に行うとO(N^2)となる
    # エラトステネスの篩を真似ると、NlogNで済む
    # 同じ数字が存在している場合は、注意する

    table = [False]*(A[-1]+1)
    ans = 0
    for i in range(N):
        # すでに何かの倍数ならば、考える必要なし
        if table[A[i]]:
            continue
        # 最大値まで見ていく
        for j in range(2, A[-1]//A[i]+1):
            table[A[i]*j] = True

    ans = 0
    for i in range(N):
        if table[A[i]] is False:
            ans += 1
            if i == 0:
                if A[0] == A[1]:
                    ans -= 1
            elif i == N-1:
                if A[N-1] == A[N-2]:
                    ans -= 1
            else:
                if A[i] == A[i-1] or A[i] == A[i+1]:
                    ans -= 1
    print(ans)

    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import math
sys.setrecursionlimit(10**8)
from bisect import bisect_left


def divisors(n):
    ret = set()
    for i in range(1, int(n ** 0.5) + 1):
        d, m = divmod(n, i)
        if m == 0:
            ret.add(i)
            ret.add(d)
    return ret


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()

    # 愚直に行うとO(N^2)となる
    # 各要素、約数を列挙(sqrt(N))
    # 約数がこれまでに存在したかをチェックO(1)*約数の個数
    # 存在すれば1を加える

    # print(A)
    ans = 0
    history = [False]*N
    for i in range(N):
        if history[i]:
            continue
        # A[i]を乗じていくとどうか
        k = i
        for j in range(2, A[-1]//A[i] + 1):
            k = bisect_left(A, A[i]*j, lo=k)
            # print(A[i], A[i]*j, k, A[k])
            if A[k] % A[i] == 0:
                history[k] = True
        #
        k = bisect_left(A, A[i])
        if k < i:
            history[i] = True
        if i+1 < N and A[i] == A[i+1]:
            history[i] = True
    print(N-sum(history))

    return


if __name__ == '__main__':
    main()
S1 = input()
T = input()


for i in range(len(S1)-len(T)+1):
    flag1 = True
    flag2 = True
    for s,t in zip(S1[i:i+len(T)],T):
        if s == "?" or s == t:
            pass
        else:
            flag1 = False 
            break
    if flag1:
        flag2 = False
        S1 = S1.replace(S1[i:i+len(T)],T)
        S = ["a" if s1 == "?" else s1 for s1 in S1]
        print("".join(S))
        break
if flag2:
    print("UNRESTORABLE")

### FIXED CODE ###

S1 = input()
T = input()

S1_r = S1[::-1]
T_r = T[::-1]
if len(S1) < len(T):
    print("UNRESTORABLE")
else:    
    for i in range(len(S1)-len(T)+1):
        flag1 = True
        flag2 = True
        for s,t in zip(S1_r[i:i+len(T)],T_r):
            if s == "?" or s == t:
                pass
            else:
                flag1 = False 
                break
        if flag1:
            flag2 = False
            S1_r = S1_r.replace(S1_r[i:i+len(T)],T_r,1)
            S_r = ["a" if s1 == "?" else s1 for s1 in S1_r]
            print("".join(S_r[::-1]))
            break
    if flag2:
        print("UNRESTORABLE")
A,B,K=map(int,input().split())
if K%2==0:
	K=K/2
	for i in range(K):
		if A%2==0:
			A=A/2
			B=B+A
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
		else:
			A= (A-1)/2
			B=A+B
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
else:
	K=(K-1)/2
	for i in range(int(K)):
		if A%2==0:
			A=A/2
			B=B+A
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
		else:
			A= (A-1)/2
			B=A+B
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
	
	if A%2==0:
		A=A/2
		B=B+A
	else:
		A=(A-1)/2
		B=A+B
	
print(str(int(A))+" "+str(int(B)))

### FIXED CODE ###

A,B,K=map(int,input().split())
if K%2==0:
	K=K/2
	for i in range(int(K)):
		if A%2==0:
			A=A/2
			B=B+A
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
		else:
			A= (A-1)/2
			B=A+B
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
else:
	K=(K-1)/2
	for i in range(int(K)):
		if A%2==0:
			A=A/2
			B=B+A
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
		else:
			A= (A-1)/2
			B=A+B
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
	
	if A%2==0:
		A=A/2
		B=B+A
	else:
		A=(A-1)/2
		B=A+B
	
print(str(int(A))+" "+str(int(B)))
a = int(input('tate'))
b = int(input('yoko'))
area = a*b
lenght = 2*a + 2*b
print(area)
print(lenght)


### FIXED CODE ###

a, b = list(map(int, input().split()))
x= a*b
y= 2*a + 2*b
print(x,y)
n = int(input())
k = int(input())

print(0 if n%k == 0 else 1)

### FIXED CODE ###

n,k=map(int,input().split())

print(0 if n%k == 0 else 1)
n = int(input())
x = input()


def count(n):
    ans = 0
    while n:
        ans += n % 2
        n //= 2
    return ans


ma = 5*10**5
dp = [0] * ma
for i in range(1, ma):
    dp[i] = dp[i % count(i)]+1

c = x.count("1")
a = int(x, 2) % (c+1)

if c==1:
    for i in range(n):
        if x[i] == "0":
            print(dp[(a + pow(2, n-i-1, c+1)) % (c+1)] + 1)
        else:
            print(0)
    exit()

b = int(x, 2) % (c-1)
for i in range(n):
    if x[i] == "0":
        print(dp[(a + pow(2,n-i-1,c+1))%(c+1)] + 1)
    else:
        print(dp[(b - pow(2, n-i-1, c-1)) % (c-1)] + 1)



### FIXED CODE ###

def solve(L,R,d):
    count = 0
    for i in range(L,R+1):
        if i % d == 0:
            count += 1
    return count
L, R, d = map(int, input().split())
print(solve(L,R,d))
import collections
from scipy.special import comb

N = int(input())
words = [input() for i in range(N)] 

ans = 0
L = []
for ix, word in  enumerate(words):
    word_list = list(word)
    word_list.sort()
    L.append(''.join(map(str, word_list)))

c = collections.Counter(L)

for i in c.values():
    ans += comb(i, 2, exact=True)

print(ans)


### FIXED CODE ###

N = int(input())
dic = {}

for i in range(N):
    spell = ''.join(sorted(input()))
    if spell in dic.keys():
        dic[spell] += 1
    else:
        dic[spell] = 1

count = 0
for num in dic.values():
    count += sum([i for i in range(num)])

print(count)
import sys
input = sys.stdin.readline
N=int(input())
H=list(map(int,input().split()))
counts=[]
count=0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count+=1
    if i==N-2:
      counts.append(count)
  elif H[i] < H[i+1]:
    counts.append(count)
    count=0
counts.sort()
print(counts[-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline
N=int(input())
H=list(map(int,input().split()))
counts=[]
count=0
for i in range(N-1):
  if H[i] >= H[i+1]:
    count+=1
    if i==N-2:
      counts.append(count)
  elif H[i] < H[i+1]:
    counts.append(count)
    count=0
counts.sort()
if N==1:
  print(0)
else:
  print(counts[-1])
from collections import deque
H, W = map(int, input().split())  # H行, W列
CY, CX = map(lambda x: int(x)-1, input().split())  # 魔法使いの初期値
DY, DX = map(lambda x: int(x)-1, input().split())  # 目的地
gridgraph = [input() for _ in range(H)]
# print(gridgraph)

q = deque()
q.append([CY, CX])  # スタート地点
# 各頂点について2*2の幅優先する？
adjacent = [[1, 0], [0, 1], [-1, 0], [0, -1]]  # 上下左右
distant = [[10**10]*W for _ in range(H)]
# print(distant)
# 更新されるなら追加
distant[CY][CX] = 0
while len(q):
    cy, cx = q.popleft()  # 現在位置
    for dy, dx in adjacent:
        # 新しい位置
        ny = cy+dy
        nx = cx+dx
        if ny < 0 or ny >= H or nx < 0 or nx >= W:
            continue
        # 道の場合
        if gridgraph[ny][nx] == ".":
            # 道の場合はコスト0で移動できる
            if distant[ny][nx] > distant[cy][cx]:
                distant[ny][nx] = distant[cy][cx]
                q.append([ny, nx])
    # 周囲5*5の道に+1で到達する
    for i in range(-2, 3, 1):
        for j in range(-2, 3, 1):
            target_y, target_x = cy+i, cx+j
            if target_y < 0 or target_y >= H or target_x < 0 or target_x >= W:
                continue
            else:
                if gridgraph[target_y][target_x] == "." and distant[target_y][target_x] > distant[cy][cx]+1:
                    distant[target_y][target_x] = distant[cy][cx]+1
                    q.append([target_y, target_x])

if distant[DY][DX] == INF:
    print(-1)
else:
    print(distant[DY][DX])


### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())  # H行, W列
CY, CX = map(lambda x: int(x)-1, input().split())  # 魔法使いの初期値
DY, DX = map(lambda x: int(x)-1, input().split())  # 目的地
gridgraph = [input() for _ in range(H)]
# print(gridgraph)

q = deque()
q.append((CY, CX))  # スタート地点
# 各頂点について2*2の幅優先する？
adjacent = [[1, 0], [0, 1], [-1, 0], [0, -1]]  # 上下左右
distant = [[10**10]*W for _ in range(H)]
distant[CY][CX] = 0
warp_y = list(range(-2, 3, 1))
warp_x = list(range(-2, 3, 1))
while len(q):
    cy, cx = q.popleft()  # 現在位置
    for dy, dx in adjacent:
        # 新しい位置
        ny = cy+dy
        nx = cx+dx
        if ny < 0 or ny >= H or nx < 0 or nx >= W:
            continue
        # 道の場合
        if gridgraph[ny][nx] == "." and distant[ny][nx] > distant[cy][cx]:
            # 道の場合はコスト0で移動できる
            distant[ny][nx] = distant[cy][cx]
            q.appendleft((ny, nx))
    # 周囲5*5の道に+1で到達する
    for i in warp_y:
        for j in warp_x:
            target_y, target_x = cy+i, cx+j
            if target_y < 0 or target_y >= H or target_x < 0 or target_x >= W:
                continue
            else:
                if gridgraph[target_y][target_x] == "." and distant[target_y][target_x] > distant[cy][cx]+1:
                    distant[target_y][target_x] = distant[cy][cx]+1
                    q.append((target_y, target_x))

if distant[DY][DX] == 10**10:
    print(-1)
else:
    print(distant[DY][DX])
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, S: int):
    if K==0:
        if S>N:
            ans=[0]*N
        else:
            ans=[N+1]*N
    if K==N:
        ans=[S]*N

    for i in range(N):
        yok=0
        if i<K:
            ans[i]=S
        else:
            ans[i]=1
            yok+=1
    ans[K-1]-=yok

    for i in range(N):
        print(ans[i],end=" ")

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    solve(N, K, S)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, K: int, S: int):
    ans=[-1]*N
    yok=0
    for i in range(N):
        if i<K:
            ans[i]=S
        else:
            if S>N:
                ans[i]=1
                yok+=1
            else:
                ans[i]=10**9
    
    for i in range(N):
        print(ans[i],end=" ")

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    solve(N, K, S)

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

W1 = '1' * A + '0' * (W - A)
W0 = '0' * A + '1' * (W - A)

if A > (H // 2) or B > (W // 2):
    print('No')
    exit()

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


ans = []
ans.append(W1)

for _ in range(B):
    ans.append(W0)

for _ in range(H - B - 1):
    ans.append(W1)

for i in ans:
    print(i)


### FIXED CODE ###

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

W1 = '1' * A + '0' * (W - A)
W0 = '0' * A + '1' * (W - A)

if A > (W // 2) or B > (H // 2):
    print('No')
    exit()

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


ans = []
ans.append(W1)

for _ in range(B):
    ans.append(W0)

for _ in range(H - B - 1):
    ans.append(W1)

for i in ans:
    print(i)
# 文字列の入力
s = raw_input()
dst = s.replace(',', ' ')
# 出力
print(dst)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 文字列の入力
s = raw_input()
dst = s.replace(',', ' ')
# 出力
print(dst)
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

bignum = 1000000007

N,K = map(int,input().split())
R = N - K

for i in range(1,K+1):
    tmp = cmb(R+1,i)*cmb(K-1,i-1)
    print(tmp%bignum)

### FIXED CODE ###

import math

def combi(n ,k):
    return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))

N,K = map(int,input().split())
R = N - K

for i in range(1,K+1):
    if R + 1 >= i:
        tmp = combi(R+1,i) * combi(K-1,i-1)
    else:
        tmp = 0
    print(tmp % (10**9+7))
s = int(input())
s_hold = s
sum = 0
i = 0

while i < 9:
  sum = sum + s % 10
  s = s // 10
  i = i + 1

if s_hold % sum == 0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

s = int(input())
s_hold = s
sum = 0
i = 0

while i < 9:
  sum = sum + s % 10
  s = s // 10
  i = i + 1

if sum == 0:
  print("Yes")
elif s_hold % sum == 0:
  print("Yes")
else:
  print("No")
#coding: utf-8
N, M = map(int, input().split())
points = list(map(int, input().split()))
points.sort()
koma = [points[i+1] - points[i] for i in range(M-1)]
for i in range(N-1):
  koma.remove(max(koma))
print(sum(koma))

### FIXED CODE ###

#coding: utf-8
N, M = map(int, input().split())
points = list(map(int, input().split()))
if N > M:
  print(0)
else:
  points.sort()
  koma = [points[i+1] - points[i] for i in range(M-1)]
  koma.sort()
  print(sum(koma[:M-N]))