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	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cctype>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl

using namespace std;
typedef long long int ll;
typedef string::const_iterator State;
typedef pair<int,int> P;
class ParseError {};
const ll INF=1LL<<50;
char fi[101][101];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
double EPS = 1e-14;
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003



int bow[353][353]={0};
double add(double a,double b){
	if(abs(a+b)<EPS*(abs(a)+abs(b)))
	return 0;
	return a+b;
}

/*struct P{
	double x,y;
	P(){}
		P(double x,double y):x(x),y(y){
		}
		P operator + (P p){
			return P(add(x,p.x),add(y,p.y));
		}
		P operator - (P p){
			return P(add(x,-p.x),add(y,-p.y));
		}
		P operator *(double d){
			return P(x*d,y*d);
		}
		double dot(P p){
			return add(x*p.x,y*p.y);
		}
		double det(P p){
			return add(x*p.y,-y*p.x);
		}
};

bool cmp_x(const P& p,const P& q){
	if(p.x!=q.x) return p.x<q.x;
	return p.y<q.y;
}

vector<P> convex_hull(P* ps, int n){
	sort(ps,ps+n,cmp_x);
	int k=0;
	vector<P> 	qs(n*2);
	
	rep(i,n){
		while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
			k--;
		qs[k++]=ps[i];
	}
	for(int i=n-2,t=k;i>=0;i--){
		while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)
		k--;
		qs[k++]=ps[i];
	}
	qs.resize(k-1);
	return qs;
}

int n,m;
vector<double> p;
P ps[101];
*/
//char c[520][520];
long long mod=1000000007;
long long pow(ll i,ll j){
	ll tmp=1;
	while(j){
		if(j%2) tmp=tmp*i%mod;
		i=i*i%mod;
		j/=2;
	}
	return tmp;
}

int expression(State&);
int term(State&);
int factor(State&);
int number(State&);
int expression(State &begin){
	int ret = term(begin);
	
	for(;;){
		if(*begin == '+'){
			begin++;
			ret += term(begin);
		}
		else if(*begin == '-'){
			begin++;
			ret -= term(begin);
		}
		else
			break;
	}
	return ret;
}

int term(State &begin){
	int ret = factor(begin);
	
	for(;;){
		if(*begin=='*'){
			begin++;
			ret *= factor(begin);
		}
		else if(*begin=='/'){
			begin++;
			ret /= factor(begin);
		}
		else
			break;
	}
	return ret;
}

int factor(State &begin){
	int ret;
	if(*begin == '('){
		begin++;
		ret = expression(begin);
		begin++;
	}
	else
	ret = number(begin);
	
	return ret;

}

int number(State &begin){
	int ret =0;
	
	while(isdigit(*begin)){
		ret*=10;
		ret+=*begin - '0';
		begin++;
	}
	return ret;
}
/*int inf=1e9;
struct edge{ll to;
ll cost;};
typedef pair<ll,ll> T;
int V;
vector<edge> G[100000];
bool used[100000];

ll prim(){
	priority_queue<T,vector<T>, greater<T> > que;
	fill(used,used+V,false);
	ll res=0;

	que.push(T(0,0));
	
	while(!que.empty()){
		T t = que.top();
		que.pop();
		int v=t.second;
		if(used[v])
			continue;
		used[v]=true;
		res+=t.first;
		for(int i=0;i<G[v].size();i++){
			
			que.push(T(G[v][i].cost,G[v][i].to));
		}
	}
	return res;
}
*/
int gcd(int a,int b){
	if(!b)	return a;
	return gcd(b,a%b);
}


int main(void){
	
	
	int n,m;
	
	while(cin>>n,n!=0){
		bool d[21][21]={false};

	int a,b;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		d[b][a]=true;
	}
		cin>>m;
	int x=10,y=10;
	string s;
	int count=0;
	for(int i=0;i<m;i++){
		cin>>s>>a;
		if(s=="N"){
			for(int j=1;j<=a;j++){
				if(d[y+j][x]){
					d[y+j][x]=false;
					count++;
				}
			}
			y+=a;
		}
		else if(s=="S"){
			for(int j=1;j<=a;j++){
				if(d[y-j][x]){
					d[y-j][x]=false;
					count++;
				}
			}
			y-=a;
		}
		else if(s=="E"){
			for(int j=1;j<=a;j++){
				if(d[y][x+j]){
					d[y][x+j]=false;
					count++;
				}
			}
			x+=a;
		}
		else if(s=="W"){
			for(int j=1;j<=a;j++){
				if(d[y][x-j]){
					d[y][x-j]=false;
					count++;
				}
			}
			x-=a;
		}
	}
	
	if(count==n)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;

	}

}

C++: #include <iostream>
#include <list>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define F first
#define S second
using namespace std;

int main(void){
	int n,m;
	while(cin >> n,n){
		bool field[21][21]={false};
		pair<int,int> P[20];
		REP(i,n){
			int x,y;
			cin >> x >> y;
			P[i].F=x,P[i].S=y;
		}
		int x=10,y=10;
		cin >> m;
		REP(i,m){
			char dir;
			int num;
			cin >> dir;
			if(dir=='N'){
				cin >> num;
				REP(j,num)
					y++,field[x][y]=true;
			}else if(dir=='W'){
				cin >> num;
				REP(j,num)
					x--,field[x][y]=true;
			}else if(dir=='S'){
				cin >> num;
				REP(j,num)
					y--,field[x][y]=true;
			}else if(dir=='E'){
				cin >> num;
				REP(j,num)
					x++,field[x][y]=true;
			}
		}
		bool ok=true;
		REP(i,n){
			if(!field[P[i].F][P[i].S])
				ok=false;
		}
		if(ok)
			cout << "Yes" << endl;
		else 
			cout << "No" << endl;
	}
	return 0;
}