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++: #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<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;

#define reps(i,f,n) for(int i = int(f); i <= int(n); i++)
#define rep(i,n) reps(i,0,int(n)-1)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)

#define all(x) (x).begin(),(x).end()
#define X first
#define Y second

#define sz size()
#define eb emplace_back



int main(void){
  int n;
  while(cin >> n ){
    if(!n)break;
    int m, x, y;
    pii pos = pii(10,10);
    string S;
    int cell[32][32] = {0};
    rep(i,n){
      cin >> x >> y;
      cell[x][y] = 1;
    }
    cin >> m; 
    rep(i,m){
      cin >> S >> x;
      if(S[0] == 'N'){
        while(x--){
          pos.Y++;
          cell[pos.X][pos.Y] = 0;
        }
      }else if(S[0]=='E'){
        while(x--){
          pos.X++;
          cell[pos.X][pos.Y] = 0;
        }
      }else if(S[0] == 'S'){
        while(x--){
          pos.Y--;
          cell[pos.X][pos.Y] = 0;
        }
        pos.Y -= x;
      }else if(S[0] == 'W'){
        while(x--){
          pos.X--;
          cell[pos.X][pos.Y] = 0;
        }
      }
    }
    bool flag = false;
    rep(i,32)rep(j,32)
      if(cell[i][j] != 0)
        flag |=true;

    if(flag) cout << "No" << endl;
    else cout << "Yes" << endl;
  }

  return 0;
}

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

int main(){
  while(1){
    int N=0;
    cin >> N;
    if(N==0)break;
    int m[20][20]={0};
    for(int i=0;i<N;i++){
      int x,y;
      cin >> x >> y;
      m[x-1][y-1]=1;
    }
    int M;
    cin >> M;
    map<char,pair<int,int> > mp;
    mp['N'].first=0;
    mp['N'].second=1;
    mp['E'].first=1;
    mp['E'].second=0;
    mp['S'].first=0;
    mp['S'].second=-1;
    mp['W'].first=-1;
    mp['W'].second=0;
    int count=0;
    int nx=9,ny=9;
    if(m[nx][ny]==1){
      count++;
      m[nx][ny]=0;
    }
    for(int i=0;i<M;i++){
      char Q;
      int D;
      cin >> Q >> D;
      for(int j=0;j<D;j++){
        nx+=mp[Q].first;
        ny+=mp[Q].second;
        if(m[nx][ny]==1){
          count+=m[nx][ny];
          m[nx][ny]=0;
        }
      }
    }
    if(count==N){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

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

struct ans{
	int n;
	ans *next;
};

int main(){
	ans *start=new ans();
	start->next=NULL;
	ans *end=start;
	ans *buf;
	char s[20];
	char dir;
	char *ps;
	int **juel;
	int x=10,y=10;
	int state[21][21];
	int i,j,n,m,size;
	while(fgets(s,sizeof(s),stdin)){
		size=atoi(s);
		if(size==0) break;
		memset(state,0x00,sizeof(state));
		x=10;
		y=10;
		juel=new int*[size];
		for(i=0;i<size;i++){
			juel[i]=new int[2];
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			juel[i][0]=atoi(ps);
			ps=strtok(NULL," ");
			juel[i][1]=atoi(ps);
		}
		fgets(s,sizeof(s),stdin);
		n=atoi(s);
		for(i=0;i<n;i++){
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			dir=ps[0];
			ps=strtok(NULL," ");
			m=atoi(ps);
			if(dir=='N'){
				for(j=1;j<=m;j++) state[x][y+j]=1;
				y+=m;
			}
			else if(dir=='S'){
				for(j=1;j<=m;j++) state[x][y-j]=1;
				y-=m;
			}
			else if(dir=='E'){
				for(j=1;j<=m;j++) state[x+j][y]=1;
				x+=m;
			}
			else if(dir=='W'){
				for(j=1;j<=m;j++) state[x-j][y]=1;
				x-=m;
			}
		}
		for(i=0;i<size;i++){
			if(state[juel[i][0]][juel[i][1]]==0) break;
		}
		if(i==size) n=0;
		else n=1;
		buf=new ans();
		buf->n=n;
		buf->next=NULL;
		end->next=buf;
		end=buf;
		for(i=0;i<size;i++) delete [] juel[i];
		delete [] juel;
	}
	buf=start->next;
	while(buf!=NULL){
		if(buf->n==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
		end=buf;
		buf=buf->next;
		delete end;
	}
	return 0;
}

C++: // AOJ 2000
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const int XMAX = 30, YMAX = 30, MMAX = 40;

bool field[XMAX][YMAX];
char dir[MMAX];
int dist[MMAX];
int N, M;

void init() {
  REP(x, XMAX) REP(y,YMAX) { field[x][y] = false; }
}

bool solve() {
  int items = 0;
  int x = 10, y = 10;
  REP(i, M) {
    REP(d, dist[i]) {
      x += (dir[i] == 'E' ? 1 : dir[i] == 'W' ? -1 : 0);
      y += (dir[i] == 'N' ? 1 : dir[i] == 'S' ? -1 : 0);

      if (field[x][y]) {
        field[x][y] = false;
        items++;
      }
    }
  }
  return items == N;
}

int main() {
  while (cin >> N and N) {
    init();
    REP(i, N) {
      int x, y;
      cin >> x >> y;
      field[x][y] = true;
    }

    cin >> M;
    REP(i, M) {
      cin >> dir[i] >> dist[i];
    }

    cout << (solve() ? "Yes" : "No") << endl;
  }
}