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):
A, B = map(int, input().split())
if A <= B:
    s0, s1 = '.', '
    M, m = B, A
else:
    s0, s1 = '
    M, m = A, B

print(100, 100)

ans = [[s0] * 100 for _ in range(100)]
ans[0] = [s1] * 100
ans[1] = [s0, s1] * 50
M -= 1
m -= 1

y, x = 2, 0
for _ in range(m):
    ans[y][x] = s1
    x += 2
    if x >= 100:
        y += 1
        x = y % 2
y, x = 98, 1
for _ in range(M - m):
    ans[y][x] = s1
    x += 2
    if x >= 100:
        y -= 2
        x = 1
for a in ans:
    print(''.join(map(str, a)))

Solution (Python):
A,B = map(int,input().split())
A -= 1
B -= 1
K = 50
print(100,100)
grid1 = [['
grid2 = [['.']*100 for i in range(50)]
for r in range(0,50,2):
    for c in range(0,100,2):
        if A > 0:
            grid1[r][c] = '.'
            A -= 1
        else:
            break

for r in range(1,50,2):
    for c in range(0,100,2):
        if B > 0:
            grid2[r][c] = '
            B -= 1
        else:
            break
for row in grid1:
    print(''.join(row))

for row in grid2:
    print(''.join(row))

Solution (Python):


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








n_B = B - 1
n_A = A - 1
print(100, 100)
for _ in range(25):
    out = []
    for i in range(100):
        if i % 2 == 0 and n_B > 0:
            out.append('
            n_B -= 1
        else:
            out.append('.')
    print(''.join(out))
    print('.' * 100)


for _ in range(25):
    out = []
    print('
    for i in range(100):
        if i % 2 == 0 and n_A > 0:
            out.append('.')
            n_A -= 1
        else:
            out.append('
    print(''.join(out))

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

mark = ['.', '

def print_ans(ans):
  for a in ans:
    print(''.join(a))

def change(num, mark_id):
  global ans
  idx = 0
  while num > 1:
    if idx <= 99:
      ans[-1][idx] = mark[mark_id]
      idx += 2
      num -= 1
    else:
      ans.extend([list(mark[mark_id-1]*100) for i in range(2)])
      idx = 0

  
ans = [list(mark[0] * 100)]
change(B, 1)
ans.append(list(mark[0] * 100))
ans.extend([list(mark[1]*100) for i in range(2)])
change(A, 0)

print(len(ans), 100)
print_ans(ans)

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

a, b = [int(x) for x in input().split()]

white = [['.'] * 100 for _ in range(50)]
black = [['

a, b = a - 1, b - 1

if b != 0:
    for i in range(0, 50, 2):
        flag = 0
        for j in range(0, 100, 2):
            white[i][j] = '
            b -= 1
            if b == 0:
                flag = 1
                break
        if flag:
            break

if a != 0:
    for i in range(1, 50, 2):
        flag = 0
        for j in range(1, 100, 2):
            black[i][j] = '.'
            a -= 1
            if a == 0:
                flag = 1
                break
        if flag:
            break
print(100, 100)
for i in white:
    print(''.join(i))
for j in black:
    print(''.join(j))

Solution (Python):
A,B = map(int,input().split())
cnt = 0
grid = []

for i in range(50):
    s = ''
    for j in range(25):
        k = 0
        if i%2 == 0 and cnt < A-1:
            s += '.
            cnt += 1
            k = 1
        if i%2 == 1 and cnt < A-1:
            s += '
            cnt += 1
            k = 1
        if k == 0:
            s += '
    grid.append(s)
s = ''
for i in range(100):
    s += '.'
grid.append(s)
cnt = 0
for i in range(49):
    s = ''
    for j in range(25):
        k = 0
        if i%2 == 0 and cnt < B-1:
            s += '
            cnt += 1
            k = 1
        if i%2 == 1 and cnt < B-1:
            s += '..
            cnt += 1
            k = 1
        if k == 0:
            s += '....'
    grid.insert(50,s)

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

Solution (Python):
A, B = map(int, input().split())
print(100, 100)
grid = [['
A -= 1; B -= 1
i, j = 0, 0
while A:
    grid[i][j] = '.'; A -= 1
    if j == 98: i += 2; j = 0
    else: j += 2
i, j = 51, 0
while B:
    grid[i][j] = '
    if j == 98: i += 2; j = 0
    else: j += 2
for r in grid:
    print(''.join(r))

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

Solution (Python):
a, b = map(int, input().split())
k = 50
ans = []
for _ in range(k):
    ans += [['
for _ in range(k):
    ans += [['.'] * (2 * k)]

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

print('{} {}'.format(2*k, 2*k))
for i in range(2 * k):
    for j in range(2 * k):
        print(ans[i][j], end='')
    print()

Solution (Python):
a,b=map(int,input().split())
s=[]
g=[['
for i in range(1,100,4):
  for j in range(1,100,4):
    s.append((i,j))
if a>=b:
  for i in range(a):
    y,x=s[i]
    for dy in [-1,0,1]:
      for dx in [-1,0,1]:
        if dy==dx==0:
          continue
        g[y+dy][x+dx]='.'
  for i in range(a-b+1):
    y,x=s[i]
    g[y][x]='.'
else:
  for i in range(100):
    for j in range(100):
      g[i][j]='.'
  for i in range(b):
    y,x=s[i]
    for dy in [-1,0,1]:
      for dx in [-1,0,1]:
        if dy==dx==0:
          continue
        g[y+dy][x+dx]='
  for i in range(b-a+1):
    y,x=s[i]
    g[y][x]='
print(100,100)
for i in range(100):
  print(''.join(g[i]))

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

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


print("100 100")

A -= 1
B -= 1
for y in range(50):
  s = ""
  if y%2 == 1:
    for x in range(100):
      if A > 0 and x%2 == 0:
        s += "."
        A -= 1
      else:
        s += "
    print(s)
  else:
    print("
for y in range(50):
  s = ""
  if y%2 == 1:
    for x in range(100):
      if B > 0 and x%2 == 0:
        s += "
        B -= 1
      else:
        s += "."
    print(s)
  else:
    print("." * 100)

Solution (Python):
a,b = map(int,input().split())
grid_b = [list('
grid_w = [list('.'*100) for _ in range(50)]
for i in range(a-1):
    grid_b[2*(i//50)+1][2*(i%50)+1] = '.'
for i in range(b-1):
    grid_w[2*(i//50)+1][2*(i%50)+1] = '
print(100, 100)
for i in range(50):
    print(''.join(grid_b[i]))
for i in range(50):
    print(''.join(grid_w[i]))

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

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

for i in range(50):
    if i%2 == 1:
        print("
    else:
        res = []
        for j in range(100):
            if j%2 == 1:
                res.append("
            elif a > 1:
                res.append(".")
                a -= 1
            else:
                res.append("
        print("".join(res))

for i in range(50):
    if i%2 == 0:
        print("."*(100))
    else:
        res = []
        for j in range(100):
            if j%2 == 1:
                res.append(".")
            elif b > 1:
                res.append("
                b -= 1
            else:
                res.append(".")
        print("".join(res))

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

K = 50
a = '.'
b = '
grid = [[a] * (2 * K) for _ in range(K)] + [[b] * (2 * K) for _ in range(K)]

B -= 1
for i in range(1, K - 1, 2):
    for j in range(1, 2 * K - 1):
        if (i + j) % 2:
            grid[i][j] = b
            B -= 1
        if B == 0:
            break
    else:
        continue
    break

A -= 1
for i in range(K + 1, 2 * K - 1, 2):
    for j in range(1, 2 * K - 1):
        if (i + j) % 2:
            grid[i][j] = a
            A -= 1
        if A == 0:
            break
    else:
        continue
    break

print(2 * K, 2 * K)
for r in grid:
    print(*r, sep='')

Solution (Python):
import sys
input = sys.stdin.readline
INF = 10**9
MOD = 10**9 + 7

def main():
    a,b = map(int,input().split())
    
    if a == 1 and b == 1:
        print(1,2)
        print('.
        exit()

    if a != 1:
        h1 = 2 * ((a - 2)//50 + 2) - 1
        lim1 = 1
        grid1 = [['
    else:
        h1 = 0
        lim1 = 0

    if b != 1:
        h2 = 2 * ((b - 2)//50 + 1)
        lim2 = 1
        grid2 = [['.']*100 for _ in range(h2)]
    else:
        h2 = 0
        lim2 = 0
    
    i = 1
    j = 1
    while a > lim2:
        grid1[i][j] = '.'
        a -= 1
        j += 2
        if j == 101:
            i += 2
            j = 1
    
    i = 1
    j = 1
    while b > lim1:
        grid2[i][j] = '
        b -= 1
        j += 2
        if j == 101:
            i += 2
            j = 1

    print(h1 + h2, 100)

    for i in range(h1):
        print(''.join(grid1[i]))

    for i in range(h2):
        print(''.join(grid2[i]))

if __name__=='__main__':
    main()

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

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

for _ in range(50):
    grid.append(["

i = 51
j = 0
for _ in range(a - 1):
    grid[i][j] = "."
    j += 2
    if j >= 100:
        i += 2
        j = 0

i = 0
j = 0
for _ in range(b - 1):
    grid[i][j] = "
    j += 2
    if j >= 100:
        i += 2
        j = 0

print(100, 100)
for row in grid:
    print(*row, sep="")

Solution (Python):
a, b = map(int, input().split())
s = [[0 for _ in range(100)] for _ in range(100)]
for i in range(100):
    for j in range(100):
        if j == 0:
            s[i][j] = "."
        elif j == 99:
            s[i][j] = "
        else:
            if i % 2 == 0:
                s[i][j] = "
            else:
                s[i][j] = "."
c, d = 0, 2
while b != 1:
    s[c][d] = "."
    b -= 1
    d += 2
    if d > 95:
        c += 6
        d = 2
c, d = 3, 97
while a != 1:
    s[c][d] = "
    a -= 1
    d -= 2
    if d < 4:
        c += 6
        d = 97
print(100, 100)
for t in s:
    print("".join(t))

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
C = []

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

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


h = -1
w = 0

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

print(100, 100)
for i in range(100):
    print(*C[i], sep="")

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

S = [["."]*100 for i in range(100)]

for i in range(50,100):
    for j in range(0,100):
        S[i][j] = "

for i in range(B-1):
    S[2*(i//50)][(i%50)*2+(i//50)%2] = "
for i in range(A-1):
    S[2*(i//50)+51][(i%50)*2+(i//50)%2] = "."

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

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

Solution (Python):
A,B=map(int,input().split())
l=[[0]*100 for i in range(40)]
A-=1
for i in range(0,19,2):
    for j in range(1,100,2):
        if A:
            l[i][j]=1
            A-=1
B-=1
for i in range(21,40,2):
    for j in range(1,100,2):
        if B:
            l[i][j]=1
            B-=1
print(40,100)
for i in l[:20]:
    for j in i:
        print("." if j else "
    print()
for i in l[20:]:
    for j in i:
        print("
    print()

Solution (Python):
A, B = map(int, input().split())
a,p = divmod(A-1,50)
b,q = divmod(B-1,50)
ans = []
cnt = 0
for i in range(2*a):
  if i%2==0:
    ans += ['.
  else:
    ans += ['
cnt += 2*a

if p!=0:
  ans += ['.
  cnt += 1
ans += ['
ans += ['.'*100]
cnt += 2
for i in range(2*b):
  if i%2==0:
    ans += ['.
  else:
    ans += ['.'*100]
cnt += 2*b
if q!=0:
  ans += ['.
  cnt += 1
print(cnt,100)
print('\n'.join(ans))

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

for i in range(50):
  l=[]
  for j in range(100):
    if i%2==0 and j%2==0 and a>1:
      l.append('.')
      a-=1
    else:
      l.append('
  ans.append(l)

for i in range(50):
  l=[]
  for j in range(100):
    if i%2==1 and j%2==1 and b>1:
      l.append('
      b-=1
    else:
      l.append('.')
  ans.append(l)

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

Solution (Python):
A, B = map(int, input().split())
grid = [['
A -= 1
cnt = 0
i = 0
j = 0
while cnt < A:
    grid[i][j] = '.'
    cnt += 1
    j += 2
    if j >= 100:
        i += 2
        j = 0
B -= 1
cnt = 0
i = 39
j = 0
while cnt < B:
    grid[i][j] = '
    cnt += 1
    j += 2
    if j >= 100:
        i -= 2
        j = 0
print(40, 100)
for row in grid:
    print(''.join(row))

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


a, b = LI()
a -= 1; b -= 1
ans = [['.'] * 100 for _ in range(50)] + [['


flg = 0
for y in range(99, 50, -2):
    for x in range(0, 100, 2):
        if not a:
            flg = 1
            break
        ans[y][x] = '.'
        a -= 1
    if flg:
        break

flg = 0
for y in range(0, 50, 2):
    for x in range(0, 100, 2):
        if not b:
            flg = 1
            break
        ans[y][x] = '
        b -= 1
    if flg:
        break


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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


a, b = LI()
a -= 1; b -= 1
ans = [['.'] * 100 for _ in range(50)] + [['


flg = 0
for y in range(99, 50, -2):
    for x in range(0, 100, 2):
        if not a:
            flg = 1
            break
        ans[y][x] = '.'
        a -= 1
    if flg:
        break

flg = 0
for y in range(0, 50, 2):
    for x in range(0, 100, 2):
        if not b:
            flg = 1
            break
        ans[y][x] = '
        b -= 1
    if flg:
        break


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

Solution (Python):
def main():
    a, b = map(int, input().split())
    ans_w = [["."]*100 for _ in range(50)]
    ans_b = [["
    cnt = 1
    for i in range(0, 50, 2):
        if cnt == a:
            break
        for j in range(0, 100, 2):
            ans_b[i][j] = "."
            cnt += 1
            if cnt == a:
                break
    cnt = 1
    for i in range(1, 50, 2):
        if cnt == b:
            break
        for j in range(0, 100, 2):
            ans_w[i][j] = "
            cnt += 1
            if cnt == b:
                break
    print("100 100")
    for i in range(50):
        for j in range(100):
            print(ans_b[i][j], end="")
        print("")
    for i in range(50):
        for j in range(100):
            print(ans_w[i][j], end="")
        print("")
if __name__ == "__main__":
    main()

Solution (Python):
a, b = map(int, input().split())
hw = [["." for i in range(100)] for j in range(50)]
wo = [["
hw += wo
k = 0
for i in range(b-1):
	i = i*2 + 1
	if i%100 == 1 and i//100 > 0:
		k += 2
	hw[k][i%100] = "
l = 51
for i in range(a-1):
	i = i*2 + 1
	if i%100 == 1 and i//100 > 0:
		l += 2
	hw[l][i%100] = "."
print (100,100)
for i in range(100):
	print ("".join(hw[i]))

Solution (Python):
def d_grid_components(H=100, W=100):
    A, B = [int(i) for i in input().split()]
    
    
    grid = [['

    def fill(start, end, num, symbol):
        """start 行から end-1 行まで，num 個の symbol を 1 マスおきに置いていく"""
        for row in range(start, end, 2):
            for col in range(1, W, 2):
                if num == 0:
                    return
                grid[row][col] = symbol
                num -= 1
        return None

    fill(1, 50, A - 1, '.')  
    fill(51, 100, B - 1, '
    return '100 100\n' + '\n'.join([''.join(row) for row in grid])

print(d_grid_components())

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

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

A-=1

for i in range(50):
    for j in range(25):
        if A>0:
            L[i*2][j*2] = "."
            A -=1
B-=1

for i in range(50):
    for j in range(25):
        if B>0:
            L[51 + i*2][j*2] = "
            B-=1
for i in range(100):
    print("".join(L[i]))

Solution (Python):

a,b = map(int,input().split())
a -= 1
b -= 1
ap = a // 50
bp = b // 50
ar = a % 50
br = b % 50
print(ap*2 + 4 + bp*2,100)
for _ in range(ap):
  print('.
  print('
print('.
print('
print('..' * 50)
print('.
for _ in range(bp):
  print('..' * 50)
  print('.

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

a, b = [int(_) for _ in input().split()]

a -= 1
b -= 1


def f(b, av, bv):
    A = [list(av * 100) for _ in range(50)]
    for i in range(1, 49):
        if b == 0: break
        for j in range(1, 99):
            if b == 0: break

            if A[i - 1][j] != bv and \
                    A[i - 1][j - 1] != bv and \
                    A[i - 1][j + 1] != bv and \
                    A[i][j - 1] != bv :
                A[i][j] = bv
                b -= 1
    for a in A:
        print(*a,sep='')

print(100,100)
f(b, '.', '
f(a, '

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

N=100

S=[[] for _ in range(N)]
for i in range(N):
    if i<N//2:
        S[i]=list("
    else:
        S[i]=list("."*N)
        
    
y=0
x=0
for _ in range(A-1):
    S[y][x]="."
    x+=2
    if x>=N:
        x=0
        y+=2
        
y=N//2+1
x=0
for _ in range(B-1):
    S[y][x]="
    x+=2
    if x>=N:
        x=0
        y+=2
        
print(N,N)
for i in range(N):
    print(''.join(map(str, S[i])))

Solution (Python):


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

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

white_count = 1
row = 0
col = 0
while white_count < A:
    grid[row][col] = "."
    col += 2
    if col == 100:
        col = 0
        row += 2
    white_count += 1

black_count = 1
row = 99
col = 0
while black_count < B:
    grid[row][col] = "
    col += 2
    if col == 100:
        col = 0
        row -= 2
    black_count += 1

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

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A,B=MI_()
    H,W=100,100
    print(H,W)
    ans = [[""]*W for _ in range(H)]
    for i in range(H):
        if i<H//2:
            ans[i] = ["
        else:
            ans[i] = ["."]*W

    for i in range(H):
        for j in range(W):
            if i&1 or j&1:
                continue
            if i<H//2:
                if A:
                    ans[i][j] = "."
                    A-=1
            else:
                if B:
                    ans[H+49-i][j] = "
                    B-=1
    for a in ans:
        print(*a,sep="")

if __name__ == '__main__':
    main()

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

x=np.array([['.']*100]*100,dtype=str)

x[:,:50]='

v1=(a-1)//20
v2=(a-1)-v1*20
w1=(b-1)//20
w2=(b-1)-w1*20

for i in range(v1):
    x[2*i+1,1:40:2]='.'

x[-1,1:2*v2:2]='.'

for i in range(w1):
    x[2*i+1,51:90:2]='
x[-1,51:50+w2*2:2]='
print(100,100)
for i in range(100):
    print(''.join(x[i]))

Solution (Python):
def change(w,b):
    h = 0
    grid = []
    for i in range(50):
        if i % 3 == 0:
            grid.append([1 for j in range(100)])
        elif i % 3 == 1:
            grid.append([])
            for j in range(100):
                if w > 1 and j % 2 and j < 99:
                    grid[i].append(0)
                    w -= 1
                else:
                    
                    grid[i].append(1)
        elif i % 3 == 2:
            grid.append([])
            for j in range(100):
                if w > 1 and j % 2 == 0 and j < 99:
                    grid[i].append(0)
                    w -= 1
                else:
                    grid[i].append(1) 
    b -= 1
    for i in range(50, 100):
        if i % 3 == 2:
            grid.append([0 for j in range(100)])
        elif i % 3 == 0:
            grid.append([])
            for j in range(100):
                if b > 0 and j % 2 and j < 99:
                    grid[i].append(1)
                    b -= 1
                else:
                    grid[i].append(0) 
        elif i % 3 == 1:
            grid.append([])
            for j in range(100):
                if b > 0 and j % 2 == 0 and j < 99:
                    grid[i].append(1)
                    b -= 1
                else:
                    grid[i].append(0) 

    print(100,100)
    d = {0:'.', 1:'
    [print(''.join(map(d.get,line))) for i,line in enumerate(grid)]

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

change(w,b)

Solution (Python):
a,b = map(int, input().split())
ans = [['.' for i in range(50)]+['

x,y = 0,51
while a>1:
    ans[x][y] = '.'
    y+=2
    if y>99:
        x+=2
        y=51
    a-=1

x,y = 0,0
while b>1:
    ans[x][y] = '
    y+=2
    if y>48:
        x+=2
        y=0
    b-=1

print(100,100)

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

Solution (Python):
g_0 = [["
g_1 = [["."]*100 for _ in range(50)]

a,b = map(int, input().split())
print("100 100")
for i in range(a-1):
    g_0[2*(i//49) + 1][2*(i%49) +1] = "."

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

for i in range(50):
    print("".join(g_0[i]))
for i in range(50):
    print("".join(g_1[i]))

Solution (Python):
import numpy as np
A,B = map(int,input().split())
w = "."
b = "
if A<B:
    w,b = b,w
    A,B = B,A
Q1 = np.array([[b,b,b,b],[b,b,b,b],[b,b,b,b],[b,b,b,b]],dtype=np.unicode)
Q2 = np.array([[w,w,w,b],[w,w,w,b],[w,w,w,b],[b,b,b,b]],dtype=np.unicode)
Q3 = np.array([[w,w,w,b],[w,b,w,b],[w,w,w,b],[b,b,b,b]],dtype=np.unicode)
Grid = [[Q1]*25 for _ in range(20)]
B -= 1
for i in range(20):
    for j in range(25):
        if A:
            Grid[i][j] = Q2
            A -= 1
            if B:
                Grid[i][j] = Q3
                B -= 1
for i in range(20):
    if i == 0:
        AC = Grid[0][0]
    else:
        AC_ = Grid[i][0]
    for j in range(1,25):
        if i == 0:
            AC = np.hstack([AC,Grid[0][j]])
            continue
        AC_ = np.hstack([AC_,Grid[i][j]])
    if i != 0:
        AC = np.vstack([AC,AC_])
print(80,100)
for i in range(80):
    print(*AC[i],sep="")

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

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

i = 60
a -= 1
while a > 0:
    for j in range(0, 100, 2):
        ans[i][j] = "."
        a -= 1
        if a == 0:
            break
    i += 2
print(100, 100)
for i in range(100):
    print("".join(ans[i]))

Solution (Python):
a,b=map(int,input().split())
a-=1
b-=1
print(40,100)
for i in range(10):
  for j in range(50):
    if a>0:
      a-=1
      print('
    else:
      print('
  print('');
  print('
for i in range(10):
  print('....................................................................................................');
  for j in range(50):
    if b>0:
      b-=1
      print('
    else:
      print('..',end='')
  print('');

Solution (Python):
H, W = 82, 49
half_h = H // 2

WH = 0
BK = 1

nw, nb = map(int, input().split())
nw -= 1
nb -= 1

ret = []
for _ in range(half_h):
    ret.append([WH] * W)
for _ in range(half_h):
    ret.append([BK] * W)


def put(color, cnt, r1, r2):
    if cnt == 0:  
        return
    for r in range(r1 + 1, r2 - 1, 2):
        for c in range(0, W, 2):
            ret[r][c] = color
            cnt -= 1
            if cnt == 0:
                return


put(BK, nb, 0, half_h)
put(WH, nw, half_h, H)

print(H, W)  
for row in ret:
    print(*('

Solution (Python):
def main():
    a,b = map(int,input().split())
    print(100,100)
    white = [["."]*50 for _ in range(100)]
    black = [["
    a1,b1 = a-1,b-1
    x,y = 0,0
    for i in range(b1//25):
        for j in range(25):
            white[i*2][j*2] = "
        x = i+1
    for i in range(b1%25):
        white[x*2][i*2] = "
    for i in range(a1//25):
        for j in range(25):
            black[i*2][49-j*2] = "."
        y = i+1
    for i in range(a1%25):
        black[y*2][49-i*2] = "."
    for i,j in zip(white,black):
        print("".join(i) + "".join(j))
    
if __name__ == '__main__':
    main()

Solution (Python):
A, B = map(int, input().split())
L = []
def AA(A): return [".
def BB(B):  return [".." * 50, "
L += AA(max(0, A-1))
A -= 51
while A > 0:
    L += AA(A)
    A -= 50
L += BB(max(0, B-1))
B -= 51
while B > 0:
    L += BB(B)
    B -= 50
print(len(L), 100)
print(*L, sep="\n")

Solution (Python):
import sys
input = sys.stdin.readline
A,B=map(int,input().split())
a=[["
b=[["."]*100 for i in range(50)]


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