alexjercan/bugnet huggingface dataset:
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int coord[21][21];
int loc_i = 10, loc_j = 10;

void func_Juge(char c, int l) {
  if (c == 'N') {
    for (int i = 0; i < l; i++) {
      loc_i++;
      if (coord[loc_i][loc_j] == 1)
        coord[loc_i][loc_j] = 0;
    }
  } else if (c == 'S') {
    for (int i = 0; i < l; i++) {
      loc_i--;
      if (coord[loc_i][loc_j] == 1)
        coord[loc_i][loc_j] = 0;
    }
  } else if (c == 'E') {
    for (int i = 0; i < l; i++) {
      loc_j++;
      if (coord[loc_i][loc_j] == 1)
        coord[loc_i][loc_j] = 0;
    }
  } else if (c == 'W') {
    for (int i = 0; i < l; i++) {
      loc_j--;
      if (coord[loc_i][loc_j] == 1)
        coord[loc_i][loc_j] = 0;
    }
  }
}

int main() {
  int N, M;

  while (1) {
    cin >> N;
    loc_i = 10;
    loc_j = 10;
    if (N == 0)
      break;

    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        coord[i][j] = 0;
      }
    }

    for (int i = 0; i < N; i++) {
      int x, y;
      cin >> x >> y;
      coord[y][x] = 1;
    }

    cin >> M;
    for (int i = 0; i < M; i++) {
      char c;
      int l;
      cin >> c >> l;
      func_Juge(c, l);
    }

    int flag = 1;
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        if (coord[i][j] != 0) {
          flag = 0;
          break;
        }
      }
    }

    if (flag == 0)
      cout << "No" << endl;
    else if (flag == 1)
      cout << "Yes" << endl;
  }

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int coord[21][21];
int loc_i = 10, loc_j = 10;

void func_Juge(char c, int l) {
  if (c == 'N') {
    for (int i = 0; i < l; i++) {
      loc_i++;
      if (coord[loc_i][loc_j] == 1)
        coord[loc_i][loc_j] = 0;
    }
  } else if (c == 'S') {
    for (int i = 0; i < l; i++) {
      loc_i--;
      if (coord[loc_i][loc_j] == 1)
        coord[loc_i][loc_j] = 0;
    }
  } else if (c == 'E') {
    for (int i = 0; i < l; i++) {
      loc_j++;
      if (coord[loc_i][loc_j] == 1)
        coord[loc_i][loc_j] = 0;
    }
  } else if (c == 'W') {
    for (int i = 1; i < l; i++) {
      loc_j--;
      if (coord[loc_i][loc_j] == 1)
        coord[loc_i][loc_j] = 0;
    }
  }
}

