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>
using namespace std;

int n,m;
const char vec[4]={'N','E','W','S'};
const int   dx[4]={ 0 , 1 ,-1 , 0 };
const int   dy[4]={ 1 , 0 , 0 , -1};
int gx[20],gy[20];
char v; int vn;

int main()
{
	while(cin>>n,n)
	{
		for(int i=0;i<n;i++)
		{
			cin>>gx[i]>>gy[i];
		}

		cin>>m;
		int sx=10,sy=10,gnum=0;
		bool flag[20]; memset(flag,false,sizeof flag);
		for(int i=0;i<m;i++)
		{
			cin>>v>>vn;
			int cnt;
			for(int j=0;j<4;j++)
			{
				if(vec[j]==v) {cnt=j; break;}
			}

			while(vn--)
			{
				sx+=dx[cnt];sy+=dy[cnt];
				for(int j=0;j<n;j++)
				{
					if(sx==gx[j]&&sy==gy[j]&&!flag[j])
					{
						gnum++;
						flag[j]=true;
					}
				}
			}
		}
		cout<<(gnum==n?"Yes":"No")<<endl;
	}
	return 0;
}

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

int N, M, cnt;
int Map[21][21];

struct Position{
	int x;
	int y;
}robot;

void initMap(void){
	int i, j;
	for(i = 0; i < 21; i++){
		for(j = 0; j < 21; j++){
			Map[i][j] = 0;
		}
	}
}

void setGems(int x, int y){
	Map[x][y] = 1;
}

int main(){
	int x, y, step;
	char dir;
	while(true){
		initMap();
		cnt = 0;
		robot.x = 10; robot.y = 10;
		cin >> N;
		if(N == 0)	break;
		for(int i = 0; i < N; i++){
			cin >> x >> y;
			setGems(x, y);
		}
		cin >> M;
		for(int i = 0; i < M; i++){
			cin >> dir >> step;
			switch(dir){
				case 'N':
					for(int i = 0; i < step; i++){
						robot.y++;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'E':
					for(int i = 0; i < step; i++){
						robot.x++;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'S':
					for(int i = 0; i < step; i++){
						robot.y--;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'W':
					for(int i = 0; i < step; i++){
						robot.x--;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				default:
					break;

			}
		}
		if(cnt == N){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;	
		}
	}
	return 0;
}

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

struct pos{
  int x;
  int y;

  bool operator==(const pos& rhs) const;
};

bool pos::operator==(const pos& rhs) const
{
  if(x == rhs.x && y == rhs.y)
    return true;
  else
    return false;
}

struct mov{
  char direction;
  int distance;
};

void retrieve(vector<pos>& gems, mov way, pos& robot);


int main()
{
  int N, M;
  while(cin >> N){
    vector<pos> gems;
    pos robot;
    pos temp;
    robot.x = 10;
    robot.y = 10;  //robot?????????????????????
    for(int i=0; i<N; ++i){
      cin >> temp.x >> temp.y;
      gems.push_back(temp);
    }
    //??¢??°retrieve??§??????????????????????????§???????????????????????§
    if(find(gems.begin(), gems.end(), robot) != gems.end())
      gems.erase(find(gems.begin(), gems.end(), robot));
    cin >> M;
    for(int i=0; i<M; ++i){
      mov go;
      cin >> go.direction >> go.distance;
      retrieve(gems, go, robot);
    }
    if(gems.size() == 0)
      cout << "Yes\n";
    else
      cout << "No\n";
  } 
}

    
void retrieve(vector<pos>& gems, mov way, pos& robot)
{
  int change, stay;
  pos temp;
  char dir = way.direction;
  if(dir=='N'){
    change = robot.y;
    stay = robot.x;
    while(change <= robot.y+way.distance){
      ++change;
      temp.x = stay;
      temp.y = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.y += way.distance;
  }
  else if(dir=='E'){
    change = robot.x;
    stay = robot.y;
    while(change <= robot.x+way.distance){
      ++change;
      temp.y = stay;
      temp.x = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.x += way.distance;
  }
  else if(dir=='S'){
    change = robot.y;
    stay = robot.x;
    while(change >= robot.x-way.distance){
      --change;
      temp.x = stay;
      temp.y = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.y -= way.distance;
  }
  else if(dir=='W'){
    change = robot.x;
    stay = robot.y;
    while(change >= robot.x-way.distance){
      --change;
      temp.y = stay;
      temp.x = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.x -= way.distance;
  }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>

using namespace std;
int main(){

	int n;
	int field[21][21];
	while(cin>>n&&n!=0){
		memset(field,0,sizeof(field));
		for(int i = 0; i < n; i++){
			int x,y;
			cin>>x>>y;
			field[y][x]=1;
		}
		int m;
		cin>>m;
		int rx=10;
		int ry=10;
		int cnt=n;
		for(int i = 0; i < m; i++){
			char ch;
			int d;
			cin>>ch>>d;
			int ny=ry;
			int nx=rx;
			while(d){
				d--;
				if(ch=='W'){
					nx--;
					if(ny>=0&&nx>=0&&ny<=20&&nx<=20){
						if(field[ny][nx]){
							cnt--;
							field[ny][nx]=0;
						}
						ry=ny;
						rx=nx;
					}
				}
				else if(ch=='E'){
					nx++;
					if(ny>=0&&nx>=0&&ny<=20&&nx<=20){
						if(field[ny][nx]){
							cnt--;
							field[ny][nx]=0;
						}
						ry=ny;
						rx=nx;
						
					}
				}
				else if(ch=='N'){
					ny++;
					if(ny>=0&&nx>=0&&ny<=20&&nx<=20){
						if(field[ny][nx]){
							cnt--;
							field[ny][nx]=0;
						}
						ry=ny;
						rx=nx;
						
					}
				}
				else if(ch=='S'){
					ny--;
					if(ny>=0&&nx>=0&&ny<=20&&nx<=20){
						if(field[ny][nx]){
							cnt--;
							field[ny][nx]=0;
						}
						ry=ny;
						rx=nx;
						
					}
				}
			}
		}
		if(cnt==0)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}

	return 0;
}