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++: /*** Mysterious Gems ***/

#include <bits/stdc++.h>
using namespace std;
#define SIZE 21
#define REP(i, n) for(int i=0; i<n; ++i)

void create_map(int map[][SIZE], int n){
	int x, y;
	REP(j, SIZE){
		REP(i, SIZE){
			map[j][i]=0;
		}
	}
	REP(i, n){
		cin >> x >> y;
		map[y][x]=1;
	}
	return;
}
	
int main(){
	int N, M;
	int l;
	int map[SIZE][SIZE], flag;
	char d;
	
	cin >> N;
	while(N!=0){
		create_map(map, N);
		
		int xx=10, yy=10;
		cin >> M;
		REP(k, M){
			cin >> d >> l;
			while(l>0){
				if(d=='N') ++yy;
				else if(d=='E') ++xx;
				else if(d=='S') --yy;
				else --xx;
				
				if(map[yy][xx]) map[yy][xx]=0;
				--l;
			}
		}
		flag=0;
		REP(j, SIZE){
			REP(i, SIZE){
				if(map[j][i]){
					flag=1;
					break;
				}
			}
		}
		
		if(flag) cout << "No" << endl;
		else cout << "Yes" << endl;
		
		cin >> N;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
int main(){
	char h;
	int n,m,c;
	while(cin>>n,n){
		bool jewel[20][20];
		memset(jewel,false,sizeof(jewel));
		int x=10,y=10;
		for(int i=0;i<n;i++){
			int a,b;
			cin>>a>>b;
			jewel[a][b]=true;
		}
		int cnt=0;
		cin>>m;
		for(int j=0;j<m;j++){
			cin>>h>>c;
			if(h=='N'){
				for(int i=0;i<c;i++){
					y++;
					if(jewel[x][y]){
						cnt++;
						jewel[x][y]=false;
					}
				}
			}else if(h=='S'){
				for(int i=0;i<c;i++){
					y--;
					if(jewel[x][y]){
						cnt++;
						jewel[x][y]=false;
					}
				}
			}else if(h=='E'){
				for(int i=0;i<c;i++){
					x++;
					if(jewel[x][y]){
						cnt++;
						jewel[x][y]=false;
					}
				}
			}else{
				for(int i=0;i<c;i++){
					x--;
					if(jewel[x][y]){
						cnt++;
						jewel[x][y]=false;
					}
				}
			}
		}
		if(cnt==n){
			cout<<"Yes"<<endl;
		}else cout<<"No"<<endl;
	}
}

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

int main(){
    int n;
    while(cin >> n, n){
        int x = 10, y = 10, mat[21][21] = {}, a, b;
        for(int i = 0; i < n; i++){
            cin >> a >> b;
            mat[b][a]++;
        }
        
        int m;
        cin >> m;

        char w;
        int d;
        for(int i = 0; i < m; i++){
            int dy = 0, dx = 0;
            cin >> w >> d;
            if(w == 'N')    dy = 1;
            if(w == 'S')    dy = -1;
            if(w == 'E')    dx = 1;
            if(w == 'W')    dx = -1;
            for(int j = 0; j < d; j++){
                x += dx, y += dy;
                if(mat[y][x] == 1)  n--, mat[y][x]--;
            }
        }

        if(n == 0)  cout << "Yes" << endl;
        else        cout << "No" << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
int main(void){
    int n;
    while(cin>>n,n){
        valarray<int> field(0,441);
        int cur=220;
        rep(i,n){
            int x,y; cin>>x>>y;
            field[x+(20-y)*21]=1;
        }
        int m; cin>>m;
        rep(i,m){
            char c; int d;
            cin>>c>>d;
            vi vl={-21,1,-1,21};
            rep(j,d){
                cur+=vl[((string)"NEWS").find(c)];
                field[cur]=0;
            }
        }
        cout<<(field.sum()==0?"Yes":"No")<<endl;
    }
}

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

int main()
{
	int numGems = 0;;

	std::cin >> numGems;
	const int gridSize = 21;
	std::vector<bool> gems(gridSize * gridSize, false);
	int gemPointX;
	int gemPointY;
	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;
	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;
		}
	}
	
	for (int i = 0; i < gridSize * gridSize; i++)
	{
		if (gems[i])//???????????????????????????
		{
			std::cerr << "NO" << std::endl;
			return 0;
		}
	}
	std::cerr << "YES" << std::endl;
	return 0;
}