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 <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;
		//m????§???????????????????
		rep(i, m) {
			//d????§????
			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;
}

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

bool solve(bool** gems, vector<pair<char,int> >* v);

int main(void){
  while(1){
    int N,M;
    cin>>N;
    if(N==0){
      break;
    }
    bool* gems[21];
    for(int i=0;i<=20;i++){
      gems[i]=(bool*)malloc(21*sizeof(bool));
    }
    for(int i=0;i<=20;i++){
      for(int j=0;j<=20;j++){
        gems[i][j]=false;
      }
    }
    for(int i=0;i<N;i++){
      int x,y;
      cin>>x>>y;
      gems[20-y][x]=true;
    }
    cin>>M;
    vector<pair<char,int> > v;
    for(int i=0;i<M;i++){
      char d;
      int l;
      cin>>d>>l;
      pair<char,int> p=make_pair(d,l);
      v.push_back(p);
    }
    if(solve(gems,&v)) {
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
  return 0;
}

bool solve(bool** gems, vector<pair<char,int> >* _v){
  auto v=*_v;
  auto point=make_pair(10,10);
  gems[10][10]=false;
  for(auto iter=v.begin();iter!=v.end();iter++){
    if(iter->first=='S'){
      int X=point.first;
      int y_goal=point.second+iter->second;
      for(int y=min(point.second,y_goal);y<=max(point.second,y_goal);y++){
        gems[y][X]=false;
      }
      gems[y_goal][X]=false;
      point.second=y_goal;
    }
    else if(iter->first=='N'){
      int X=point.first;
      int y_goal=point.second-iter->second;
      for(int y=min(point.second,y_goal);y<=max(point.second,y_goal);y++){
        gems[y][X]=false;
      }
      gems[y_goal][X]=false;
      point.second=y_goal;
    }
    else if(iter->first=='E'){
      int Y=point.second;
      int x_goal=point.first+iter->second;
      for(int x=min(point.first,x_goal);x<=max(point.first,x_goal);x++){
        gems[Y][x]=false;
      }
      gems[Y][x_goal]=false;
      point.first=x_goal;
    }
    else if(iter->first=='W'){
      int Y=point.second;
      int x_goal=point.first-iter->second;
      for(int x=min(point.first,x_goal);x<=max(point.first,x_goal);x++){
        gems[Y][x]=false;
      }
      gems[Y][x_goal]=false;
      point.first=x_goal;
    }
  }
  for(int x=0;x<=20;x++){
    for(int y=0;y<=20;y++){
      if(gems[y][x]){
        return false;
      }
    }
  }
  return true;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstring>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < (int)(n); i++)
using namespace std;

bool d[100][100];
int rx = 10,ry = 10;

int main(){
    int N,M;
    int X,Y,l[100];
    char dir[100];
    while(true) {
        cin >> N;
        if (N == 0) break;
        rx = 10,ry = 10;
        memset(d,false,sizeof(d));
        rep(i,N) cin >> X >> Y, d[20 - Y][X] = true;
        cin >> M;
        rep(i,M) cin >> dir[i] >> l[i];
        rep(i,M){
            switch (dir[i]) {
            case 'N':
                rep(j,l[i]){
                    ry--;
                    d[ry][rx] = false;
                }
                break;
            case 'S':
                rep(j,l[i]){
                    ry++;
                    d[ry][rx] = false;
                }
                break;
            case 'W':
                rep(j,l[i]){
                    rx--;
                    d[ry][rx] = false;
                }
                break;
            case 'E':
                rep(j,l[i]){
                    rx++;
                    d[ry][rx] = false;
                }
                break;
            }
        }

        string ans = "Yes";
        rep(y,21) {
            rep(x,21) {
                // cout << d[y][x] << " ";
                if(d[y][x] == true) ans = "No";
            }
            // cout << endl;
        }
        cout << ans << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;

struct POINT {
	int x;
	int y;
};

int main(void) {
	int N, M;
	while (cin >> N, N) {
		vector< vector<bool> > gem(21, vector<bool> (21, 0) );
		for (int gi = 0; gi < N; gi++) {
			int x, y;
			cin >> x >> y;
			gem[x][y] = true;
		}

		POINT robotp = {10, 10};
		int haveGem = 0;
		cin >> M;
		for (int i = 0; i < M; i++) {
			char dir;
			int dis;
			cin >> dir >> dis;
			while (dis) {
				switch(dir) {
					case 'N':
						robotp.y--;
						break;
					case 'E':
						robotp.x--;
						break;
					case 'S':
						robotp.y++;
						break;
					case 'W':
						robotp.x++;
						break;
				}
				if (gem[robotp.x][robotp.y]) {
					gem[robotp.x][robotp.y] = false;
					haveGem++;
				}
				dis--;
			}
		}

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

	int area[20][20];

	return 0;
}