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 <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
 
using namespace std;

int main()
{
    int N;
    while(1){
        cin >> N;
        if(N == 0) break;
        int gemmap[21][21] = {0};
        int gem_x, gem_y;
        for(int i = 0; i < N; i++){
            cin >> gem_x >> gem_y;
            gemmap[gem_x][gem_y] = 1;
        }
        int M;
        cin >> M;
        char direction;
        int howfar;
        int now_x = 10, now_y = 10;
        int get_gem = 0;
        for(int i = 0; i < M; i++){
            cin >> direction >> howfar;
            if(direction == 'N'){
                for(int j = 1; j <= howfar; j++){
                    now_y++;
                    if(gemmap[now_x][now_y] == 1){
                        get_gem++;
                        gemmap[now_x][now_y] = 0;
                    }
                }
            }else if(direction == 'E'){
                for(int j = 1; j <= howfar; j++){
                    now_x++;
                    if(gemmap[now_x][now_y] == 1){
                        get_gem++;
                        gemmap[now_x][now_y] = 0;
                    }
                }
            }else if(direction == 'S'){
                for(int j = 1; j <= howfar; j++){
                    now_y--;
                    if(gemmap[now_x][now_y] == 1){
                        get_gem++;
                        gemmap[now_x][now_y] = 0;
                    }
                }
            }else if(direction == 'W'){
                for(int j = 1; j <= howfar; j++){
                    now_x--;
                    if(gemmap[now_x][now_y] == 1){
                        get_gem++;
                        gemmap[now_x][now_y] = 0;
                    }
                }
            }
        }
        if(get_gem == N) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
   return 0;
}

C++: #include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
using namespace std;

int main(void) {
	vector<string> r;
	while (true)
	{
		int gem=0,gemgot=0;
		int map[21][21]={{0}};
		cin >> gem;
		if (gem==0){break;}
		for(int i=0;i<gem;i++)
		{
			int x=0,y=0;
			scanf("%d %d",&x,&y);
			map[x][y] = 1;
		}
		int rx=10,ry=10;
		int n;
		cin >> n;
		for(int i=0;i<n;i++)
		{
			int d=0;
			int dx=0,dy=0;
			char dest[1];
			scanf("%s %d",dest,&d);
			if (*dest == 'N'){
				dy = 1;
			} else if (*dest == 'S'){
				dy = -1;
			} else if (*dest == 'W'){
				dx = -1;
			} else if (*dest == 'E'){
				dx = 1;
			}
			for (int j=0;j<d;j++)
			{
				rx += dx;
				ry += dy;
				if (map[rx][ry] == 1)
				{
					map[rx][ry] = 0;
					gemgot++;
				}
			}
		}
		if (gem == gemgot){
			r.push_back("YES");
		} else {
			r.push_back("NO");
		}
	}
	for(int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#define _USE_MATH_DEFINES
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, PP> PPP;
typedef pair<string, int > Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;

bool jewel[21][21];
bool can[21][21];
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int main(){
	int n, m;
	while(cin >> n&& n){
		memset(jewel, false, sizeof(jewel));
		memset(can, false, sizeof(can));
		for(int i = 0; i < n; i++){
			int x, y;
			cin >> x >> y;
			jewel[x][y] = true;
		}
		cin >> m;
		int c = 0;
		int x = 10;
		int y = 10;
		can[x][y] = true;
		for(int i = 0; i < m; i++){
			int d;
			int dire;
			char to;
			cin >> to >> d;
			if(to == 'N'){
				dire = 0;
			}else if(to == 'E'){
				dire = 1;
			}else if(to == 'S'){
				dire = 2;
			}else {
				dire = 3;
			}
			for(int j = 0; j < d; j++){
				x += dx[dire];
				y += dy[dire];
				can[x][y] = true;
			}
		}
		
		for(int i = 0; i <= 20; i++){
			for(int j = 0; j <= 20; j++) if(can[i][j] && jewel[i][j]) c++;
		}
		if(c == n) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#define rep(i,a,b) for(int i=(a);i<b;i++)
#define INF 1000000000
using namespace std;
bool debug=false;

int main(){
  int n,m;
  while(1){
    cin>>n;
    if(n==0)break;

    pair<int,int>p[22];
    for(int i=0;i<n;i++)cin>>p[i].first>>p[i].second;

    cin>>m;
    int x=10,y=10;
    int cnt=0;
    for(int i=0;i<m;i++){
      char a;int b;
      cin>>a>>b;
      
      if(a=='N'){

	for(int j=0;j<n;j++){
	  if(x==p[j].first&&y<=p[j].second&&p[j].second<=y+b){
	    cnt++;
	    p[j].first=INF;p[j].second=INF;
	  }
	}
	y+=b;
	
      }else if(a=='S'){

	for(int j=0;j<n;j++){
	  if(x==p[j].first&&y-b<=p[j].second&&p[j].second<=y){
	    cnt++;
	    p[j].first=INF;p[j].second=INF;
	  }
	  
	}

	y-=b;
	
      }else if(a=='W'){

	for(int j=0;j<n;j++){
	  if(y==p[j].second&&x-b<=p[j].first&&p[j].first<=x){
	    cnt++;
	    p[j].first=INF;p[j].second=INF;
	  }
	  
	}
	x-=b;
	
      }else if(a=='E'){

	for(int j=0;j<n;j++){
	  if(y==p[j].second&&x<=p[j].first&&p[j].first<=x+b){
	    cnt++;
	    p[j].first=INF;p[j].second=INF;
	  }
      
	}
	x+=b;
	
      }
      if(debug)cout<<"("<<x<<","<<y<<")"<<endl;
    }
    if(cnt==n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}