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 <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

struct Gem{
	int x; int y; bool isFound;
	Gem(){ x = 10; y = 10; isFound = false; }
};

int main(){
	int n;

	while(cin >> n && n != 0){
		Gem gems[20], robot;
		for (int i = 0; i < n; ++i){
			cin >> gems[i].x >> gems[i].y;
		}

		int m;
		cin >> m;
		for (int i = 0; i < m; ++i){
			char s; int dist;
			cin >> s >> dist;
			
			switch (s)
			{
			case (int)'N':
				robot.y += dist;
				break;
			case (int)'E':
				robot.x += dist;
				break;
			case (int)'S':
				robot.y -= dist;
				break;
			case (int)'W':
				robot.x -= dist;
				break;
			}
			for (int i = 0; i < n; ++i){
				if (robot.x == gems[i].x &&  robot.y == gems[i].y){
					gems[i].isFound = true;
				}
			}

		}


		int res = 1;
		for (int i = 0; i < n; ++i){
				res *= gems[i].isFound;
		}
		cout << ((res == 1) ? "Yes" : "No") << endl;


	}


	return 0;
}

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

bool field[20][20];

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
string compass = "NESW";

int main() {
  int n, m;

  while(cin >> n, n) {
    int ans = 0;
    int nx = 10, ny = 10;

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

    for(int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      field[x][y] = true;
    }

    cin >> m;
    for(int i = 0; i < m; i++) {
      string s; int d;
      cin >> s >> d;
      int pos;
      for(int j = 0; j < 4; j++) {
	if(compass.substr(j, 1) == s) pos = j;
      }

      for(int j = 1; j <= d; j++) {
	int tx = nx+dx[pos]*j, ty = ny+dy[pos]*j;
	if(field[ty][tx]) {
	  ans++;
	  field[ty][tx] = false;
	}
      }
      nx += dx[pos]*d, ny += dy[pos]*d;
    }
    
    if(ans == n) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

C++: /* #include <iostream> */
/* using namespace std; */
#include <stdio.h>

typedef struct {
  int fst, snd;
} tuple;

int main() {
  int i,j,k,n,m,score;
  char c;
  tuple gems[20], robot, prog;
  
  while(1) {
    scanf("%d", &n); if(n==0) break;
    for(i=0;i<n;i++)
      scanf("%d %d", &gems[i].fst, &gems[i].snd);

    robot.fst = 10; robot.snd = 10; score = 0;
    
    scanf("%d", &m);
    for(i=0;i<m;i++){
      /* cin >> c >> prog.snd; */
      scanf("%*c%c %d", &c, &prog.snd);
      prog.fst = (int)(c);
      for(j=0;j<n;j++) if(robot.fst==gems[j].fst && robot.snd==gems[j].snd) score++;
      for(k=0;k<prog.snd;k++){
	switch(prog.fst) {
	case 'N': robot.snd++; break;
	case 'E': robot.fst++; break;
	case 'S': robot.snd--; break;
	case 'W': robot.fst--; break;
	default : printf("error!\n");
	}
	for(j=0;j<n;j++) if(robot.fst==gems[j].fst && robot.snd==gems[j].snd) score++;
      }
    }
    if(score==n)
      printf("Yes\n");
    else
      printf("No\n");
  }

  return 0;
}

C++: #include <iostream>
#include <set>
enum{Nor,Eas,Sou,Wes};
#define MAX_MASU 21

using namespace std;

set<int> gemplace;
bool isgem(int p[2]);
void removegem(int p[2]);

int main(){
    while(1){
        gemplace.clear();
        int n;
        cin>>n;
        if(n==0)break;
        int gemcount=n;
        
        for(int i=0;i<n;i++){
            int p[2];
            cin>>p[0]>>p[1];
            gemplace.insert(p[0]+p[1]*MAX_MASU);
        }
        
        int M;
        cin>>M;
        int orderlist[M][2];//{N,12},{S,3},{///
        int nowplace[2];
        nowplace[0]=10;nowplace[1]=10;
        for(int i=0;i<M;i++){
            char dir;
            int temp;
            cin>>dir>>temp;
            orderlist[i][1]=temp;
            switch(dir){
            case 'N':
                orderlist[i][0]=Nor;
                break;
            case 'E':
                orderlist[i][0]=Eas;
                break;
            case 'S':
                orderlist[i][0]=Sou;
                break;
            case 'W':
                orderlist[i][0]=Wes;
                break;
            }
        }
        for(int i=0;i<M;i++){
            while(orderlist[i][1]){
                switch(orderlist[i][0]){
                case Nor:
                    nowplace[1]++;
                    break;
                case Eas:
                    nowplace[0]++;
                    break;
                case Sou:
                    nowplace[1]--;
                    break;
                case Wes:
                    nowplace[0]--;
                    break;
                }
                //cout<<"P:"<<nowplace[0]<<","<<nowplace[1]<<"\n";
                if(isgem(nowplace)){
                    removegem(nowplace);
                    gemcount--;
                }
                orderlist[i][1]--;
            }
        }
        if(gemcount==0)cout<<"Yes\n";
        else cout<<"No\n";
    }
}
bool isgem(int p[2]){
    if(gemplace.find(p[0]+p[1]*MAX_MASU)!=gemplace.end())return true;
    return false;
}
void removegem(int p[2]){
    gemplace.erase(p[0]+p[1]*MAX_MASU);
    return;
}

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

int main(void){
    
    while(1) {
        int n;
        cin >> n;
        if (n==0) break;
        int stone[21][21];
        for(int y=0; y<21; y++){
            for(int x=0; x<21; x++){
                stone[y][x] = 0;
            }
        }
        for(int i=0; i<n; i++){
            int x, y;
            cin >> x >> y;
            stone[y][x] = 1;
        }
        int m;
        int x=10, y=10;
        cin >> m;
        for(int i=0; i<m; i++){
            char d;
            int l;
            cin >> d;
            cin >> l;
            for(int j=0; j<l; j++) {
                if(d=='N'){ y++; }
                if(d=='E'){ x++; }
                if(d=='S'){ y--; }
                if(d=='W'){ x--; }
                if(stone[y][x] == 1) {
                    stone[y][x] = 0;
                    n--;
                }
           }
        }
        cout << (n==0 ? "Yes" : "No") << endl;
        
    }
    
}