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 main(){

  while(1){
    int n,m;
    cin >> n;
    if(n==0)break;

    int map[25][25]={},ans=0;

    for(int i=0;i<n;++i){
      int x ,y;
      cin >> x >> y;
      map[y][x]=1;
    }
    cin >> m;
    int nx=10,ny=10;
    for(int i=0;i<m;++i){
      string s;
      int d,dx,dy;
      cin >> s >> d;

      if(s=="N"){
	dy=1;dx=0;
      }
      else if(s=="S"){
	dy=-1;dx=0;
      }
      else if(s=="E"){
	dy=0;dx=1;
      }
      else if(s=="W"){
	dy=0;dx=-1;
      }

      for(int j=0;j<d;j++){
	nx=nx+dx; ny=ny+dy;
	if(map[ny][nx] == 1) ans++;
      }
    }
    if(ans == n)cout << "YES" <<endl;
    else cout << "NO" <<endl;


  }
  return 0;
}

C++: #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 <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <fstream>
#include <stdio.h>

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();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//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())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second


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

set<complex<int> > jem;
set<complex<int> > cood;
map<char, complex<int> > inst;
namespace std {
  bool operator < (const complex<int>& a, const complex<int>& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

int main(){
	while(1){
		int n,m;
		inst['N']=complex<int>(0,1);
		inst['S']=complex<int>(0,-1);
		inst['E']=complex<int>(1,0);
		inst['W']=complex<int>(-1,0);
		jem.clear();
		cood.clear();
		cin>>n;
		if(n==0)return 0;
		REP(i,n){
			int x, y;
			cin>>x>>y;
			jem.insert(complex<int>(x,y));
		}
		cin>>m;
		complex<int> cur(10,10);
		cood.insert(cur);
		REP(i,m){
			char c;
			int l;
			cin>>c>>l;
			REP(j,l){
				cur+=inst[c];
				cood.insert(cur);
			}
		}
		int flag = 0;
		for(set<complex<int> >::iterator it = jem.begin(); it!= jem.end(); it++){
			if(!EXIST(cood, *it)){
				cout << "No" << endl;
				flag = 1;
				break;
			}
		}
		if(flag == 0)cout<<"Yes"<<endl;
	}
}

C++: #include<stdio.h>

int main(){
	int n,m,d,x,y,i;
	for(;scanf("%d",&n),n;puts(n?"No":"Yes")){
		int f[21][21] = {0};
		for(i=n;i--;f[y][x] = 1)
			scanf("%d %d",&x,&y);
		scanf("%d",&m);
		x=y=10;
		for(i=m;i--;)
			for(scanf(" %c %d",&m,&d);d--;f[y][x]?n--,f[y][x]=0:0){
				x+=m==69?1:m==87?-1:0,
				y+=m==78?1:m==83?-1:0;
			}
	}
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

struct DATA{
  int x;
  int y;
};

void North(int, int&, int&, vector<DATA>&);
void South(int, int&, int&, vector<DATA>&);
void East(int, int&, int&, vector<DATA>&);
void West(int, int&, int&, vector<DATA>&);

int main(){
  int i, n, m, x, y, d;
  string s;
  DATA _data;
  vector<DATA> data;

  while(1){
    cin >> n;
    if(n == 0) break;

    for(i=0; i<n; ++i){
      cin >> x >> y;
      _data.x = x;
      _data.y = y;
      data.push_back(_data);
    }

    cin >> m;

    for(i=0, x=10, y=10; i<m; ++i){
      cin >> s >> d;

      if(data.size() != 0){
	if(s == "N") North(d, x, y, data);
	else if(s == "S") South(d, x, y, data);
	else if(s == "E") East(d, x, y, data);
	else if(s == "W") West(d, x, y, data);
      }
    }

    if(data.size() == 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;

    data.clear();
  }

  return 0;
}

void North(int d, int& x, int& y, vector<DATA>& data){
  vector<DATA>::iterator i = data.begin();
  while(i != data.end()){
    if(x == (*i).x && y <= (*i).y && y+d >= (*i).y)
      i = data.erase(i);
    else
      ++i;
  }
  y += d;
}

void South(int d, int& x, int& y, vector<DATA>& data){
  vector<DATA>::iterator i = data.begin();
  while(i != data.end()){
    if(x == (*i).x && y-d <= (*i).y && y >= (*i).y)
      i = data.erase(i);
    else
      ++i;
  }
  y -= d;
}

void East(int d, int& x, int& y, vector<DATA>& data){
  vector<DATA>::iterator i = data.begin();
  while(i != data.end()){
    if(y == (*i).y && x <= (*i).x && x+d >= (*i).x)
      i = data.erase(i);
    else
      ++i;
  }
  x += d;
}

void West(int d, int& x, int& y, vector<DATA>& data){
  vector<DATA>::iterator i = data.begin();
  while(i != data.end()){
    if(y == (*i).y && x-d <= (*i).x && x >= (*i).x)
      i = data.erase(i);
    else
      ++i;
  }
  y -= d;
}

C++: #include<iostream>
using namespace std;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

int N,M,a,b;
int t[30][30];

void init(){
  for(int i=0;i<30;i++)
    for(int j=0;j<30;j++)
      t[i][j]=0;
}
int main(){
  while(1){
    cin>>N;
    if(N==0)break;
    init();
    for(int i=0;i<N;i++){
      cin>>a>>b;
      t[b][a]=1;
    }
    cin>>M;
    int y=10,x=10,ans=0;
    for(int i=0;i<M;i++){
      char ch;
      cin>>ch>>a;
      if(ch=='N')b=2;
      if(ch=='S')b=0;
      if(ch=='E')b=1;
      if(ch=='W')b=3;
      for(int j=0;j<a;j++){
	y+=dy[b];
	x+=dx[b];
	if(t[y][x])ans++,t[y][x]=0;
      }
    }
    cout<<(M==ans?"Yes":"No")<<endl;
  }
  return 0;
}