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>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int n;
  while(cin >> n,n){
    int x,y;
    int t[21][21]={};
    rep(i,n){
      cin >> x >> y;
      t[x][y]=1;
    }
    int m,g;
    x=10; y=10;
    cin >> m;
    char d;
    rep(i,m){
      cin >> d >> g;
      rep(j,g){
        if(d=='N') y++;
        if(d=='E') x++;
        if(d=='S') y--;
        if(d=='W') x--;
        if(t[x][y]==1) t[x][y]=0;
      }
    }
    bool flag = true;
    rep(i,21) rep(j,21) if(t[i][j]==1) flag = false;
    if(flag==true) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>

int main()
{
	int numGems = 0;;

	std::cin >> numGems;
	const int gridSize = 21;
	std::vector<bool> gems(gridSize * gridSize, false);
	gems.resize(gridSize * gridSize);
	int gemPointX = 0;
	int gemPointY = 0;
	if (numGems == 0)
	{
		std::cerr << "NO" << std::endl;
		return 0;
	}

	for (int i = 0; i < numGems; i++)
	{
		std::cin >> gemPointX;
		std::cin >> gemPointY;

		gems[gemPointY * gridSize + gemPointX] = true;
	}

int numOrders = 0;
	std::cin >> numOrders;

	char direction = ' ';
	int distance = 0;
	std::pair<int, int> currentPoint(10, 10);

for (int i = 0; i < numOrders; i++)
	{
		std::cin >> direction;
		std::cin >> distance;

		switch (direction)
		{
		case 'N':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.second += 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'E':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.first += 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'S':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.second -= 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'W':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.first -= 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		default:
			break;
		}
	}

        return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
  int N,M;
  int x,y;
  int i,j;
  int l;
  int check=0;
  char d;
  
  while(1){
    cin >> N;
    if(N==0) break;
    
    int flag[21][21]={};

    for(i=0;i<N;++i){
      cin >> x >> y;

      
      flag[x][y]=1;
    }
    
    check =0;
    
    int rx=10,ry=10;
    
    cin >> M;
    
    for(i=0;i<M;++i){
      
      cin >> d >> l;
      
      for(j=1;j<=l;++j){
	
	if(d=='N'){

	  if(flag[rx][ry+j]==1){
	    check++;
	    flag[rx][ry+j]=0;
	  }

	  ry+=l;
	}else if(d=='E'){

	  if(flag[rx+j][ry]==1){
	    check++;
	    flag[rx+j][ry]=0;
	  }

	  rx+=l;
	}else if(d=='S'){

	  if(flag[rx][ry-j]==1){
	    check++;
	    flag[rx][ry-j]=0;
	  }

	  ry-=l;
	}else{

	  if(flag[rx-j][ry]==1){
	    check++;
	    flag[rx-j][ry]=0;
	  }

	  rx-=l;
	}
      }
    }
 
    
    if(check==N){
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }
  }


  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];
vector<bool> hantei;
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++;
			gems[10][10] = false;
		}
		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++;
					gems[nowy][nowx] = false;
				}
			}
		}
		if(ret == n){
			hantei.push_back(1);
		}else{
			hantei.push_back(0);
		}
		cin >> n;
	}
	REP(i,hantei.size()){
		string dis = hantei[i] ? "YES":"NO";
		cout << dis << endl;
	}
	return 0;
}

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

typedef pair<int, int> P;

int main(){
    while(1){
        int n; cin>>n;
        if(n == 0) return 0;
        map<P, bool> treasure;
        for(int i=0; i<n; i++){
            int x, y; cin>>x>>y;
            treasure[P(x, y)] = true;
        }

        int m; cin>>m;
        int cx = 10, cy = 10;
        for(int i=0; i<m; i++){
            char d; cin>>d;
            int l; cin>>l;
            if(d == 'N'){
                for(int j=0; j<l; j++){
                    cy++;
                    if(treasure[P(cx, cy)]){
                        treasure[P(cx, cy)] = false;
                    }
                }
            }
            else if(d == 'E'){
                for(int j=0; j<l; j++){
                    cx++;
                    if(treasure[P(cx, cy)]){
                        treasure[P(cx, cy)] = false;
                    }
                }
            }
            else if(d == 'S'){
                for(int j=0; j<l; j++){
                    cy--;
                    if(treasure[P(cx, cy)]){
                        treasure[P(cx, cy)] = false;
                    }
                }
            }
            else{
                for(int j=0; j<l; j++){
                    cx--;
                    if(treasure[P(cx, cy)]){
                        treasure[P(cx, cy)] = false;
                    }
                }
            }
        }

        bool valid = true;
        for(auto j : treasure){
            if(j.second) valid = false;
        }

        if(valid){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}