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(void){
    
    while(1) {
        int n;
        cin >> n;
        if (n==0) break;
        int stone[21][21];
        for(int y=0; y<21; y++){
            for(int x=0; x<21; x++){
                stone[y][x] = 0;
            }
        }
        for(int i=0; i<n; i++){
            int x, y;
            cin >> x >> y;
            stone[y][x] = 1;
        }
        int m;
        int x=10, y=10;
        cin >> m;
        for(int i=0; i<m; i++){
            char d;
            int l;
            cin >> d;
            cin >> l;
            for(int j=0; j<l; j++) {
                if(d=='N'){
                    y++;
                }
                if(d=='E'){
                    x++;
                }
                if(d=='S'){
                    y--;
                }
                if(d=='W'){
                    x--;
                }
                if(stone[y][x] == 1) {
                    stone[y][x] = 0;
                    n--;
                }
           }
        }
        printf("%s\n", (n==0 ? "YES" : "NO"));
    }
    
}

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;
    erep(i, 0, MAX_X) erep(j, 0, MAX_Y) 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>
using namespace std;
#define FOR(i,a) for(int i=0;i<a;i++)
int a[21][21];
int main() {
	while(1){
		int n;
		cin>>n;
		if(n==0){break;}
		FOR(i,21){FOR(j,21){a[i][j]=0;}}
		FOR(i,n){int d,f;cin>>d>>f;a[d][f]++;}
		int m;
		cin>>m;
		int x=10;int y=10;
		a[10][10]=0;
		FOR(i,m){
			char p;int move;
			cin>>p>>move;
			int h;
			int dx[4]={1,0,-1,0};
			int dy[4]={0,1,0,-1};
			if(p=='N'){h=0;}
			else if(p=='E'){h=1;}
			else if(p=='S'){h=2;}
			else if(p=='W'){h=3;}
			FOR(j,move){
				x+=dx[h];y+=dy[h];
				a[x][y]=0;
			}
		}
		int ans=0;
		FOR(i,21){FOR(j,21){if(a[i][j]!=0){ans++;}}}
		if(ans==0){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int n,x,y,m,l,z,s;
char d;
int main(){
	while(cin>>n){
		if(n==0) break;
		int a[n];
		for(int i=0;i<n;i++){
			cin>>x>>y;
			a[i]=30*x+y+1;
		}
		cin>>m;
		z=311;
		for(int i=0;i<m;i++){
			cin>>d>>l;
			if(d=='N'){
				for(int j=0;j<l;j++){
					z++;
					for(int k=0;k<n;k++){
						if(a[k]==z) a[k]=0;
					}
				}
			}
			else if(d=='S'){
				for(int j=0;j<l;j++){
					z--;
					for(int k=0;k<n;k++){
						if(a[k]==z) a[k]=0;
					}
				}
			}
			else if(d=='E'){
				for(int j=0;j<l;j++){
					z=z+30;
					for(int k=0;k<n;k++){
						if(a[k]==z) a[k]=0;
					}
				}
			}
			else if(d=='W'){
				for(int j=0;j<l;j++){
					z=z-30;
					for(int k=0;k<n;k++){
						if(a[k]==z) a[k]=0;
					}
				}
			}
		}
		s=0;
		for(int i=0;i<n;i++){
			s=s+a[i];
		}
		if(s==0){
			cout<<"Yes"<<endl;
		} else{
			cout<<"No"<<endl;
		}
	}
    return 0;
}

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

int main(void){
	while(true){
		int n, m, count = 0, x = 10 ,y = 10, a, b;
		cin >> n;
		if(n == 0)return 0;
		int z[21][21] = {};
		for(int i = 0; i < n; i++){
			cin >> a >> b;
			z[a][b] = 1;
		}
		count = n;
		cin >> m;
		char temp;
		int temp2;
		for(int i = 0; i < m; i++){
			cin >> temp;
			cin >> temp2;
			for(int j = 0;j < temp2; j++){
				if(temp == 'N') y++;
				if(temp == 'W') y--;
				if(temp == 'S') x--;
				if(temp == 'E') x++;
				if(z[x][y] == 1) {count--; z[x][y] = 0; }
			}
		}
		if(count == 0){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}

	return 0;
}

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

int t[21][21];
int n, m, x, y, l, sum, nx, ny;
char d;

void pick(int x, int y) {
  if(t[21 - y][x] == 1) sum++;
  t[21 - y][x] = 0;
}

void move() {
  if(d == 'W') {
    for(int i = 1; i <= l; ++i) {
      nx = nx - 1;
      pick(nx, ny);
    }
  }
  else if(d == 'E') {
    for(int i = 1; i <= l; ++i) {
      nx = nx + 1;
      pick(nx, ny);
    }
  }
  else if(d == 'N') {
    for(int i = 1; i <= l; ++i) {
      ny = ny + 1;
      pick(nx, ny);
    }
  }
  else {
    for(int i = 1; i <= l; ++i) {
      ny = ny - 1;
      pick(nx, ny);
    }
  }
}

int main() {
  while(cin >> n && n) {
    nx = 10; ny = 10;
    sum = 0;

    for(int i = 0; i < n; ++i) {
      cin >> x >> y;
      t[21 - y][x] = 1;
    }
    cin >> m;
    for(int i = 0; i < m; ++i) {
      cin >> d >> l;
      move();
    }
    cout << ((sum == n) ? "Yes" : "No") << endl;
  }
  return 0;
}