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 <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

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

string s = "ENWS";

int main()
{
    while (cin >> N)
    {
        if (N == 0)
            return 0;
        vector<int> x(N), y(N);
        for (int i = 0; i < N; i++)
            cin >> x[i] >> y[i];
        int X = 10, Y = 10, M;
        cin >> M;
        for (int i = 0; i < M; i++)
        {
            char c;
            int a, dic;
            cin >> c >> a;
            for (int j = 0; j < 4; j++)
            {
                if (s[j] == c)
                    dic = j;
            }
            for (int j = 0; j < a; j++)
            {
                X += dx[dic], Y += dy[dic];
                for (int k = 0; k < N; k++)
                {
                    if (X == x[k] && Y == y[k])
                        x[k] = -1, y[k] = -1;
                }
            }
        }
        bool f = true;
        for (int j = 0; j < N; j++)
        {
            if (x[j] != -1 && y[j] != -1)
                f = false;
        }
        cout << (f ? "Yes" : "No") << endl;
    }
}

C++: #include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i=0;i<n;++i)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=n-1;0<=i;--i)
#define rRep(i,n) for(int i=n;0<i;--i)
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define scani(a) scanf("%d",&a)
#define scanr(a) scanf("%lf",&a)
#define scans(s) scanf("%s",s)
#define printi(a) printf("%d",a)
#define printr(a) printf("%lf",a)
#define prints(s) printf("%s",s)
#define is_odd(n) (n&1)
#define is_even(n) ((n+1)&1)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define all(x) x.begin(), x.end()
#define EPS 1e-8
#define INF 1e8
#define PI acos(-1.0)

typedef double Real;
typedef int Int;
typedef vector<Int> vi;
typedef vector<vector<Int> > vvi;
typedef pair<Int,Int> pii;

inline Real sr(Real a) {return sqrt(max(a, (Real)0));}
template <typename T> inline T sq(T a) {return a * a;}
const vi dy = {-1, 0, 1, 0}, dx = {0, -1, 0, 1};
vector<string> split(const string &s, char d) {vector<string> r;stringstream t(s);string x;while(getline(t,x,d))if(!x.empty())r.push_back(x);return r;}

void solve()
{
  for(;;)
  {
    Int N; scani(N);
    if(N == 0) break;

    vvi field(21, vi(21, 0));
    rep(i, N)
    {
      Int x, y; scani(x); scani(y);
      ++field[y][x];
    }

    Int M; scani(M);
    Int x = 10, y = 10, count = field[10][10] ? 1 : 0;
    rep(_, M)
    {
      char d; Int l; cin >> d; scani(l);
      Int dx = 0, dy = 0;
      switch(d)
      {
        case 'N': dy += l; break;
        case 'S': dy -= l; break;
        case 'E': dx += l; break;
        case 'W': dx -= l; break;
      }

      Int ty = y, tx = x;
      if(dy!=0) for(;ty != y+dy;)
      {
        0<dy ? ++ty : --ty;
        if(field[ty][x]) ++count;
      }
      else if(dx!=0) for(;tx != x+dx;)
      {
        0<dx ? ++tx : --tx;
        if(field[y][tx]) ++count;
      }
      y = ty;
      x = tx;
    }

    puts((N == count) ? "Yes" : "No");
  }
  
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(9);

  solve();

  return 0;
}

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

int main()
{
  int N, M;
  while( cin >> N, N ) {
    int treasure[21][21] = {{0}};
    for(int i=0; i<N; i++) {
      int x, y;
      cin >> x >> y;
      treasure[y][x] = 1;
    }

    int x = 10, y = 10;
    int cnt = 0;
    cin >> M;
    while( M-- ) {
      char d;
      int l;
      cin >> d >> l;
      if( d == 'N' ) {
	for(int i=y; i<=y+l; i++) {
	  if( treasure[i][x] ) cnt++, treasure[i][x] = 0;
	}
	y += l;
      }
      if( d == 'E' ) {
	for(int i=x; i<=x+l; i++) {
	  if( treasure[y][i] ) cnt++, treasure[y][i] = 0;
	}
	x += l;
      }
      if( d == 'S' ) {
	for(int i=y; i>=y-l; i--) {
	  if( treasure[i][x] ) cnt++, treasure[i][x] = 0;
	}
	y -= l;
      }
      if( d == 'W' ) {
	for(int i=x; i>=x-l; i--) {
	  if( treasure[y][i] ) cnt++, treasure[y][i] = 0;
	}
	x -= l;
      }
    }

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