int main() {
  int N, M;

  while (1) {
    cin >> N;
    if (N == 0)
      break;

    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        coord[i][j] = 0;
      }
    }

    for (int i = 0; i < N; i++) {
      int x, y;
      cin >> x >> y;
      coord[y][x] = 1;
    }

    cin >> M;
    for (int i = 0; i < M; i++) {
      char c;
      int l;
      cin >> c >> l;
      func_Juge(c, l);
    }

    int flag = 1;
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        if (coord[i][j] != 0) {
          flag = 0;
          break;
        }
      }
    }

    if (flag == 0)
      cout << "No" << endl;
    else if (flag == 1)
      cout << "Yes" << endl;
  }

  return 0;
}
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    if (n == 0)
      break;
    int m, count = n, p[21][21];
    for (int i = 0; i < 21; ++i)
      for (int j = 0; j < 21; ++j)
        p[i][j] = 0;
    for (int i = 0, x, y; i < n; ++i) {
      cin >> x >> y;
      p[x][y] = 1;
    }
    cin >> m;
    for (int i = 0, d, cx = 10, cy = 10; i < m; ++i) {
      string s;
      cin >> s;
      cin >> d;
      if (s == "N") {
        for (int j = 0; j < d; ++j) {
          ++cy;
          if (p[cx][cy] == 1) {
            count--;
            p[cx][cy] = 0;
          }
        }
      } else if (s == "E") {
        for (int j = 0; j < d; ++j) {
          ++cx;
          if (p[cx][cy] == 1) {
            count--;
            p[cx][cy] = 0;
          }
        }
      } else if (s == "S") {
        for (int j = 0; j < d; ++j) {
          --cy;
          if (p[cx][cy] == 1) {
            count--;
            p[cx][cy] = 0;
          }
        }
      } else if (s == "W") {
        for (int j = 0; j < d; ++j) {
          --cx;
          if (p[cx][cy] == 1) {
            count--;
            p[cx][cy] = 0;
          }
        }
      }
    }
    if (count == 0)
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    if (n == 0)
      break;
    int m, count = n, p[20][20];
    for (int i = 0; i < 20; ++i)
      for (int j = 0; j < 20; ++j)
        p[i][j] = 0;
    for (int i = 0, x, y; i < n; ++i) {
      cin >> x >> y;
      p[x][y] = 1;
    }
    cin >> m;
    for (int i = 0, d, cx = 10, cy = 10; i < m; ++i) {
      string s;
      cin >> s;
      cin >> d;
      if (s == "N") {
        for (int j = 0; j < d; ++j) {
          ++cy;
          if (p[cx][cy] == 1) {
            count--;
            p[cx][cy] = 0;
          }
        }
      } else if (s == "E") {
        for (int j = 0; j < d; ++j) {
          ++cx;
          if (p[cx][cy] == 1) {
            count--;
            p[cx][cy] = 0;
          }
        }
      } else if (s == "S") {
        for (int j = 0; j < d; ++j) {
          --cy;
          if (p[cx][cy] == 1) {
            count--;
            p[cx][cy] = 0;
          }
        }
      } else if (s == "W") {
        for (int j = 0; j < d; ++j) {
          --cx;
          if (p[cx][cy] == 1) {
            count--;
            p[cx][cy] = 0;
          }
        }
      }
    }
    if (count == 0)
      cout << "Yes\\n";
    else
      cout << "No\\n";
  }
  return 0;
}
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int N;
  while (cin >> N, N) {
    int m[21][21] = {0};
    for (int i = 0; i < N; ++i) {
      int x, y;
      cin >> x >> y;
      ++m[x][y];
    }
    int px = 10, py = 10;
    int M;
    cin >> M;
    int ans = m[px][py];
    for (int i = 0; i < M; ++i) {
      char d;
      int l;
      cin >> d >> l;
      int dx = d == 'E' ? 1 : d == 'W' ? -1 : 0;
      int dy = d == 'N' ? 1 : d == 'S' ? -1 : 0;
      for (int j = 0; j < l; ++j) {
        px += dx, py += dy;
        ans += m[px][py];
        m[px][py] = 0;
      }
    }
    if (ans == N)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

Error: -6
*** stack smashing detected ***: terminated


Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, tmpx, tmpy, mpx, mpy;
  bool jp[21][21], expp[21][21];
  int m, l;
  char d;
  int sum;
  while (cin >> n, n) {
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        jp[i][j] = false;
        expp[i][j] = false;
      }
    }
    mpx = 10;
    mpy = 10;
    jp[mpx][mpx] = true;
    for (int i = 0; i < n; i++) {
      cin >> tmpx >> tmpy;
      jp[tmpx][tmpy] = true;
    }
    cin >> m;
    for (int i = 0; i < m; i++) {
      cin >> d >> l;
      if (d == 'N') {
        for (int j = 0; j < l; j++) {
          expp[mpx][++mpy] = true;
        }
      } else if (d == 'E') {
        for (int j = 0; j < l; j++) {
          expp[++mpx][mpy] = true;
        }
      } else if (d == 'S') {
        for (int j = 0; j < l; j++) {
          expp[mpx][--mpy] = true;
        }
      } else if (d == 'W') {
        for (int j = 0; j < l; j++) {
          expp[++mpx][mpy] = true;
        }
      }
    }
    sum = 0;
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        if (jp[i][j] && expp[i][j])
          sum++;
      }
    }
    if (sum == n)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  while (cin >> n, n) {
    vector<vector<int>> g(21, vector<int>(21));
    for (int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      g[x][y] += 1;
    }

    int r;
    cin >> r;
    int x = 10;
    int y = 10;
    int sum = 0;
    while (r--) {
      char d;
      int c;
      cin >> d >> c;
      int dx = 0;
      int dy = 0;

      if (d == 'N')
        dy++;
      if (d == 'S')
        dy--;
      if (d == 'E')
        dx++;
      if (d == 'W')
        dx--;

      for (int i = 0; i < c; i++) {
        x += dx;
        y += dy;

        if (g[x][y] > 0) {
          sum += g[x][y];
          g[x][y] = 0;
        }
      }
    }

    if (n == sum)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  while (cin >> n, n) {
    vector<vector<int>> g(20, vector<int>(20));
    for (int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      g[x][y] += 1;
    }

    int r;
    cin >> r;
    int x = 10;
    int y = 10;
    int sum = 0;
    while (r--) {
      char d;
      int c;
      cin >> d >> c;
      int dx = 0;
      int dy = 0;

      if (d == 'N')
        dy++;
      if (d == 'S')
        dy--;
      if (d == 'E')
        dx++;
      if (d == 'W')
        dx--;

      for (int i = 0; i < c; i++) {
        x += dx;
        y += dy;

        if (g[x][y] > 0) {
          sum += g[x][y];
          g[x][y] = 0;
        }
      }
    }

    if (n == sum)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }

  return 0;
}
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

