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 <string>
#include <algorithm>
#define MAX 30
using namespace std;
string S;

int main(){
    while (1) {
        int p;
        cin >> p;
        if (p!=0) {
            int stx[MAX],sty[MAX];
            for (int i = 0; i<p; i++){
                cin >> stx[i] >> sty[i];
            }
            int area[MAX][MAX]={};
            int pointx=10,pointy=10;
            int ord_num,ord_dis;
            char ord_dir;
            cin >> ord_num;
            for (int i =0; i<ord_num; i++) {
                cin >> ord_dir >> ord_dis;
                if (ord_dir=='N') {
                    for (int j=0; j<ord_dis; j++) {
                        pointy++;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='E') {
                    for (int j=0; j<ord_dis; j++) {
                        pointx++;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='S') {
                    for (int j=0; j<ord_dis; j++) {
                        pointy--;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='W') {
                    for (int j=0; j<ord_dis; j++) {
                        pointx--;
                        area[pointx][pointy]=1;
                    }
                }
            }
            int flag=0;
            for (int i=0; i<p; i++) {
                if (area[stx[i]][sty[i]]==1) {
                    flag++;
                }
            }
            if (flag==p) {
                cout << "Yes"<<"\n";
            }else{
                cout << "No" << "\n";
                
            }
        }else{
            break;
        }
    }
    
}

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

const int XMAX = 30, YMAX = 30, MMAX = 40;

bool field[XMAX][YMAX];
char dir[MMAX];
int dist[MMAX];
int N, M;

void init() {
  REP(x, XMAX) REP(y,YMAX) { field[x][y] = false; }
}

bool solve() {
  int items = 0;
  int x = 10, y = 10;
  REP(i, M) {
    REP(d, dist[i]) {
      x += (dir[i] == 'E' ? 1 : dir[i] == 'W' ? -1 : 0);
      y += (dir[i] == 'N' ? 1 : dir[i] == 'S' ? -1 : 0);

      if (field[x][y]) {
        field[x][y] = false;
        items++;
      }
    }
  }
  return items == N;
}

int main() {
  while (cin >> N and N) {
    init();
    REP(i, N) {
      int x, y;
      cin >> x >> y;
      field[x][y] = true;
    }

    cin >> M;
    REP(i, M) {
      cin >> dir[i] >> dist[i];
    }

    cout << (solve() ? "Yes" : "No") << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
int main(){
	char h;
	int n,m,c;
	while(cin>>n,n){
		bool jewel[21][21];
		memset(jewel,false,sizeof(jewel));
		int x=10,y=10;
		for(int i=0;i<n;i++){
			int a,b;
			cin>>a>>b;
			jewel[a][b]=true;
		}
		int cnt=0;
		cin>>m;
		for(int j=0;j<m;j++){
			cin>>h>>c;
			if(h=='N'){
				for(int i=0;i<c;i++){
					y++;
					if(jewel[x][y]){
						cnt++;
						jewel[x][y]=false;
					}
				}
			}else if(h=='S'){
				for(int i=0;i<c;i++){
					y--;
					if(jewel[x][y]){
						cnt++;
						jewel[x][y]=false;
					}
				}
			}else if(h=='E'){
				for(int i=0;i<c;i++){
					x++;
					if(jewel[x][y]){
						cnt++;
						jewel[x][y]=false;
					}
				}
			}else{
				for(int i=0;i<c;i++){
					x--;
					if(jewel[x][y]){
						cnt++;
						jewel[x][y]=false;
					}
				}
			}
		}
		if(cnt==n){
			cout<<"Yes"<<endl;
		}else cout<<"No"<<endl;
	}
}

C++: #include <string.h>
#include <iostream>
#include <queue>
#include <complex>
#include <functional>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

typedef complex<double> P;
#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( a.real(), b.real() ) && EQ( a.imag(), b.imag() ) )

#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,n) for(int i=a;i<=n;i++)

//---------------------------------------------------------------------
struct Point {
	int x, y;
};
struct Oridir {
	char o;
	int d;
};
int n, m;
bool check[20];

vector<Point> juel(20);
vector<Oridir> mov(30);

int main() {
	while (cin >> n, n) {
		memset(check, false, sizeof(check));
		rep(i, n) cin >> juel[i].x >> juel[i].y;
		cin >> m;
		rep(i, m) cin >> mov[i].o >> mov[i].d;
		//????????????

		int x = 10, y = 10;
		rep(i, m) {
			while (mov[i].d--) {
				switch (mov[i].o) {
				case 'N': y++; break;
				case 'S': y--; break;
				case 'E': x++; break;
				case 'W': x--; break;
				default: break;
				}
				rep(j, n) {
					if (check[j]) continue;
					if (x == juel[j].x && y == juel[j].y) check[j] = true;
				}
			}
		}

		int suc = true;
		rep(j, n) {
			if (!check[j]) {
				suc = false;
				cout << "NO" << endl;
				break;
			}
		}
		if (suc) cout << "YES" << endl;
	}
	return 0;
}