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;
#define FOR(i,a) for(int i=0;i<a;i++)
int a[21][21];
int main() {
	while(1){
		int n;
		cin>>n;
		if(n==0){break;}
		FOR(i,21){FOR(j,21){a[i][j]=0;}}
		FOR(i,n){int d,f;cin>>d>>f;a[f][d]++;}
		int m;
		cin>>m;
		int x=10;int y=10;
		a[10][10]=0;
		FOR(i,m){
			char p;int move;
			cin>>p>>move;
			int h;
			int dx[4]={1,0,-1,0};
			int dy[4]={0,1,0,-1};
			if(p=='N'){h=0;}
			else if(p=='E'){h=1;}
			else if(p=='S'){h=2;}
			else if(p=='W'){h=3;}
			FOR(j,move){
				x+=dx[h];y+=dy[h];
				a[x][y]=0;
				cout<<x<<y;
			}
		}
		int ans=0;
		FOR(i,21){FOR(j,21){if(a[i][j]!=0){ans++;}}}
		if(ans==0){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    bool Map[25][25]={};
    for(int i=0;i<n;i++){
      int x,y;cin>>x>>y;
      Map[y][x]=true;
    }
    int m;cin>>m;
    int num=n;
    pair<int,int>now=mp(10,10);
    for(int i=0;i<m;i++){
      char N;int a;cin>>N>>a;
      switch(N){
      case 'N':
	for(int j=0;j<a;j++){
	  now.F++;
	  if(Map[now.F][now.S])num--;
	}break;
      case 'E':
	for(int j=0;j<a;j++){
	  now.S++;
	  if(Map[now.F][now.S])num--;
	}break;
      case 'S':
	for(int j=0;j<a;j++){
	  now.F--;
	  if(Map[now.F][now.S])num--;
	}break;
      case 'W':
	for(int j=0;j<a;j++){
	now.S--;
	if(Map[now.F][now.S])num--;
	}break;
      }
    }
    if(num)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
  return 0;
}

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

int main(){
  int N;
  while(std::cin >> N, N){
    std::vector<int> x{},y{};
    x.reserve(N);
    y.reserve(N);
    int x_robo, y_robo;

    while(N--){
      std::cin >> x_robo >> y_robo;
      x.push_back(x_robo);
      y.push_back(y_robo);
    }

    x_robo = 10;
    y_robo = 10;

    int M;
    std::cin >> M;

    char d;
    int l;

    std::size_t pick_up = 0;
    while(M--){
      std::cin >> d >> l;
      switch(d){
      case 'S':
        l = -l;
        // No break
      case 'N':
        for(auto x_it = std::find(x.begin(),x.end(),x_robo); x.end() != x_it; x_it = std::find(std::next(x_it),x.end(),x_robo)){
          auto y_it = std::next(y.begin(),std::distance(x.begin(),x_it));
          if(y_robo <= (*y_it) && (*y_it) <= y_robo + l){ ++pick_up; }
        }
        y_robo += l;
        break;
      case 'W':
        l = -l;
        // No break
      case 'E':
        for(auto y_it = std::find(y.begin(),y.end(),y_robo); y.end() != y_it; y_it = std::find(std::next(y_it),y.end(),y_robo)){
          auto x_it = std::next(x.begin(),std::distance(y.begin(),y_it));
          if(x_robo <= (*x_it) && (*x_it) <= x_robo + l){ ++pick_up; }
        }
        x_robo += l;
        break;
      default:
        break;
      }
    }
    std::cout << ((x.size() == pick_up) ? "Yes" : "No") << std::endl;
  }
  return 0;
}

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

int main(){
  int n;

  while(cin >> n,n){
    int field[MAX][MAX]={{0}},a,b;
    while(n--){
      cin >> a >> b;
      field[a][b] = 1;
    }
    cin >> n;
    int x = 10 ,y = 10 , c = field[x][y],dis;  field[x][y] = 0;
    char order;
    const int dx[] = {-1,0,1,0} ,dy[] = {0,-1,0,1};
    int nx,ny;

    while(n--){
      cin >> order >> dis;
      for(int i = 0 ; i < dis ; i++){
	switch(order){
	case 'N':
	  nx = x + dx[3];
	  ny = y + dy[3];
	  y++;
	  break;
	case 'S':
	  nx = x + dx[1];
	  ny = y + dy[1];
	  y--;
	  break;
	case 'W':
	  nx = x + dx[0];
	  ny = y + dy[0];
	  x--;
	  break;
	case 'E':
	  nx = x + dx[2];
	  ny = y + dy[2];
	  x++;
	  break;
	}
	field[nx][ny] = 0;
      }
    }
    int cnt = 0;    
    for(int i = 0 ; i < 20 ; i++){
      for(int j = 0 ; j < 20 ; j++){
	if(field[i][j]) cnt++;
      }
    }
    if(cnt) cout << "No" << endl;
    else cout << "Yes" << endl;
  }

  return 0;
}

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

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

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

void initMap(void){
	int i, j;
	for(i = 0; i < 20; i++){
		for(j = 0; j < 20; 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();
		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;
}