Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	sc = bufio.NewScanner(os.Stdin)
)

type Point struct {
	X, Y int
}

type Gem struct {
	ID int
	Point
}

type Map struct {
	Current       *Point
	Gems          map[int]*Gem
	CollectedGems map[int]*Gem
}

func (m *Map) Move(dir string, l int) {
	switch {
	case dir == "N" || dir == "S":
		a := 1
		if dir == "S" {
			a = -1
		}
		for i := 0; i < l; i++ {
			m.Current.Y += a
			for _, g := range m.Gems {
				m.TryToTakeGem(g)
			}
		}
	case dir == "E" || dir == "W":
		a := 1
		if dir == "W" {
			a = -1
		}
		for i := 0; i < l; i++ {
			m.Current.X += a
			for _, g := range m.Gems {
				m.TryToTakeGem(g)
			}
		}
	}
}

func (m *Map) HasCompleted() bool {
	return len(m.Gems) == 0
}

func (m *Map) TryToTakeGem(g *Gem) {
	if m.Current.X == g.X && m.Current.Y == g.Y {
		m.CollectedGems[g.ID] = g
		delete(m.Gems, g.ID)
	}
}

func main() {
	for sc.Scan() {
		n, _ := strconv.Atoi(sc.Text())
		if n == 0 {
			break
		}
		m := &Map{
			Current:       &Point{X: 10, Y: 10},
			Gems:          map[int]*Gem{},
			CollectedGems: map[int]*Gem{},
		}
		for i := 0; i < n; i++ {
			sc.Scan()
			chunks := strings.Split(sc.Text(), " ")
			x, _ := strconv.Atoi(chunks[0])
			y, _ := strconv.Atoi(chunks[1])
			m.Gems[i+1] = &Gem{ID: i + 1, Point: Point{X: x, Y: y}}
		}
		sc.Scan()
		opCnt, _ := strconv.Atoi(sc.Text())
		for i := 0; i < opCnt; i++ {
			sc.Scan()
			chunks := strings.Split(sc.Text(), " ")
			dir := chunks[0]
			v, _ := strconv.Atoi(chunks[1])
			m.Move(dir, v)
		}
		msg := "No"
		if m.HasCompleted() {
			msg = "Yes"
		}
		fmt.Println(msg)
	}
}

C++: #include <iostream>
#include  <stdio.h>
#include  <algorithm>
#include  <math.h>
#include  <vector>
#include  <string>
#include  <sstream>
#include  <numeric>
#include  <set>
#include <map>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long

using namespace std;

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

	int dat[20][20] = { 0 };
	int num = 0;
	while (cin >> num && num != 0)
	{
		int ans = 0;
		rep(i, num)
		{
			int tmp = 0, tmp2 = 0;
			cin >> tmp >> tmp2;
			dat[tmp][tmp2] = 1;
			if (tmp == 10 && tmp2 == 10) { ans += 1; }
		}
		int tmp = 0; cin >> tmp;
		string m; int cmd = 0;
		int now_x = 10, now_y = 10;
		rep(i, tmp)
		{
			cin >> m >> cmd;
			rep(i, cmd)
			{
				switch (m[0])
				{
				case 'N': now_y += 1; break;
				case 'E': now_x += 1; break; 
				case 'S': now_y -= 1; break; 
				case 'W': now_x -= 1; break; 
				}
				ans += dat[now_x][now_y];
				//dat[now_x][now_y] = 0;
			}
		}
		if (ans == num) { printf("Yes\n"); }
		else { printf("No\n"); }
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int gem[25][25];
int n, m;

int main() {
    while(1) {
        cin >> n;
        if(n == 0) break;
        memset(gem, 0, sizeof(gem));
        for(int i = 0; i < n; ++i) {
            int x, y; cin >> x >> y;
            gem[y][x] = 1;
        }
        cin >> m;
        int nx = 10, ny = 10;
        int cnt = 0;
        if(gem[ny][nx]) {
            cnt++;
            gem[ny][nx] = 0;
        }
        for(int i = 0; i < m; ++i) {
            char dir;
            int len;
            cin >> dir >> len;
            while(len--) {
                if(dir == 'N') ny++;
                else if(dir == 'E') nx++;
                else if(dir == 'S') ny--;
                else nx--;
                if(gem[ny][nx]) {
                    cnt++;
                    gem[ny][nx] = 0;
                }
            }
        }
        if(cnt == n) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int MAX_N = 30;
const int MAX_X = 30;
const int MAX_Y = 30;
int n, m;
int x[MAX_N], y[MAX_N];
map<char, int> hm;
char c;
int d;
bool flag[MAX_X+1][MAX_Y+1];

int main()
{
  hm['W'] = 0;
  hm['S'] = 1;
  hm['E'] = 2;
  hm['N'] = 3;

  while(cin >> n, n){
    int cnt = 0;
    int hx = 10;
    int hy = 10;
    rep(i, n) rep(j, n) flag[i][j] = false;

    rep(i, n){
      cin >> x[i] >> y[i];
      flag[x[i]][y[i]] = true;
      cnt += 1;
    }

    cin >> m;
    rep(i, m){
      cin >> c >> d;
      rep(j, d){
        hx += dx[hm[c]];
        hy += dy[hm[c]];
        if(flag[hx][hy]){
          cnt -= 1;
          flag[hx][hy] = false;
        }
      }
    }

    puts(cnt == 0 ? "Yes" : "No");
  }

  return 0;
}

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

int main(){
  int n,m;
  int order;
  string str;
  int x,y;
  
  while(1){
    int cnt = 0;
    int a[20+1][20+1]={};
    
    cin >> n;
    if(n == 0) break;

    for(int i=0;i < n;i++){
	cin >> x >> y;
	a[21-y-1][x-1] = 1;
    }
    x=10;
    y=10;
    
    cin >> m;
    for(int i=0;i < m;i++){
      cin >> str >> order;
      
      for(int j=0;j < order;j++){
	if(str == "N"){
	  y++;
	}
	else if(str == "S"){
	  y--;
	}
	else if(str == "E"){
	  x++;
	}
	else if(str == "W"){
	  x--;
	}
	if(a[21-y-1][x-1] == 1){
	  a[21-y-1][x-1] = 0;
	  cnt++;
	}
      }
    }
    if(cnt == n) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <iostream>
using namespace std;
int field[21][21];
int main() {
    int n;
    while (scanf("%d",&n)) {
        if (!n) break;
        for (int i=0; i<n; i++) {
            int x, y; scanf("%d%d",&x,&y);
            field[y][x]=1;
        }
        int m; scanf("%d",&m);
        int rx=10, ry=10;
        field[ry][rx]=0;
        for (int i=0; i<m; i++) {
            char d; cin>>d;
            int dist; scanf("%d",&dist);
            if (d=='N') {
                for (int j=0; j<dist; j++) {
                    field[++ry][rx]=0;
                }
            }
            if (d=='E') {
                for (int j=0; j<dist; j++) {
                    field[ry][++rx]=0;
                }
            }
            if (d=='S') {
                for (int j=0; j<dist; j++) {
                    field[--ry][rx]=0;
                }
            }
            if (d=='W') {
                for (int j=0; j<dist; j++) {
                    field[ry][--rx]=0;
                }
            }
        }
        int flag=0;
        for (int i=0; i<21; i++) {
            for (int j=0; j<21; j++) {
                flag+=field[i][j];
                field[i][j]=0;
            }
        }
        if (flag) puts("NO");
        else puts("YES");
    }
}