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 = 21;
	std::vector<bool> gems(gridSize * gridSize, false);
	gems.resize(gridSize * gridSize);
	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<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define all(c) (c).begin(), (c).end()

using namespace std;
template<class T> inline void chmax(T& a, T b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, T b) { if(b < a) a = b; }

int cx,cy,cnt;

int main() {
	int N,M;
	while(cin >> N && N) 
	{
		int light[21][21];
		int x,y;
		rep(j,21) {
			rep(i,21){ light[i][j] = false; }
		}
		rep(i,N) {	
			cin >> x >> y;
			light[x][y] = true;
		}
		cin >> M;
		char angle;
		int move;
		cx=10,cy=10,cnt=0;
		rep(i,M) {
			cin >> angle >> move;
			if (angle == 'N') {
				rep(i,move) {
					if (light[cx][cy+i+1]) {cnt++;}
				}
				cy += move;
			}
			else if (angle == 'E') { //東
				rep(i,move) {
					if (light[cx+i+1][cy]) {cnt++;}
				}
				cx += move;
			}
			else if (angle == 'S') { //南
				rep(i,move) {
					if (light[cx][cy-i-1]) {cnt++;}
				}
				cy -= move;
			}
			else if (angle == 'W') { //西
				rep(i,move) {
					if (light[cx-i-1][cy]) {cnt++;}
				}
				cx -= move;
			}
		}
		if (cnt == N) { 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 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;

        vector<bool> gem_x(20, false);
        vector<bool> gem_y(20, false);
        rep(i, n){
            int x, y;
            cin >> x >> y;
            gem_x[x] = true;
            gem_y[y] = 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':
                pos_y += leng;
                break;
            case 'E':
                pos_x += leng;
                break;
            case 'S':
                pos_y -= leng;
                break;
            case 'W':
                pos_x -= leng;
                break;
            }

            if(gem_x[pos_x] && gem_y[pos_y]) gem_num++;
        }

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

C++: #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <map>
#include <numeric>
#include <stack>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <strstream>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef long long ll;

int x=10,y=10;

int measure(char c,int m,bool jewel[][21],int flag){
	if(c == 'N'){
		rep(i,m){
			y++;
			if( jewel[x][y] ){
				flag++;
				jewel[x][y] = false;
			}
		}
	}
	else if(c == 'E'){
		rep(i,m){
			x++;
			if( jewel[x][y] ){
				flag++;
				jewel[x][y] = false;
			}
		}
	}
	else if(c == 'S'){
		rep(i,m){
			y--;
			if( jewel[x][y] ){
				flag++;
				jewel[x][y] = false;
			}
		}
	}
	else if(c == 'W'){
		rep(i,m){
			x--;
			if( jewel[x][y] ){
				flag++;
				jewel[x][y] = false;
			}
		}
	}
	return flag;
}

int main(){
	int n,m;

	while( cin >> n ,n){
		x=10,y=10;
		bool jewel[21][21] = {0};
		int flag = 0;
		
		rep(i,n){
			int x,y;
			cin >> x >> y;
			jewel[x][y] = true;
		}
		
		cin >> m;
		
		rep(i,m){
			char compass;
			int di;
			cin >> compass >> di;
			flag += measure(compass,di,jewel,0);
		}
		if( n == flag ) puts("Yes");
		else puts("No");
	}
	return 0;
}