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 <stdio.h>
#include <string.h>

char a[20][20];

int main()
{
  int n,x,y,m,s;
  int i;
  char d[3];

  while(1){
    scanf("%d", &n);
    if(n==0)
      break;

    memset(a,0,sizeof(a));

    for(i=0;i<n;i++){
      scanf("%d%d", &x, &y);
      a[x][y]=1;
    }

    scanf("%d", &m);
    x=10,y=10;
    while(m-- > 0){
      scanf("%s%d", d, &s);
      while(s-- > 0){
	if(d[0] == 'E')x++;
	else if(d[0] == 'S')y--;
	else if(d[0] == 'W')x--;
	else if(d[0] == 'N')y++;
	
	if(a[x][y])n--,a[x][y]=0;
      }
    }

    if(n==0)
      printf("Yes\n");
    else printf("No\n");
  }
  return 0;
}

C++: #include <iostream>

int main(void){
  while(true){
    int posx = 10, posy = 10;
    int cnt = 0;
    int numOfJewel, numOfOrder;
    bool isJewel[21][21];

    for(int i=0; i < 21; i++){
      for(int j =0; j < 21; j++){
        isJewel[i][j] = false;
      }
    }

    std::cin >> numOfJewel;
    if(numOfJewel == 0) return 0;
    for(int i=0; i < numOfJewel; i++){
      int x, y;
      std::cin >> x >> y;
      isJewel[y][x] = true;
    }

    std::cin >> numOfOrder;
    for(int i=0; i < numOfOrder; i++){
      char order;
      int dist;
      std::cin >> order >> dist;
      for(int j = 0; j < dist; j++){
        if(order == 'N'){
          posy++;
        }else if(order == 'S'){
          posy--;
        }else if(order == 'E'){
          posx++;
        }else if(order == 'W'){
          posy--;
        }
        if(isJewel[posy][posx] == true){
          cnt++;
          isJewel[posy][posx] = false;
        }
      }
    }
    if(cnt == numOfJewel){
      std::cout << "Yes" << std::endl;
    }else{
      std::cout << "No" << std::endl;
    }
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { 1, -1, 0, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, 0, 1, -1 , 1,  1, -1, -1 };
static const string Move = "EWNS";

int N, now_y, now_x, M, move_many, cnt;
char moves;
vector<PII> gems;

int gcd( int m, int n ) {
	if ( n == 0 ) return m;
	return gcd( n, m % n );
}

int main() {
	while ( ~scanf("%d", &N) && N ) {
		gems.resize( N );
		for ( int i = 0; i < N; i++ ) {
			scanf( "%d %d", &gems[ i ].first, &gems[ i ].second );
		}
		cnt = 0;
		sort( gems.begin(), gems.end() );
		now_y = 10;
		now_x = 10;
		scanf( "%d", &M );
		for ( int i = 0; i < M; i++ ) {
			scanf( "%c %d", &moves, &move_many );
			for ( int j = 0; j < Move.size(); j++ ) {
				if ( Move[ j ] == moves ) {
					for ( int k = 0; k < move_many; k++ ) {
						now_x += dx[ j ];
						now_y += dy[ j ];
						for ( int i = 0; i < gems.size(); i++ ) {
							if ( gems[ i ] == PII( now_x, now_y ) ) {
								gems.erase( gems.begin() + i );
								cnt++;
								break;
							}
						}
					}

				}
			}
		}
		if ( cnt == N ) {
			printf( "Yes\n" );
		}
		else {
			printf( "No\n" );
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){

  int n;

  while (cin >> n,n){
    int x[100];
    int y[100];

    int gem[25][25] = {0};

    REP(i,n){
      cin >> x[i] >> y[i];
      gem[x[i]][y[i]] = 1;
    }
    int m;

    cin >> m;

    char d[100];
    int l[100];

    int nowx=10;
    int nowy=10;

    REP(j,m){
      cin >> d[j] >> l[j];
      if (d[j]=='N'){
	REP(k,l[k]){
	  gem[nowx+k][nowy]=0;
	    }
	nowx +=l[j];
      }else if(d[j]=='S'){
	REP(k,l[k]){
	  gem[nowx-k][nowy]=0;
	    }
	nowx -=l[j];
      }else if(d[j]=='W'){
	REP(k,l[k]){
	  gem[nowx][nowy-k]=0;
	    }
	nowx -=l[j];
      }else if(d[j]=='E'){
	REP(k,l[k]){
	  gem[nowx][nowy+k]=0;
	    }
	nowx +=l[j];
      }
    }
    int tf;

    REP(hoge,25){
      REP(huga,25){
	tf +=gem[25][25];
	if(tf>0) break;
	  }
      if(tf>0) break;
    }

    if(tf){
      cout<<"NO"<<endl;
    }else{
      cout<<"YES"<<endl;
    }
  }
}

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

int main(void) {
	int N, M, x, y, g;
	char D[2];
	while (1) {
		int jewelry[20][20] = { 0 };
		int a[20][20] = { 0 };
		cin >> N;
		if (N == 0)
			break;
		for (int i = 0; i < N; i++) {
			cin >> x >> y;
			jewelry[x][y] = 1;
		}
		cin >> M;
		int x2 = 10;
		int y2 = 10;
		for (int i = 0; i < M; i++) {
			cin >> D >> g;
			if (!strcmp(D, "N")) 
				y2 = y2 + g;
			else if (!strcmp(D, "E")) 
				x2 = x2 + g;
			else if (!strcmp(D, "S"))
				y2 = y2 - g;
			else if (!strcmp(D, "W"))
				x2 = x2 - g;
		}
		a[x2][y2] = jewelry[x2][y2];

		if (a[x2][y2] == 1) 
			cout << "Yes" << endl;
		else 
			cout << "No" << endl;
	}
}