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

import sys
input = sys.stdin.buffer.readline


from collections import defaultdict


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



def main():
	A, B = getlist()
	ans = [["."] * 100 for i in range(50)] + [["
	for i in range(B - 1):
		ans[1 + 2 * ((2 * i) // 100)][(1 + 2 * i) % 100] = "
	for i in range(A - 1):
		ans[51 + 2 * ((2 * i) // 100)][(1 + 2 * i) % 100] = "."

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


if __name__ == '__main__':
	main()

Solution (Python):
def main():
    a,b=map(int,input().split())
    grid=[["
    cnt=0
    flag=False
    for i in range(0,40,2):
        for j in range(0,100,2):
            if cnt>=a-1:
                flag=True
                break
            grid[i][j]="."
            cnt+=1
        if flag:break
    cnt=0
    flag=False
    for i in range(60,100,2):
        for j in range(0,100,2):
            if cnt>=b-1:
                flag=True
                break
            grid[i][j]="
            cnt+=1
        if flag:break
    for i in range(100):
        grid[i]="".join(grid[i])
    print(100,100)
    for i in grid:
        print(i)
main()

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

L=[]
for i in range(100):
    if i<50:
        L.append(["."]*100)
    else:
        L.append(["



B-=1
for i in range(1,50):
    for j in range(99):
        if i%2==0 and j%2==1 and B>0:
            L[i][j]="
            B-=1
            
A-=1
for i in range(51,100):
    for j in range(99):
        if i%2==0 and j%2==1 and A>0:
            L[i][j]="."
            A-=1
print(100,100)
for i in range(100):
    print("".join(L[i]))

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

S = []
S.append('
a = A-1
while (a>0):
  k = min(50,a)
  S.append('.
  S.append('
  a -= k
S.append('.'*100)
b = B-1
while (b>0):
  k = min(50,b)
  S.append('.
  S.append('.'*100)
  b -= k
print(len(S),100)
for s in S:
  print(s)

Solution (Python):



import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b = LI()
lst = []
for _ in range(50):
    lst.append(['
for _ in range(50):
    lst.append(['.']*100)
print(100,100)
cnt = 0
flg = True
if cnt != a-1:
    for i in range(25-1):
        for j in range(50):
            lst[2*i][2*j] = '.'
            cnt += 1
            if cnt == a-1:
                flg = False
                break
        if not flg:
            break
cnt = 0
flg = True
if cnt != b-1:
    for i in range(25+1,50)[::-1]:
        for j in range(50)[::-1]:
            lst[2*i+1][2*j+1] = '
            cnt += 1
            if cnt == b-1:
                flg = False
                break
        if not flg:
            break
for i in range(100):
    print(''.join(lst[i]))

Solution (Python):



import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b = LI()
lst = []
for _ in range(50):
    lst.append(['
for _ in range(50):
    lst.append(['.']*100)
print(100,100)
cnt = 0
flg = True
if cnt != a-1:
    for i in range(25-1):
        for j in range(25-1):
            lst[2*i][2*j] = '.'
            cnt += 1
            if cnt == a-1:
                flg = False
                break
        if not flg:
            break
cnt = 0
flg = True
if cnt != b-1:
    for i in range(25+1,50)[::-1]:
        for j in range(25+1,50)[::-1]:
            lst[2*i+1][2*j+1] = '
            cnt += 1
            if cnt == b-1:
                flg = False
                break
        if not flg:
            break
for i in range(100):
    print(''.join(lst[i]))

Solution (Python):
A,B = [int(x) for x in input().split()]
K = 50
h,w = 2*K,2*K
cntA = A-1
cntB = B-1
print(h,w)
for i in range(h):
    pr = ''
    if(i<K):
        for j in range(w):
            if(cntA>0):
                if((i%2==0 and j%2==0)):
                    pr += '.'
                    cntA -= 1
                else:
                    pr += '
            else:
                pr += '
    else:
        pr = ''
        for j in range(w):
            if(cntB>0 and i>K):
                if((i%2==0 and j%2==0)):
                    pr += '
                    cntB -= 1
                else:
                    pr += '.'
            else:
                pr += '.'
    print(pr)

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

G = [["


x = y = 0
for i in range(A-1):
    G[y][x] = "."
    x += 2
    if x >= 100:
        x -= 100
        y += 2

x = 0
y = 51
for i in range(B-1):
    G[y][x] = "
    x += 2
    if x >= 100:
        x -= 100
        y += 2
        
print(100, 100)
for s in G:
    print("".join(s))

Solution (Python):
def main():

    A, B = map(int, input().split())
    grid = []
    for _ in range(50):
        grid.append(["
    for _ in range(50):
        grid.append(["." for _ in range(100)])

    count1 = 0
    for i in range(0, 50, 3):
        for j in range(0, 100, 3):
            if count1 < A-1:
                grid[i][j] = "."
                count1 += 1
            if count1 == A-1:
                break
    count2 = 0
    for i in range(51, 100, 3):
        for j in range(0, 100, 3):
            if count2 < B-1:
                grid[i][j] = "
                count2 += 1
            if count2 == B-1:
                break

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

if __name__ == '__main__':
    main()

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

ans = [["." for i in range(100)] for j in range(100)]

for i in range(100):
    for j in range(50):
        ans[i][j] = "

a-=1
b-=1

ind = 0
while True:
    loop = min(a,25)
    for i in range(loop):
        ans[ind][i*2] = "."
    a-=loop
    ind += 2
    if a == 0:
        break

ind = 0
while True:
    loop = min(b,25)
    for i in range(loop):
        ans[ind][51+i*2] = "
    b-=loop
    ind += 2
    if b == 0:
        break

print("100 100")
for i in range(100):
    for j in range(99):
        print(ans[i][j],end="")
    print(ans[i][-1])

Solution (Python):
A,B=map(int,input().split())
g=[['.']*100 for i in range(25)]+[['
i,j=1,0
for x in range(B-1):
    g[i][j]='
    if j<98:
        j+=2
    else:
        i,j=i+2,0
i,j=26,0
for x in range(A-1):
    g[i][j]='.'
    if j<98:
        j+=2
    else:
        i,j=i+2,0
print(50,100)
print(*[''.join(g[l]) for l in range(50)],sep='\n')

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

Aimax = (A-1)%50*2-1
Bimax = (B-1)%50*2-1
Ajmax = (A-1)//50
Bjmax = (B-1)//50

rowA1 = ['
rowA2 = ['.' if i%2==0 else '
rowA3 = ['.' if i%2==0 and i <= Aimax else '

rowB1 = ['.' for _ in range(100)]
rowB2 = ['
rowB3 = ['

state = []

r = 0
for j in range(50):
    if j%2 == 0 and r < Ajmax:
        state.append(rowA2)
        r += 1
    elif j%2 == 0 and r == Ajmax:
        state.append(rowA3)
        r += 1
    else:
        state.append(rowA1)

r = 0
for j in range(50):
    if j%2 == 1 and r < Bjmax:
        state.append(rowB2)
        r += 1
    elif j%2 == 1 and r == Bjmax:
        state.append(rowB3)
        r += 1
    else:
        state.append(rowB1)

print(100, 100)
for s in state:
    print(''.join(s))

Solution (Python):
a,b = map(int, input().split())
t = [["."]*100 for _ in range(50)] + [["
j = 0
for i in range(b-1):
  j += 3
  if j%100 == 0 or j%100 == 99:
    j += 3
  t[j//100][j%100] = "
j = 100*100-1
for i in range(a-1):
  j -= 3
  if j%100 == 0 or j%100 == 99:
    j -= 3
  t[j//100][j%100] = "."
print(100,100)
for x in t:
  print("".join(x))

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

N = 100
board = [['.
for i in range(B-1):
    r, c = i // 25 * 2, (i % 25) * 2
    board[r][c] = "
for i in range(A-1):
    r, c = i // 25 * 2, (i % 25) * 2
    board[-r-1][c] = "."
print(N, N)
print("\n".join(''.join(row) for row in board))

Solution (Python):

A,B = map(int,input().split())
ans = [["" for i in range(100)] for j in range(100)]
for i in range(100):
    for j in range(100):
        if i < 50:
            ans[i][j] = "
        else:
            ans[i][j] = "."
w = 1
b = 1
flag = 0
for i in range(50):
    for j in range(100):
        if i%2 == 0 and (flag+j)%2 == 0:
            if w < A:
                ans[i][j] = "."
                w+=1
    if i%2 == 0:
        flag^=1
        
flag = 0            
for i in range(50):
    for j in range(100):
        if i%2 == 0 and (flag+j)%2 == 0:
            if b < B:
                ans[99-i][j] = "
                b+=1
    if i%2 == 0:
        flag^=1
                
print(100,100)
for i in range(100):
    for j in range(100):
        print(ans[i][j],end="")
    print()

Solution (Python):
"""
上半分を真っ黒、下半分を真っ白に塗る

その後、境界線に触れないように黒の内部に縦横1つおきに白マスを足していく。
同様に白の内部に黒マスを足していく。
ざっと50*100/(2*2) = 1250 個は置けるので、500個は構成できる！
"""

white, black = list(map(int, input().split()))

print("50 100")

n_col = 100
for row_i in range(25):
	if row_i % 2 == 0:
		print("
	else:
		if white > 1:
			white_in_row = min(49, white - 1) 
			print("
			white -= white_in_row
		else:
			print("

for row_i in range(25):
	if row_i % 2 == 0:
		print("." * n_col)
	else:
		if black > 1:
			black_in_row = min(49, black - 1) 
			print(".
			black -= black_in_row
		else:
			print("." * n_col)

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

ans = [['
ans_ = [['.'] * 100 for _ in range(50)]
ans.extend(ans_)

h = 0
w = 0
for i in range(A-1):
    ans[h][w] = '.'
    w += 2
    if w >= 100:
        h += 2
        w = 0

h = 51
w = 0
for i in range(B-1):
    ans[h][w] = '
    w += 2
    if w >= 100:
        h += 2
        w = 0

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

Solution (Python):
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)



A,B = map(int,input().split())
bd = []
for i in range(50):
    bd.append(["
for i in range(50):
    bd.append(["." for _ in range(100)])

for i in range(A-1):
    bd[(i//50)*2][(i%50)*2] ="."
for i in range(B-1):
    bd[-((i//50)*2)-1][(i%50)*2] ="
print(100,100)

for b in bd:
    print(*b,sep="")

Solution (Python):
import numpy as np
A,B = [ int(it) for it in input().split() ]
x = np.zeros([100,100]).astype(np.int32)
x[:,99]=1
for i in range(20):
    x[99-i*2,1:]=1
    
p=97
q=98
for i in range(A-1):
    x[q,p]=1
    p-=2
    if (p==3):
        p=97
        q-=2

p=1
q=1
for j in range(B-1):
    x[q,p]=1
    p+=2
    if (p==95):
        p=1
        q+=2

print ( 100,100)
for line in x:
    print ( "".join([ "

Solution (Python):
import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b
  
def solve():
    A, B = map(int, line_input())
    grid = [[] for i in range(100)]
    for i in range(50):
        grid[i] = ["
        grid[50 + i] = ["."] * 100

    for a in range(A-1):
        w = a % 25
        h = a // 25
        if h % 2 == 0: grid[h][4 * w] = "."
        else: grid[h][4 * w + 2] = "."

    for b in range(B-1):
        w = b % 25
        h = b // 25
        if h % 2 == 0: grid[51 + h][4 * w] = "
        else: grid[51 + h][4 * w + 2] = "

    print(100, 100)
    for h in range(100):
        print("".join(map(str, grid[h])))

if __name__ == "__main__":
    solve()

Solution (Python):
import sys

import numpy as np

sys.setrecursionlimit(10000)
INF = float('inf')

W, B = list(map(int, input().split()))

















np.set_printoptions(threshold=np.inf)


HEIGHT = 82
WIDTH = 51
table = np.empty((HEIGHT, WIDTH), dtype=str)
table[:HEIGHT//2:2, :] = '
table[1:HEIGHT//2:2, ::2] = '
table[1:HEIGHT//2:2, 1::2] = '.'
table[HEIGHT//2::2, :] = '.'
table[HEIGHT//2 + 1::2, ::2] = '.'
table[HEIGHT//2 + 1::2, 1::2] = '

whites = 501
blacks = 501
for i in range(HEIGHT // 2):
    for j in range(WIDTH):
        if whites <= W:
            break
        if table[i][j] == '.':
            table[i][j] = '
            whites -= 1
for i in range(HEIGHT // 2, HEIGHT):
    for j in range(WIDTH):
        if blacks <= B:
            break
        if table[i][j] == '
            table[i][j] = '.'
            blacks -= 1

print(HEIGHT, WIDTH)
for t in table:
    print(''.join(t))

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

for i in range(A-1):
    from_btm = (i // 50)*2
    from_lft = (i % 50)*2
    resmap[99-from_btm][from_lft] = "."
    resmap[99-from_btm][from_lft+1] = "
    resmap[99-from_btm-1][from_lft] = "
    resmap[99-from_btm-1][from_lft+1] = "

for i in range(B-1+(A==1)):
    from_top = (i // 50)*2
    from_lft = (i % 50)*2
    resmap[from_top][from_lft] = "


for line in resmap:
    print(*line, sep="")

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

for i in range(50):
  if i%2==0:
    print('.'*100)
  else:
    for j in range(50):
      if b>1:
        b-=1
        print('.
      else:
        print('..',end='')
    print()

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


def hoge(n, w=".", b="
    for i in range(50):
        if i%2==0:
            print(b*100)
        else:
            l = [b]*100
            for j in range(min(25, n)):
                l[j*2] = w
            n -= min(25,n)
            print("".join(l))

hoge(a-1)
hoge(b-1,"

Solution (Python):
a, b = map(int, input().split())
f = [['
    [['.' for _ in range(100)] for _ in range(50)]

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

for i in range(b-1):
    h = -((i // 50) * 2 + 1)
    w = (i % 50) * 2
    f[h][w] = '

print(100, 100)
for line in f:
    print(''.join(line))

Solution (Python):
import math
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
a,b = na()
R,C = 100,100
G = [["
for i in range(R):
    for j in range(50,100):
        G[i][j] = "."

a-=1
b-=1
p_a = a//25
r_a = a%25
p_b = b//25
r_b = b%25


for i in range(0,2*p_a,2):
    for j in range(0,50,2):
        G[i][j] = "."
for i in range(0,2*r_a,2):
    G[2*p_a][i]="."
for i in range(0,2*p_b,2):
    for j in range(51,100,2):
        G[i][j] = "
for i in range(51,50+2*r_b,2):
    G[2*p_b][i]="


print(100, 100)
for i in range(R):
    print("".join(G[i]))

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

v = [['.' for j in range(N)] for i in range(N)]

for i in range(N // 2, N):
    for j in range(N):
        v[i][j] = '

for a in range(A - 1):
    i = (a // (N // 2)) * 2 + (N // 2) + 1
    j = (a % (N // 2)) * 2
    v[i][j] = '.'

for b in range(B - 1):
    i = (b // (N // 2)) * 2
    j = (b % (N // 2)) * 2
    v[i][j] = '

for i in range(N):
    line = ""
    for j in range(N):
        line += v[i][j]
    print(line)

Solution (Python):

def main():
    buf = input()
    buflist = buf.split()
    A = int(buflist[0])
    B = int(buflist[1])
    board = []
    for i in range(100):
        board.append([])
        for j in range(100):
            if i < 50:
                board[-1].append('
            else:
                board[-1].append('.')
    A_remaining = A - 1
    for i in range(0, 50, 2):
        if A_remaining <= 0:
            break;
        for j in range(0, 100, 2):
            board[i][j] = '.'
            A_remaining -= 1
            if A_remaining <= 0:
                break;
    B_remaining = B - 1
    for i in range(100-1, 50-1, -2):
        if B_remaining <= 0:
            break;
        for j in range(0, 100, 2):
            board[i][j] = '
            B_remaining -= 1
            if B_remaining <= 0:
                break;
    print(100, 100)
    for i in range(100):
        print(''.join(board[i]))

if __name__ == '__main__':
    main()

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


white_cnt = 1
while white_cnt < a:
  grid[(white_cnt//24)*2][(white_cnt%24)*2+1] = "."
  white_cnt +=1

black_cnt = 1
while black_cnt < b:
  grid[(black_cnt//24)*2][(black_cnt%24)*2+50+1] = "
  black_cnt += 1  

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

Solution (Python):
a,b=map(int,input().split())
d=".
s=".
print(100,100)
for i in range(100):
    if i<50:
        if i%2==0:
            if len(d)>0:
                if len(d)>99:
                    print(d[:100])
                    d=d[100:]
                else:
                    print(d+"
                    d=""
            else:
                print("
        else:
            print("
    else:
        if i%2==1:
            if len(s)>0:
                if len(s)>99:
                    print(s[:100])
                    s=s[100:]
                else:
                    print(s+"."*(100-len(s)))
                    s=""
            else:
                print("."*100)
        else:
            print("."*100)

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

grid = [['
  + [['.' for _ in range(100)] for _ in range(50)]

for i in range(a-1):
  grid[(i // 50) * 2][(i % 50) * 2] = '.'

for i in range(b-1):
  grid[-((i // 50) * 2) - 1][(i % 50) * 2] = '

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

Solution (Python):
s=[['.']*100 for i in range(50)]+[['
a,b=map(int, input().split())
a-=1
b-=1
a1,a2=a%50,a//50
b1,b2=b%50,b//50
for i in range(b2):
    for j in range(50):s[i*2][j*2]='
for j in range(b1):s[48][j*2]='
for i in range(a2):
    for j in range(50):s[51+i*2][j*2]='.'
for j in range(a1):s[98][j*2]='.'
print(100,100)
for i in s:print(''.join(i))

Solution (Python):
a,b = map(int,input().split(" "))
ar = []
for i in range(50):
    l = ["
    ar.append(l)
for i in range(50):
    l = ["." for j in range(100)]
    ar.append(l)
print(100,100)
count = 0
for i in range(48,-1,-2):
    if count == a-1:
        break
    if i % 2 == 0:
        for j in range(0,100,2):
            ar[i][j] = "."
            count += 1
            if count == a-1:
                break
    else:
        for j in range(1,100,2):
            ar[i][j] = "."
            count += 1
            if count == a-1:
                break
count = 0
for i in range(99,50,-2):
    if count == b-1:
        break
    if i % 2 == 0:
        for j in range(0,100,2):
            ar[i][j] = "
            count += 1
            if count == b-1:
                break
    else:
        for j in range(1,100,2):
            ar[i][j] = "
            count += 1
            if count == b-1:
                break
for r in ar:
    print("".join(r))

Solution (Python):
def inpl(): return [int(i) for i in input().split()]

A, B = inpl()

def nextin(nwin):
    nx, ny = nwin
    if nx != 98:
        return(nx+2, ny)
    else:
        return(0,ny+2)

Wh = [['
nowin = [0,0]
for _ in range(A-1):
    ix, iy = nowin
    Wh[iy][ix] = '.'
    nowin = nextin(nowin)

Bl = [['.' for _ in range(100)] for _ in range(50)]
nowin = [0,1]
for _ in range(B-1):
    ix, iy = nowin
    Bl[iy][ix] = '
    nowin = nextin(nowin)
print('100','100')
for i in range(50):
    print(''.join(Wh[i]))

for j in range(50):
    print(''.join(Bl[j]))

Solution (Python):


A,B = map(int,input().split())
h,w = 100, 100
grid = [['.' if j < 50 else '
A -= 1
B -= 1
reg = ['.' if i % 2 == 0 else '
for i in range(25):
    if B >= 50:
        grid[i*2] = reg
        B -= 50
    else:
        for j in range(B):
            grid[i*2][j*2] = '
        break
for i in range(25):
    if A >= 50:
        grid[99 - i*2] = reg
        A -= 50
    else:
        for j in range(A):
            grid[99 - i*2][j*2] = '.'
        break
print(h,w)
for row in grid:
    print(''.join(row))

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

Acount = 1
Bcount = 1

print(40,100)
for j in range(19):
    OUTPUT = ""
    for i in range(100):
        if i%2==0 and j%2==0 and Acount<A:
            Acount += 1
            OUTPUT += "."
        else: OUTPUT += "
    print(OUTPUT)
print("".join(["

B_OUTPUT = []
for j in range(19):
    OUTPUT = ""
    for i in range(100):
        if i%2==0 and j%2==0 and Bcount<B:
            Bcount += 1
            OUTPUT += "
        else: OUTPUT += "."
    B_OUTPUT.append(OUTPUT)
B_OUTPUT.append("".join(["." for i in range(100)]))

for b in B_OUTPUT[::-1]:
    print(b)

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

Acount = 1
Bcount = 1

print(100,100)
for j in range(49):
    OUTPUT = ""
    for i in range(100):
        if i%2==0 and j%2==0 and Acount<A:
            Acount += 1
            OUTPUT += "."
        else: OUTPUT += "
    print(OUTPUT)
print("".join(["

B_OUTPUT = []
for j in range(49):
    OUTPUT = ""
    for i in range(100):
        if i%2==0 and j%2==0 and Bcount<B:
            Bcount += 1
            OUTPUT += "
        else: OUTPUT += "."
    B_OUTPUT.append(OUTPUT)
B_OUTPUT.append("".join(["." for i in range(100)]))

for b in B_OUTPUT[::-1]:
    print(b)

Solution (Python):
a,b = map(int,input().split()) 
grid = []
for i in range(50):
    whiteline = ["." for k in range(100)]
    grid.append(whiteline)
for i in range(50):
    blackline = ["
    grid.append(blackline)

b += -1
check = 1
x = 1
y = 1
while b > 0:
    grid[y][x] = "
    b += -1
    if x+2 < 50:
        x += 2
    else:
        check = check * (-1)
        if check == 1:
            x = 2
        else:
            x = 1
        y += 2

a += -1
check = 1
x = 1
y = 55
while a > 0:
    grid[y][x] = "."
    a += -1
    if x+2 < 50:
        x += 2
    else:
        check = check * (-1)
        if check == 1:
            x = 2
        else:
            x = 1
        y += 2

print(100,100)
for i in range(100):
    for k in range(100):
        if k != 99:
            print(grid[i][k],end = "")
        else:
            print(grid[i][k])

Solution (Python):
def makelist(n, m):
    return [['.' for _ in range(m)] for _ in range(n)]

a, b = map(int, input().split())
N = 100
h = N // 2
d = makelist(N, N)


for y in range(h):
    for x in range(N):
        d[y][x] = "

a, b = a-1, b-1

for y in range(h):
    for x in range(N):
        if a == 0:
            break
        if y % 2 == 0 and x % 2 == 0:
            a -= 1
            d[y][x] = "."

for y in reversed(range(h, N)):
    for x in range(N):
        if b == 0:
            break
        if y % 2 == 1 and x % 2 == 1:
            b -= 1
            d[y][x] = "

print(N, N)
for y in range(N):
    print("".join(d[y]))

Solution (Python):
A, B = map(int, input().split())
ans = [['
for i in range(0, 50, 2):
    for j in range(0, 100, 2):
        if A > 1:
            ans[i][j] = '.'
            A -= 1

for i in range(51, 100, 2):
    for j in range(0, 100, 2):
        if B > 1:
            ans[i][j] = '
            B -= 1
print(100, 100)
for row in ans:
    print(*row, sep='')

Solution (Python):
a, b = map(int, input().split())
if a < b:
	ans = [["."] * 100 for _ in range(100)]
	ichi = (a - 1) // 50
	matsu = (a - 1) % 50

	for i in range(ichi):
		if i % 2 == 0:
			for j in range(0, 100, 2):
				ans[i][j] = "
		else:
			for j in range(1, 100, 2):
				ans[i][j] = "

	if matsu == 0:
		ans[ichi] = ["

	elif ichi % 2 == 0:
		for j in range(0, 2 * matsu - 1, 2):
			ans[ichi][j] = "
		for j in range(2 * matsu, 100):
			ans[ichi][j] = "
		ans[ichi + 1] = ["

	else:
		for j in range(1, 2 * matsu, 2):
			ans[ichi][j] = "
		for j in range(2 * matsu, 100):
			ans[ichi][j] = "
		ans[ichi + 1] = ["

	if ichi > 0:
		used = 50 * (ichi - 1) + matsu + 1
	else:
		used = 1
	remain = b - used
	r_ichi = remain // 50
	r_matsu = remain % 50

	for i in range(r_ichi):
		for j in range(0, 100, 2):
			ans[99 - 2 * i][j] = "

	for j in range(0, 2 * r_matsu, 2):
		ans[99 - 2 * r_ichi][j] = "

else:
	ans = [["
	ichi = (b - 1) // 50
	matsu = (b - 1) % 50

	for i in range(ichi):
		if i % 2 == 0:
			for j in range(0, 100, 2):
				ans[i][j] = "."
		else:
			for j in range(1, 100, 2):
				ans[i][j] = "."

	if matsu == 0:
		ans[ichi] = ["."] * 100

	elif ichi % 2 == 0:
		for j in range(0, 2 * matsu - 1, 2):
			ans[ichi][j] = "."
		for j in range(2 * matsu, 100):
			ans[ichi][j] = "."
		ans[ichi + 1] = ["."] * 100

	else:
		for j in range(1, 2 * matsu, 2):
			ans[ichi][j] = "."
		for j in range(2 * matsu, 100):
			ans[ichi][j] = "."
		ans[ichi + 1] = ["."] * 100

	if ichi > 0:
		used = 50 * (ichi - 1) + matsu + 1
	else:
		used = 1
	remain = a - used
	r_ichi = remain // 50
	r_matsu = remain % 50

	for i in range(r_ichi):
		for j in range(0, 100, 2):
			ans[99 - 2 * i][j] = "."

	for j in range(0, 2 * r_matsu, 2):
		ans[99 - 2 * r_ichi][j] = "."

print(100, 100)
print(*["".join(ans[i]) for i in range(100)], sep="\n")

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

print(100,100)

x1 = ''.join(['.']*100)
y1 = ''.join(['

for i in range(25):
    x = ['.'] * 100
    for j in range(50):
        if B>1:
            x[2*j] = '
            B -= 1
    print(''.join(x))
    print(x1)

for i in range(25):
    print(y1)
    y = ['
    for j in range(50):
        if A>1:
            y[2*j] = '.'
            A -= 1
    print(''.join(y))

Solution (Python):
a, b = list(map(int, input().split()))
g1 = [["
g2 = [["." for i in range(100)] for i in range(20)]

a, b = a-1, b-1
j = 0
while a!=0:
  for i in range(0, 100, 2):
    g1[j][i] = "."
    a -= 1
    if a==0:
      break
  j += 2

j = 1
while b!=0:
  for i in range(0, 100, 2):
    g2[j][i] = "
    b -= 1
    if b==0:
      break
  j += 2

g1.extend(g2)
print(40, 100)
for ele in g1:
  print("".join(ele))

Solution (Python):
import string
import re
import datetime
import calendar
import collections
import heapq
import bisect
import array

import numpy as np

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

ans = np.empty((100, 100), dtype=int)

x, y = ans.shape

for i in range(x):
    for j in range(y):
        if j == 0:
            ans[i,j] = 1
        elif j == y-1:
            ans[i,j] = 0
        elif (i % 4) == 0 or (i % 4) == 1:
            ans[i,j] = 1
        else:
            ans[i,j] = 0
def cut_b():
    itr = 1
    for i in range(2, x, 4):
        for j in range(2, y//2, 2):
            yield itr
            ans[i,j] = ans[i+1,j] = 1
            itr+=1

def cut_w():
    itr = 1
    for i in range(0, x, 4):
        for j in range(-3, -y//2, -2):
            yield itr
            ans[i,j] = ans[i+1,j] = 0
            itr+=1

for i in cut_b():
    if i == a:
        break
for i in cut_w():
    if i == b:
        break
print(100, 100)
for i in range(x):
    for j in range(y):
        if ans[i,j] == 0:
            print('.', end="")
        else:
            print('
    print()

Solution (Python):
A,B=map(int,input().split())
grid=[['
A-=1
B-=1
for i in range(0,43,2):
    for j in range(0,100,2):
        if A<=0:
            break
        grid[j][i]='.'
        A-=1
for i in range(66,100,2):
    for j in range(0,100,2):
        if B<=0:
            break
        grid[j][i]='
        B-=1
print(100,100)
for i in range(100):
    print(''.join(grid[i]))

Solution (Python):
A,B=map(int,input().split())
a_line=(A-1)//50+1
b_line=(B-1)//50+1

print(2*a_line+2*b_line,99)
for i in range(a_line):
 if i == a_line-1:
  print(('.
 else:
  print(('.
 print('

for i in range(b_line):
 print('.'*99)
 if i == b_line-1:
  print(('
 else:
  print(('

Solution (Python):
a, b = map(int, input().split())
a_line = (a-1) // 50 + 1
b_line = (b-1) // 50 +1
print(a_line*2 + b_line*2, 99)
for i in range(a_line):
    if i == a_line-1:
        print(('.
    else:
        print(('.
    print('
for i in range(b_line):
    print('.'*99)
    if i == b_line-1:
        print(('
    else:
        print(('

Solution (Python):
white, black = map(int,input().split())
white -= 1
black -= 1

grid = [['
for i in range(1, 99):
    for j in range(50, 99):
        grid[i][j] = "."

a = 3
b = 3
while True:
    if white == 0:
        break
    grid[a][b] = "."
    white -= 1
    a += 2
    if a > 93:
        a = 3
        b += 2
    
 
c = 3
d = 53
while True:
    if black == 0:
        break
    grid[c][d] = "
    black -= 1
    c += 2
    if c > 93:
        c = 3
        d += 2
    

print(100, 100)
for i in grid:
    print("".join(i))

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

buf = [['.'] * 100 for _ in range(50)] + [['

bd, bm = divmod(b - 1, 50)
for i in range(0, (bd + (bm > 0)) * 2, 2):
    for j in range(0, bm * 2 if i == bd * 2 else 100, 2):
        buf[i][j] = '

ad, am = divmod(a - 1, 50)
for i in range(0, (ad + (am > 0)) * 2, 2):
    for j in range(0, am * 2 if i == ad * 2 else 100, 2):
        buf[i + 51][j] = '.'

print(100, 100)
print('\n'.join(''.join(row) for row in buf))