Problem:
 Score : 500 points    Problem Statement You are given two integers A and B .  Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:   Let the size of the grid be h \times w ( h vertical, w horizontal). Both h and w are at most 100 .  The set of the squares painted white is divided into exactly A connected components.  The set of the squares painted black is divided into exactly B connected components.   It can be proved that there always exist one or more solutions under the conditions specified in Constraints section.
If there are multiple solutions, any of them may be printed.      Notes Two squares painted white, c_1 and c_2 , are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.  A set of squares painted white, S , forms a connected component when the following conditions are met:   Any two squares in S are connected.  No pair of a square painted white that is not included in S and a square included in S is connected.   A connected component of squares painted black is defined similarly.      Constraints  1 \leq A \leq 500  1 \leq B \leq 500         Input Input is given from Standard Input in the following format:  A  B       Output Output should be in the following format:   In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.  Then, print h more lines. The i -th ( 1 \leq i \leq h ) of these lines should contain a string s_i as follows:  If the square at the i -th row and j -th column ( 1 \leq j \leq w ) in the grid is painted white, the j -th character in s_i should be . .  If the square at the i -th row and j -th column ( 1 \leq j \leq w ) in the grid is painted black, the j -th character in s_i should be # .           Sample Input 1 2 3      Sample Output 1 3 3
##.
..#
#.#  This output corresponds to the grid below:          Sample Input 2 7 8      Sample Output 2 3 5
#.#.#
.#.#.
#.#.#       Sample Input 3 1 1      Sample Output 3 4 2
..
#.
##
##       Sample Input 4 3 14      Sample Output 4 8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
#.........#..####.

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

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

H, W = 100, 100

