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 <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  int N, M, dx[] = {0,1,0,-1}, dy[] = {1,0,-1,0};
  while(scanf("%d", &N) && N){
    int x[32], y[32];
    rep(i, N) scanf("%d%d", x+i, y+i);
    scanf("%d", &M);
    int nx = 10, ny = 10, dis, d;
    bool field[21][21] = {};
    field[ny][nx] = true;
    char com[4];
    rep(i, M){
      scanf("%s%d", com, &dis);
      switch(com[0]){
      case 'N': d = 0; break;
      case 'E': d = 1; break;
      case 'S': d = 2; break;
      case 'W': d = 3; break;
      }
      rep(j, dis){
	nx += dx[d]; ny += dy[d];
	field[ny][nx] = true;
      }
    }
    /*    rep(i, 21){
      rep(j, 21) printf("%d ", field[i][j]?1:0);
      puts("");
      }*/
    bool f = true;
    rep(i, N)
      if(!field[y[i]][x[i]]) f = false;
    if(f) puts("Yes");
    else puts("No");
  }
  return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

int mp[21][21];

int main(){
	int N,M;
	int x[]={0,1,0,-1};
	int y[]={1,0,-1,0};
	while(cin>>N){
		if(N==0)break;
		CLR(mp);
		REP(i,N){
			int tx,ty;
			cin>>tx>>ty;
			mp[tx][ty]++;
		}
		cin>>M;
		int nx=10,ny=10;
		int res=0;
		REP(i,M){
			
			char d;int l;
			cin>>d>>l;
			int rx,ry;
			if(d=='N'){
				rx=x[0]*l;
				ry=y[0]*l;
			}else if(d=='E'){
				rx=x[1]*l;
				ry=y[1]*l;
			}else if(d=='S'){
				rx=x[2]*l;
				ry=y[2]*l;
			}else{
				rx=x[3]*l;
				ry=y[3]*l;
			}
			REP(i,rx+1)REP(j,ry+1){
				if(mp[nx+i][ny+j]!=0){
					mp[nx+i][ny+j]=0;
					//cout<<"!"<<nx+i<<" "<<ny+j<<endl;
					res++;
				}
			}
			nx+=rx;ny+=ry;
		}
		if(res==N)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<iomanip>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{"; for(auto nth : list){ cout << nth << " ";}cout << "}" << endl;

using namespace std;

int main(){

	while(true){

		int map[21][21];
		int x=10,y=10;
		int count=0;

		for(int i=0;i<21;i++){
			for(int j=0;j<21;j++){
				map[i][j]=0;
			}
		}

		int number,a,b;
		int stone;

		cin >> number;

		stone = number;

		if(number == 0) break;


		//cout << "あ" << endl;

		for(int i=0;i<number;i++){
			cin >> a >> b;
			map[a][b] = 1;
		}

		cin >> number;

		string aim;
		int num;


		for(int i=0;i<number;i++){
			cin >> aim >> num;
			if(aim == "N"){
				for(int j=0;j<num;j++){
					y++;
					if(map[x][y]==1){
						count++;			
					}
				}
			}
			else if(aim == "E"){
				for(int j=0;j<num;j++){
					x++;
					if(map[x][y]==1){
						count++;			
					}
				}
			}
			if(aim == "S"){
				for(int j=0;j<num;j++){
					y--;
					if(map[x][y]==1){
						count++;			
					}
				}
			}
			if(aim == "W"){
				for(int j=0;j<num;j++){
					x--;
					if(map[x][y]==1){
						count++;			
					}
				}
			}

		}
		if(count>=stone){
			cout << "Yes" << endl;	
		}
		else{
			cout << "No" << endl;
		}




	}

}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){

  int n;

  while (cin >> n,n){
    int x[100];
    int y[100];

    int gem[25][25] = {1};

    REP(i,n){
      cin >> x[i] >> y[i];
      gem[x[i]][y[i]] = 0;
    }
    int m;

    char d[100];
    int l[100];

    int nowx=10;
    int nowy=10;

    REP(j,m){
      cin >> d[j] >> l[j];
      if (d[j]=='N'){
	REP(k,l[k]){
	  gem[nowx+k][nowy]=1;
	    }
	nowx +=l[j];
      }else if(d[j]=='S'){
	REP(k,l[k]){
	  gem[nowx-k][nowy]=1;
	    }
	nowx -=l[j];
      }else if(d[j]=='W'){
	REP(k,l[k]){
	  gem[nowx][nowy-k]=1;
	    }
	nowx -=l[j];
      }else if(d[j]=='E'){
	REP(k,l[k]){
	  gem[nowx][nowy+k]=1;
	    }
	nowx +=l[j];
      }
    }
    int tf;

    REP(hoge,25){
      REP(huga,25){
	tf +=gem[25][25];
	  }
    }

    if(tf){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}