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(){
    int N, M;
    int field[21][21];
    int i, j;
    int x, y;
    char D;
    int dist;
    int pos[2];
    int xory;
    int porm;
    int n;
    cin >> N;
    while(N){
        pos[0] = 10;
        pos[1] = 10;
        n = 0;
        for(i=0;i<21;i++){
            for(j=0;j<21;j++){
                field[i][j] = 0;
            }
        }
        for(i=0;i<N;i++){
            cin >> x >> y;
            field[x][y] = 1;
        }
        cin >> M;
        for(i=0;i<M;i++){
            cin >> D >> dist;
            if(D=='N'){
                xory = 1;
                porm = 1;
            }else if(D=='S'){
                xory = 1;
                porm = -1;
            }else if(D=='E'){
                xory = 0;
                porm = 1;
            }else if(D=='W'){
                xory = 0;
                porm = -1;
            }
            for(j=0;j<dist;j++){
                pos[xory] += porm;
                if(field[pos[0]][pos[1]]){
                    field[pos[0]][pos[1]] = 0;
                    n++;
                }
            }
        }
        if(n<N){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
        cin >> N;
    }
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n;
    while(scanf("%lld", &n), n) {
        int board[30][30] = {};
        bool visited[30][30] = {};
        visited[9][9] = true;
        int r, c;
        rep(i,0,n) {
            scanf("%lld%lld", &c, &r); r--; c--;
            board[r][c] = 1;
        }

        int m; scanf("%lld", &m);
        string st = "NSEW";
        char d; int t;
        r = 9, c = 9;
        int cnt = 0;
        if(board[9][9] == 1) cnt = 1;
        rep(i,0,m) {
            scanf(" %c %lld", &d, &t);
            // printf("debug: m = %lld, input = (%c, %lld)\n", m, d, t);
            int p = st.find(d);
            rep(j,0,t) {
                r += dx[p], c += dy[p];
                if(visited[r][c]) continue;
                visited[r][c] = true;
                if(board[r][c]) cnt++;
            }
        }
        if(cnt == n) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

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

int main(){
  int stc,cmdc,rx,ry,tx,ty;
  char tc;
  int stloc[21][21];
  int gstc;

  while (1){
    cin >> stc;
    if (stc==0) break;
    
    for (int i=0;i<21;i++)
      for (int j=0;j<21;j++)
      stloc[i][j]=0;
    rx=ry=10;
    gstc=0;    

    for (int i=0;i<stc;i++){
      cin >> tx >> ty;
      stloc[tx][ty]=1;
    }
    
    cin >> cmdc;
    
    for (int i=0;i<cmdc;i++){
      cin >> tc >> tx;
      if (tc == 'E'){
	for (int j=rx+1;j<=rx+tx;j++){
	  gstc += stloc[j][ry];
	  stloc[j][ry]=0;
	}
	rx+=tx;
      }else if (tc == 'N'){
	for (int j=ry+1;j<=ry+tx;j++){
	  gstc += stloc[rx][j];
	  stloc[rx][j]=0;
	}
	ry+=tx;
      }else if (tc == 'W'){
	for (int j=rx-1;j>=rx-tx;j--){
	  gstc += stloc[j][ry];
	  stloc[j][ry]=0;
	}
	rx-=tx;
      }else if (tc == 'S'){
	for (int j=ry-1;j>=ry-tx;j--){
	  gstc += stloc[rx][j];
	  stloc[rx][j]=0;
	}
	ry-=tx;
      }
    }
   
    if (gstc == stc) cout << "Yes" <<endl;
    else cout << "No" << endl;

  }
  return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <map>

using namespace std;
typedef long long LL;
#define REP(i,N) for(int i = 0; i < (int)N; i++)
int dy[4] = {1,0,-1,0};
int dx[4] = {0,1,0,-1};
bool gems[25][25];
int meirei[30];
int main(){
	int n;
	cin >> n;
	while(n!=0){
		REP(i,25)memset(gems[i],0,sizeof(gems[i]));
		REP(i,n){
			int x,y;
			cin >> x >> y;
			gems[y][x] = true;
		}
		int ret=0;
		int m;
		cin >> m;
		int nowx,nowy;
		nowx = nowy = 10;
		if(gems[10][10])ret++;
		REP(i,m){
			char c;
			int nor;
			cin >> c >> nor;
			int dir;
			switch(c){
				case 'N':
					dir = 0;
					break;
				case 'E':
					dir = 1;
					break;
				case 'S':
					dir = 2;
					break;
				case 'W':
					dir = 3;
					break;
			}

			REP(j,nor){
				nowx += dx[dir];
				nowy += dy[dir];
				if(gems[nowy][nowx])ret++;
			}
		}
		if(ret == n){
				cout << "YES" << endl;
		}else{
			 cout << "NO"  << endl;
		}
		cin >> n;
	}
	return 0;
}