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 <cstdio>
#include <stack>
#include <queue>

#define MAX 32

using namespace std;

int main(void) {
	while(1) {
		int n, m;
		int x[MAX], y[MAX];
		int m_x = 10, m_y = 10;
		char d;
		int l;
		bool moved[MAX][MAX] = {false};
		moved[10][10] = true;
		bool collect = true;

		scanf("%d", &n);
		if(n == 0) break;
		for(int i = 0; i < n; i++) {
			scanf("%d %d", &x[i], &y[i]);
		}
		scanf("%d", &m);
		for(int i = 0; i < m; i++) {
			cin >> d >> l;
			if(d == 'N') {
				for(int j = 0; j <= l; j++) {
					moved[m_x][m_y + j] = true;
				}
				m_y += l;
			}
			if(d == 'E') {
				for(int j = 0; j <= l; j++) {
					moved[m_x + j][m_y] = true;
				}
				m_x += l;
			}
			if(d == 'S') {
				for(int j = 0; j <= l; j++) {
					moved[m_x][m_y - j] = true;
				}
				m_y -= l;
			}
			if(d == 'W') {
				for(int j = 0; j <= l; j++) {
					moved[m_x - j][m_y] = true;
				}
				m_y -= l;
			}
		}

		for(int i = 0; i < n; i++) {
			if(!moved[x[i]][y[i]]) collect = false;
		}

		printf("%s\n", collect ? "Yes" : "No");
	}
	return 0;
}

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

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

int main()
{
  while(1){
    int N;
    cin >> N;
    if(N == 0){
      break;
    }else{
      int x, y;
      int planet[21][21];
      fill(&planet[0][0], &planet[21][0], 0);
      REP(i, N){
        cin >> x >> y;
        planet[x][y] = 1;
      }
      int M;
      char d;
      int l;
      int px, py;
      px = py = 10;
      cin >> M;
      REP(i, M){
        cin >> d >> l;
        if(d == 'N'){
          REP(j, l + 1)
            planet[px][py + j] = 0;
          py += l;
        }else if(d == 'E'){
          REP(j, l + 1)
            planet[px + j][py] = 0;
          px += l;
        }
        else if(d == 'S'){
          REP(j, l + 1)
            planet[px][py - j] = 0;
          py -= l;
        }else{
          REP(j, l + 1)
            planet[px - j][py] = 0;
          px -= l;
        }
      }
      int c = 0;
      REP(i, 21)
        REP(j, 21)
          if(planet[i][j])
            c++;
      if(c)
        cout << "No" << endl;
      else
        cout << "Yes" << endl;
    }
  }
}

C++: #include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, counter = 0, w, h;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(50, vector<ll>(50, 0));

int main()
{
	while (true)
	{
		cin >> n;
		if (!n) return 0;
		vv.clear();
		counter = 0;
		REP(i, n)
		{
			ll a, b;
			cin >> a >> b;
			vv[a][b] = 1;
		}
		ll m;
		cin >> m;
		ll px = 10, py = 10;
		if (vv[px][py]) counter++;
		REP(i,m)
		{
			char c;
			ll d;
			cin >> c >> d;
			if (c == 'N')
			{
				REP(i, d)
				{
					py++;
					if (vv[px][py])
					{
						counter++;
						vv[px][py] = 0;
					}
				}
			}
			if (c == 'E')
			{
				REP(i, d)
				{
					px++;
					if (vv[px][py])
					{
						counter++;
						vv[px][py] = 0;
					}
				}
			}
			if (c == 'W')
			{
				REP(i, d)
				{
					px--;
					if (vv[px][py])
					{
						counter++;
						vv[px][py] = 0;
					}
				}
			}
			if (c == 'S')
			{
				REP(i, d)
				{
					py--;
					if (vv[px][py])
					{
						counter++;
						vv[px][py] = 0;
					}
				}
			}
		}
		cout << (counter == n ? "Yes" : "No") << endl;
	}
}

C++: #include <stdio.h>
#include <cmath>
#include <iostream>

using namespace std;

int main() {
	int k;
	char d;
	int a,b;
	int counter;
	int robx;
	int roby;
	int kari;
	while (cin >> k) {
		if (k == 0) {
			break;
		}
		counter = 0;
		int hyou[21][21] = {0};
		int koudou[30][2] = {0};
		for (int i = 0; i < k; i++) {
			cin >> a >> b;
			hyou[a][b] = 1;
			counter++;
		}
		cin >> k;
		for (int i = 0; i < k; i++) {
			cin >> d >> a;
			if (d == 'N') {
				koudou[i][0] = a;
			} else if (d == 'S') {
				koudou[i][0] = -a;
			} else if (d == 'E') {
				koudou[i][1] = a;
			} else {
				koudou[i][1] = -a;
			}
		}
		robx = 10;
		roby = 10;
		
		for (int i = 0; i < k; i++) {
			if (koudou[i][0] == 0) {
				kari = 1;
			} else {
				kari = 0;
			}
			for (int j = 0; j < abs(koudou[i][kari]); j++) {
				if (koudou[i][kari] > 0) {
					if (kari == 0) {
						roby++;
					} else {
						robx++;
					}
				} else {
					if (kari == 0) {
						roby--;
					} else {
						robx--;
					}
				}
				//printf("%d %d\n",robx,roby);
				if (hyou[robx][roby] == 1) {
					hyou[robx][roby] = 0;
					counter--;
				}
			}
		}
		if (counter == 0) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}

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

int main(){
    int n, m, x, y, l;
    bool t[21][21];
    char d;
    while(true){
	cin >> n;
	memset(t, false, sizeof(t));
	if(n == 0)return 0;
	int xx = 10, yy = 10;
	for(int i = 0;i < n;i++){
	    cin >> x >> y;
	    t[x][y] = true;
	}
	cin >> m;
	for(int i = 0;i < m;i++){
	    cin >> d >> l;
	    int xs = 0, ys = 0;
	    if(d == 'N')ys = 1;
	    if(d == 'E')xs = 1;
	    if(d == 'S')ys = -1;
	    if(d == 'W')xs = -1;
	    while(l--){
		xx += xs, yy += ys;
		t[xx][yy] = false;
	    }
	}
	bool comp = true;
	for(int i = 0;i <= 20;i++)
	    for(int j = 0;j <= 20;j++)
		if(t[i][j])
		    comp = false;
	if(comp)
	    cout << "YES" << endl;
	else
	    cout << "NO" << endl;
    }
}