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 <cstring>
using namespace std;
int main() {
    int N;
    while (cin >> N && N != 0) {
        int gems[21][21]; // 宝石の位置を記録する配列
        memset(gems, 0, sizeof gems);

        int x, y;
        for (int i=0; i<N; ++i) {
            cin >> x >> y;
            gems[y][x] = 1;
        }

        int trace[21][21]; // 回収範囲を記録する配列
        memset(trace, 0, sizeof trace);

        int nx = 10; int ny = 10; // 初期位置

        int M; cin >> M;

        int dx[256], dy[256];
        dx['N'] = 0; dx['E'] = 1; dx['W'] = -1; dx['S'] = 0; 
        dy['N'] = 1; dy['E'] = 0; dy['W'] = 0;  dy['S'] = -1;

        for (int i=0; i<M; ++i) {
            trace[ny][nx] = 1;

            char d; cin >> d;
            int l; cin >> l;
            for (int j=0; j<l; ++j) {
                nx += dx[d];
                ny += dy[d];
                trace[ny][nx] = 1;
            }
        }

        string output = "Yes";
        for (int i=0; i<21; ++i) {
            for (int j=0; j<21; ++j) {
                if (gems[i][j] == 1 && trace[i][j] != 1) {
                    output = "No";
                }
            }
        }

        cout << output << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<climits>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    int n;
    while (cin >> n && n) {
        int table[21][21] = {0};
        rep(i, n) {
            int x, y; cin >> x >> y;
            table[x][y] = 1;
        }
        int m; cin >> m;
        int nx = 10, ny = 10;
        int c = 0;
        rep(i, m) {
            char d; int l; cin >> d >> l;
            string dir = "EWSN";
            int key = 0;
            rep(j, dir.size()) if (dir[j] == d) key = j;
            while (l--) {
                nx += dx[key];
                ny += dy[key];
                if (table[nx][ny] == 1) {c++; table[nx][ny]--;}
            }
        }
        if (c == n) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

C++: #include <iostream>

using namespace std;

int f[21][21];

int main() {
	int n;
	while (cin >> n, n) {
		f[21][21]={};

		for (int i = 0; i<n; i++) {
			int x, y;
			cin >> x >> y;
			f[y][x] = 1;
		}

		int x = 10, y = 10;

		int m;
		cin >> m;
		for (int i = 0; i<m; i++) {
			char dir;
			int step;
			cin >> dir >> step;
			while (step--) {
				if (dir == 'N') { y++; }
				else if (dir == 'S') { y--; }
				else if (dir == 'E') { x++; }
				else { x--; }
				f[y][x] = 0;
			}
		}

		bool yes = true;
		for (int y = 0; y <= 20; y++) {
			for (int x = 0; x <= 20; x++) {
				if (f[y][x]) {
					yes = false;
					goto ANSWER;
				}
			}
		}
	ANSWER:
		if (yes) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b)-1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n)-1; i >= 0; i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define loop while(true)

#define PB push_back
#define pb push_back
#define MP make_pair
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()

#define PII pair<int, int>
#define pii pair<int, int>
#define VB vector<bool>
#define VVB vector<vector<bool> >
#define VI vector<int>
#define VVI vector<vector<int> >

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

signed main()
{
    loop{
        int n;
        cin >> n;
        if(n == 0) break;

        VVB gem(21);
        rep(i, 21){
            gem[i].resize(21);
        }
        
        rep(i, n){
            int x, y;
            cin >> x >> y;
            gem[y][x] = true;
        }

        int pos_x = 10;
        int pos_y = 10;

        int m;
        cin >> m;
        int gem_num = 0;
        rep(i, m){
            char dir;
            int leng;
            cin >> dir >> leng;
            switch(dir){
            case 'N':
                rep(dy, leng){
                    if(gem[pos_y+dy+1][pos_x]) gem_num++;
                }
                pos_y += leng;
                break;
            case 'E':
                rep(dx, leng){
                    if(gem[pos_y][pos_x+dx+1]) gem_num++;
                }
                pos_x += leng;
                break;
            case 'S':
                rep(dy, leng){
                    if(gem[pos_y-dy-1][pos_x]) gem_num++;
                }
                pos_y -= leng;
                break;
            case 'W':
                rep(dx, leng){
                    if(gem[pos_y][pos_x-dx-1]) gem_num++;
                }
                pos_x -= leng;
                break;
            }

        }

        if(gem_num >= n){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    
    return 0;
}