string solve(int n) {
  // string ans;
  vector<vector<int>> treasurePosition(n, vector<int>(2));
  int move;

  for (int i = 0; i < n; i++) {
    cin >> treasurePosition[i][0] >> treasurePosition[i][1];
  }
  cin >> move;
  int cast[move];
  vector<string> movedirection(move);
  for (int i = 0; i < move; i++) {
    cin >> movedirection[i];
    cin >> cast[i];
    // cout << cast[i] << " " << endl;
  }
  int xPosition = 10;
  int yPosition = 10;
  int count = 0;
  for (int i = 0; i < move; i++) {
    for (int k = 0; k < cast[i]; k++) {
      // int cast = (int)movedirection[i][1];
      if (movedirection[i][0] == 'N') {
        yPosition++;
      } else if (movedirection[i][0] == 'E') {
        xPosition++;
      } else if (movedirection[i][0] == 'S') {
        yPosition--;
      } else if (movedirection[i][0] == 'W') {
        xPosition--;
      }
      for (int j = 0; j < n; j++) {
        if (xPosition == treasurePosition[j][0] &&
            yPosition == treasurePosition[j][1]) {
          count++;
          treasurePosition[j][0] = -1;
          treasurePosition[j][1] = -1;
        }
        // cout << xPosition << " " << yPosition << endl;
      }
    }
  }
  if (count == n)
    return "Yes";
  else
    return "No";
}

int main(int argc, char const *argv[]) {
  int n;
  vector<string> ans;
  while (1) {
    cin >> n;
    if (n == 0) {
      break;
    }
    ans.push_back(solve(n));
  }
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
  return 0;
}


Error: -11

Fixed submission:

#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

string solve(int n) {
  string ans;
  int treasurePosition[n][2];
  int move;
  char movedirection[move];
  int cast[move];

  for (int i = 0; i < n; i++) {
    cin >> treasurePosition[i][0] >> treasurePosition[i][1];
  }
  cin >> move;
  for (int i = 0; i < move; i++) {
    cin >> movedirection[i] >> cast[i];
  }
  int xPosition = 10;
  int yPosition = 10;
  int count = 0;
  for (int i = 0; i < n; i++) {
    // int cast = (int)movedirection[i][1];
    for (int j = 0; j < cast[i]; j++) {
      if (movedirection[i] == 'N') {
        yPosition++;
      } else if (movedirection[i] == 'E') {
        xPosition++;
      } else if (movedirection[i] == 'S') {
        xPosition--;
      } else if (movedirection[i] == 'W') {
        yPosition--;
      }
      for (int k = 0; k < n; k++) {
        if (yPosition == treasurePosition[j][0] &&
            xPosition == treasurePosition[j][1])
          count++;
      }
    }
  }
  if (count == n)
    return "Yes";
  else
    return "No";
}

int main(int argc, char const *argv[]) {
  int n;
  vector<string> ans;
  while (1) {
    cin >> n;
    if (n == 0) {
      break;
    }
    ans.push_back(solve(n));
  }
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int N, M;
  int x, y;
  int i, j;
  int l;
  int check = 0;
  char d;

  while (1) {
    cin >> N;
    if (N == 0)
      break;

    int flag[21][21] = {};

    for (i = 0; i < N; ++i) {
      cin >> x >> y;

      flag[x][y] = 1;
    }

    check = 0;

    int rx = 10, ry = 10;

    cin >> M;

    for (i = 0; i < M; ++i) {

      cin >> d >> l;

      for (j = 1; j <= l; ++j) {

        if (d == 'N') {
          ry++;
        } else if (d == 'E') {
          rx++;
        } else if (d == 'S') {
          ry--;
        } else {
          rx--;
        }
        if (flag[rx][ry] == 1) {
          check++;
          flag[rx][ry] = 0;
        }
      }
    }

    if (check == N) {
      cout << "Yes\\n";
    } else {
      cout << "No\\n";
    }
  }

  return 0;
}


