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 <vector>

int main()
{
	int numGems = 0;;

	std::cin >> numGems;
	const int gridSize = 400;
	std::vector<bool> gems(gridSize * gridSize, false);
	int gemPointX = 0;
	int gemPointY = 0;
	if (numGems == 0)
	{
		std::cerr << "NO" << std::endl;
		return 0;
	}

	for (int i = 0; i < numGems; i++)
	{
		std::cin >> gemPointX;
		std::cin >> gemPointY;

		gems[gemPointY * gridSize + gemPointX] = true;
	}

	int numOrders = 0;
	std::cin >> numOrders;

	char direction = ' ';
	int distance = 0;
	std::pair<int, int> currentPoint(10, 10);
	for (int i = 0; i < numOrders; i++)
	{
		std::cin >> direction;
		std::cin >> distance;

		switch (direction)
		{
		case 'N':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.second += 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'E':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.first += 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'S':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.second -= 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'W':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.first -= 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		default:
			break;
		}
	}
	
	for (int i = 0; i < gridSize * gridSize; i++)
	{
		if (gems[i])//???????????????????????????
		{
			std::cerr << "NO" << std::endl;
			return 0;
		}
	}
	std::cerr << "YES" << std::endl;
	return 0;
}

C++: #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define debug(x) cerr<<#x<<": "<<x<<'\n'

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    while(cin >> n,n){
        bool a[21][21] = {};
        rep(i,n){
            int x,y;
            cin >> x >> y;
            a[x][y] = true;
        }
        int m;
        cin >> m;
        int x = 10;int y=10;
        a[10][10] = false;
        rep(i,m){
            string s;
            int d;
            cin >> s >> d;
            switch(s[0]){
                case 'N':
                rep(k,d){
                    y+=1;
                    a[x][y] = false;
                }
                break;
                case 'E':
                rep(k,d){
                    x+=1;
                    a[x][y] = false;
                }
                break;
                case 'S':
                rep(k,d){
                    y-=1;
                    a[x][y] = false;
                }
                break;
                case 'W':
                rep(k,d){
                    x-=1;
                    a[x][y] = false;
                }
                break;
            }
        }
        [&]()->void{
            rep(x,21) rep(y,21) if(a[x][y]){
                cout << "No" << endl;
                return;
            }
            cout << "Yes" << endl;
        }();


    }
    return 0;

}

C++: #include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;

string orCheck(bool matrix[21][21]){
    for(int i = 0; i < 21; i++){
        for(int j = 0; j < 21; j++){
            if(matrix[i][j]) return "NO";
        }
    }
    return "YES";
};

int main(int argc, const char * argv[])
{
    int n;
    while(true){
        cin >> n;
        if(n == 0) break;
        bool tile[21][21];
        for(int i = 0; i < 21; i++){
            for(int j = 0; j < 21; j++){
                tile[i][j] = false;
            }
        }
        
        // 宝石
        for(int i = 0; i < n; i++){
            int gx, gy;
            cin >> gx >> gy;
            tile[gy][gx] = true;
        }
        
        // 命令
        int m;
        cin >> m;
        int x = 10, y = 10;
        tile[y][x] = false;
        for(int i = 0; i < m; i++){
            char direction;
            int distance;
            cin >> direction >> distance;
            //cout << "direction: " << direction << "\tdistance: " << distance << "\n";
            
            switch (direction) {
                case 'N':
                    for(int j = 1; j < distance; j++)
                        tile[y + j][x] = false;
                    y += distance;
                    break;
                    
                case 'S':
                    for(int j = 1; j <= distance; j++)
                        tile[y - j][x] = false;
                    y -= distance;
                    break;
                    
                case 'E':
                    for(int j = 1; j <= distance; j++)
                        tile[y][x + j] = false;
                    x += distance;
                    break;
                    
                case 'W':
                    for(int j = 1; j <= distance; j++)
                        tile[y][x - j] = false;
                    x -= distance;
                    break;
            }
            //cout << "position: " << x << " " << y << "\n";
        }
        cout << orCheck(tile) << "\n";
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a[21][21] = {};
	int n;
	int x, y;
	while (cin >> n&&n != 0) {
		for (int i = 0; i < n; i++) {
			cin >> x >> y;
			a[x][y] = 1;
		}
		int m;
		x = 10, y = 10;
		int count = 0;
		int num;
		char c;
		for (cin >> m; m > 0; m--) {
			cin >> c >> num;
			for (int i = 0; i < num; i++) {
				if (c == 'N')y++;
				else if (c == 'E')x++;
				else if (c == 'S')y--;
				else x--;
				if (a[x][y]) {
					count++;
					a[x][y] = 0;
				}
			}

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