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>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it = (c).begin(); it != (c).end(); it++)
#define X first
#define Y second

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int N = 21;
vector< vector<bool> > m(N);

const string DI = "NESW";
const int DX[4] = {0, 1, 0, -1};
const int DY[4] = {1, 0, -1, 0};

int main(void){
    map<char, pii> d;
    rep(i, 4) d[DI.at(i)] = mp(DX[i], DY[i]);
    rep(i, N) m[i].resize(N);

    string res;
    for(int n; res = "Yes", cin >> n, n; cout << res << endl){
        rep(i, N) fill(ALL(m[i]), false);

        while(n -- ){
            int x, y; cin >> x >> y;
            m[y][x] = true; }
        
        pii cur = mp(10, 10);
        m[cur.Y][cur.X] = false;
        cin >> n;
        while(n --){
            char dir; cin >> dir;
            int len; cin >> len;

            while(len --){
                cur.X += d[dir].X, cur.Y += d[dir].Y;
                m[cur.Y][cur.X] = false;
            }
        }

        rep(i, N) if(find(ALL(m[i]), true) != m[i].end()) res = "No";
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
  int N,M;
  int x,y;
  int i,j;
  int l;
  int check=0;
  char d;
  
  while(1){
    cin >> N;
    if(N==0) break;

    int flag[20][20]={};
    for(i=0;i<N;++i){
      cin >> x >> y;
      flag[x][y]=1;
    }
    check =0;
    int rx=10,ry=10;
    cin >> M;
    for(i=0;i<M;++i){
      scanf("%c%d",&d,&l);

      if(d=='N'){
	for(j=1;j<=l;++j){
	  if(flag[rx][ry+j]==1) check++;
	}
	ry+=l;
      }else if(d=='E'){
	for(j=1;j<=l;++j){
	  if(flag[rx+j][ry]==1) check++;
	}
	rx+=l;
      }else if(d=='S'){
	for(j=1;j<=l;++j){
	  if(flag[rx][ry-j]==1) check++;
	}
	ry-=l;
      }else{
	for(j=1;j<=l;++j){
	  if(flag[rx-j][ry]==1) check++;
	}
	rx-=l;
      }
      cout << j << endl;

    }
 
    
    if(check==N){
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }
  }


  return 0;
}

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

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

#define MAX 21
int brd[MAX][MAX];

int N;

int dx[] = { 0, 0, 1, -1 }; // N S E W
int dy[] = { 1, -1, 0, 0 };
int direc[128];

int main()
{
	direc['N'] = 0;
	direc['S'] = 1;
	direc['E'] = 2;
	direc['W'] = 3;
	while (cin >> N, N) {
		memset(brd, 0, sizeof(brd));
		rep(i, N) {
			int x, y;
			cin >> x >> y;
			brd[y][x] = 1;
		}

		int step;
		cin >> step;
		int x = 10, y = 10;	
		rep(t, step) {
			char d;	int s;
			cin >> d >> s;
			while (s--) {
				x += dx[direc[d]];
				y += dy[direc[d]];
				brd[y][x] = 0;
			}
		}

		int cnt = 0;
		rep(j, MAX) rep(i, MAX)	if (brd[j][i]) cnt++;
		cout << (cnt?"No":"Yes") << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<bits//stdc++.h>
#include<functional>
using namespace std;
int main() {
	int n;
	while(cin>>n&&n!=0){
		for(int i=0;i<=20;i++){
			for(int j=0;j<=20;j++) a[i][j]=false;
		}
		int c,d;
		for(int i=0;i<n;i++){
			cin>>c>>d;
			a[c][d]=true;
		}
		int sum=n,m;
		int x=10,y=10;
		cin>>m;
		char e;
		for(int i=0;i<m;i++){
			cin>>e>>c;
			if(e=='N')x-=d;
			else if(e=='S') x+=d;
			else if(e=='E') y+=d;
			else y-=d;
			if(a[x][y]) {
				sum--;
				a[x][y]=false;
			} 
		}
		if(sum==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}