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;

bool solve(int N) {
    bool exist[21][21] = {};
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        exist[x][y] = true;
    }
    int M;
    cin >> M;
    map<char, pair<int, int>> m;
    m['N'] = make_pair(0, 1);
    m['E'] = make_pair(1, 0);
    m['S'] = make_pair(0, -1);
    m['W'] = make_pair(-1, 0);
    int cx = 10, cy = 10;
    for (int i = 0; i < M; i++) {
        char d;
        int l;
        cin >> d >> l;
        for (int j = 0; j < l; j++) {
            if (exist[cx][cy]) {
                exist[cx][cy] = false;
            }
            cx += m[d].first;
            cy += m[d].second;
        }
        if (exist[cx][cy]) {
            exist[cx][cy] = false;
        }
    }
    bool res = true;
    for (int i = 0; i < 21; i++) {
        for (int j = 0; j < 21; j++) {
            if (exist[i][j]) {
                res = false;
            }
        }
    }
    return res;
}

int main() {
    int N;
    while (true) {
        cin >> N;
        if (!N) return 0;
        cout << (solve(N) ? "Yes" : "No") << endl;
    }
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
#define MAX 32

typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int n, m;

bool exist[MAX][MAX];

int main(void) {
    while (cin >> n) {
        if (n == 0) break;
        for (int i = 0; i <= 20; i++) {
            for (int j = 0; j <= 20; j++) {
                exist[i][j] = false;
            }
        }
        for (int i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            exist[y][x] = true;
        }
        int nowx = 10;
        int nowy = 10;
        cin >> m;
        for (int i = 0; i < m; i++) {
            //printf("now pos (%d %d)\n", nowx, nowy);
            char d;
            int l;
            cin >> d >> l;
            if (exist[nowy][nowx]) exist[nowy][nowx] = false;
            if (d == 'N') {
                for (int j = 0; j < l; j++) {
                    nowy++;
                    if (exist[nowy][nowx]) exist[nowy][nowx] = false;
                }
            }
            if (d == 'S') {
                for (int j = 0; j < l; j++) {
                    nowy--;
                    if (exist[nowy][nowx]) exist[nowy][nowx] = false;
                }
            }
            if (d == 'E') {
                for (int j = 0; j < l; j++) {
                    nowx++;
                    if (exist[nowy][nowx]) exist[nowy][nowx] = false;
                }
            }
            if (d == 'W') {
                for (int j = 0; j < l; j++) {
                    nowx--;
                    if (exist[nowy][nowx]) exist[nowy][nowx] = false;
                }
            }
        }
        if (exist[nowy][nowx]) exist[nowy][nowx] = false;
        bool ok = true;
        for (int y = 0; y <= 20; y++) {
            for (int x = 0; x <= 20; x++) {
                if (exist[y][x]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) break;
        }
        if (ok) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}