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 <cstdio>
#include <algorithm>
using namespace std;

int n;
int m;
int dx[256];
int dy[256];
int xs[256];
int ys[256];
bool field[100][100];


int main() {
  dx['N'] = 0;
  dy['N'] = 1;
  dx['S'] = 0;
  dy['S'] = -1;
  dx['E'] = 1;
  dy['E'] = 0;
  dx['W'] = -1;
  dy['W'] = 0;

  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

    fill(field[0], field[30], false);

    for (int i=0; i<n; i++) {
      scanf("%d%d", &xs[i], &ys[i]);
      field[ys[i]][xs[i]] = true;
    }
  
    scanf("%d", &m);

    int x = 10;
    int y = 10;
    int cnt = 0;
    for (int i=0; i<m; i++) {
      char d;
      int l;

      scanf(" %c %d", &d, &l);
      while (l--) {
        x += dx[d];
        y += dy[d];
        if (field[y][x]) {
          field[y][x] = false;
          cnt++;
        }
      }
    }

    if (cnt == n) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
}

C++: #define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int g[21][21];
int dy[4] = {1,0,-1,0};
int dx[4] = {0,1,0,-1};

int main()
{
	while(1) {
		int n, m;
		cin >> n;
		if (!n) break;
		memset(g, 0, sizeof(g));
		rep(i,0,n) {
			int a, b; cin >> a >> b;
			g[a][b]++;
		}

		cin >> m;
		int tx = 10, ty = 10;
		int cnt = 0;
		rep(i,0,m) {
			char a;
			int b; 
			cin >> a >> b;
			int d;
			if (a == 'N') d = 0;
			else if (a == 'E') d = 1;
			else if (a == 'S') d = 2;
			else if (a == 'W') d = 3;
			rep(j,0,b) {
				tx += dx[d];
				ty += dy[d];
				if (g[tx][ty]) {
					cnt++;
					g[tx][ty]--;
				}
			}
		}
		if (cnt == n) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 21

void calc(int n){
  int y,x,m,l;
  char dir;
  bool jewel[SIZE][SIZE] = {};
  
  for(int i=0;i<n;i++){
    scanf("%d%d",&x,&y);
    jewel[y][x] = true;
  }

  y = 10;
  x = 10;
  int cc = 0;

  scanf("%d",&m);

  cc += jewel[y][x];
  jewel[y][x] = false;

  for(int i=0;i<m;i++){
    scanf(" %c%d",&dir,&l);

    for(int j=0;j<l;j++){
      if(dir=='N') y += 1;
      if(dir=='W') x -= 1;
      if(dir=='S') y -= 1;
      if(dir=='E') x += 1;

      cc += jewel[y][x];
      jewel[y][x] = false;
    }
  }
  
  if(cc==n) puts("Yes");
  else puts("No");
  
  return;
}

int main(){
  int n;
  
  while(1){
    scanf("%d",&n);
    if(n==0) break;
    calc(n);
  }

  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;
			}
		}
		if(cnt == N){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;	
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#define F(a, b) for (int j = a; j <= b; j++)
using namespace std;
typedef pair<int, int> mypair;
int main(void)
{
	int n, m;
	while (1)
	{
		cin >> n;
		if (n == 0)
			break;
		vector<vector<int> > t(21, vector<int>(21, 0));
		mypair p;
		int c = 0;
		int x, y;
		for (int i = 0; i < n; i++)
		{
			cin >> x >> y;
			t[x][y] = 1;
		}
		mypair now(10, 10);
		cin >> m;
		char a;
		for (int i = 0; i < m; i++)
		{
			cin >> a >> x;
			if (a == 'N')
			{
				F(now.second, now.second + x)
				{
					if (t[now.first][j] == 1)
					{
						c++;
						t[now.first][j] = 0;
					}
				}
				now.second += x;
			}
			else if (a == 'W')
			{
				F(now.first - x, now.first)
				{
					if (t[j][now.second] == 1)
					{
						c++;
						t[j][now.second] = 0;
					}
				}
				now.first -= x;
			}
			else if (a == 'E')
			{
				F(now.first, now.first + x)
				{
					if (t[j][now.second] == 1)
					{
						c++;
						t[j][now.second] == 0;
					}
				}
				now.first += x;
			}
			else
			{
				F(now.second - x, now.second)
				{
					if (t[now.first][j])
					{
						c++;
						t[now.first][j] == 0;
					}
				}
				now.second -= x;
			}
		}
		if (c == n)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	return 0;
}