Error: WA

Fixed submission:

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int N, M;
  int x, y;
  int i, j;
  int l;
  int check = 0;
  char d;

  while (1) {
    cin >> N;
    if (N == 0)
      break;

    int flag[21][21] = {};

    for (i = 0; i < N; ++i) {
      cin >> x >> y;

      flag[x][y] = 1;
    }

    check = 0;

    int rx = 10, ry = 10;

    cin >> M;

    for (i = 0; i < M; ++i) {

      cin >> d >> l;

      for (j = 1; j <= l; ++j) {

        if (d == 'N') {

          if (flag[rx][ry + j] == 1) {
            check++;
            flag[rx][ry + j] = 0;
          }

          ry += l;
        } else if (d == 'E') {

          if (flag[rx + j][ry] == 1) {
            check++;
            flag[rx + j][ry] = 0;
          }

          rx += l;
        } else if (d == 'S') {

          if (flag[rx][ry - j] == 1) {
            check++;
            flag[rx][ry - j] = 0;
          }

          ry -= l;
        } else {

          if (flag[rx - j][ry] == 1) {
            check++;
            flag[rx - j][ry] = 0;
          }

          rx -= l;
        }
      }
    }

    if (check == N) {
      cout << "Yes\\n";
    } else {
      cout << "No\\n";
    }
  }

  return 0;
}
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000            // 2000000000
#define LLINF 1000000000000000000 // 9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

