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 <string>
using namespace std;

int map[21][21];

void search(int a[][21], string d, int i, int *x, int *y) {

	if (d == "N") {
		for (int j = 1; j <= i; j++) a[*y + j][*x] = 2;
		*y += i;
	} else if (d == "S") {
		for (int j = 1; j <= i; j++) a[*y - j][*x] = 2;
		*y -= i;
	} else if (d == "E") {
		for (int j = 1; j <= i; j++) a[*y][*x + j] = 2;
		*x += i;
	} else if (d == "W") {
		for (int j = 1; j <= i; j++) a[*y][*x - j] = 2;
		*x -= i;
	}

}

int judge (int a[][21]) {
	for (int i = 0; i < 21; i++) {
		for (int j = 0; j < 21; j++) {
			if (a[i][j] == 1) return 0;
		}
	}
	return 1;
}

void print (int a[][21]) {
	for (int i = 0; i < 21; i++) {
		for (int j = 0; j < 21; j++) {
			cout << a[i][j] << " ";
		}
		cout << "\n";
	}
}


int main(void) {
	int N, x, y, M, i, nowx, nowy;
	string d;

	cin.tie(0);
	//ios::sync_with_stdio(false);

	while (cin >> N, N) {
		nowx = nowy = 10;
		for (int k = 0; k < 21; k++) {
			for (int l = 0; l < 21; l++) {
				map[k][l] = 0;
			}
		}


		for (int j = 0; j < N; j++) {
			cin >> x >> y;
			map[y][x] = 1;
		}

		map[nowy][nowx] = 2;

		//print(map);

		cin >> M;

		for (int k = 0; k < M; k++) {
			cin >> d >> i;
			search(map, d, i, &nowx, &nowy);
			//print(map);
		}
		cout << (judge(map) == 1 ? "YES" : "NO") << "\n";

	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
  int N,M;
  int x,y;
  int i,j;
  int l;
  int check=0;
  char d;
  
  while(1){
    cin >> N;
    if(N==0) break;
    
    int flag[21][21]={};
    
    for(i=0;i<N;++i){
      cin >> x >> y;
      flag[x][y]=1;
    }
    
    check =0;
    
    int rx=10,ry=10;
    
    cin >> M;
    
    for(i=0;i<M;++i){
      
      cin >> d >> l;
      
      
      if(d=='N'){
	for(j=1;j<=l;++j){
	  if(flag[rx][ry+j]==1) check++;
	}
	ry+=l;
      }else if(d=='E'){
	for(j=1;j<=l;++j){
	  if(flag[rx+j][ry]==1) check++;
	}
	rx+=l;
      }else if(d=='S'){
	for(j=1;j<=l;++j){
	  if(flag[rx][ry-j]==1) check++;
	}
	ry-=l;
      }else{
	for(j=1;j<=l;++j){
	  if(flag[rx-j][ry]==1) check++;
	}
	rx-=l;
      }

    }
 
    
    if(check==N){
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }
  }


  return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

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 vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

const double EPS = 1e-10;

int main() {
	int N;
	
	while(cin >> N, N) {
		vvi field(21, vi(21, 0));
		
		REP(i, N) {
			int x, y;
			cin >> x >> y;
			field[x][y] = 1;
		}

		int M;
		cin >> M;

		int pos_x = 10, pos_y = 10;

		REP(i, M) {
			char d;
			int l;
			cin >> d >> l;

			switch(d) {
			case 'N':
				REP(j, l) {
					++pos_y;
					field[pos_x][pos_y] = 0;
				}
				break;
			case 'E':
				REP(j, l) {
					++pos_x;
					field[pos_x][pos_y] = 0;
				}
				break;
			case 'W':
				REP(j, l) {
					--pos_x;
					field[pos_x][pos_y] = 0;
				}
				break;
			case 'S':
				REP(j, l) {
					--pos_y;
					field[pos_x][pos_y] = 0;
				}
				break;
			}
		}

		bool suc = true;

		REP(i, 21) {
			REP(j, 21) {
				if(field[i][j]) {
					suc = false;
				}
			}
		}

		if(suc) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define INF 100000005
#define MAX 200005

string str = "NESW";
int yy[4] = {1, 0, -1, 0}, xx[4] = {0, 1, 0, -1};
int a[25][25], n, m, py, px;
int solve(int h, int d){
	int ans = 0;
	for(int i = 0;i < d;i++){
		py = py+yy[h];
		px = px+xx[h];
		if(a[py][px])ans++;
	}
	return ans;
}

int main(){
	int d, y, x, h;
	char c;
	while(cin >> n, n){
		int ans = 0;
		py = px = 10;
		fill((int*)a, (int*)(a+21), 0);
		for(int i = 0;i < n;i++){
			cin >> x >> y;
			a[y][x] = 1;
		}
		cin >> m;
		for(int i = 0;i < m;i++){
			cin >> c >> d;
			for(int j = 0;j < 4;j++)if(c == str[j])h = j;
			ans += solve(h, d);
		}
		if(n-ans == 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <algorithm>
using namespace std;

int n;
int m;
int dx[256];
int dy[256];
int xs[256];
int ys[256];
bool field[100][100];


int main() {
  dx['N'] = 0;
  dy['N'] = 1;
  dx['S'] = 0;
  dy['S'] = -1;
  dx['E'] = 1;
  dy['E'] = 0;
  dx['W'] = -1;
  dy['W'] = 0;

  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

    fill(field[0], field[30], false);

    for (int i=0; i<n; i++) {
      scanf("%d%d", &xs[i], &ys[i]);
      field[ys[i]][xs[i]] = true;
    }
  
    scanf("%d", &m);

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

      scanf(" %c %d", &d, &l);
      while (l--) {
        x += dx[d]*l;
        y += dy[d]*l;
        if (field[y][x]) {
          field[y][x] = false;
          cnt++;
        }
      }
    }

    if (cnt == n) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
}

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

int main(){
  bool g[21][21];
  int n;
  int x,y;
  while(cin>>n && n){
    int rx=10,ry=10,dx,dy,dxy;
    char ch;
    memset(g,0,sizeof(g));
    for(int i=0;i<n;i++){
      cin>>x>>y;
      g[x][y]=1;
    }
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>ch>>dxy;
      if(ch=='N') { dx=0;dy=1;}
      else if(ch=='E') { dx=1;dy=0;}
      else if(ch=='S') { dx=0;dy=-1;}
      else {dx=-1;dy=0;}
      while(dxy--){rx+=dx;ry+=dy;g[rx][ry]=0;}
    }
    bool f=0;
    for(int i=0;i<21;i++)
      for(int j=0;j<21;j++){
	if(g[i][j]) f=1;
      }
    if(f) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
  
  return 0;
}