Problem p03251 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS                                                                    \
  cin.tie(0);                                                                  \
  ios::sync_with_stdio(false)
#define MP_ make_pair
#define PB_ push_back
#define FIR first
#define SEC second
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP_R(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define FOR(i, m, n) for (int i = ((int)(m)); i < (int)(n); ++i)
#define FOR_R(i, m, n) for (int i = ((int)(m)-1); i >= (int)(n); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SIZ(x) ((int)(x).size())
typedef long long int lli;
using namespace std;
int ctoi(char c) {
  if (c >= '0' and c <= '9') {
    return (int)(c - '0');
  }
  return -1;
}

int main() {
  // IOS; /* making cin faster */
  int N, M, X, Y;
  scanf("%d%d%d%d", &N, &M, &X, &Y);

  vector<int> x(N);
  vector<int> y(N);

  REP(i, N) { scanf("%d", &x[i]); }

  REP(i, M) { scanf("%d", &y[i]); }

  int flag_peace = 0;
  int flag_val;

  FOR(Z, X + 1, Y + 1) {
    flag_val = 1;

    REP(i, N) {
      if (x[i] >= Z) {
        flag_val = 0;
        break;
      }
    }

    REP(i, M) {
      if (y[i] < Z) {
        flag_val = 0;
        break;
      }
    }

    if (flag_val) {
      flag_peace = 1;
      break;
    }
  }

  if (flag_peace) {
    printf("No War\n");

  } else {
    printf("War\n");
  }
}


Fixed submission:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS                                                                    \
  cin.tie(0);                                                                  \
  ios::sync_with_stdio(false)
#define MP_ make_pair
#define PB_ push_back
#define FIR first
#define SEC second
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP_R(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define FOR(i, m, n) for (int i = ((int)(m)); i < (int)(n); ++i)
#define FOR_R(i, m, n) for (int i = ((int)(m)-1); i >= (int)(n); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SIZ(x) ((int)(x).size())
typedef long long int lli;
using namespace std;
int ctoi(char c) {
  if (c >= '0' and c <= '9') {
    return (int)(c - '0');
  }
  return -1;
}

int main() {
  // IOS; /* making cin faster */
  int N, M, X, Y;
  scanf("%d%d%d%d", &N, &M, &X, &Y);

  vector<int> x(N);
  vector<int> y(M);

  REP(i, N) { scanf("%d", &x[i]); }

  REP(i, M) { scanf("%d", &y[i]); }

  int flag_peace = 0;
  int flag_val;

  FOR(Z, X + 1, Y + 1) {
    flag_val = 1;

    REP(i, N) {
      if (x[i] >= Z) {
        flag_val = 0;
        break;
      }
    }

    REP(i, M) {
      if (y[i] < Z) {
        flag_val = 0;
        break;
      }
    }

    if (flag_val) {
      flag_peace = 1;
      break;
    }
  }

  if (flag_peace) {
    printf("No War\n");

  } else {
    printf("War\n");
  }
}