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>
#include<algorithm>
using namespace std;

int main(){
    int n, m, x, y, l;
    bool t[21][21];
    char d;
    while(true){
	cin >> n;
	if(n == 0)return 0;
	memset(t, false, sizeof(t));
	int xx = 10, yy = 10;
	for(int i = 0;i < n;i++){
	    cin >> x >> y;
	    t[x][y] = true;
	}

	cin >> m;
	for(int i = 0;i < m;i++){
	    cin >> d >> l;
	    int xs = 0, ys = 0;
	    if(d == 'N')ys = 1;
	    if(d == 'E')xs = 1;
	    if(d == 'S')ys = -1;
	    if(d == 'W')xs = -1;
	    while(l--){
		xx += xs, yy += ys;
		t[xx][yy] = false;
	    }
	}

	bool comp = true;
	for(int i = 0;i <= 20;i++)
	    for(int j = 0;j <= 20;j++)
		if(t[i][j])
		    comp = false;
	if(comp)
	    cout << "Yes" << endl;
	else
	    cout << "No" << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
#include <queue>
#define INF 1e+18
#define int long long
using namespace std;

signed main(){
	int n,m;
	while(cin >> n,n){
		int field[21][21] = {};
		bool used[21][21] = {};
		for(int i = 0;i < n;i++){
			int x,y;
			cin >> x >> y;
			field[x][y] = 1;
		}
		cin >> m;
		int x = 10,y = 10;
		for(int i = 0;i < m;i++){
			char d;
			int l;
			cin >> d >> l;
			for(int j = 0;j < l;j++){
				if(d == 'N') used[x][++y] = true;
				else if(d == 'S') used[x][--y] = true;
				else if(d == 'E') used[++x][y] = true;
				else used[--x][y] = true;
			}
		}
		int cnt = 0;
		for(int i = 0;i <= 20;i++){
			for(int j = 0;j <= 20;j++){
				if(used[i][j]) cnt += field[i][j];
			}
		}
		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 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':
                pos_y += leng;
                break;
            case 'E':
                pos_x += leng;
                break;
            case 'S':
                pos_y -= leng;
                break;
            case 'W':
                pos_x -= leng;
                break;
            }

            if(gem[pos_y][pos_x]) gem_num++;
        }

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int d1[4] = { 1,0,-1,0 };
int d2[4] = { 0,1,0,-1 };

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

		vector<VI> a(29, VI(29));

		rep(i, n) {
			int X, Y;
			cin >> X >> Y;
			a[X][Y] = 1;
		}

		int x = 10, y = 10;
		int m; cin >> m;
		rep(i, m) {
			char d; int l, D;
			cin >> d >> l;
			if (d == 'N')D = 1;
			if (d == 'E')D = 0;
			if (d == 'S')D = 3;
			if (d == 'W')D = 2;
			
			rep(j, l) {
				x += d1[D];
				y += d2[D];
				a[x][y] = 0;
			}
		}

		bool flag = true;
		rep(i, 20)rep(j, 20) {
			if (a[i][j] == 1)flag = false;
		}
		puts(flag ? "Yes" : "No");
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int map[21][21],n,a,b,c,d,x,y,n2;
	char h;
	while(cin>>n){
		if(n==0)break;
		for(int i=0;i<21;i++)for(int j=0;j<21;j++)map[i][j]=0;
		for(int i=0;i<n;i++){cin>>a>>b;map[b][a]++;}
		cin>>n2;c=0;x=y=10;
		for(int i=0;i<n2;i++){
			cin>>h;
			cin>>d;
			if(h=='N')for(int j=0;j<d;j++){y++;if(map[y][x]!=0){map[y][x]=0;c++;cout<<y;}}
			else if(h=='S')for(int j=0;j<d;j++){y--;if(map[y][x]==1){map[y][x]=0;c++;}}
			else if(h=='E')for(int j=0;j<d;j++){x++;if(map[y][x]==1){map[y][x]=0;c++;}}
			else if(h=='W')for(int j=0;j<d;j++){x--;if(map[y][x]==1){map[y][x]=0;c++;}}
		}
		if(c==n)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

C++: #include <cstdio>
using namespace std;

int main()
{
	int num;
	while (scanf("%d", &num), num){
		int map[100][100] = {0};
		
		for (int i = 0; i < num; i++){
			int x, y;
			scanf("%d %d", &x, &y);
			map[x][y] = 1;
		}
		
		int X = 10;
		int Y = 10;
		
		int M;
		scanf("%d", &M);
		for (int i = 0; i < M; i++){
			char c;
			int l;
			scanf(" %c %d", &c, &l);
			
			while (l > 0){
				switch (c){
					case 'N':
					Y++;
					break;
					
					case 'E':
					X++;
					break;
					
					case 'S':
					Y--;
					break;
					
					case 'W':
					X--;
					break;
				}
				num -= map[X][Y];
				map[X][Y] = 0;
				l--;
			}
		}
		
		if (num == 0){
			puts("Yes");
		}
		else {
			puts("No");
		}
	}
	
	return 0;
}