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;

typedef struct P {
	int x, y;
	bool ok;
	bool operator==(P other) {
		return x == other.x && y == other.y;
	}
	P operator+=(P other) {
		x += other.x;
		y += other.y;
		return{ x + other.x,y + other.y };
	}
}P;
typedef struct D {
	char d;
	int l;
}D;

int n, m;
P loc, p[20];
D o;

P get_e(D a) {
	P e = { 0,0 };
	switch (a.d) {
	case 'W':e = { -1,0 }; break;
	case 'N':e = { 0,1 }; break;
	case 'E':e = { 1,0 }; break;
	case 'S':e = { 0,-1 }; break;
	default:break;
	}
	return e;
}

int find() {
	for (int i = 0; i < n; i++) {
		if (loc == p[i]) {
			p[i].ok = true;
		}
	}
	return 0;
}

int move(D a) {
	P e = get_e(a);
	for (int i = 0; i < a.l; i++) {
		loc += e;
		find();
	}
	return 0;
}

bool check() {
	for (int i = 0; i < n; i++) {
		if (!p[i].ok)
			return false;
	}
	return true;
}

int main(){
	while (cin >> n && n != 0) {
		loc = { 10,10,false };
		for (int i = 0; i < n; i++) {
			cin >> p[i].x >> p[i].y;
			p[i].ok = false;
		}
		cin >> m;
		for (int i = 0; i < m; i++) {
			cin >> o.d >> o.l;
			move(o);
		}
		if (check()) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

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

int main(void){
	int i,j,x,y,n,m,d,sum;
	int field[24][24];
	string s;

	while(cin>>n && n){
		sum = 0;
		memset(field,0,sizeof(field));
		for(i=0;i<n;i++){
			cin>>x>>y;
			field[y][x] = 1;
		}
		cin>>m;
		i=j=10;
		while(m--){
			cin>>s>>d;
			while(d--){
				if(s == "N") i++;
				if(s == "S") i--;
				if(s == "W") j--;
				if(s == "E") j++;
				if(field[i][j] == 1) sum++;
			}
		}
		if(sum == n) cout<<"Yes\n";
		else cout<<"No\n";
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  int i, j, k;
  int q, w;
  int tempx, tempy, temp2, count;
  int N, M;
  char temp1;
  while(1){
    q = 10; w = 10; count = 0;
    int a[30][30] = {};
    cin>>N;
    if(N == 0) break;

    for(i = 0; i < N; i++){
      cin>>tempx>>tempy;
      a[tempx][tempy] = 1;
    }

    cin>>M;

    if(a[w][q] == 1)count++;
    
    for(i = 0; i < M; i++){
      cin>>temp1>>temp2;
      if(temp1 == 'N') {
	for(j = 1; j <= temp2; j++){
	  q++;
	  if(a[w][q] == 1){
	    count++;
	     a[w][q] == 0;
	  }
	}
      }else if(temp1 == 'S'){
         for(j = 1; j <= temp2; j++){
	  q--;
	  if(a[w][q] == 1){
	    count++;
	     a[w][q] == 0;
	  }
	 }
	
      } else if(temp1 == 'E'){
	  for(j = 1; j <= temp2; j++){
  	   w++;
	   if(a[w][q] == 1){
	     count++;
	      a[w][q] == 0;
	   }
	  }
	
      } else if(temp1 == 'W'){
	 for(j = 1; j <= temp2; j++){
	  w--;
	  if(a[w][q] == 1){
	    count++;
	    a[w][q] == 0;
	  }
	
	 }
      }
	 
    }


    if(count == N)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)

const int dx[] = {0,0,1,-1};
const int dy[] = {1,-1,0,0};
int N,M,ope[33],dist[33];
bool field[33][33];

void input(){
    int i;
    rep(i,N){
        int x,y; cin >> x >> y;
        field[y][x] = true;
    }
    cin >> M;
    rep(i,M){
        char dir; cin >> dir >> dist[i];
        if( dir == 'S' ) ope[i] = 1;
        if( dir == 'N' ) ope[i] = 0;
        if( dir == 'E' ) ope[i] = 2;
        if( dir == 'W' ) ope[i] = 3;
        //cout << "dir=" << dir << " , dist=" << dist[i] << endl;
    }
}

int main(){
    int i;

    while( cin >> N, N ){
        memset(field, false, sizeof(field));
        input();

        int cnt = 0;
        int sx = 10, sy = 10;
        rep(i,M){
            int tx = sx + dx[ope[i]] * dist[i];
            int ty = sy + dy[ope[i]] * dist[i];
            if( tx < 0 || ty > 20 || tx > 20 || ty < 0 ){
                puts("no inside"); exit(1);
            }
            for(;;){
                //printf("(%d,%d)\n",sx,sy);
                if( field[sy][sx] ) cnt++;
                if( tx == sx && ty == sy ) break;
                sx += dx[ope[i]];
                sy += dy[ope[i]];
            }
        }
        puts(cnt == N ? "Yes" : "No");
    }
    return 0;
}

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

int main(){
	int n, m;
	int f[256];
	f['N'] = 0;
	f['E'] = 1;
	f['S'] = 2;
	f['W'] = 3;
	int dx[4] = {0,1,0,-1};
	int dy[4] = {1,0,-1,0};
	
	while( cin >> n , n ){
		int px = 10, py = 10, cnt=0;
		int s[21][21] = {0};
		
		for(int i=0 ; i < n ; i++ ){
			int x, y;
			cin >> x >> y;
			s[y][x] = 1;
		}

		if( s[py][px] == 1 ){
			cnt++;
			s[py][px] = 0;
		}
		
		cin >> m ;
		for(int i=0 ; i < m ; i++ ){
			string d;
			int l;
			cin >> d >> l;
			for(int k=0 ; k < l ; k++ ){
				px = px + dx[ f[d[0]] ];
				py = py + dy[ f[d[0]] ];
				if( s[py][px] == 1 ){
					cnt++;
					s[py][px] = 0;
				}
			}
		}
		if( cnt == n ){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
}

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

int main(void){
  while(true){
    int n, m;
    cin >> n;
    if(n == 0)
      break;

    vector< vector<int> > plane(21, vector<int>(21, 0));
    for(int i=0; i<n; i++){
      int x, y;
      cin >> x >> y;
      plane[x][y] = 1;
    }

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

      int dx = 0, dy = 0;
      if(d == 'N'){
	dy = 1;
      }else if(d == 'E'){
	dx = 1;
      }else if(d == 'S'){
	dy = -1;
      }else if(d == 'W'){
	dx = -1;
      }

      for(int i=0; i<l; i++){
	x += dx;
	y += dy;
	if(plane[x][y] == 1)
	  plane[x][y] = 0;
      }
    }

    bool flag = true;
    for(int i=0; i<=20; i++){
      for(int j=0; j<=20; j++){
	if(plane[i][j] == 1){
	  flag = false;
	  i = 21;
	  j = 21;
	}
      }
    }
    if(flag == true)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  
  return 0;
}