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 <cstdio>
#include <algorithm>

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

using namespace std;

int n, m;
bool x[21][21];

int main(){
	while(scanf("%d", &n), n){
		rep(i, 21){
			fill_n(x[i], 21, false);
		}
		rep(i, n){
			int a, b;
			scanf("%d%d", &a, &b);
			x[a][b] = true;
		}
		scanf("%d", &m);
		int p = 10, q = 10;
		int ans = 0;
		if(x[p][q]){
			++ans;
			x[p][q] = false;
		}
		rep(i, m){
			char c;
			int d;
			scanf(" %c %d", &c, &d);
			int dx = 0, dy = 0;
			switch(c){
			case 'N':
				dy = 1;
				break;

			case 'E':
				dx = 1;
				break;

			case 'S':
				dy = -1;
				break;

			case 'W':
				dx = -1;
				break;
			}

			rep(j, d){
				p += dx;
				q += dy;
				if(x[p][q]){
					++ans;
					x[p][q] = false;
				}
			}
		}
		printf("%s\n", n == ans ? "Yes" : "No");
	}
	return 0;
}

C++: #include <iostream>
#include <string>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
	int N;
	int M;
	int px_R,py_R;
	int all_gem;
	int ope;
	std::string move;

	cin >> N;
	
	while (N != 0) {
		all_gem = 1;
		px_R = 10;
		py_R = 10;
		int *gem_x = new int[ N ];
		int *gem_y = new int[ N ];
		int *gem = new int[ N ];

		int px_G,py_G;
		for (int i = 0; i < N; i++) {
			cin >> gem_x[i];
			cin >> gem_y[i];
			gem[i] = 1;
		}

		cin >> M;
		for (int i = 0; i < M; i++) {
			cin >> move;
			cin >> ope;

			if (move == "N") {
				for (int j = 0; j < N; j++) {
					if (gem[j]) {
						if (gem_x[j] == px_R) {
							if (gem_y[j] >= py_R && gem_y[j] <= (py_R+ope)) {
								gem[j] = 0;
							}
						}
					}
				}
				py_R += ope;
			}
			if (move == "S") {
				for (int j = 0; j < N; j++) {
					if (gem[j]) {
						if (gem_x[j] == px_R) {
							if (gem_y[j] <= py_R && gem_y[j] >= (py_R-ope)) {
								gem[j] = 0;
							}
						}
					}
				}
				py_R -= ope;
			}
			if (move == "E") {
				for (int j = 0; j < N; j++) {
					if (gem[j]) {
						if (gem_y[j] == py_R) {
							if (gem_x[j] >= px_R && gem_x[j] <= (px_R+ope)) {
								gem[j] = 0;
							}
						}
					}
				}
				px_R += ope;
			}
			if (move == "W") {
				for (int j = 0; j < N; j++) {
					if (gem[j]) {
						if (gem_y[j] == py_R) {
							if (gem_x[j] <= px_R && gem_x[j] >= (px_R-ope)) {
								gem[j] = 0;
							}
						}
					}
				}
				px_R -= ope;
			}
		}
		for (int i = 0; i < N; i++) {
			if (gem[i] == 1){
				all_gem = 0;
				break;
			}
		}
		if (all_gem) {
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
		
		cin >> N;
		delete[] gem_x;
		delete[] gem_y;
		delete[] gem;
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>

int main(void)
{
	int n,m; //宝の個数、移動回数
	int i; //for変数
	int math[21][21]; //宝の位置、ある場所は1,ない場所は0
	int x=10,y=10;
	int a,b; 
	char d; //方角
	int l; //移動量
	int count; //見つけた宝の数
	int yL=y,xL=x;
	
	for(;;)
	{
		scanf("%d",&n);
		if(n==0) break;
		for(a=0; a<21; a++)
		{
			for(b=0; b<21; b++)
			{
				math[a][b]=0;
			}
		}
		for(i=0; i<n; i++)
		{
			scanf("%d  %d",&a,&b);
			math[a][b]=1;
		}
		
		scanf("%d",&m);
		for(i=0; i<m; i++)
		{
			scanf("%s %d",&d,&l);
		
			if(math[10][10]==1)
			{
				count++;
				math[10][10]=0;
			}	
			if(d=='N')
			{
				yL+=l;
				for(y=y+1; y<=yL; y++)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				y--;
			}
			if(d=='E')
			{
				xL+=l;
				for(x=x+1; x<=xL; x++)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				x--;
			}
			if(d=='S')
			{
				yL-=l;
				for(y=y-1; y>=yL; y--)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				y++;
			}
			if(d=='W')
			{
				xL-=l;
				for(x=x-1; x>=xL; x--)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				x++;
			}
		}
		
		if(count==n) printf("Yes\n");
		else printf("No\n");
		count=0;
		x=10;y=10;
	}
	
	return 0;
}

C++: #include<iostream>
#include<vector>

using namespace std;

int main(){
  int n, m, x, y, mer;
  char dim;
  cin >> n;
  vector<int> ans;
  while(n){
    vector< vector<int> > gem(21, vector<int>(21));
    for(int i = 0; i < n; i++){
      cin >> x >> y;
      gem[y][x] = 1;
    }
    cin >> m;
    int nowx = 10;
    int nowy = 10;
    for(int j = 0; j < m; j++){
      cin >> dim >> mer;
      for(int k = 1; k <= mer; k++){
        if(dim == 'N') nowy++;
        if(dim == 'E') nowx++;
        if(dim == 'S') nowy--;
        if(dim == 'W') nowx--;
        gem[nowy][nowx] = 0;
      }
    }
    int boo = 0;
    for(int i = 0; i <= 20; i++){
      for(int j = 0; j <= 20; j++){
        if(gem[i][j])boo = 1;
      }
    }
    ans.push_back(boo);
    cin >> n;
  }
  for(int i = 0; i < (int)ans.size(); i++){
    if(!ans[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

C++: # include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;

int d[21][21];


bool clear() {
  int res = 0;

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

  return res == 0;
}


int main() {
  int n, x, y, z; // z: window
  char dir; // direction

  map<char, vector<int>> m;
  m['N'] = { 0, 1};
  m['E'] = { 1, 0};
  m['S'] = { 0, -1};
  m['W'] = {-1, 0};

  while (cin >> n && n) {
    rep (i, 21) rep(j, 21) d[i][j] = 0;

    vector<int> p = {10, 10}; // ?????¨???

    for (int i=0; i<n; i++) {
      cin >> x >> y;
      d[x][y] = 1;
    }

    cin >> n;
    for (int i=0; i<n; i++) {
      cin >> dir >> z;

      for (int t=0; t<z; t++) {
        p[0] += m[dir][0];
        p[1] += m[dir][1];

        d[p[0]][p[1]] = 0;
      }
    }

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