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>


namespace {

int jems_num = 0;
int jems_matrix[21][21] = {};
int orders_num = 0;

} //anonymous namespace

void clearJemsField() {
    for (int i = 0; i < 21; i++) {
        for (int j = 0; j < 21; j++) {
            jems_matrix[i][j] = 0;
        }
    }
}

void setJems(int jn) {
    for (int i = 0; i < jn; i++) {
        int set_jem_x, set_jem_y;
        std::cin >> set_jem_x;
        std::cin >> set_jem_y;
        jems_matrix[set_jem_x][set_jem_y] = 1;
    }
}

class Robot
{
public:
    explicit Robot()
        : m_x(10), m_y(10) {};
    void getJem();
    void move(char, int);
private:
    int m_x;
    int m_y;
};

void Robot::getJem()
{
    if (jems_matrix[m_x][m_y] == 1) {
        jems_matrix[m_x][m_y] = 0;
        jems_num--;
    }
}

void Robot::move(char dir, int dist)
{

    for (int i = 0; i < dist; i++) {
        if (dir == 'N') {
            m_y++;
        }
        if (dir == 'S') {
            m_y--;
        }
        if (dir == 'E') {
            m_x++;
        }
        if (dir == 'W') {
            m_y--;
        }

        getJem();
    }
}


int main()
{
    while (1) {

        std::cin >> jems_num;
        if (jems_num == 0) {
            break;
        }

        clearJemsField();
        setJems(jems_num);

        Robot* robot = new Robot();

        std::cin >> orders_num;
        char order_direction[orders_num] = {};
        int order_distance[orders_num] = {};
        for (int i = 0; i < orders_num; i++) {
            std::cin >> order_direction[i];
            std::cin >> order_distance[i];
        }

        for (int i = 0; i < orders_num; i++) {
            robot->move(order_direction[i], order_distance[i]);
        }

        if (jems_num == 0) {
            std::cout << "Yes" << std::endl;
        } else {
            std::cout << "No" << std::endl;
        }

        delete robot;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int d(char c){
	switch(c){
	case 'N':return 0;
	case 'E':return 1;
	case 'S':return 2;
	case 'W':return 3;
	}
	return -1;
}

int main(){
	int n;
	while(cin>>n &&n){
		int ma[21][21];
		fill((int*)ma,(int*)ma+21*21,0);
		for(int i=0;i<n;i++){
			int x,y;
			cin>>x>>y;
			ma[y][x]=1;
		}
		int m;
		int ans=0;
		cin>>m;
		int nx=10;
		int ny=10;
		for(int i=0;i<m;i++){
			char c;
			int v;
			cin>>c>>v;
			while(v>0){
				v--;

				nx+=dx[d(c)];
				ny+=dy[d(c)];
				if(ma[ny][nx]==1){
					ma[ny][nx]=0;
					ans++;
				}
			}
			
		}
		if(ans==n)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define sz size()
#define pb push_back
#define mp make_pair
#define ALL(X) (X).begin(),(X).end()

using namespace std;

const int INF = 1000000000;
const double eps = 1e-8;

int main(void) {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    vector<string> tb(21,string(21,' '));
    REP(i,n){
      int x,y;cin>>x>>y;
      tb[y][x]='*';
    }
    int m;cin>>m;
    int x=10,y=10;
    REP(i,m){
      char dc;
      int d,l;
      cin>>ws>>dc>>l;
      int dx[]={0,1,0,-1};
      int dy[]={1,0,-1,0};
      switch(dc){
        case 'N':
          d=0;
          break;
        case 'E':
          d=1;
          break;
        case 'S':
          d=2;
          break;
        case 'W':
          d=3;
          break;
        default:
        cout<<"error"<<endl;
      }
      REP(j,l){
        x+=dx[d];
        y+=dy[d];
        tb[y][x]=' ';
      }
    }
    bool exist=false;
    REP(i,21)REP(j,21){
      if(tb[i][j]=='*')exist=true;
    }
    if(exist)
      cout<<"No"<<endl;
    else
      cout<<"Yes"<<endl;
  }
  return 0;
}

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

struct ans{
	int n;
	ans *next;
};

int main(){
	ans *start=new ans();
	start->next=NULL;
	ans *end=start;
	ans *buf;
	char s[20];
	char dir;
	char *ps;
	int **juel;
	int x=10,y=10;
	int state[21][21];
	int i,j,n,m,size;
	while(fgets(s,sizeof(s),stdin)){
		size=atoi(s);
		if(size==0) break;
		memset(state,0x00,sizeof(state));
		state[10][10]=1;
		juel=new int*[size];
		for(i=0;i<size;i++){
			juel[i]=new int[2];
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			juel[i][0]=atoi(ps);
			ps=strtok(NULL," ");
			juel[i][1]=atoi(ps);
		}
		fgets(s,sizeof(s),stdin);
		n=atoi(s);
		for(i=0;i<n;i++){
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			dir=ps[0];
			ps=strtok(NULL," ");
			m=atoi(ps);
			if(dir=='N'){
				for(j=1;j<=m;j++) state[x][y+j]=1;
				y+=m;
			}
			else if(dir=='S'){
				for(j=1;j<=m;j++) state[x][y-j]=1;
				y-=m;
				break;
			}
			else if(dir=='E'){
				for(j=1;j<=m;j++) state[x+j][y]=1;
				x+=m;
			}
			else if(dir=='W'){
				for(j=1;j<=m;j++) state[x-j][y]=1;
				x-=m;
			}
		}
		for(i=0;i<size;i++){
			if(state[juel[i][0]][juel[i][1]]==0) break;
		}
		if(i==size) n=0;
		else n=1;
		buf=new ans();
		buf->n=n;
		buf->next=NULL;
		end->next=buf;
		end=buf;
		for(i=0;i<size;i++) delete [] juel[i];
		delete [] juel;
	}
	buf=start->next;
	while(buf!=NULL){
		if(buf->n==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
		end=buf;
		buf=buf->next;
		delete end;
	}
	return 0;
}

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

int main(void) {
	int n, x, y, m, i;
	char d;
	while (true)
	{
		int cnt = 0;
		int fx = 10;
		int fy = 10;
		int fld[21][21] = { 0 };

		cin >> n;
		if (n == 0) break;
		for (int j = 0; j < n; j++) {
			cin >> x >> y;
			fld[x][y] = 1;
		}
		cin >> m;
		for (int j = 0; j < m; j++) {
			cin >> d >> i;
			for (int k = 0; k < i; k++) {
				switch (d) {
				case 'N':
					if (fld[fx][++fy] == 1) cnt++;
					break;
				case 'E':
					if (fld[++fx][fy] == 1) cnt++;
					break;
				case 'S':
					if (fld[fx][--fy] == 1) cnt++;
					break;
				case 'W':
					if (fld[--fx][fy] == 1) cnt++;
					break;
				default:
					break;
				}
			}
		}
		if (cnt == n) cout << "Yes";
		else cout << "No";
	}
	return 0;
}