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++: //Misterious Gems
#include <iostream>

using namespace std;

enum Direction{
	N = 1,
	E = 2,
	W = 3,
	S = 4
};

struct Order{
	Direction dir;
	int length;
};

int main(){
	int MaxN;//宝石最大数
	bool GemField[21][21];//宝石の有無保持用フィールド
	bool RobotField[21][21];//ロボット通過情報保持用フィールド
	int MaxM;//命令数
	Order Ord[30];//命令
	int RobotX, RobotY;//ロボット位置
	bool Gettable;//収集可能性

	int i, j, k, l;//使用する一時変数
	char c;//使用する一時変数

	while (1){
		//フィールド初期化
		for (i = 0; i < 21; ++i){
			for (j = 0; j < 21; ++j){
				GemField[i][j] = false;
				RobotField[i][j] = false;
			}
		}
		RobotField[10][10] = true;
		RobotX = 10; RobotY = 10;
		Gettable = true;
		//代入
		cin >> MaxN;
		if (MaxN == 0)break;
		for (i = 0, j = 0, k = 0; i < MaxN; ++i){
			cin >> j >> k;
			GemField[j][k] = true;
		}
		cin >> MaxM;
		for (i = 0, c = 0; i < MaxM; ++i){
			cin >> c >> Ord[i].length;
			switch(int(c)){
			case 'N':
				Ord[i].dir = N;
				break;
			case 'E':
				Ord[i].dir = E;
				break;
			case 'W':
				Ord[i].dir = W;
				break;
			case 'S':
				Ord[i].dir = S;
				break;
			}
		}

		//命令実行&RobotFieldに反映
		for (i = 0, k = 0, l = 0; i < MaxM; ++i){
			//方向決定
			k = (Ord[i].dir % 2 == 0) ? 1 : 0;
			l = (Ord[i].dir % 2 == 0) ? 0 : 1;
			if (Ord[i].dir >= 3){
				k *= -1; l *= -1;
			}
			//移動
			for (int j = 0; j < Ord[i].length; ++j){
				RobotX += k; RobotY += l;
				RobotField[RobotX][RobotY] = true;
			}
		}

		//全収集チェック
		for (i = 0; i < 21 && Gettable ; ++i){
			for (j = 0; j < 21 && Gettable; ++j){
				if (GemField[i][j] && !RobotField[i][j])Gettable = false;
			}
		}

		//出力
		cout << (Gettable ? "Yes" : "No") << endl;
	}

	return 0;
}

C++: #include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

string solve(int n) {
    // string ans;
    vector<vector<int>> treasurePosition(n, vector<int>(2));
    int move;

    for (int i = 0; i < n; i++) {
        cin >> treasurePosition[i][0] >> treasurePosition[i][1];
    }
    cin >> move;
    int cast[move];
    vector<string> movedirection(move);
    for (int i = 0; i < move; i++) {
        cin >> movedirection[i];
        cin >> cast[i];
        //cout << cast[i] << " " << endl;
    }
    int xPosition = 10;
    int yPosition = 10;
    int count     = 0;
    for (int i = 0; i < move; i++) {
        for (int k = 0; k < cast[i]; k++) {
            // int cast = (int)movedirection[i][1];
            if (movedirection[i][0] == 'N') {
                yPosition++;
            } else if (movedirection[i][0] == 'E') {
                xPosition++;
            } else if (movedirection[i][0] == 'S') {
                yPosition--;
            } else if (movedirection[i][0] == 'W') {
                xPosition--;
            }
            for (int j = 0; j < n; j++) {
                if (xPosition == treasurePosition[j][0] && yPosition == treasurePosition[j][1]) count++;
                // cout << xPosition << " " << yPosition << endl;
            }
        }
    }
    if (count == n)
        return "Yes";
    else
        return "No";
}

int main(int argc, char const *argv[]) {
    int n;
    vector<string> ans;
    while (1) {
        cin >> n;
        if (n == 0) {
            break;
        }
        ans.push_back(solve(n));
    }
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

#define REP(i,b,c) for(int i=b;i<(int)c;i++)
#define rep(i,c) REP(i,0,c)

using namespace std;

int main(){
  char move1[1000];
  int i,j,k,n,m,jewel[1000][1000],move2[1000],count;
  int mapQ[50][50],startx,starty;


  for(i=0;i<=20;i++){
    for(j=0;j<=20;j++)mapQ[i][j]=0;
  }

  while(1){
    count = 0;
    cin >> n;
    if(n == 0)break;

    rep(i,n){
      cin >> jewel[i][0] >> jewel[i][1];
      mapQ[jewel[i][1]][jewel[i][0]]=1; //ツ陛ウツ静篠づ個暗環置ツづーツマツッツプツ湘」ツづ可篠ヲツつキツ（ツ１ツづ可渉可甘コツ可サツ）
	
	}

  

    cin >> m;

    rep(i,m)cin >> move1[i] >> move2[i];

    startx=10;
    starty=10;
    mapQ[starty][startx]=2; //ツスツタツーツトツ地ツ点ツづー2ツづ可渉可甘コツ可サ

    rep(i,m){
      for(j=1;j<=move2[i];j++){
	if(move1[i] == 'N'){
	  mapQ[++starty][startx];
	  if(mapQ[starty][startx] == 1)count++;
	  mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'E'){
	  mapQ[starty][++startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'S'){
	  mapQ[starty][--startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'W'){
	  mapQ[--starty][startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}

      }
    }
    //   rep(i,21){
    //   rep(j,21)cout << mapQ[i][j] << " - " ;
    //   cout << endl; 
    //   }
    //   cout << "count =" << count <<  " n =" << n << endl;    

    
    count == n ? cout << "Yes" << endl : cout << "No" << endl ; 
    
    
  }
  
  
 return 0;
 
}

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;
		}
	}
}