def main():
    a, b = rli()
    grid = [['
    for i in range(a-1):
        x = i*2 % W
        y = (i*2 // W)*2
        grid[y][x] = '.'
    for i in range(b-1):
        x = i*2 % W
        y = 2*(i*2 // W)+H//2+1
        grid[y][x] = '
    print(H, W)
    for col in grid:
        print("".join(col))


if __name__ == '__main__':
    main()

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

ans_array = [ [1] * 100 if i < 50 else [0] * 100 for i in range(100)]


A -= 1
B -= 1
i = 1
j = 1

while A != 0:
    ans_array[i][j] = 0
    A -= 1
    j += 2
    if j >= 100:
        i += 2
        j = 1

i = 51
j = 1
while B != 0:
    ans_array[i][j] = 1
    B -= 1
    j += 2
    if j >= 100:
        i += 2
        j = 1

print(100,100)
for ans in ans_array:
    ans_str = "".join(map(str,ans)).replace("0",".").replace("1","
    print(ans_str)

Solution (Python):
a,b=map(int,input().split())
a1,a2,b1,b2=(a-1)//49,(a-1)%49,(b-1)//49,(b-1)%49
n=6*(max(a1,b1)+1)
print(n,100)
for i in range(n):
  if i%6==0 or i%6==2:
    print("."+"
  elif i%6==3 or i%6==5:
    print("."*99+"
  elif i%6==1:
    if i//6<a1:
      print(".
    elif i//6==a1:
      print(".
    else:
      print("."+"
  else:
    if i//6<b1:
      print(".
    elif i//6==b1:
      print("."*(100-2*(b2+1))+".
    else:
      print("."*99+"

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

H,W = 100,100
D = [["."]*100 for _ in [0]*50]+[["

c = 1
i = 1
j = 1
while c<B:
    D[i][j] = "
    c += 1
    j += 2
    if j>100:
        j-=100
        i+=2
c = 1
i = 51
j = 1
while c<A:
    D[i][j] = "."
    c += 1
    j += 2
    if j>100:
        j-=100
        i+=2

print(H,W)
for out in D:
    print("".join(out))

Solution (Python):
A, B = map(int, input().split())
m = [["."] * 100 for _ in range(50)]


def fill(f, b, i, j, n):
    for k in range(5):
        for l in range(5):
            m[i + k][j + l] = b
    m[i + 1][j + 1] = f if n > 0 else b
    m[i + 1][j + 3] = f if n > 1 else b
    m[i + 2][j + 2] = f if n > 2 else b
    m[i + 3][j + 1] = f if n > 3 else b
    m[i + 3][j + 3] = f if n > 4 else b


A -= 1
B -= 1
for i in range(0, 25, 5):
    for j in range(0, 100, 5):
        n = min(5, A)
        A -= n
        fill(".", "
for i in range(25, 50, 5):
    for j in range(0, 100, 5):
        n = min(5, B)
        B -= n
        fill("

print(50, 100)
for v in m:
    print("".join(v))

Solution (Python):
a,b=map(int,input().split())
board=[['.']*100 for _ in range(100)]
pos=0
for i in range(0,(a-1)//50):
  for j in range(0,100,2):
    board[2*i][j+1]='
    board[2*i+1][j]='
    board[2*i+1][j+1]='
pos=2*((a-1)//50)
for j in range(0,2*((a-1)%50),2):
  board[pos][j+1]='
  board[pos+1][j]='
  board[pos+1][j+1]='
pos+=3
for i in range(0,(b-1)//50):
  for j in range(0,100,2):
    board[2*i+pos+1][j+1]='
pos+=2*((b-1)//50)
for j in range(0,2*((b-1)%50),2):
  board[pos+1][j+1]='
pos+=3
if a==1:
  board[pos+1][1]='
print(100,100)
for row in board:
  print(''.join(map(str,row)))

Solution (Python):
A,B = map(int,input().split())
grid_b = [["
grid_w = [["."]*100 for i in range(50)]
for i in range(A-1):
    grid_b[(i//50)*2][(i%50)*2] = "."
for i in range(B-1):
    grid_w[49-(i//50)*2][(i%50)*2] = "
grid = grid_b+grid_w
print(100,100)
for y in grid:
    for x in y:
        print(x,end="")
    print()

Solution (Python):
def main():
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    h = 40
    w = 100
    print(h, w)
    for i in range(10):
        X = "
        A = max(A-50, 0)
        print(X)
        print("
    for i in range(10):
        X = ".
        B = max(B-50, 0)
        print("." * 100)
        print(X)


if __name__ == "__main__":
    main()

Solution (Python):
A, B = list(map(int,input().split()))
K = 50
field = [["" for j in range(2*K)] for i in range(2*K)]
ans = int(0)

for i in range(2*K):
    for j in range(K):
        field[i][j] = "."
    for j in range(K,2*K):
        field[i][j] = "


n = int(0)
j = int(0)
while(j<K/2):
    i= int(0)
    while(i<K and n<B-1):
        field[2*i][2*j] = "
        i +=1
        n +=1
    j +=1


n = int(0)
j = int(K/2)
while(j<K):
    i= int(0)
    while(i<K and n<A-1):
        field[2*i][2*j+1] = "."
        i +=1
        n +=1
    j +=1

print(2*K,2*K)
for i in field:

    print(*i,sep="")

Solution (Python):
a,b=map(int,input().split())
print(100,100)
b_r=b-1
q=b_r//50
r=b_r%50
for i in range(q):
    print('.'*100)
    print('.
print('.'*100)
print('.
for i in range(50-2*(q+1)):
    print('.'*100)
a_r=a-1
q=a_r//50
r=a_r%50
for i in range(q):
    print('
    print('
print('
print('
for i in range(50-2*(q+1)):
    print('

Solution (Python):
A,B = map(int,input().split())
s1 = [['
s2 = [['.']*100 for _ in range(50)]

A -= 1
B -= 1
for i in range(50):
    for j in range(100):
        if A == 0:
            break
        if i%2==0 and j%2==0:
            s1[i][j] = '.'
            A -= 1
for i in range(50):
    for j in range(100):
        if B == 0:
            break
        if i%2==1 and j%2==1:
            s2[i][j] = '
            B -= 1

S = [''.join(s) for s in s1]+[''.join(s) for s in s2]
print('100 100')
for s in S:
    print(s)

Solution (Python):
import sys,collections as cl,bisect as bs,math
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
    return list(map(int,input().split()))
def m():
    return map(int,input().split())
def onem():
    return int(input())
def s(x):
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x):
    return " ".join(map(str,x))

a,b = m()

print(100,100)
aa = [["." for i in range(100)] for j in range(100)]
c = 0
for i in range(50):
    for j in range(100):
        aa[i][j] = "
a -= 1
b -= 1
k = 0
for i in range(100):
    if i <= 48:
        if k == 1:
            k = 0
            continue
        if a != 0:
            for j in range(100):
                if a == 0:
                    break
                if i//2 % 2 == 0:
                    if j % 2 == 0:
                        aa[i][j] = "."
                        a -= 1
                        k = 1
                else:
                    if j % 2 == 1:
                        aa[i][j] = "."
                        a -= 1
                        k = 1
    elif i >= 51:
        if k == 1:
            k = 0
            continue
        if b == 0:
            break
        else:
            for j in range(100):
                if b == 0:
                    break
                if i//2 % 2 == 0:
                    if j % 2 == 0:
                        aa[i][j] = "
                        b -= 1
                        k = 1
                else:
                    if j % 2 == 1:
                        aa[i][j] = "
                        b -= 1
                        k = 1
    else:
        k = 0

for i in range(100):
    print("".join(aa[i]))

Solution (Python):
A,B=map(int,input().split())
G=[[0]*100 for i in range(100)]
for i in range(50,100):
    G[i]=[1]*100
A-=1
B-=1
i=0
j=0
while(B):
    G[i][j]=1
    B-=1
    if j==98:
        j=0
        i+=2
    else:
        j+=2
i=51
j=0
while(A):
    G[i][j]=0
    A-=1
    if j==98:
        j=0
        i+=2
    else:
        j+=2
S=[]
print(100,100)
for i in range(100):
    s=""
    for j in range(100):
        if G[i][j]==0:
            s+="."
        else:
            s+="
    print(s)

Solution (Python):
A,B=map(int,input().split())
G=[[0]*100 for i in range(100)]
for i in range(50,100):
    G[i]=[1]*100
A-=1
B-=1
i=0
j=0
while(B):
    G[i][j]=1
    B-=1
    if j==98:
        j=0
        i+=2
    else:
        j+=2
i=51
j=0
while(A):
    G[i][j]=0
    A-=1
    if j==98:
        j=0
        i+=2
    else:
        j+=2
S=[]
print(100,100)
for i in range(100):
    s=""
    for j in range(100):
        if G[i][j]==0:
            s+="."
        else:
            s+="
    print(s)

Solution (Python):
A,B = map(int,input().split())
grid_b = [["
grid_w = [["."]*100 for i in range(50)]
for i in range(A-1):
    grid_b[(i//50)*2][(i%50)*2] = "."
for i in range(B-1):
    grid_w[49-(i//50)*2][(i%50)*2] = "
grid = grid_b+grid_w
print(100,100)
for y in grid:
    for x in y:
        print(x,end="")
    print()

Solution (Python):
a, b = map(int, input().split())
s = [['
for i in range(a - 1):
    s[i * 2 // 100 * 2][i * 2 % 100] = '.'
for i in range(b - 1):
    s[51 + i * 2 // 100 * 2][i * 2 % 100] = '
print(100, 100)
for row in s:
    print(''.join(row))

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

p = [["."]*100 for _ in range(20)]
q = [["

for t in range(b-1):
  p[t//50*2][t%50*2] = "
for t in range(a-1):
  q[t//50*2+1][t%50*2] = "."
  
print(41, 100)
for l in p+q:
  print("".join(l))

Solution (Python):
h,w=100,100
a,b=map(int,input().split())
u=[['
d=[['.']*w for i in range(h//2)]


for i in range(a-1):
    u[1+((2*i)//w)*2][(2*i)%w]='.'

for i in range(b-1):
    d[1+((2*i)//w)*2][(2*i)%w]='
    
g=u+d
    
print(h,w)
for j in g:
    print(''.join(j))

Solution (Python):









H = 24
W = 49


import numpy as np
X = np.full((W+W+1,2*(H+H+1)),'.',dtype='U1')
A,B = map(int,input().split())


left = X[:,:H+H+1]
right = X[:,H+H+1:]
right[:] = '

for symbol,n,view in [['
  q,r = n//H,n%H
  for i in range(q):
    view[2*i+1,1::2] = symbol
  view[2*q+1,1:1+2*r:2] = symbol

print(2*W+1,4*H+2)
for row in X:
  print(''.join(row))

Solution (Python):
a,b=map(int,input().split())
print(100,100)
for i in range(50):
    for j in range(100):
        if a-1and i%2and j%2:
            print('.',end='')
            a-=1
        else:
            print('
    print()
for i in range(50):
    for j in range(100):
        if b-1and i%2and j%2:
            print('
            b-=1
        else:
            print('.',end='')
    print()

Solution (Python):
a,b=map(int,input().split())
print(100,100)
for i in range(50):
    for j in range(100):
        if a-1and i%2and j%2:
            print('.',end='')
            a-=1
        else:
            print('
    print()
for i in range(50):
    for j in range(100):
        if b-1and i%2and j%2:
            print('
            b-=1
        else:
            print('.',end='')
    print()

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

WHITE = '.'
BLACK = '

K = 50

grid = [[BLACK for _ in range(2*K)] for _ in range(2*K)]
for y in range(K, 2*K):
    for x in range(2*K):
        grid[y][x] = WHITE

A -= 1
B -= 1

for y in range(0, K-1, 2):
    for i in range(K):
        if A > 0:
            grid[y][2*i] = WHITE
            A -= 1
        else:
            break

for y in range(0, K-1, 2):
    for i in range(K):
        if B > 0:
            grid[y+K+1][2*i] = BLACK
            B -= 1
        else:
            break

print("{0} {1}".format(2*K, 2*K))
for g in grid:
    print("".join(g))

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)





def main():
    a, b = intin()

    if a < b:
        dot = '
        wide = '.'
    else:
        dot = '.'
        wide = '

    print('38 100')

    print(dot * 100)
    print(('%s%s' % (dot, wide)) * 50)

    mincount = min(a, b) - 1

    for i in range(12):
        lline = ''
        for j in range(50):
            if mincount == 0:
                lline += '%s%s' % (wide, wide)
            elif i & 1:
                lline += '%s%s' % (dot, wide)
                mincount -= 1
            else:
                lline += '%s%s' % (wide, dot)
                mincount -= 1
        print(lline)

    dotcount = abs(a - b)

    for i in range(12):
        print(wide * 100)
        lline = ''
        for j in range(50):
            if dotcount == 0:
                lline += '%s%s' % (wide, wide)
            else:
                lline += '%s%s' % (wide, dot)
                dotcount -= 1
        print(lline)


if __name__ == '__main__':
    main()

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

white = '.'
black = '
grid = [[black * 100] for i in range(50)] + [[white * 100] for i in range(50)]

for i in range(A-1):
    grid[(i // 50)*2][0] = grid[(i // 50)*2][0][:(i % 50) * 2] + white + grid[(i // 50)*2][0][(i % 50) * 2 + 1:]

for i in range(B-1):
    grid[(i // 50)*2 + 51][0] = grid[(i // 50)*2 + 51][0][:(i % 50) * 2] + black + grid[(i // 50)*2 + 51][0][(i % 50) * 2 + 1:]

print(100, 100)
for g in grid:
    print(g[0])

Solution (Python):

def main():
    white_num, black_num = map(int, input().split())
    data = [['.' for i in range(100)] for j in range(50)] + [['

    black_change = black_num - 1
    count = 0
    for i in range(black_change // 25 + 1):
        high = i  * 2
        for j in range(50):
            width = j * 2
            if count == black_change:
                break
            count += 1
            data[high][width] = '
        if count == black_change:
            break

    black_change = white_num - 1
    count = 0
    for i in range(black_change // 25 + 1):
        high = i * 2 + 51
        for j in range(50):
            width = j * 2
            if count == black_change:
                break
            count += 1
            data[high][width] = '.'
        if count == black_change:
            break

    print(100, 100)
    for i in range(100):
        print(''.join(data[i]))


if __name__ == '__main__':
    main()

Solution (Python):
import math
def main():
	A, B = map(int,input().split())
	K = 50
	ans = [["
	num_w = 0
	num_b = 0
	for i in range(A-1):
		k = (i*2//(2*K))*2
		l = (i*2)%(2*K)
		ans[k][l] = "."

	for i in range(B-1):
		k = (i*2//(2*K))*2
		l = (i*2)%(2*K)
		ans[K+1+k][l] = "

	l1 = str(2*K) + " " + str(2*K)
	print(l1)
	for i in range(2*K):
		this_ans = ""
		for j in range(2*K):
			this_ans += ans[i][j]
		print(this_ans)


if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math
INF = float("inf")


def solve(A: int, B: int):
    h = 100
    w = 99
    print(h, w)

    grid = [["."]*w for row in range(h)]

    for i in range(h//2, h):
        grid[i] = ["

    def ij_k(k):
        row = (w-1)//2
        i = (k//row)*2+1
        j = (k % row)*2+1
        return i, j

    for k in range(B-1):
        i, j = ij_k(k)
        grid[i][j] = "

    for k in range(A-1):
        i, j = ij_k(k)
        grid[i+h//2][j] = "."

    for i in range(h):
        r = "".join(grid[i])
        print(r)

    return


def main():

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


if __name__ == '__main__':
    main()

Solution (Python):
A,B = map(int,input().split())
grid = [[0]*50+[1]*50 for _ in range(100)]
point = 0
for a in range(A-1):
    grid[point%100][int(point/100)*2] = 1
    point += 2
point = 0
for b in range(B-1):
    grid[point%100][99-int(point/100)*2] = 0
    point  += 2
print(100,100)
for gg in grid:
    temp = ""
    for g in gg:
        temp += "
    print(temp)

Solution (Python):
import sys



def cul1(s,i,j):
    if s[i][j]==1: return "."
    else: return "

def cul2(s,i,j):
    if s[i][j]==1: return "
    else: return "."

a,b=map(int,input().split())
H=20
print(H*2,100)

s=[[0 for j in range(100)] for i in range(H)]
for i in range(a-1):
    k=(i*2//100)*2
    l=(i*2)%100
    s[k][l]=1

for i in range(H):
    d=""
    for j in range(100):
        d+=cul1(s,i,j)
    print(d)


s=[[0 for j in range(100)] for i in range(H)]
for i in range(b-1):
    k=(i*2//100)*2
    l=(i*2)%100
    s[k][l]=1

for i in range(H-1,-1,-1):
    d=""
    for j in range(100):
        d+=cul2(s,i,j)
    print(d)

Solution (Python):
import sys



def cul1(s,i,j):
    if s[i][j]==1: return "."
    else: return "

def cul2(s,i,j):
    if s[i][j]==1: return "
    else: return "."

a,b=map(int,input().split())
print("100 100")

s=[[0 for j in range(100)] for i in range(50)]
for i in range(1,a):
    k=(i*2//100)*2
    l=(i*2)%100
    s[k][l]=1

for i in range(50):
    d=""
    for j in range(100):
        d+=cul1(s,i,j)
    print(d)


s=[[0 for j in range(100)] for i in range(50)]
for i in range(1,b):
    k=(i*2//100)*2
    l=(i*2)%100
    s[k][l]=1

for i in range(49,-1,-1):
    d=""
    for j in range(100):
        d+=cul2(s,i,j)
    print(d)

Solution (Python):
A,B=map(int,input().split())
A,B=A-1,B-1
print(100,100)

for i in range(50):
  print("."*50+"
  a=min(24,A)
  b=min(24,B)
  print(".
  A-=a
  B-=b

Solution (Python):
a,b = map(int,input().split())
l = ['
ans = []
for i in range(a//30+1):
    if i==a//30:
        if a%30==0:
            ans[-2] = l[1]*29+l[0]
            break
        k = max(a%30-1,0)
        ans.append(l[1]*k+l[0]*(30-k))
        ans.append(l[0]*30)
        break
    ans.append(l[1]*30)
    ans.append(l[0]*30)
ans.append(l[3]*30)
for i in range(b//30+1):
    if i==b//30:
        if b%30==0:
            ans[-2] = l[2]*29+l[3]
            break
        k = max(b%30-1,0)
        ans.append(l[2]*k+l[3]*(30-k))
        ans.append(l[3]*30)
        break
    ans.append(l[2]*30)
    ans.append(l[3]*30)
print(len(ans),90)
for i in range(len(ans)):
    print(ans[i])

Solution (Python):
a, b = [int(i) for i in input().split(" ")]
h = 96
w = 96
ca = 512 - a
cb = 512 - b

print(w, h)

m = [[False for j in range(0, h)] for i in range(0, w)]

for i in range(0, 32 * 3):
    for j in range(0, 32 * 3):
        m[i][j] =  (i // 3 + j // 3) % 2 == 1

for i in range(0, min(ca, 15)):
    for j in range(i * 6 + 3, i * 6 + 6):
        m[0][j] = False
        
ca -= min(ca, 15)

for i in range(0, min(ca, 15)):
    for j in range(i * 6 + 3, i * 6 + 6):
        m[j][0] = False
    
ca -= min(ca, 15)

k = 0
while ca > 0:
    for i in range(0, min(ca, 16)):
        m[3 * k + 2][6 * i + 3] = False
    ca -= min(ca, 16)
    k += 1
    for i in range(0, min(ca, 15)):
        m[3 * k + 2][6 * i + 6] = False
    ca -= min(ca, 15)
    k += 1
    
    
for i in range(0, min(cb, 15)):
    for j in range(i * 6 + 3, i * 6 + 6):
        m[95][j] = True
        
cb -= min(cb, 15)

if cb > 0:
    cb -= 1
    m[93][95] = True
    m[94][95] = True
    m[95][95] = True
    m[95][94] = True
    m[95][93] = True

for i in range(0, min(cb, 15)):
    for j in range(i * 6 + 3, i * 6 + 6):
        m[92 - j][95] = True
    
cb -= min(cb, 15)

k = 0
while cb > 0:
    for i in range(0, min(cb, 15)):
        m[92 - 3 * k][6 * i + 6] = True
    cb -= min(cb, 15)
    k += 1
    for i in range(0, min(cb, 16)):
        m[92 - 3 * k][6 * i + 3] = True
    cb -= min(cb, 16)
    k += 1

for i in range(0, 32 * 3):
    s = ""
    for j in range(0, 32 * 3):
        if m[i][j]:
            s = s + "
        else:
            s = s + "."
    print(s)

Solution (Python):
a, b = [int(item) for item in input().split()]
size = 100

grid = [["."] * size for _ in range(size//2)] + [["

for i in range(b-1):
  grid[(i//49)*2 + 1][(i%49)*2 + 1] = "
for i in range(a-1):
  grid[(i//49)*2 + 51][(i%49)*2 + 1] = "."

print(100, 100)
for line in grid:
  for item in line:
    print(item, end="")
  print("")

Solution (Python):
import numpy as np
A,B = map(int,input().split())

mat = np.zeros((100,100),dtype=bool)

if A<=B:
    black = "."
    white = "
else:
    black = "
    white = "."

A,B = min(A,B),max(A,B)

a = A-1
b = B-1

for i in range(100):
    mat[0][i] = 1
for i in range(100):
    mat[1][i] = i%2

for line in range(2,100):
    if a>=50 and b>=50:
        for j in range(100):
            mat[line][j] = not(line%2 ^ j%2)
        a-=50
        b-=50
    elif a>0:
        for j in range(a*2):
            mat[line][j] = not(line%2 ^ j%2)
        b-=a
        a = 0
    else:
        break
for line in range(99,2,-2):
    if b>=50:
        for j in range(100):
            mat[line][j] = (j%2)
        b -= 50
    elif b>0:
        for j in range(b*2):
            mat[line][j] = (j%2)
        b = 0
    else:
        break

print("100 100")
for i in range(100):
    for j in range(100):
        if not mat[i][j]:
            print(black,end="")
        else:
            print(white,end="")
    print("")

Solution (Python):
from math import ceil


def solve(string):
    b, a = map(int, string.split())
    h = 2 * ceil(max((a - 1) / 25, (b - 1) / 25)) + 1
    a -= 1
    b -= 1
    ans = []
    ans.append("{} {}".format(h, 100))
    for i in range(h):
        if i % 2 == 0:
            ans.append("." * 50 + "
        else:
            ma = min(a, 25)
            mb = min(b, 25)
            ans.append(".." * (25 - ma) + "
            a -= ma
            b -= mb
            a = max(a, 0)
            b = max(b, 0)
    return "\n".join(ans)


if __name__ == '__main__':
    print(solve(input()))

Solution (Python):
from math import ceil


def solve(string):
    b, a = map(int, string.split())
    h = 2 * ceil(max((a - 1) / 25, (b - 1) / 25)) + 1
    a -= 1
    b -= 1
    ans = []
    ans.append("{} {}".format(h, 100))
    for i in range(h):
        if i % 2 == 0:
            ans.append("." * 50 + "
        else:
            """
            if a > 0 and b > 0:
                ma = min(a, 25)
                mb = min(b, 25)
                ans.append("
                a -= ma
                b -= mb
            elif a == 0 and b > 0:
                mb = min(b, 25)
                ans.append("." * 50 + "
                b -= mb
            elif a > 0 and b == 0:
                ma = min(a, 25)
                ans.append("
                a -= ma
            """
            ma = min(a, 25)
            mb = min(b, 25)
            ans.append(".." * (25 - ma) + "
            a -= ma
            b -= mb
            a = max(a, 0)
            b = max(b, 0)
            
    return "\n".join(ans)


if __name__ == '__main__':
    print(solve(input()))

Solution (Python):
from math import ceil


def solve(string):
    b, a = map(int, string.split())
    h = 2 * ceil(max((a - 1) / 25, (b - 1) / 25)) + 1
    a -= 1
    b -= 1
    ans = []
    ans.append("{} {}".format(h, 100))
    for i in range(h):
        if i % 2 == 0:
            ans.append("." * 50 + "
        else:
            if a > 0 and b > 0:
                ma = min(a, 25)
                mb = min(b, 25)
                ans.append("
                a -= ma
                b -= mb
            elif a == 0 and b > 0:
                mb = min(b, 25)
                ans.append("." * 50 + "
                b -= mb
            elif a > 0 and b == 0:
                ma = min(a, 25)
                ans.append("
                a -= ma
            """
            ma = min(a, 25)
            mb = min(b, 25)
            ans.append("
            a -= ma
            b -= mb
            a = max(a, 0)
            b = max(b, 0)
            """
    return "\n".join(ans)


if __name__ == '__main__':
    print(solve(input()))

Solution (Python):
import math
b, a = map(int, input().strip().split(" "))
h = 2 * math.ceil(max((a - 1) / 25, (b - 1) / 25)) + 1
a -= 1
b -= 1
print("{} {}".format(h, 100))
for i in range(h):
    if i % 2 == 0:
        print("." * 50 + "
    else:
        if a > 0 and b > 0:
            ma = min(a, 25)
            mb = min(b, 25)
            print("
            a -= ma
            b -= mb
        elif a == 0 and b > 0:
            mb = min(b, 25)
            print("." * 50 + "
            b -= mb
        elif a > 0 and b == 0:
            ma = min(a, 25)
            print("
            a -= ma

Solution (Python):
W, B = map(int, input().split())
S = 100














Mij = [[0 for _ in range(S)] for _ in range(S)]
for i in range(S):
    v = 0 if i < S // 2 else 1
    for j in range(S):
        Mij[i][j] = v


count = 1
for i in range(1, S // 2, 2):
    for j in range(0, S, 2):
        if count < B:
            Mij[i][j] = 1
            count += 1

count = 1
for i in range(S - 1, S // 2, -2):
    for j in range(0, S, 2):
        if count < W:
            Mij[i][j] = 0
            count += 1


print(S, S)
for mi in Mij:
    txt = ""
    for m in mi:
        if m == 0:
            txt += "."
        else:
            txt += "
    print(txt)

Solution (Python):
A, B = map(int, input().split())
fu, fd = [['
dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]
for _ in range(A - 1):
    FLAG = BREAK = False
    for y in range(1, 49):
        for x in range(1, 49):
            for i in range(4):
                for j in range(4):
                    if fu[y + dy[i]][x + dx[j]] == '.':
                        BREAK = True
            if BREAK:
                BREAK = False
                continue
            FLAG, fu[y][x] = True, '.'
            break
        if FLAG:
            break
for _ in range(B - 1):
    FLAG = BREAK = False
    for y in range(1, 49):
        for x in range(1, 49):
            for i in range(4):
                for j in range(4):
                    if fd[y + dy[i]][x + dx[j]] == '
                        BREAK = True
            if BREAK:
                BREAK = False
                continue
            FLAG, fd[y][x] = True, '
            break
        if FLAG:
            break
print(100, 100)
for f in [fu, fd]:
    for y in range(50):
        s = ""
        for x in range(100):
            s += f[y][x]
        print(s)

Solution (Python):
A,B = map(int,input().split())
print("100 100")
ans = [["
A -=1
B -=1

wR = 0 
while A>=50:
    A -= 50
    for i in range(0,100,2):
        ans[wR][i]="."
    wR += 2
     
wC = 0
while A>0:
    A -= 1
    ans[wR][wC]="."
    wC += 2
    
bR=99
while B>=50:
    B -= 50
    for i in range(0,100,2):
        ans[bR][i]="
    bR -= 2
    
bC = 0
while B>0:
    B -= 1
    ans[bR][bC]="
    bC += 2

[print("".join(i)) for i in ans]

Solution (Python):
A, B = map(int, input().split())
X = [["
A -= 1
B -= 1
for i in range(10):
    for j in range(50):
        if A > 0:
            X[10+i*2][j*2] = "."
            A -= 1
            
for i in range(10):
    for j in range(50):
        if B > 0:
            X[60+i*2][j*2] = "
            B -= 1
            
print(100, 100)
for x in X:
    print(*x, sep = "")

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

print("100 100")
a = []

for i in range(50):
    a.append(['

for i in range(50):
    a.append(['.' for j in range(100)])

for i in range(w - 1):
    x = (i % 50) * 2
    y = (i // 50) * 2 + 1
    a[y][x] = "."

for i in range(b - 1):
    x = (i % 50) * 2
    y = (i // 50) * 2 + 51
    a[y][x] = "

for y in range(100):
    print(''.join(a[y]))