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  <stdio.h>
#include  <algorithm>
#include  <math.h>
#include  <vector>
#include  <string>
#include  <sstream>
#include  <numeric>
#include  <set>
#include <map>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int num = 0;
	while (cin >> num && num != 0)
	{
		vector<vector<int>> gem(22, vector<int>(22, 0));
		rep(i, num)
		{
			int tmp[2] = { 0 };
			cin >> tmp[0] >> tmp[1];
			gem[tmp[0]][tmp[1]] = 1;
		}
		int num2 = 0;  cin >> num2;
		int x = 10, y = 10, ans = 0;
		rep(i, num2)
		{
			char dir = 0; int m = 0;
			cin >> dir >> m;
			rep(j, m)
			{
				switch (dir)
				{
				case 'N': y++; break;
				case 'E': x++;  break;
				case 'S': y--;  break;
				case 'W': x--;  break;
				}
				num -= gem[x][y];
				gem[x][y] = 0;
			}
		}
		if (num == 0) { printf("Yes\n"); }
		else { printf("No\n"); }
	}
	return 0;
}

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

int main(){
	int x[100],y[100],t[100],s[100],cx,cy,sum;
	char d[100];
	int n,m;
	while(true){
		cin>>n;
		memset(t,0,sizeof(t));
		if(n==0){
			break;
		}
		
		for(int i=1;i<=n;i++){
			cin>>x[i]>>y[i];
			t[i]=1;
		}
		cx=10;
		cy=10;
		sum=0;
		cin>>m;
		for(int i=1;i<=m;i++){
			cin>>d[i]>>s[i];

			if(d[i]=='N'){
				for(int j=1;j<=s[i];j++){
					cy += 1;
					for(int k=1;k<=m;k++){
						if((x[k]==cx && y[k]==cy) && t[i]==1){
							sum += 1;
							t[i]=0;
						}
					}
				}
			}
			if(d[i]=='E'){
				for(int j=1;j<=s[i];j++){
					cx += 1;
					for(int k=1;k<=m;k++){
						if((x[k]==cx && y[k]==cy) && t[i]==1){
							sum += 1;
							t[i]=0;
						}
					}
				}
			}
			if(d[i]=='S'){
				for(int j=1;j<=s[i];j++){
					cy -= 1;
					for(int k=1;k<=m;k++){
						if((x[k]==cx && y[k]==cy) && t[i]==1){
							sum += 1;
							t[i]=0;
						}
					}
				}
			}
			if(d[i]=='W'){
				for(int j=1;j<=s[i];j++){
					cx -= 1;
					for(int k=1;k<=m;k++){
						if((x[k]==cx && y[k]==cy) && t[i]==1){
							sum += 1;
							t[i]=0;
						}
					}
				}
			}

		}
		if(sum==n){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
  int n;
  while(1){
    cin >> n;
    if(n==0) break;
    int a[21][21] = {0}, x, y;
    for(int i=0; i<n; i++){
      cin >> x >> y;
      a[x][y] = 1;
    }
    int m, X=10, Y=10, cnt=0;
    char d;
    int l;
    cin >> m;
    for(int j=0; j<m; j++){
      cin >> d >> l;
      for(int k=0; k<l; k++){
        if(d=='N') Y++;
        else if(d=='E') X++;
        else if(d=='S') Y--;
        else if(d=='W') X--;
        if(a[X][Y]==1){
          cnt++;
          a[X][Y]=0;
        }
      }
    }
    if(cnt==n) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

C++: #include <string.h>
#include <iostream>
#include <queue>
#include <complex>
#include <functional>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

typedef complex<double> P;
#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( a.real(), b.real() ) && EQ( a.imag(), b.imag() ) )

#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,n) for(int i=a;i<=n;i++)

//---------------------------------------------------------------------
struct Point {
	int x, y;
};
struct Oridir {
	char o;
	int d;
};
int n, m;
bool check[20];

vector<Point> juel(20);
vector<Oridir> mov(30);

int main() {
	while (cin >> n, n) {
		memset(check, false, sizeof(check));
		rep(i, n) cin >> juel[i].x >> juel[i].y;
		cin >> m;
		rep(i, m) cin >> mov[i].o >> mov[i].d;
		//??\???

		int x = 10, y = 10;
		//m????§???????????????????
		rep(i, m) {
			//d????§????
			while (mov[i].d--) {
				switch (mov[i].o) {
					case 'N': y++; break;
					case 'S': y--; break;
					case 'E': x++; break;
					case 'W': x--; break;
					default: break;
				}
				//?§???????????????????????????\?§???????????????§??????
				rep(j, n) {
					if (check[j]) continue;
					if (x == juel[j].x && y == juel[j].y) check[j] = true;
				}
			}
		}
		//??¨?§??????????

		int suc = true;
		rep(j, n) {
			if (!check[j]) {
				suc = false;
				cout << "NO" << endl;
				break;
			}
		}
		if (suc) cout << "YES" << endl;
	}
	return 0;
}

C++: #include <stdio.h>

typedef struct _Gem{
	int x;
	int y;
	bool hit;
} Gem;

static void
pick_gem(Gem* g, int n, int x, int y)
{
	for (int i = 0; i < n; i++) {
		if (!g[i].hit && g[i].x == x && g[i].y == y) {
			g[i].hit = true;
			return;
		}
	}
}

static bool
check_gem(Gem* g, int n)
{
	for (int i = 0; i < n; i++) {
		if (g[i].hit == false) {
			return false;
		}
	}
	
	return true;
}

int
main(void)
{
	
	char line[80];
	int n;
	int m;
	
	Gem g[20];
	
	char d[30];
	int l[30];

	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d", &n) != 1) {
			return 1;
		}

		if (n == 0) {
			break;
		}

		for (int i = 0; i < n; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			if (sscanf(line, "%d %d", &(g[i].x), &(g[i].y)) != 2) {
				return 1;
			}
			g[i].hit = false;
		}
		
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d", &m) != 1) {
			return 1;
		}
		
		for (int i = 0; i < m; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			if (sscanf(line, "%c %d", &(d[i]), &(l[i])) != 2) {
				return 1;
			}
		}
		
		int x = 10;
		int y = 10;
		for (int i = 0; i < m; i++) {
			if (d[i] == 'N') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, x, ++y);
				}
			} else if (d[i] == 'S') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, x, --y);
				}
			} else if (d[i] == 'E') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, ++x, y);
				}
			} else {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, --x, y);
				}
			}
		}
		printf("%s\n", (check_gem(g, n) ? "YES" : "NO"));
	}

	return 0;
}