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

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B = map(int, readline().split())


def solve():
    W = 100
    hw = B // 25 + 2
    hb = A // 25 + 2
    H = hw + hb
    grid = [[i >= hw] * W for i in range(H)]  

    def paint_black():
        black = 1
        for r in range(0, hw - 1, 2):
            for c in range(0, W, 2):
                if black == B:
                    return
                grid[r][c] = True
                black += 1

    def paint_white():
        white = 1
        for r in range(hw + 1, H, 2):
            for c in range(0, W, 2):
                if white == A:
                    return
                grid[r][c] = False
                white += 1

    paint_black()
    paint_white()
    return grid


def print_grid(grid):
    h, w = len(grid), len(grid[0])
    print(h, w)
    for r in range(h):
        for c in range(w):
            if grid[r][c]:
                print("
            else:
                print(".", end="")
        print()


if __name__ == "__main__":
    print_grid(solve())

Solution (Python):

import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B = map(int, readline().split())
color_flipped = False
if A < B:
    A, B = B, A
    color_flipped = True


def solve():
    hb = min(B, 12)
    h = (hb * 2 + 1) * 3
    w = 100
    
    grid = [[True] * w for _ in range(h)]
    black = 1
    white = 0
    for i in range(hb):
        if black == B:
            break
        black += 1
        white += 1
        for c in range(w):
            for j in range(3):
                grid[6 * i + j + 3][c] = False

    def paint_white(i):
        nonlocal white
        for c in range(0, w, 2):
            if white == A:
                return
            grid[6 * i + 1][c] = False
            white += 1

    def paint_black(i):
        nonlocal black
        for c in range(0, w, 2):
            if black == B:
                return
            grid[6 * i + 4][c] = True
            black += 1

    for i in range(hb):
        paint_white(i)
        paint_black(i)
    assert black == B
    while white < A:
        grid.append([True] * w)
        grid.append([True] * w)
        for c in range(0, w, 2):
            if white == A:
                break
            white += 1
            grid[-1][c] = False

    return grid


def print_grid(grid):
    h, w = len(grid), len(grid[0])
    print(h, w)
    for r in range(h):
        for c in range(w):
            if grid[r][c] ^ color_flipped:
                print("
            else:
                print(".", end="")
        print()


if __name__ == "__main__":
    print_grid(solve())

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

A,B = map(int,readline().split())

grid = []
for i in range(50):
  grid.append(["
  
for i in range(50):
  grid.append(["."] * 100)
  

cnt = 0
for i in range(50):
  if cnt >= A - 1:
    break
  for j in range((i % 2) * 2,len(grid[i]),4):
    if cnt >= A - 1:
      break
    grid[i][j] = "."
    cnt += 1
      
cnt = 0
for i in range(51,100):
  if cnt >= B - 1:
    break
  for j in range((i % 2) * 2,len(grid[i]),4):
    if cnt >= B - 1:
      break
    grid[i][j] = "
    cnt += 1

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

Solution (Python):
def main():
    BK = '
    WH = '.'

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

    g = []
    for _ in range(50):
        g.append([BK] * 100)  
    for _ in range(50):
        g.append([WH] * 100)

    r, c = 1, 1
    for _ in range(A - 1):
        g[r][c] = WH
        c += 2
        if c > 99:
            c = 1
            r += 2

    r, c = 51, 1
    for _ in range(B - 1):
        g[r][c] = BK
        c += 2
        if c > 99:
            c = 1
            r += 2

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


if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b = inpl()
if a == b == 1:
    print(1,2)
    print('.
    quit()
rev = False
if a < b:
    rev = True
    a,b = b,a
a -= 1
res = [[None] * 100 for _ in range(100)]
r = 0
ok = True
while ok:
    for c in range(100):
        if r%2:
            res[r][c] = 0
        else:
            if not ok or c%2:
                res[r][c] = 1
                b -= 1
                if b == 0:
                    ok = False
            else:
                res[r][c] = 0
    r += 1
for c in range(100):
    res[r][c] = 1 if c == 99 else 0
r += 1
for c in range(100):
    res[r][c] = 1
r += 1
ok = True
while ok:
    for c in range(100):
        if r%2:
            res[r][c] = 1
        else:
            if not ok or c%2:
                res[r][c] = 0
                a -= 1
                if a <= 0:
                    ok = False
            else:
                res[r][c] = 1
    r += 1
for i in range(r,100):
    for j in range(100):
        res[i][j] = res[i-1][j]
print(100,100)
for i in range(100):
    for j in range(100):
        if rev:
            res[i][j] = '.' if res[i][j] else '
        else:
            res[i][j] = '
    print(''.join(res[i]))

Solution (Python):
def main():
    A, B = (int(i) for i in input().split())
    grid = [["

    for h in range(49):
        if h % 2 == 1:
            continue
        for w in range(0, 100, 2):
            if A > 1:
                grid[h][w] = "."
                A -= 1
            else:
                break
    for h in range(51, 100):
        if h % 2 == 0:
            continue
        for w in range(0, 100, 2):
            if B > 1:
                grid[h][w] = "
                B -= 1
            else:
                break
    print(100, 100)
    for r in grid:
        print("".join(r))


if __name__ == '__main__':
    main()

Solution (Python):
A,B = map(int,input().split())
if A==1:
    C = [["." for _ in range(100)] for _ in range(100)]
    cnt = 0
    flag=0
    for i in range(0,100,2):
        for j in range(0,100,2):
            C[i][j] = "
            cnt += 1
            if cnt==B:
                flag = 1
                break
        if flag==1:
            break
elif B==1:
    C = [["
    cnt = 0
    flag = 0
    for i in range(0,100,2):
        for j in range(0,100,2):
            C[i][j] = "."
            cnt += 1
            if cnt==A:
                flag = 1
                break
        if flag==1:
            break
else:
    C = [["." for _ in range(100)] for _ in range(100)]
    for i in range(50,100):
        for j in range(100):
            C[i][j] = "
    for i in range(1,49):
        for j in range(1,99):
            C[i][j] = "
    cnt = 0
    flag = 0
    for i in range(2,47,2):
        for j in range(2,97,2):
            if cnt==A-2:
                flag = 1
                break
            C[i][j] = "."
            cnt += 1
        if flag==1:break
    for i in range(51,99):
        for j in range(1,99):
            C[i][j] = "."
    cnt = 0
    flag = 0
    for i in range(52,97,2):
        for j in range(2,97,2):
            if cnt==B-2:
                flag = 1
                break
            C[i][j] = "
            cnt += 1
        if flag==1:break
print(100,100)
for i in range(100):
    print("".join(C[i]))

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

Grid = [list('

A -= 1
B -= 1
for i in range(0,50,2):
    for j in range(0,100,2):
        if A > 0:
            Grid[i][j] = '.'
            A -= 1
        else:
            break
    else:
        continue
    break

for i in range(99,50,-2):
    for j in range(0,100,2):
        if B > 0:
            Grid[i][j] = '
            B -= 1
        else:
            break
    else:
        continue
    break

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

Solution (Python):
a, b = map(int, input().split())
print(41, 100)
for _ in range(10):
    for _ in range(50):
        print('.', end='')
        if b>1:
            print('
            b -= 1
        else:
            print('.', end='')
    print()
    print('.'*100)
print('
for _ in range(10):
    for _ in range(50):
        print('
        if a>1:
            print('.', end='')
            a -= 1
        else:
            print('
    print()
    print('

Solution (Python):
a,b=map(int,input().split())
d=[["
a-=1
b-=1
for i in range(50,100):
    for j in range(100):
        d[i][j]="."
for i in range(0,50,2):
    for j in range(0,100,2):
        if a==0:
            break
        d[i][j]="."
        a-=1
    if a==0:
        break
for i in range(99,49,-2):
    for j in range(0,100,2):
        if b==0:
            break
        d[i][j]="
        b-=1
print(100,100)
for i in d:
    print(*i,sep="")

Solution (Python):

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  







A, B = read_ints()
A -= 1
B -= 1
print(100, 100)


for _ in range(25):
    for _ in range(50):
        if A > 0:
            print('
            A -= 1
        else:
            print('
    print()
    print('


for _ in range(25):
    print('.' * 100)  
    for _ in range(50):
        if B > 0:
            print('
            B -= 1
        else:
            print('..', end='')
    print()

Solution (Python):
def examA():
    C = [SI()for _ in range(3)]
    ans = C[0][0]+C[1][1]+C[2][2]
    print(ans)
    return

def examB():
    N, M = LI()
    P = [0]*N
    S = [LSI()for _ in range(M)]
    pena = 0
    ac = set()
    for p,s in S:
        p = int(p)-1
        if s=="WA":
            P[p] += 1
        else:
            if p in ac:
                continue
            ac.add(p)
            pena += P[p]

    print(len(ac),pena)
    return

def examC():
    W, H, N = LI()
    lx, rx, ly, ry = 0, W, 0, H
    A = [LI()for _ in range(N)]
    for x,y,a in A:
        if a==1:
            lx = max(lx,x)
        elif a==2:
            rx = min(rx,x)
        elif a==3:
            ly = max(ly,y)
        elif a==4:
            ry = min(ry,y)
    ans = max(0,rx-lx)*max(0,ry-ly)
    print(ans)
    return

def examD():
    N, H = LI()
    B = [0]*N
    maxa = 0
    ans = 0
    for i in range(N):
        a, B[i] = LI()
        if a>maxa:
            maxa = a
    B.sort(reverse=True)
    for b in B:
        if b<maxa:
            break
        H -= b
        ans += 1
        if H<=0:
            print(ans)
            return
    ans += -(-H//maxa)
    print(ans)
    return

def examE():
    A, B = LI()
    ans = [["
    i = 0; j = 0
    for _ in range(A-1):
        ans[i][j] = "."
        j += 2
        if j>=100:
            j = 0; i += 2
    i = 0; j = 0
    for _ in range(B-1):
        ans[99-i][j] = "
        j += 2
        if j>=100:
            j = 0; i += 2
    print(100,100)
    for v in ans:
        print("".join(map(str,v)))
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

ans = [['
A -= 1
B -= 1

for h in range(0, 50, 2):
    for w in range(0, 100, 2):
        if A == 0:
            break
        ans[h][w] = '.'
        A -= 1

for h in range(0, 50, 2):
    for w in range(0, 100, 2):
        if B == 0:
            break
        ans[-(h + 1)][w] = '
        B -= 1

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

Solution (Python):
ansl1 = list("
ansl2 = list("." * (100 * 25))

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

for i in range(a-1):
    ansl1[2*i] = "."

for i in range(b-1):
    ansl2[2*i] = "
print(100, 100)

for i in range(25):
    print("".join(ansl1[(i*100):(i*100)+100]))
    print("

for j in range(24, -1, -1):
    print("".join(ansl2[(j*100):(j*100)+100]))
    print("." * 100)

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

grid = []
for _ in range(50):
    grid.append(["
for _ in range(50):
    grid.append(["."] * 100)


div, mod = divmod(A - 1, 50)
for d in range(div):
    h = 0 + d * 2
    for w in range(0, 100, 2):
        grid[h][w] = "."
if mod:
    h = 0 + div * 2
    for w in range(0, mod * 2, 2):
        grid[h][w] = "."

div, mod = divmod(B - 1, 50)
for d in range(div):
    h = 51 + d * 2
    for w in range(0, 100, 2):
        grid[h][w] = "
if mod:
    h = 51 + div * 2
    for w in range(0, mod * 2, 2):
        grid[h][w] = "

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

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

ans = [['
A -= 1
B -= 1

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

for h in range(0, 100, 2)[::-1]:
    if B == 0:
        break
    for w in range(0, 100, 2):
        ans[h][w] = '
        B -= 1
        if B == 0:
            break

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

Solution (Python):
A,B=map(int, input().split())
h=w=100
ans=[['' for _ in range(w)] for __ in range(h)]
for i in range(h//2):
    for j in range(w):
        if i&1 and j&1 and A-1>0:
            ans[i][j]='.'
            A-=1
        else:
            ans[i][j]='
for i in range(h-1,h//2-1,-1):
    for j in range(w):
        if i&1 and j&1 and B-1>0:
            ans[i][j]='
            B-=1
        else:
            ans[i][j]='.'

print(h,w)
for r in ans:
    print(''.join(r))

Solution (Python):
w,b = map(int,input().split())
grid = []
for i in range(50):
    grid.append(["."]*100)
for i in range(50):
    grid.append(["
w -= 1
b -= 1
cnt = 0
i = 0
j = 0
while cnt < b:
    grid[i][j] = "
    if j == 98:
        i += 2
        j = 1
    elif j == 99:
        i += 2
        j = 0
    else:
        j += 2
    cnt += 1

cnt = 0
i = 51
j = 0
while cnt < w:
    grid[i][j] = "."
    if j == 98:
        i += 2
        j = 1
    elif j == 99:
        i += 2
        j = 0
    else:
        j += 2
    cnt += 1
print(100,100)
for i in range(len(grid)):
    print("".join(grid[i]))

Solution (Python):
a,b=map(int,input().split())
print(100,100)
ans=[list("
for i in range(a-1):
  h=(i//50)*2
  w=(i%50)*2
  ans[h][w]="."
for i in range(b-1):
  h=(i//50)*2+51
  w=(i%50)*2
  ans[h][w]="
for i in ans:print("".join(i))

Solution (Python):
a,b = list(map(int,input().split()))
ls = [['
i,j = 0,0
for c in range(a - 1):
    ls[i][j] = '.'
    if j >= 97:
        j = 0;i += 2
    else:
        j += 2
i,j = 51,0
for c in range(b - 1):
    ls[i][j] = '
    if j >= 97:
        j = 0;i += 2
    else:
        j += 2
print(98,99)
for j in range(98):
    print(''.join(ls[j]))

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

mat=[]
for i in range(100):
  array=["."]*20+["
  mat.append(array)

for i in range(B-1):
  j=2*(i//10)
  k=2*(i%10)
  mat[j][k]="
for i in range(A-1):
  j=2*(i//10)
  k=2*(i%10)+21
  mat[j][k]="."
  
print(100,40)
for i in range(100):
  print("".join(mat[i]))

Solution (Python):



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


def paint1(ans):
    a = 1
    for i in range(0, 49, 2):
        for j in range(0, 100, 2):
            if a == A:
                return
            ans[i][j] = "."
            a += 1


def paint2(ans):
    b = 1
    for i in range(51, 100, 2):
        for j in range(0, 100, 2):
            if b == B:
                return
            ans[i][j] = "
            b += 1


def main():
    ans = [["
    paint1(ans)
    paint2(ans)

    print(100, 100)
    for r in ans:
        print("".join(r))


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    a, b = map(int, input().split())
    k = 50
    gw = [['.'] * 2 * k for _ in range(k)]
    gb = [['
    for i in range(b - 1):
        h = (i // k) * 2
        w = (i % k) * 2
        gw[h][w] = '
    for i in range(a - 1):
        h = (i // k) * 2 + 1
        w = (i % k) * 2 + 1
        gb[-h][-w] = '.'
    ans = gw + gb
    print(2 * k, 2 * k)
    for l in ans:
        print(*l, sep='')


if __name__ == '__main__':
    main()

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

for i in range(50,100):
    for j in range(100):
        m[i][j]=1
a-=1 
b-=1 

for i in range(0,48,2):
    if b==0:
        break
    for j in range(0,100,2):
        m[i][j]=1
        b-=1
        if b==0:
            break
     

for i in range(99,50,-2):
    if a==0:
        break
    for j in range(0,100,2):
        m[i][j]=0
        a-=1
        if a==0:
            break
print(100,100)
for i in range(100):
    for j in range(100):
        if m[i][j]==0:
            print('.',end='')
        else:
            print('
    print()

Solution (Python):





a,b = map(int, input().split( ))
k=50
W = [["."]*(k*2) for i in range(k)] 
B = [["

for i in range(b-1):
    w = (i//k)*2
    h = (i%k)*2
    W[w][h]="


for i in range(a-1):
    w = (i//k)*2+1
    h = (i%k)*2+1
    B[-w][-h]="."
ans = [''.join(W[i]) for i in range(k)]+ [''.join(B[i]) for i in range(k)]
print(100,100)
print('\n'.join(ans))

Solution (Python):





a,b = map(int, input().split( ))
k=50
W = [["."]*(k*2) for i in range(k)] 
B = [["
for i in range(b-1):
    h = (i//k)*2
    w = (i%k)*2
    W[h][w]="



for i in range(a-1):
    h = (i//k)*2+1
    w = (i%k)*2+1
    B[-h][-w]="."
    
ans = [''.join(W[i]) for i in range(k)]+ [''.join(B[i]) for i in range(k)]
print(100,100)
print('\n'.join(ans))

Solution (Python):
a,b=map(int,input().split())
grid=[["." for i in range(100)] for j in range(50)]+[["
white=0;black=0
for i in range(49):
    if black==b-1:break
    if i%2==0:continue
    for j in range(100):
        if i%2==j%2:
            grid[i][j]="
            black+=1
        if black==b-1:break
    
for i in range(50,100):
    if white==a-1:break
    if i%2==0:continue
    for j in range(100):
        if i%2==j%2:
            grid[i][j]="."
            white+=1
        if white==a-1:break
print(100,100)
for i in range(100):
    stri=""
    for j in grid[i]:
        stri+=j
    print(stri)

Solution (Python):
a, b = map(int, input().split())
L = [["
qa, ra = divmod(a-1, 50)
for i in range(qa):
  L[i*2] = ["
L[qa*2] = ["
qb, rb = divmod(b-1, 50)
for i in range(qb):
  L[51+i*2] = ["." if j%2 else "
L[51+qb*2] = ["." if j%2 else "
print(100, 100)
for l in L:
  print(*l, sep="")

Solution (Python):
a,b=map(int,input().split())
cntA,cntB=0,0
print(100,100)
flag=False
if a>=b:
  arr=[['
  l=[]
  cntB=1
  for i in range(2,99,4):
    if flag:break
    for j in range(2,99,4):
      l.append((i,j))
      for y in range(i-1,i+2):
        for x in range(j-1,j+2):
          arr[y][x]='.'
      cntA+=1
      if cntA==a:
        flag=True
        break
  while cntB<b:
    cntB+=1
    s,t=l.pop()
    arr[s][t]='
  for i in range(100):
    print(''.join(arr[i]))
else:
  arr=[['.']*100 for i in range(100)]
  l=[]
  cntA=1
  for i in range(2,99,4):
    if flag:break
    for j in range(2,99,4):
      l.append((i,j))
      for y in range(i-1,i+2):
        for x in range(j-1,j+2):
          arr[y][x]='
      cntB+=1
      if cntB==b:
        flag=True
        break
  while cntA<a:
    cntA+=1
    s,t=l.pop()
    arr[s][t]='.'
  for i in range(100):
    print(''.join(arr[i]))

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

w = '.'
b = '

ans = [ [b]* 20 + [w] * 20 for _ in range(100)]

for i in range(A-1):
    x = 2 * (i//50)
    y = (i%50) * 2
    ans[y][x] = w
    
for i in range(B-1):
    x = 2 * (i//50) + 21
    y = (i%50) * 2
    ans[y][x] = b
    
print('100 40')
for i in range(100):
    print(''.join(ans[i]))

Solution (Python):
a,b = map(int,input().split())
s = [['.']*99 if i<50 else ['
print(100,99)
for i in range(b-1):
    row = ((i*2)//99)*2
    col = (i*2)%99
    s[row][col] = '
for i in range(a-1):
    row = ((i*2)//99)*2+51
    col = (i*2)%99
    s[row][col] = '.'
for i in s:
    for j in i:
        print(j,end='')
    print()

Solution (Python):
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

a,b = inm()
c = [ ['
c.extend([ ['.']*50 for i in range(45) ])
for z in range(a-1):
    c[(z//25)*2][(z%25)*2] = '.'
for z in range(b-1):
    c[(z//25)*2+50][(z%25)*2] = '
print('90 50')
for i in range(90):
    print(''.join(c[i]))

Solution (Python):
A,B = map(int,input().split())
h = 96
w = 99
S = [["." for _ in range(w)] for _ in range(h)]
for i in range(48,h):
    for j in range(w):
        S[i][j] = "
cnt = 0
while cnt<B-1:
    for i in range(16):
        for j in range(33):
            S[3*i+1][3*j+1]="
            cnt += 1
            if cnt==B-1:break
        if cnt==B-1:break
    if cnt==B-1:break
cnt = 0
while cnt<A-1:
    for i in range(16):
        for j in range(33):
            S[48+3*i+1][3*j+1]="."
            cnt += 1
            if cnt==A-1:break
        if cnt==A-1:break
    if cnt==A-1:break
print(h,w)
for i in range(h):
    print("".join(S[i]))

Solution (Python):

from bisect import *
from collections import *
from heapq import *




A,B=map(int,input().split())
A-=1
B-=1
lst=[["
for h in range(0,100,2):
    for w in range(0,100,2):
        if A==0:
            break
        lst[h][w]="."
        A-=1

    if A==0:
        break
for h in range(99,-1,-2):
    for w in range(0,100,2):
        if B==0:
            break
        lst[h][w]="
        B-=1

    if B==0:
        break
print(100,100)
for i in range(100):
    print("".join(lst[i]))

Solution (Python):

G=[["
for i in range(50,100):
  for j in range(100):
    G[i][j]="."

A,B=map(int,input().split())   
A-=1
B-=1

i,j=0,0

while(A>0):
  G[i][j]="."
  A-=1
  j+=2
  if j>99:
    j=0
    i+=2
i,j=99,0
while(B>0):
  G[i][j]="
  B-=1
  j+=2
  if j>99:
    j=0
    i-=2
    
    
print(100,100)
for i in range(100):
  print("".join(G[i]))

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

for a in range(A-1):
    j = a%50
    z[(j*2)+((a//50)%2)+202*(a//50)] = "."
z2 = (["."]*100 + ["\n"])*50

for a in range(B-1):
    j = a%50
    z2[(j*2)+((a//50)%2)+101+202*(a//50)] = "
print(100, 100)
print("".join(z)+"".join(z2))

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

N = 100

A -= 1
B -= 1

S = []
for i in range(N // 2):
  S.append(list("." * N))
for i in range(50):
  S.append(list("

flag = 0
for i in range(1, N // 2, 2):
  for j in range(1, N, 2):
    if B == 0:
      flag = 1
      break
    else:
      S[i][j] = "
      B -= 1
  if flag:
    break

flag = 0
for i in range(N // 2 + 1, N, 2):
  for j in range(1, N, 2):
    if A == 0:
      flag = 1
      break
    else:
      S[i][j] = "."
      A -= 1
  if flag:
    break

print(N, N)
for i in range(N):
  print("".join(S[i]))

Solution (Python):
import sys
input = sys.stdin.readline
A, B = map(int, input().split())
a = [["
for i in range(100):
  a[i][0] = "."
for i in range(0, 100, 2):
  for j in range(1, 99):
    a[i][j] = "."
for i in range(0, 100, 2):
  for j in range(1, 99, 2):
    if A <= 1: break
    A -= 1
    a[i][j] = "
for i in range(99, -1, -2):
  for j in range(98, 0, -2):
    if B <= 1: break
    B -= 1
    a[i][j] = "."
print(100, 100)
for r in a: print("".join(r))

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

U=[['
for w in range(A-1):
    s=w//50;t=w%50
    U[s*2][t*2]='.'

D=[['.' for j in range(100)] for i in range(50)]
for b in range(B-1):
    u=b//50;v=b%50
    D[u*2+1][v*2]='

print(100,100)
for Ui in U:
    print(''.join(Ui))
for Di in D:
    print(''.join(Di))

Solution (Python):
import sys
import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  
rs = lambda: stdin.readline().rstrip()  

A, B = rl()
grid = [['.'] * 100 for _ in range(50)] + [['
for i in range(B-1):
    row, column = divmod(i, 50)
    row *= 2
    column *= 2
    grid[row][column] = '

for i in range(A-1):
    row, column = divmod(i, 50)
    row *= 2
    column *= 2
    grid[99-row][column] = '.'
print(100,100)
for x in grid:
    print(*x, sep='')

Solution (Python):
def f(base,m,c):
	for i in range(16):
		for j in range(32):
			if not m:
				break
			base[2 * i][j * 2] = c
			m -= 1
		else:
			continue
		break
	return base

w,b=map(int,input().split())
print(64,64)
print("\n".join(map("".join,f([["

Solution (Python):
w,b=map(int,input().split())
w-=1
b-=1
black_base=[["
white_base=[["."]*100 for _ in range(50)]

for i in range(25):
	for j in range(25):
		if not w:
			break
		black_base[2*i][j*2]="."
		w-=1
	else:
		continue
	break

for i in range(25):
	for j in range(25):
		if not b:
			break
		white_base[2*i+1][2*j]="
		b-=1
	else:
		continue
	break

print(100,100)
print("\n".join(map("".join,black_base+white_base)))

Solution (Python):
from fractions import gcd

from heapq import*
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7



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


def main():
    a, b = map(int, input().split())
    grid = [["." for i in range(100)] for j in range(100)]
    for i in range(50):
        for j in range(100):
            grid[i][j] = "

    for i in range(0, 50, 2):
        for j in range(0, 100, 2):
            if a == 1:
                break
            grid[i][j] = "."
            a -= 1
        if a == 1:
            break

    for i in range(51, 100, 2):
        for j in range(0, 100, 2):
            if b == 1:
                break
            grid[i][j] = "
            b -= 1

        if b == 1:
            break
    print(100,100)
    for i in range(100):
        print("".join(map(str, grid[i])))
        





if __name__ == '__main__':
    main()

Solution (Python):
from math import ceil


a, b = map(int, input().split())
w = 52
r1 = ceil((a - 1) / ((w - 2) // 2))
r2 = ceil((b - 1) / (w // 2))
h = 1 + r1 * 2 + r2 * 2
print(h, w)
print('
a -= 1
for i in range(r1):
    num = min(max(a, 0), (w - 2) // 2)
    print('
    print('
    a -= (w - 2) // 2
b -= 1
for i in range(r2):
    num = min(max(b, 0), w // 2)
    print('.' * w)
    print('
    b -= w // 2

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

whiteline = list("."*100)
blackline = list("
checkline = ["." if i%2 == 0 else "

ans = []
b = B-1
for h in range(21):
    if h%2 == 0:
        ans.append(whiteline)
    else:
        if b >= 50:
            ans.append(checkline)
            b -= 50
        elif b > 0:
            P = list("."*100)
            for i in range(b):
                P[2*i] = "
            b = 0
            ans.append(P)
        else:
            ans.append(whiteline)
a = A-1
for h in range(21):
    if h%2 == 0:
        ans.append(blackline)
    else:
        if a >= 50:
            ans.append(checkline)
            a -= 50
        elif a > 0:
            P = list("
            for i in range(a):
                P[2*i] = "."
            a = 0
            ans.append(P)
        else:
            ans.append(blackline)

print(len(ans), len(ans[0]))
for L in ans:
    print("".join(L))

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

ans = [['


i, j = 0, 1
for _ in range(A-1):
    ans[i][j] = '.'
    j += 2
    if j == 101:
        i += 2
        j = 1

i, j = 51, 1
for _ in range(B-1):
    ans[i][j] = '
    j += 2
    if j == 101:
        i += 2
        j = 1

print('100 100')
for a in ans:
    print(*a, sep='')