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()
{
  int n, m, a[20], b[20], d[20];
  int x, y, x0, y0;
  int t = 0, k = 0;
  char c[20];

  while(1){
    cin >> n;
    if(n==0){
       break;
    }else{
      x = 10;
      y = 10;
      x0 = 10;
      y0 = 10;
    for(int i=0; i<n; i++){
      cin >> a[i] >> b[i];
    }

    cin >> m;
    for(int i=0; i<m; i++){
      cin >> c[i] >> d[i];
      switch(c[i]){
        case 'N':
          y += d[i];
          break;
        case 'S':
          y -= d[i];
          break;
        case 'E':
          x += d[i];
          break;
        case 'W':
          x -= d[i];
          break;
      }

      for(int j=0; j<n; j++){
        if(((x0<=a[j] && a[j]<=x) || (x<=a[j] && a[j]<=x0)) && ((y0<=b[j] && b[j]<=y) ||
        (y<=b[j] && b[j]<=y0))){
          t++;
        }
      }
      x0 = x;
      y0 = y;
    }
    if(t>=n){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  } 
  }

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

int N,M,nx,ny;
int field[31][31];
const int dy[4] = {1,0,-1,0}, dx[4] = {0,1,0,-1}; // N E S W
map<char,int> mp; // <cmd, identifier>

int func(char cmd, int move){
  int ret = 0;

  mp['N'] = 0; mp['E'] = 1; mp['S'] = 2; mp['W'] = 3;

  while(move--){
    nx += dx[mp[cmd]];
    ny += dy[mp[cmd]];
    if(field[ny][nx] == 1){ ret++; field[ny][nx] = 0; }
  }

  return ret;
}

int main(){
  int i,j;

  while(1){
    rep(i,31) rep(j,31) field[i][j] = 0;

    cin >> N; if(N == 0) break;
    rep(i,N){
      int x,y;
      cin >> x >> y;
      field[y][x] = 1;
    }

    char cmd;
    int move, get = 0;
    cin >> M;
    nx = 10; ny = 10;
    while(M--){
      cin >> cmd >> move;
      get += func(cmd,move);
    }

    cout << ((N == get) ? "YES" : "NO") << endl;
  }

  return 0;
}

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

int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int map[21][21];
int x;
int y;
int sum;

void move(int dir,int dd){
  for(int i=1;i<=dd;i++){
    x += dx[dir];
    y += dy[dir];
    if (map[x][y]==1){
      map[x][y]=0;
      sum+=1;
    }
  }
}


int maindo(void){
  sum=0;
  x=10;
  y=10;
  for(int s=0;s<21;s++){
    for(int t=0;t<21;t++){
      map[s][t]=0;
    }
  }
  int n,m;
  cin >> n;
  if (n==0) return 0;
  for(int i=0;i<n;i++){
    int s,t;
    cin >> s >> t;
    map[s][t]=1;
  }
  cin >> m;
  for(int i=0;i<m;i++){
    string dir;
    int dirint;
    int dd;
    cin >> dir >> dd;
    if (dir=="E") dirint=0;
    else if(dir=="N") dirint=1;
    else if(dir=="W") dirint=2;
    else if(dir=="S") dirint=3;
    move(dirint,dd);
  }
  if (sum==n) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 1;
}

int main(){
  while(1){
    int k=maindo();
    if (k==0) return 0;
  }
}

C++: #include <cstring>
#include <iostream>

using namespace std;

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

const char dir[5] = "NESW";

int N, M, D, X, Y, JX[20], JY[20], P[21][21];

char c;

int main()
{
	while (true)
	{
		cin >> N;

		if (N == 0) { break; }

		X = 10; Y = 10;

		memset(P, 0, sizeof(P));

		P[X][Y] = 1;

		for (int i = 0; i < N; i++)
		{
			cin >> JX[i] >> JY[i];
		}

		cin >> M;

		for (int i = 0; i < M; i++)
		{
			cin >> c >> D;

			for (int j = 0; j < 4; j++)
			{
				if (c == dir[j])
				{
					for (int k = 0; k < D; k++)
					{
						X += dx[j];
						Y += dy[j];

						P[X][Y] = 1;
					}
				}
			}
		}

		int A = 0;

		for (int i = 0; i < N; i++)
		{
			A += P[JX[i]][JY[i]];
		}

		cout << A << endl;
	}
	

	return 0;
}

C++: #include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(itr,data) for(__typeof((data).begin()) itr=(data).begin();itr!=(data).end();++itr)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long UInt64;
typedef long long Int64;

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

using namespace std;

typedef pair<int ,int > P;

int n,m;



bool solve() {
    bool mat[21][21];
    int cnt=0;
    rep(i,21) rep(j,21) mat[i][j]=false;
    int x,y;
    rep(i,n) {
        cin>>x>>y;
        mat[x][y]=true;
    }

    x=10;
    y=10;
    
    cin>>m;

    rep(i,m) {
        char c;
        int d;
        cin>>c>>d;
        if(c == 'N') {
            while(d --> 0) {
                y++;
                if(mat[x][y]) {
                    cnt++;
                    mat[x][y]=false;
                }
            }
        }
        if(c == 'E') {
            while(d --> 0) {
                x++;
                if(mat[x][y]) {
                    cnt++;
                    mat[x][y]=false;
                }
            }
        }
        if(c == 'S') {
            while(d --> 0) {
                y--;
                if(mat[x][y]) {
                    cnt++;
                    mat[x][y]=false;
                }
            }
        }
        if(c == 'W') {
            while(d --> 0) {
                x--;
                if(mat[x][y]) {
                    cnt++;
                    mat[x][y]=false;
                }
            }
        }
    }

    return cnt == n;

}

int main()
{
    while(cin>>n) {
        if(!n) return 0;

        cout<<(solve()?"Yes":"No")<<endl;
    }
    
    
    return 0;
}