Problem p03404 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
#define rep(i, l, r) for (int i = l; i < r; i++)
#define dec(i, l, r) for (int i = l; i >= r; i--)
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define pb(c) push_back(c)
#define vii vector<pair<int, int>>
#define ii pair<int, int>
#define mp(i, j) make_pair(i, j)
#define ull unsigned long long int
#define ll long long int
#define pie 3.141592653589793238
#define inf ((ll)1e18)
#define eps 1e-7
#define mod ((ll)1e9 + 7)
#define maxlg 18
const int maxn = ((int)100);
#define left(i) ((i) << 1)
#define right(i) (((i)<<1)+1
char arr[maxn][maxn];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);

#ifndef ONLINE_JUDGE
  freopen("input", "r", stdin);
  // freopen("/home/arasmus/output", "w", stdout);
#endif
  fill(&arr[0][0], &arr[0][0] + maxn * maxn, '.');
  int a, b;
  cin >> a >> b;
  a--, b--;
  int col = 0;
  for (int i = 0; i < maxn; i += 2) {
    for (int j = 0; j < maxn; j += 2) {
      if (b >= 1)
        arr[i][j] = '#', b--;
      if (b == 0)
        break;
    }
    col = i + 2;
    if (b == 0) {
      break;
    }
  }
  for (int i = col; i < maxn; i++) {
    for (int j = 0; j < maxn; j++) {
      arr[i][j] = '#';
    }
  }
  for (int i = col + 1; i < maxn; i += 2) {
    for (int j = 0; j < maxn; j += 2) {
      if (a >= 1)
        arr[i][j] = '.', a--;
      if (a == 0)
        break;
    }
    col = i + 2;
    if (a == 0) {
      break;
    }
  }
  cout << 100 << " " << 100 << endl;
  rep(i, 0, maxn) {
    rep(j, 0, maxn) cout << arr[i][j];
    cout << endl;
  }
  return 0;
} // cout<<"Case #"<<++T<<": ";

Fixed submission:
#include <bits/stdc++.h>

using namespace std;
#define rep(i, l, r) for (int i = l; i < r; i++)
#define dec(i, l, r) for (int i = l; i >= r; i--)
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define pb(c) push_back(c)
#define vii vector<pair<int, int>>
#define ii pair<int, int>
#define mp(i, j) make_pair(i, j)
#define ull unsigned long long int
#define ll long long int
#define pie 3.141592653589793238
#define inf ((ll)1e18)
#define eps 1e-7
#define mod ((ll)1e9 + 7)
#define maxlg 18
const int maxn = ((int)100);
#define left(i) ((i) << 1)
#define right(i) (((i)<<1)+1
char arr[maxn][maxn];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);

#ifndef ONLINE_JUDGE
  //  freopen("input", "r", stdin);
  // freopen("/home/arasmus/output", "w", stdout);
#endif
  fill(&arr[0][0], &arr[0][0] + maxn * maxn, '.');
  int a, b;
  cin >> a >> b;
  a--, b--;
  int col = 0;
  for (int i = 0; i < maxn; i += 2) {
    for (int j = 0; j < maxn; j += 2) {
      if (b >= 1)
        arr[i][j] = '#', b--;
      if (b == 0)
        break;
    }
    col = i + 2;
    if (b == 0) {
      break;
    }
  }
  for (int i = col; i < maxn; i++) {
    for (int j = 0; j < maxn; j++) {
      arr[i][j] = '#';
    }
  }
  for (int i = col + 1; i < maxn; i += 2) {
    for (int j = 0; j < maxn; j += 2) {
      if (a >= 1)
        arr[i][j] = '.', a--;
      if (a == 0)
        break;
    }
    col = i + 2;
    if (a == 0) {
      break;
    }
  }
  cout << 100 << " " << 100 << endl;
  rep(i, 0, maxn) {
    rep(j, 0, maxn) cout << arr[i][j];
    cout << endl;
  }
  return 0;
} // cout<<"Case #"<<++T<<": ";