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 <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

using namespace std;

int main(void){
	int N, M, dif;
	int x, y, nx, ny;
	char c;

	while(1){
		int d[21][21] = {0};
		cin >> N;
		if(!N) break;
		for(int i=0; i<N; ++i){
			cin >> x >> y;
			d[x][y] = 1;
		}

		cin >> M;
		nx = ny = 10;
		d[nx][ny] = 0;
		for(int i=0; i<M; ++i){
			cin >> c >> dif;
			for(int j=0; j<dif; ++j){
				if(c == 'N'){
					ny++;
				}
				if(c == 'S'){
					ny--;
				}
				if(c == 'E'){
					nx++;
				}
				if(c == 'W'){
					nx--;
				}
				d[nx][ny] = 0;
			}
		}
	
		int check = 0;

		for(int i=0; i<21; ++i){
			for(int j=0; j<21; ++j){
				if(d[i][j] == 1) check = 1;
			}
		}

		if(check) cout << "No" << endl;
		else cout << "Yes" << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
#include <boost/functional/hash.hpp>
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUGM(xs) cout<<#xs<<": ";REP(_i,(int)xs.size())cout<<xs[_i]<<", ";cout<<endl;
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(xs) begin(xs),end(xs)
#define _1 first
#define _2 second
#define P(k, v) make_pair(k, v)
#define PII pair<int, int>
using namespace std;
template<class T> using V = vector<T>;
template<class K> using uset = unordered_set<K, boost::hash<K>>;
template<class K, class V> using umap = unordered_map<K, V, boost::hash<K>>;
int dx[] = { 0, 1, 0, -1 }, dy[] = { 1, 0, -1, 0 }; // ??? ??? ??? ???

int main() {
    while(true){
        int n; scanf("%d", &n);
        if(n==0)return 0;
        uset<PII> hs;
        REP(i,n){int f,s;scanf("%d %d",&f,&s);hs.emplace(P(f,s));};
        int m; scanf("%d", &m);
        umap<char,int> conv = {{'N',0},{'E',1},{'S',2},{'W',3}};
        V<PII> xys(m);
        REP(i,m){char c;scanf(" %c %d",&c,&xys[i]._2);xys[i]._1=conv[c];}
        int x=10,y=10;
        REP(i,m+1){
            REP(j,xys[i]._2+1){
                DEBUG(hs.erase(P(x,y)));
                x+=dx[xys[i]._1]*j, y+=dy[xys[i]._1]*j;
            }
        }
        if(hs.size()==0)printf("Yes");
        else printf("No");
    }
}

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][pos_x]){
                        gem_num++;
                        gem[pos_y][pos_x] = false;
                    }
                }
                break;
            case 'E':
                rep(dx, leng){
                    if(gem[pos_y][++pos_x]){
                        gem_num++;
                        gem[pos_y][pos_x] = false;
                    }
                }
                break;
            case 'S':
                rep(dy, leng){
                    if(gem[--pos_y][pos_x]){
                        gem_num++;
                        gem[pos_y][pos_x] = false;
                    }
                }
                break;
            case 'W':
                rep(dx, leng){
                    if(gem[pos_y][--pos_x]){
                        gem_num++;
                        gem[pos_y][pos_x] = false;
                    }
                }
                break;
            }

        }

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

C++: #include <iostream>
using namespace std;
int main(){
	int N;	
	while(cin >> N, N){
		int m[21][21] = {0};
		for(int i = 0; i < N; ++i){
			int x, y; 
			cin >> x >> y;
			++m[x][y];	
		}
		int px = 10, py = 10;
		int M;
		cin >> M;
		int ans = m[px][py];
		for(int i = 0; i < M; ++i){
			char d; int l;
			cin >> d >> l;
			int dx = d == 'E' ? 1 : d == 'W' ? -1 : 0;
			int dy = d == 'N' ? 1 : d == 'S' ? -1 : 0;
			for(int j = 0; j < l; ++j){
				px += dx, py += dy;
				ans += m[px][py];
				m[px][py] = 0;	
			}
		}
		if (ans == N) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}