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>
using namespace std;

int main(){
  while(1){
 int N,M;
int x[21]={},y[21]={};

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

    cin>>M;

    char d;
    int j;
    int x2=10,y2=10;
    int f=0;

    for(int i=0;i<M;i++){
      cin>>d>>j;
      for(int s=0;s<j;s++){
	if(d=='N') y2+=1;
	else if(d=='E') x2+=1; 
	else if(d=='S') y2-=1;
	  else x2-=1;
	if(x[x2]==1 && y[y2]==1){
	  f++;
	  x[x2]=0;
	  y[y2]=0;
      }
    }
    }

    if(f==N) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <map>
#include <cstring>
using namespace std;

int gem[21][21];
map<char,int> dx = {{'N', 0}, {'E', 1}, {'W', -1}, {'S', 0}};
map<char,int> dy = {{'N', 1}, {'E', 0}, {'W', 0}, {'S', -1}};

int main() {
    int N, M, x, y, l;
    char d;
    while (cin >> N, N) {
        memset(gem, 0, sizeof gem);
        for (int i=0; i<N; ++i) {
            cin >> x >> y;
            gem[y][x] = 1;
        }
        cin >> M;
        int nx = 10, ny = 10;
        int cnt = 0;
        for (int i=0; i<M; ++i) {
            cin >> d >> l;
            for (int j=0; j<l; ++j) {
                nx += dx[d];
                ny += dy[d];
                cnt += gem[ny][nx];
                gem[ny][nx] = 0;
            }
        }
        cout << (cnt == N ? "Yes" : "No") << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>

using namespace std;

int main(void) {

	int map[20][20] = { 0 };
	int rx = 10,ry = 10;
	int n, m, a, b;
	char dir;
	int cnt = 0;

	while (cin >> n,n) {

		for (int i = 0; i < n; i++) {
			scanf("%d %d", &a, &b);
			map[a][b] = 1;
		}

		scanf("%d" ,&m);
		for (int i = 0; i < m; i++) {
			scanf("%c %d", dir, a);

			switch (dir) {
			case 'N':
				for (int j = 1; j <= a; j++) {
					if (map[rx][ry + j] == 1)
						cnt++;
				}
				ry += a;
				break;

			case 'E':
				for (int j = 1; j <= a; j++) {
					if (map[rx + j][ry] == 1)
						cnt++;
				}
				rx += a;
				break;

			case 'S':
				for (int j = 1; j <= a; j++) {
					if (map[rx][ry - j] == 1)
						cnt++;
				}
				ry -= a;
				break;

			case 'W':
				for (int j = 1; j <= a; j++) {
					if (map[rx - j][ry] == 1)
						cnt++;
				}
				rx -= a;
				break;
			}

		}
		if (cnt == n)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
		
		cnt = 0, rx = ry = 10;
		for (int i = 0; i < 20; i++)
			map[i][i] = 0;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;

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

		int M;
		cin >> M;
		int X=10, Y=10;
		for(int i=0; i<M; i++) {
			char d;
			int l;
			cin >> d >> l;
			for(int j=0; j<l; j++) {
				if(d=='N')
					Y++;
				else if(d=='E')
					X++;
				else if(d=='S')
					Y--;
				else if(d=='W')
					X--;
				N -= map[X][Y];
				map[X][Y] = 0;
			}
		}
		if(N) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  while(1){
    int n,m,a,b,d=10,e=10,f=0,map[21][21]={};
    char c;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>a>>b;
      map[a][b]++;
    }
    cin>>m;
    for(int i=0;i<m;i++){
      cin>>c>>a;
      if(c=='N'){
	for(int j=0;j<a;j++){
	  e++;
	  if(map[d][e]==1){
	    f++;
	    map[d][e]=0;
	  }
	}
      }
      if(c=='S'){
	for(int j=0;j<a;j++){
	  e--;
	  if(map[d][e]==1){
	    f++;
	    map[d][e]=0;
	  }
	}
      }
      if(c=='E'){
	for(int j=0;j<a;j++){
	  d++;
	  if(map[d][e]==1){
	    f++;
	    map[d][e]=0;
	  }
	}
      }
      if(c=='W'){
	for(int j=0;j<a;j++){
	  d--;
	  if(map[d][e]==1){
	    f++;
	    map[d][e]=0;
	  }
	}
      }
    }
    if(f==n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

int N,M,nx,ny;
int field[31][31];

int func(char cmd, int move){
  int ret = 0;

  if(cmd == 'N'){
    while(move--){
      ny++;
      if(field[ny][nx] == 1){ ret++; field[ny][nx] = 0; }
    }
  }
  if(cmd == 'E'){
    while(move--){
      nx++;
      if(field[ny][nx] == 1){ ret++; field[ny][nx] = 0; }
    }
  }
  if(cmd == 'W'){
    while(move--){
      nx--;
      if(field[ny][nx] == 1){ ret++; field[ny][nx] = 0; }
    }
  }
  if(cmd == 'S'){
    while(move--){
      ny--;
      if(field[ny][nx] == 1){ ret++; field[ny][nx] = 0; }
    }
  }

  return ret;
}

int main(){
  int i,j;

  while(1){
    rep(i,31) rep(j,31) field[i][j] = 0;

    cin >> N; if(N == 0) break;
    rep(i,N){
      int x,y;
      cin >> x >> y;
      field[y][x] = 1;
    }

    char cmd;
    int move, get = 0;
    cin >> M;
    nx = 10; ny = 10;
    while(M--){
      cin >> cmd >> move;
      get += func(cmd,move);
    }

    cout << ((N == get) ? "YES" : "NO") << endl;
  }

  return 0;
}