int main(void) {

  while (1) {
    int n;
    int x, y;
    int count = 0;
    int posx = 10;
    int posy = 10;
    int jwe[21][21] = {};
    int m;
    char d;
    int l;

    cin >> n;
    if (n == 0) {
      break;
    }
    FOR(i, 1, n) {
      cin >> x >> y;
      jwe[x][y]++;
    }
    cin >> m;
    FOR(i, 1, m) {
      cin >> d >> l;
      switch (d) {
      case 'N':
        FOR(t, 1, l) {
          posy++;
          if (jwe[posx][posy] > 0) {
            count++;
            jwe[posx][posy]--;
          }
        }
        break;
      case 'E':
        FOR(t, 1, l) {
          posx++;
          if (jwe[posx][posy] > 0) {
            count++;
            jwe[posx][posy]--;
          }
        }
        break;
      case 'S':
        FOR(t, 1, l) {
          posy--;
          if (jwe[posx][posy] > 0) {
            count++;
            jwe[posx][posy]--;
          }
        }
        break;
      case 'W':
        FOR(t, 1, l) {
          posx--;
          if (jwe[posx][posy] > 0) {
            count++;
            jwe[posx][posy]--;
          }
        }
        break;
      }
    }
    if (n == count) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>

#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000            // 2000000000
#define LLINF 1000000000000000000 // 9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

int main(void) {

  while (1) {
    int n;
    int x, y;
    int count = 0;
    int posx = 10;
    int posy = 10;
    int jwe[21][21] = {};
    int m;
    char d;
    int l;

    cin >> n;
    if (n == 0) {
      break;
    }
    FOR(i, 1, n) {
      cin >> x >> y;
      jwe[x][y]++;
    }
    cin >> m;
    FOR(i, 1, m) {
      cin >> d >> l;
      switch (d) {
      case 'N':
        y++;
        break;
      case 'E':
        x++;
        break;
      case 'S':
        y--;
        break;
      case 'W':
        x--;
        break;
      }
      if (jwe[x][y] > 0) {
        count++;
        jwe[x][y]--;
      }
    }
    if (n == count) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define rep(i, j, k) for (int i = j; i < k; i++)
#define INF 2 * 1e9
#define pb push_back
#define mp make_pair
#define Sort(v) sort(v.begin(), v.end());
#define SSort(v) sort(v.begin(), v.end(), greater<int>);
using namespace std;
int main(void) {
  while (1) {
    int n;
    int rx = 10, ry = 10;
    cin >> n;
    if (n == 0)
      break;
    vector<vector<int>> v(21, vector<int>(21, 0));
    rep(i, 0, n) {
      int x, y;
      cin >> x >> y;
      v[x][y] = 1;
    }

    int m;
    cin >> m;
    rep(i, 0, m) {
      char c;
      int x;
      cin >> c >> x;
      rep(j, 0, x) {
        if (c == 'N')
          ry++;
        else if (c == 'E')
          rx++;
        else if (c == 'S')
          ry--;
        else if (c == 'W')
          rx--;
        v[rx][ry] = 0;
      }
    }

    rep(i, 0, 21) {
      rep(j, 0, 21) {
        if (v[i][j] == 1) {
          cout << "No" << endl;
          goto AWAY;
        }
      }
    }
    cout << "Yes" << endl;

  AWAY:;
  }
}

Error: 0

Fixed submission:

#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define rep(i, j, k) for (int i = j; i < k; i++)
#define INF 2 * 1e9
#define pb push_back
#define mp make_pair
#define Sort(v) sort(v.begin(), v.end());
#define SSort(v) sort(v.begin(), v.end(), greater<int>);
using namespace std;
int main(void) {
  vector<vector<int>> v(20, vector<int>(20, 0));
  while (1) {
    int n;
    int rx = 10, ry = 10;
    cin >> n;
    if (n == 0)
      break;
    rep(i, 0, 20) rep(j, 0, 20) v[i][j] = 0;
    rep(i, 0, n) {
      int x, y;
      cin >> x >> y;
      v[x][y] = 1;
    }

    int m;
    cin >> m;
    rep(i, 0, m) {
      char c;
      int x;
      cin >> c >> x;
      rep(j, 0, x) {
        if (c == 'N')
          ry++;
        else if (c == 'E')
          rx++;
        else if (c == 'S')
          ry--;
        else if (c == 'W')
          rx--;
        v[rx][ry] = 0;
      }
    }

    rep(i, 0, 20) {
      rep(j, 0, 20) {
        if (v[i][j] == 1) {
          cout << "No" << endl;
          goto AWAY;
        }
      }
    }
    cout << "Yes" << endl;

  AWAY:;
  }
}
Problem p01125 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;

int main() {
  int n, m, x, y;
  int jewel_position[21][21];

  while (cin >> n && n) {
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        jewel_position[i][j] = 0;
      }
    }

    for (int i = 0; i < n; i++) {
      cin >> x >> y;
      jewel_position[x][y] = 1;
    }

    cin >> m;
    int x_pos = 10, y_pos = 10;
    for (int i = 0; i < m; i++) {
      string direction;
      int amount;
      cin >> direction;
      cin >> amount;
      if (direction == "N") {
        for (int j = 0; j < amount; j++) {
          y_pos += 1;
          jewel_position[x_pos][y_pos] = 0;
        }
      } else if (direction == "E") {
        for (int j = 0; j < amount; j++) {
          x_pos += 1;
          jewel_position[x_pos][y_pos] = 0;
        }
      } else if (direction == "W") {
        for (int j = 0; j < amount; j++) {
          x_pos -= 1;
          jewel_position[x_pos][y_pos] = 0;
        }
      } else {
        for (int j = 0; j < amount; j++) {
          y_pos -= 1;
          jewel_position[x_pos][y_pos] = 0;
        }
      }
    }

    bool f = true;
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        if (jewel_position[i][j]) {
          f = false;
        }
      }
    }
    if (f) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <string>
using namespace std;

int main() {
  int n, m, x, y;
  int jewel_position[21][21];

  while (cin >> n && n) {
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        jewel_position[i][j] = 0;
      }
    }

    for (int i = 0; i < n; i++) {
      cin >> x >> y;
      jewel_position[x][y] = 1;
    }

    cin >> m;
    int x_pos = 10, y_pos = 10;
    for (int i = 0; i < m; i++) {
      string direction;
      int amount;
      cin >> direction;
      cin >> amount;
      if (direction == "N") {
        for (int j = 0; j < amount; j++) {
          y_pos += 1;
          jewel_position[x_pos][y_pos] = 0;
        }
      } else if (direction == "E") {
        for (int j = 0; j < amount; j++) {
          x_pos += 1;
          jewel_position[x_pos][y_pos] = 0;
        }
      } else if (direction == "W") {
        for (int j = 0; j < amount; j++) {
          y_pos -= 1;
          jewel_position[x_pos][y_pos] = 0;
        }
      } else {
        for (int j = 0; j < amount; j++) {
          x_pos -= 1;
          jewel_position[x_pos][y_pos] = 0;
        }
      }
    }

    bool f = true;
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        if (jewel_position[i][j]) {
          f = false;
        }
      }
    }
    if (f) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}