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 <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

int main() {
	int n;
	while (cin >> n&&n) {
		bool treasure[21][21] = {};
		int x, y;
		for (int i = 0; i < n; i++) {
			cin >> x >> y;
			treasure[y][x] = true;
		}
		int m;
		cin >> m;
		char c;
		int a;
		int ans = 0;
		int posx = 10, posy = 10;
		for (int i = 0; i < m; i++) {
			cin >> c >> a;
			if (c == 'S') {
				for (int count = 1; count <= a; count++) {
					if (treasure[posy - count][posx])ans++, treasure[posy - count][posx] = false;
				}
				posy = posy - a;
			}
			if (c == 'N') {
				for (int count = 1; count <= a; count++) {
					if (treasure[posy + count][posx])ans++, treasure[posy + count][posx] = false;
				}
				posy = posy + a;
			}
			if (c == 'E') {
				for (int count = 1; count <= a; count++) {
					if (treasure[posy][posx + count])ans++, treasure[posy][posx + count] = false;
				}
				posx = posx + a;
			}
			if (c == 'W') {
				for (int count = 1; count <= a; count++) {
					if (treasure[posy][posx - count])ans++, treasure[posy][posx - count] = false;
				}
				posx = posx - a;
			}
		}
		cout << (ans == n ? "Yes" : "No") << endl;
	}
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

vvl(v,20,20,0);

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n && n){
    vvl(v2,21,21,0);
    v = v2;
    ll a,b;
    rep(i,n){
      cin >> a >> b;
      v[a][b] = 1;
    }
    ll m,l,x=10,y=10;
    cin >> m;
    string s;
    rep(i,m){
      cin >> s >> l;
      if(s == "N"){
        rep(j,l){
          ++y;
          if(v[x][y])--n;
        }
      }
      else if(s == "W"){
        rep(j,l){
          --x;
          if(v[x][y])--n;
        }
      }
      else if(s == "E"){
        rep(j,l){
          ++x;
          if(v[x][y]) --n;
        }
      }
      else{
        rep(j,l){
          --y;
          if(v[x][y]) --n;
        }
      }
    }
    if(n) cout << "NO"<<endl;
    else cout << "YES" << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

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

int main(){
  int n,o;
  while(cin >> n,n){
    int v[25][25] = {{}};
    int x,y;
    rep(i,n){
      cin >> x >> y;
      v[x][y] = 1;
    }
    int ans = 0;
    cin >> o;
    x = 10, y = 10;
    int d;
    string s;
    rep(i,o){
      cin >> s >> d;
      if(s == "W"){
        for(int j = x + d-1; j > x;--j){
          ans += v[j][y];
          v[j][y] = 0;
        }
        x -= d;
      }
      if(s == "E"){
        for(int j = x ; j <= x+d;++j){
          ans += v[j][y];
          v[j][y] = 0;
        }
        x += d;
      }
      if(s == "S"){
        for(int j = y + d-1; j > y;--j){
          ans += v[x][j];
          v[x][j] = 0;
        }
        y -= d;
      }
      if(s == "N"){
        for(int j = y ; j <= y+d;++j){
          ans += v[x][j];
          v[x][j] = 0;
        }
        y += d;
      }
    /* cout << x << ' ' << y << endl; */
    }
    if(ans == n){
      cout << "Yes" << endl;
    }
    else
      cout << "No" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
using namespace std;
int N,M;
int fie[21][21];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
map<char,int> m;
main(){
  m['N']=0;
  m['E']=1;
  m['S']=2;
  m['W']=3;
  while(1){
    scanf("%d",&N);
    if(N==0) break;
    memset(fie,0,sizeof(fie));
    for(int i=0;i<N;i++){
      int x,y;
      //      scanf("%d %d",&x,&y);
      cin >> x >> y;
      fie[x][y]=1;
    }
    fie[10][10]=0;
    scanf("%d",&M);
    int X=10,Y=10;
    for(int i=0;i<M;i++){
      char d;
      int o;
      cin >> d >> o;
      for(int j=0;j<o;j++){
	X+=dx[m[d]];
	Y+=dy[m[d]];
	//	cout << X << " " << Y << ":"<<fie[X][Y]<<endl;
	fie[X][Y]=0;
      }
    }
    
    bool f=true;
    for(int i=0;i<21;i++)
      for(int j=0;j<21;j++)
	if(fie[j][i]) f=false;
    if(f) puts("Yes");
    else puts("No");
  }
}