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 map[21][21];
int n,m,a,b,d,cnt;
typedef struct{
	int x;
	int y;
}POS;
POS pos;

void check(char c,int p){
	switch(c){
		case'N':
		for(int i=1;i<=p;i++){
			pos.y++;
			if(map[pos.x][pos.y]==1){
				map[pos.x][pos.y]=0;
				cnt--;
			}
		}
		break;
		case'E':
		for(int i=1;i<=p;i++){
			pos.x++;
			if(map[pos.x][pos.y]==1){
				map[pos.x][pos.y]=0;
				cnt--;
			}
		}
		break;
		case'S':
		for(int i=1;i<=p;i++){
			pos.y--;
			if(map[pos.x][pos.y]==1){
				map[pos.x][pos.y]=0;
				cnt--;
			}
		}
		break;
		case'W':
		for(int i=1;i<=p;i++){
			pos.x--;
			if(map[pos.x][pos.y]==1){
				map[pos.x][pos.y]=0;
				cnt--;
			}
		}
		break;
	}
}



int main(){
	char c;
	while(1){
		cin >>n;
		if(n==0)break;
		for(int i=0;i<=20;i++){
			for(int j=0;j<=20;j++){
				map[i][j]=0;
			}
		}
		for(int i=0;i<n;i++){
			cin >>a >>b;
			map[a][b]=1;
		}
		cin >>m;
		pos.x=pos.y=10;
		cnt=n;
		for(int i=0;i<m;i++){
			cin >>c >>d;
			check(c,d);
		}
		if(cnt==0){
			cout <<"Yes" <<endl;
		}else{
			cout <<"No" <<endl;
		}

	}
	
	return 0;
}

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

int main(){
	int n,m;
	while(cin >> n, n){
		vector<vector<bool>> field(21,vector<bool>(21));
		for(int i=0;i<21;i++)
			for(int j=0;j<21;j++)
				field[i][j]=false;
		for(int i=0;i<n;i++){
			int x,y;
			cin >> x >> y;
			field[x][y]=true;
		}
		int result=0;
		int nx=10,ny=10;
		if(field[nx][ny]){
			result++;
			field[nx][ny]=false;
		}
		cin >> m;
		for(int i=0;i<m;i++){
			char d;
			int l;
			cin >> d >> l;
			for(int j=0;j<l;j++){
				switch(d){
				case 'N':
					ny++;
					if(field[nx][ny]){
						result++;
						field[nx][ny]=false;
					}
					break;
				case 'E':
					nx++;
					if(field[nx][ny]){
						result++;
						field[nx][ny]=false;
					}
					break;
				case 'S':
					ny--;
					if(field[nx][ny]){
						result++;
						field[nx][ny]=false;
					}
					break;
				case 'W':
					nx--;
					if(field[nx][ny]){
						result++;
						field[nx][ny]=false;
					}
					break;
				}
			}
		}
		if(result==n)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int N;
  while (cin >> N, N) {
    int X[N], Y[N], x, y, M, l, G[N], D[2], t = N;
    for (int i = 0; i < N; ++i) {
      cin >> x >> y;
      X[i] = x;
      Y[i] = y;
      G[i] = 1;
    }
    cin >> M;
    string d;
    x = 10;
    y = 10;
    for (int i = 0; i < M; ++i) {
      cin >> d >> l;
      if (d == "N") {
	D[0] = 0;
	D[1] = 1;
      } else if (d == "S") {
	D[0] = 0;
	D[1] = -1;
      } else if (d == "E") {
	D[0] = 1;
	D[1] = 0;
      } else {
	D[0] = -1;
	D[1] = 0;
      }
      for (int j = 0; j < N; ++j) {
	if (G[j] && ((x <= X[j] && X[j] <= x + D[0]*l) || (x >= X[j] && X[j] >= x + D[0]*l)) && ((y <= Y[j] && Y[j] <= y + D[1]*l) || (y >= Y[j] && Y[j] >= y + D[1]*l))) {
	  --t;
	  G[j] = 0;
	}
      }
      x += D[0]*l;
      y += D[1]*l;
    }
    if (t) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
}

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

typedef pair<int,int> P;
typedef vector<pair<int,int> > VP;

int main ()
{
    int n;
    while (cin >> n) {
        if (n == 0) break;
        bool d[22][22];
        memset(d, false, sizeof(d));
        int c = n;
        while (c--) {
            int a, b;
            cin >> a >> b;
            d[a][b] = true;
        }
        int x = 10, y = 10;
        int t;
        cin >> t;
        for (int i = 0; i < t; i++) {
            int num;
            char str;
            cin >> str >> num;
            switch (str) {
            case 'N' :
                for (int i = 0; i < num; i++) {
                    ++y;
                    if (d[x][y]) {
                        d[x][y] = false, --n;
                    }
                }
                break;
            case 'E' :
                for (int i = 0; i < num; i++) {
                    ++x;
                    if (d[x][y]) {
                        d[x][y] = false, --n;
                    }
                }
                break;
            case 'S' :
                for (int i = 0; i < num; i++) {
                    --y;
                    if (d[x][y]) {
                        d[x][y] = false, --n;
                    }
                }
                break;
            case 'W' :
                for (int i = 0; i < num; i++) {
                    --x;
                    if (d[x][y]) {
                        d[x][y] = false, --n;
                    }
                }
                break;
            }
        }

        cout << (n == 0 ? "Yes" : "No" ) << endl;
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  while(cin>>n,n){
    bool jems[30][30];
    bool gred[30][30];
    memset(jems,0,sizeof(jems));
    memset(gred,0,sizeof(gred));
    int x,y;
    for(int i=0;i<n;i++){
      cin>>x>>y;
      jems[20-y][x]=true;
    }
    cin>>m;
    gred[10][10]=true; 
    x=y=10;
    for(int i=0;i<m;i++){
      char dire;
      int dist;
      cin>>dire>>dist;
      for(int j=0;j<dist;j++){
	if(dire=='N'){
	  gred[--y][x]=true;
	}else if(dire=='S'){
	  gred[++y][x]=true;
	}else if(dire=='W'){
	  gred[y][--x]=true;
	}else{
	  gred[y][++x]=true;
	}
      }
    }
    bool ans=true;
    for(int i=0;i<21;i++){
      for(int j=0;j<21;j++){
	if(jems[i][j]==false)continue;
	if(jems[i][j]==true && gred[i][j]==false)ans=false;
      }
    }
    if(ans==true){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}