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>
using namespace std;
int grid[21][21];

void init(){
  int nowx = 10,nowy = 10;
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      grid[j][i] = 0;
    }
  }
}

void serch(int a,int b,int f){
  if(a > b)swap(a,b);
  cout << a << ' ' << b << endl; 
  if(f == 1){
    for(int i = a ; i <= b ; i++ )grid[nowx][i] = 0;
  }else {
    for(int i = a ; i <= b ; i++ )grid[i][nowy] = 0;
  }
}

bool check(){
  bool flag = true; 
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      if(grid[j][i] == 1){flag = false;goto N;}
    }
  }
 N:;
  if(flag)return true;
  else return false;
}

int main(){
  int n;
  while( cin >> n,n ){
    init();
    for(int i = 0 ; i < n ; i++ ){
      int x,y;
      cin >> x >> y;
      grid[x][y] = 1;
    }
    cin >> n;
    for(int i = 0 ; i < n ; i++ ){
      char c;
      int move,f = 0,past;
      cin >> c >> move;
      if(c == 'N'){
	f = 1;
	past = nowy;
	nowy+=move;
      }else if(c == 'S'){
	f = 1;
	past = nowy;
	nowy-=move;
      }else if(c == 'E'){
	past = nowx;
	nowx+=move;
      } else {
	past = nowx;
	nowx-=move;
      }
      if(f == 0)serch(past,nowx,f);
      else serch(past,nowy,f);
    }
    if( check() )cout << "Yes" << endl;
    else cout << "No" << endl; 
  }
  return 0;
}

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

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

using namespace std;

bool field[21][21];

void initialize(){
    REP(i,21){
        REP(j,21){
            field[i][j] = false;
        }
    }
}

int main(){
    int n;
    while(cin >> n){
        if(n==0) break;
        initialize();
        REP(k,n){
            int x,y;
            cin >> x >> y;
            field[y][x] = true;
        }

        int m;
        int i=10, j=10, cnt=0;
        cin >> m;
        REP(k,m){
            char direct;
            int dist;
            cin >> direct >> dist;
            REP(l,dist){
                switch(direct){
                    case 'E':
                        j++;
                        break;
                    case 'W':
                        j--;
                        break;
                    case 'N':
                        i++;
                        break;
                    case 'S':
                        i--;
                        break;
                }
                if(field[i][j]){
                    cnt++;
                    field[i][j] = false;
                }
            }
        }
        if(cnt == n){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
  char dir; //direction                                                         
  int x,y,j,k;
  int dist; //distance                                                          
  int xy[21][21];
    while (cin >> j && j){
      memset(xy,0,sizeof(xy));
      for(int i=0;i<j;i++){
        cin >> x >> y;
        xy[x][y]=1;
      }
      cin >> k;
      x=10;
      y=10;
      int m=0;
      for(int i=0;i<k;i++){
        cin >> dir >> dist;
        for(int l=0;l<dist;l++){
          if(dir == 'N')
            y++;
          else if(dir=='S')
            y--;
          else if(dir=='W')
            x--;
          else if(dir=='E')
            x++;
          if(xy[x][y]==1){
            m++;
            xy[x][y]=0;
          }
        }
      }
      if(j==m)
          cout << "Yes" << endl;
        else
          cout << "No" << endl;
    }
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n;
    while(scanf("%lld", &n)) {
        if(n == 0) break;
        int board[30][30] = {};
        int r, c;
        rep(i,0,n) {
            scanf("%lld%lld", &c, &r);
            r = 20 - r;
            board[r][c] = 1;
        }

        int m; scanf("%lld", &m);
        string st = "SNEW";
        char d; int t;
        int rr = 10, cc = 10;
        int cnt = 0;
        rep(i,0,m) {
            scanf(" %c %lld", &d, &t);
            // printf("debug: m = %lld, input = (%c, %lld)\n", m, d, t);
            int p = st.find(d);
            rep(j,0,t) {
                rr += dx[p], cc += dy[p];
                if(board[rr][cc]) cnt++;
                board[rr][cc] = 0;
            }
        }
        if(cnt == n) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}