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 <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n, m;
    while (cin >> n && n){
        int d[21][21] = {};
        REP(i,n){
            int a,b;
            cin >> a >> b;
            d[a][b] = 1;
        }
        cin >> m;
        int x = 10, y = 10;
        d[x][y] = 0;
        while (m--){
            char c;
            int a;
            cin >> c >> a;
            int dx = 0, dy = 0;
            if (c == 'E') dx = 1;
            if (c == 'W') dx = -1;
            if (c == 'N') dy = 1;
            if (c == 'S') dy = -1;
            while (a--){
                x += dx;
                y += dy;
                d[x][y] = 0;
            }
        }
        int f = 0;
        REP(i,21) REP(j,21) f += d[i][j];
        cout << (f == 0 ? "Yes" : "No") << endl;
    }


    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
void tansaku(int x,int y,int *n,int d[21][21]){
	if(d[y][x]==1){
		*n=*n-1;
		d[y][x]=0;
	}
	
}
int main(){
	
	int n;
	
	while(cin>>n,n!=0){
		int d[21][21]={0};
		int a,b;
		for(int i=0;i<n;i++){
			cin>>a>>b;
			d[b][a]=1;
		}
		int m;
		int x=10,y=10;
		cin>>m;
		int k;
		string s;
		for(int i=0;i<m;i++){
			cin>>s>>k;
			for(int j=0;j<k;j++){
			if(s=="N")
				y++;
			else if(s=="S")
				y--;
			else if(s=="E")
				x++;
			else
				x--;
			tansaku(x,y,&n,d);
	}
		}
		if(n!=0)
			cout<<"No"<<endl;
		else
			cout<<"Yes"<<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 = 20;
int n, m;
int x[MAX_N], y[MAX_N];
map<char, int> hm;
char c;
int d;
bool flag[MAX_N][MAX_N];

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<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int n,m,x,y,l;
	char d;
	int i, j;
	while (cin >> n) {
		if (n == 0)break;
		int a[21][21];
		for (i = 0; i < 21; i++) {
			for (j = 0; j <21; j++) {
				a[i][j] = 0;
			}
		}
		for (i = 0; i < n; i++) {
			cin >> x >> y; a[x][y] = 1;
		}
		cin >> m;
		int nowx = 10; int nowy = 10;
		for (i = 0; i < m; i++) {
			cin >> d >> l;
			if (d == 'S') {
				for (j = 1; j <= l; j++) {
					a[nowx][nowy - j] = 0;
				}
				nowy -= l;
			}
			else if (d == 'N') {
				for (j = 1; j <= l; j++) {
					a[nowx][nowy + j] = 0;
				}
				nowy += l;
			}
			else if (d == 'E') {
				for (j = 1; j <= l; j++) {
					a[nowx+j][nowy] = 0;
				}
				nowx += l;
			}
			else if (d == 'W') {
				for (j = 1; j <= l; j++) {
					a[nowx-j][nowy] = 0;
				}
				nowx -= l;
			}
		}
		bool f = true;
		for (i = 0; i < 21; i++) {
			for (j = 0; j < 21; j++) {
				if (a[i][j] == 1)f = false;
			}
		}
		if (f)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

C++: #include <iostream>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

int main(){
  while(1){
    int N;
    cin >> N;
    if(N==0) break;
    int x,y,map[100][100]={};
    rep(i,N){
      cin >> x >> y;
      map[y][x] = 1;
    }
    int Rx = 10,Ry = 10,tr = 0;
    int M;
    cin >> M;
    rep(i,M){
      string v;
      int d;
      cin >> v >> d;
      if(v == "N"){
	rep(j,d){ 
	  Ry++;
	  if( map[Ry][Rx] == 1){
	    tr += map[Ry][Rx];
	    map[Ry][Rx]--;
	  }
	}
      }
      else if(v == "E"){
	rep(j,d){ 
	  Rx++;
	  if( map[Ry][Rx] == 1){
	    tr += map[Ry][Rx];
	    map[Ry][Rx]--;
	  }
	}
      }
      else if(v == "S"){
	rep(j,d){ 
	  Ry--;
	  if( map[Ry][Rx] == 1){
	    tr += map[Ry][Rx];
	    map[Ry][Rx]--;
	  }

	}
      }
      else if(v == "W"){
	rep(j,d){ 
	  Rx--;
	  if( map[Ry][Rx] == 1){
	    tr += map[Ry][Rx];
	    map[Ry][Rx]--;
	  }

	}
      }
    }
    if(tr == N) cout << "Yes\n";
    else cout << "No\n";
  }
  return 0;
}