Language: C++

#include <iostream>
using namespace std;

int main () {
  int a, b;
  cin >> a >> b;
  int m, n;
  m = a; 
  n = b;
  if (m < n) {
    swap(m, n);  
  } 
  int dp[100][100];
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      dp[i][j] = 0;  
    }  
  } 
  int num = 0;
  int nun = 0;
  cout << 100 << " " << 100 << endl;
  if (m == n) {
    for (int i = 0; i < 100; i++) {
      for (int j = 0; j < 100; j++) {
        if (i == 0) {
          if (j == 0) {
            dp[i][j] = 1;
            num++;  
          }
          else {
            if (num == m && nun == n) {
              dp[i][j] = dp[i][j - 1];  
            }  
            else {
              dp[i][j] = dp[i][j - 1] * -1;   
              if (j % 2 == 0) {
                num++;  
              }
              else {
                nun++;  
              }
            }
          }
        }  
        else {
          if (num == m && nun == n) {
            dp[i][j] = dp[i - 1][j];  
          }
          else {
            dp[i][j] = dp[i - 1][j] * -1;
            if (j % 2 == 0) {
              num++;  
            }  
            else {
              nun++;  
            }
          }
        }
      }  
    }      
  }
  else {
    // まずは，差分をgetする
    int t = m - n + 1;
    for (int j = 0; j < 100; j++) {
      dp[0][j] = -1;
      nun = 1;  
    }
    if (t >= 50) {
      int l = t % 50;
      if (l == 0) l = 50;
      for (int j = 0; j < 100; j++) {
        if (j < 2 * l) {
          if (j % 2 == 0) {
            dp[1][j] = 1;  
          }  
          else {
            dp[1][j] = -1;  
          }
          num++;
        }
        else {
          dp[1][j] = -1;  
        }
      }
      bool fortrue = false;
      int memory = 0;
      for (int i = 2; i < 100; i++) {
        if (fortrue) {
          memory = i;
          break;
        }
        for (int j = 0; j < 100; j++) {
          if (fortrue) {
            dp[i][j] = -1;  
          }
          if (i % 2 == 0) {
            dp[i][j] = -1;  
          }  
          else {
            if (j % 2 == 0) {
              dp[i][j] = 1; 
              num++;
              if (num == t) {
                fortrue = true;
              } 
            }  
            else {
              dp[i][j] = -1;  
            }
          }
        }  
      }
      n--;
      m -= t;
      num = 0;
      nun = 0;
      for (int i = memory; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
          if (nun == n && num == m) {
            if (dp[i][j] == 0) {
              dp[i][j] = dp[i - 1][j]; 
            }
          }  
          else {
            dp[i][j] = dp[i - 1][j] * -1;
            if (dp[i][j] == 1) {
              num++;  
            }  
            else {
              nun++;  
            }
            if (num == m && nun == n) {
              if (dp[i][j] == 1 && j < 99) {
                dp[i][j + 1] = -1;  
              }  
            }
          }
        }    
      }
    }
    else {
      for (int j = 0; j < 100; j++) {
        if (j < t * 2) {
          if (j % 2 == 0) {
            dp[1][j] = 1;  
          }  
          else {
            dp[1][j] = -1;  
          }
        }
        else {
          dp[i][j] = -1;  
        }
      }  
      m -= t;
      n--;
      num = 0;
      nun = 0;
      int seisan = 0;
      bool fortrue = false;
      if (m == 1) {
        for (int j = 0; j < 100; j++) {
          dp[2][j] = 1;  
          dp[3][j] = -1;
        }  
        for (int i = 0; i < 100; i++) {
          for (int j = 0; j < 100; j++) {
            dp[i][j] = dp[i - 1][j];  
          }  
        }
      }
      else if (m <= 50 && m >= 2) {
        for (int i = 2; i < 100; i++) {
          for (int j = 0; j < 100; j++) {
            if (i % 2 == 0) {
              dp[i][j] = -1;    
            }   
            if (fortrue) {
              break;  
            }
            else {
              if (fortrue) {
                dp[i][j] = -1;  
              }
              if (!fortrue) {
                if (j % 2 == 0) {
                  dp[i][j] = 1;  
                  num++;
                }  
                else {
                  dp[i][j] = -1;  
                  nun++;
                }
                if (num == m - 1 && nun == n) {
                  fortrue = true;
                }
              }    
            }
          }  
        }
        for (int j = 0; j < 100; j++) {
          dp[3][j] = -1;
          dp[4][j] = 1;
          dp[5][j] = dp[2][j] * -1;  
        }
        dp[5][99] = -1;
        for (int i = 6; i < 100; i++) {
          for (int j = 0; j < 100; j++) {
            dp[i][j] = dp[i - 1][j];  
          }  
        }
      }
      else if (m > 50) {
        m = m + t;
        n++;
        num = 0;
        nun = 1;
        bool fortrue = false;
        for (int j = 0; j < 100; j++) {
          dp[0][j] = -1;
        }   
        for (int i = 2; i < 100; i++) {
          for (int j = 0; j < 100; j++) {
            if (!fortrue) {
              if (i == 2) {
                if (j % 2 == 0) {
                  dp[i][j] = -1;  
                  nun++;
                }    
                else {
                  dp[i][j] = 1;  
                  num++;
                }
              } 
              else {
                dp[i][j] = dp[i - 1][j] * -1;    
              } 
              if (num == (m - t) && nun == (n - 1)) {
                fortrue = true;  
              }  
            }
            else {
              dp[i][j] = dp[i - 1][j];
            }
          }  
        }
        int memory = 0;
        for (int j = 0; j < 100; j++) {
          if (j % 2 == 0 && !fortrue) {
            dp[1][j] = 1;  
            num++;
          }  
          else {
            dp[1][j] =   
          }
          if (num == m) {
            memory = j;
          }
        }
      }

    }
  }
  char ans1 = '.';
  char ans2 = '#';
  if (a < b) {
    swap(ans1, ans2);      
  }
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      if (dp[i][j] == 1) {
        cout << ans1;
      }  
      else if (dp[i][j] == -1) {
        cout << ans2;
      }
    }  
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:153:14: error: 'i' was not declared in this scope
  153 |           dp[i][j] = -1;
      |              ^
a.cc:256:11: error: expected primary-expression before '}' token
  256 |           }
      |           ^