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;

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){
    CININIT;
    int n;
    while(cin>>n){
        if(n==0) break;
        bool table[21][21];

        rep(i,21) rep(j,21) table[i][j]=false;
        for(int i=0;i<n;i++){
            int a,b;
            cin>>a>>b;
            table[a][b] = true;
        }

        int m;cin>>m;
        int x=10,y=10;
        int cnt=0;
        rep(i,m){
            char d;
            int l;
            cin>>d>>l;
            for(int j=0;j<l;j++){
                if(d=='N') y+=1;
                if(d=='E') x+=1;
                if(d=='S') y-=1;
                if(d=='W') x-=1;
                assert(x>=0 and x<=20 and y<=20 and y>=0);
                if(table[x][y]) cnt++;
            }
        }

        if(n==cnt){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

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


int d[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
char dc[5] = "NESW";
char Map[25][25];

main(){
	int x,y,n,m,i,j;
	while(cin >> n, n){
		int sx, sy;
		for(i=0;i<=20;i++)
			for(j=0;j<=20;j++)
				Map[i][j] = 0;
		for(i=0;i<n;i++){
			cin >> x >> y;
			Map[x][y] = 1;
		}
		cin >> m;
		int ans = 0;
		x=10;y=10;
		for(j=0;j<m;j++){
			char c;
			int t;
			cin >> c >> t;
			int dt;
			for(i=0;i<4;i++) if(c == dc[i]) dt=i;
			for(i=0;i<t;i++){
				x += d[dt][0];
				y += d[dt][1];
				if(Map[x][y]){
					ans ++;
					Map[x][y] = 0;
				}
			}
		}
		cout << (ans == n ? "Yes":"No") << endl;
	}
	return 0;
}

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

int main(){
    while (1){
        int n;
        cin >> n;
        if (n == 0){
            break;
        }

        vector<pair<int, int> > gems(n);

        for (auto itr = gems.begin(); itr != gems.end(); ++itr){
            int x, y;
            cin >> x >> y;
            *itr = make_pair(x, y);
        }

        int m;
        cin >> m;

        pair<int, int> pos(10, 10);
        int cnt = 0;

        for (int i = 0; i < m; i++){
            char dir;
            int step;
            cin >> dir >> step;
            if (dir == 'N'){
                for (int j = 0; j < step; j++){
                    pos.second++;
                    auto isGems = find(gems.cbegin(), gems.cend(), pos);
                    if (isGems != gems.cend()){
                        cnt++;
                    }
                }
            }
            else if (dir == 'E'){
                for (int j = 0; j < step; j++){
                    pos.first++;
                    auto isGems = find(gems.cbegin(), gems.cend(), pos);
                    if (isGems != gems.cend()){
                        cnt++;
                    }
                }
            }
            else if (dir == 'S'){
                for (int j = 0; j < step; j++){
                    pos.second--;
                    auto isGems = find(gems.cbegin(), gems.cend(), pos);
                    if (isGems != gems.cend()){
                        cnt++;
                    }
                }
            }
            else{
                for (int j = 0; j < step; j++){
                    pos.first--;
                    auto isGems = find(gems.cbegin(), gems.cend(), pos);
                    if (isGems != gems.cend()){
                        cnt++;
                    }
                }
            }
        }

        cout << ((cnt == n) ? "Yes" : "No") << endl;
    }


    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n,m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

ll a[21][21];

int main()
{
	while (1) {
		cin >> n;
		if (n == 0) {
			return 0;
		} else {
			memset(a, 0, sizeof(a));

			REP(i, n)
			{
				ll x, y;
				cin >> x >> y;
				a[y][x] = 1;
			}

			ll x = 10, y = 10;
			ll cnt = 0;

			ll m;
			cin >> m;
			REP(i, m)
			{
				char c;
				ll step;
				cin >> c >> step;
				REP(j, step)
				{
					if (c == 'N') { y++; } else if (c == 'S') { y--; } else if (c == 'E') { x++; } else { x--; }

					if (a[y][x]) {
						a[y][x] = 0;
						cnt++;
					}
				}
			}

			if (cnt == n) {
				cout << "Yes" << endl;
			} else {
				cout << "No" << endl;
			}
		}
	}
}