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;
int main(){
  while (1){
    int N;
    cin >> N;
    if (N == 0){
      break;
    }
    vector<int> x(N), y(N);
    for (int i = 0; i < N; i++){
      cin >> x[i] >> y[i];
    }
    int X = 10;
    int Y = 10;
    vector<bool> used(N, false);
    int M;
    cin >> M;
    for (int i = 0; i < M; i++){
      char d;
      int l;
      cin >> d >> l;
      if (d == 'N'){
        for (int j = 0; j < l; j++){
          Y++;
          for (int k = 0; k < N; k++){
            if (X == x[k] && Y == y[k]){
              used[k] = true;
            }
          }
        }
      }
      if (d == 'E'){
        for (int j = 0; j < l; j++){
          X++;
          for (int k = 0; k < N; k++){
            if (X == x[k] && Y == y[k]){
              used[k] = true;
            }
          }
        }
      }
      if (d == 'S'){
        for (int j = 0; j < l; j++){
          Y--;
          for (int k = 0; k < N; k++){
            if (X == x[k] && Y == y[k]){
              used[k] = true;
            }
          }
        }
      }
      if (d == 'W'){
        for (int j = 0; j < l; j++){
          X--;
          for (int k = 0; k < N; k++){
            if (X == x[k] && Y == y[k]){
              used[k] = true;
            }
          }
        }
      }
    }
    bool ok = true;
    for (int i = 0; i < N; i++){
      if (!used[i]){
        ok = false;
      }
    }
    if (ok){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

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

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

int N, M;
int a[21][21];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	while(cin>>N,N) {
		rep(i, 20) {rep(j, 20)a[i][j]=false;}
		
		int x, y;
		rep(i, N) {
			cin>>x>>y;
			a[x][y] = true;
		}
		
		cin>>M;
		x=10;
		y=10;
		rep(i, M) {
			char d;
			int l;
			cin>>d>>l;
			rep(i, l) {
				switch(d) {
					case 'N':y++;break;
					case 'E':x++;break;
					case 'S':y--;break;
					case 'W':x--;break;
				}
				a[x][y]=false;
			}
		}
		
		bool f = true;
		rep(i, 21) {
			rep(j, 21) {
				if(a[i][j]) {
					f=false;
					break;
				}
			}
			if(!f)break;
		}
		cout<<(f?"Yes":"No")<<endl;
	}
	
	return 0;
}

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

int main()
{
	int numGems = 0;;

	std::cin >> numGems;
	const int gridSize = 21;
	std::vector<bool> gems(gridSize * gridSize, false);
	gems.resize(gridSize * gridSize);
	int gemPointX = 0;
	int gemPointY = 0;
	if (numGems == 0)
	{
		std::cerr << "NO" << std::endl;
		return 0;
	}

	for (int i = 0; i < numGems; i++)
	{
		std::cin >> gemPointX;
		std::cin >> gemPointY;

		gems[gemPointY * gridSize + gemPointX] = true;
	}
        return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
void setDiff(const char dir, int* diff) {
    switch (dir) {
    case 'N':
        diff[0] = 0;
        diff[1] = 1;
        break;
    case 'E':
        diff[0] = 1;
        diff[1] = 0;
        break;
    case 'S':
        diff[0] = 0;
        diff[1] = -1;
        break;
    case 'W':
        diff[0] = -1;
        diff[1] = 0;
        break;
    default:
        diff[0] = 21;
        diff[1] = 21;
        break;
    }
}
int main()
{
    int n;
    const int W = 21;
    vector<string> result;
    int board[W][W];
    int diff[2] = {0};
    while (cin >> n && n) {
        fill(board[0], board[W], 0);
        for (int i = 0; i < n; ++i) {
            int x, y;
            cin >> x >> y;
            board[x][y] = 1;
        }
        int m, collection = 0;
        cin >> m;
        int cx = 10, cy = 10;
        for (int i = 0; i < m; ++i) {
            char dir;
            int dist;
            cin >> dir >> dist;
            setDiff(dir, diff);
            for (int j = 0; j < dist; ++j) {
                cx += diff[0];
                cy += diff[1];
                collection += board[cx][cy];
                board[cx][cy] = 0;
            }
        }
        result.push_back(collection == n ? "yes" : "no");
    }
    for (int i = 0; i < result.size(); ++i) {
        cout << result[i] << endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

bool ma[128][128]={0};
int n, m, d;
char c;

int main(){

	while(cin >> n, n){
		
		queue<char> com;
		int x=10, y=10;
		
		memset(ma, 0, sizeof(ma));
		
		int a, b;
		
		for(int i=0; i<n; ++i){
			cin >> a >> b;
			ma[b][a] = true;
		}
		
		cin >> m;
		
		for(int i=0; i<m; ++i){
			
			cin >> c >> d;
			
			for(int i=0; i<d; ++i){	
				com.push(c);
			}	
		}
		
		if(ma[y][x]){
			n--;
			ma[y][x]=false;
		}
		
		while(!com.empty()){
			
			c = com.front();
			com.pop();
			
			if(c=='N')
				y++;
			else if(c=='E')
				x++;
			else if(c=='W')
				x--;
			else if(c=='S')
				y--;
				
			if(ma[y][x]){
				n--;
				ma[y][x]=false;
			}
		}
		
		cout << (!n?"Yes":"No") << endl;

	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int f[21][21];

int main() {
	int n;
	while (cin >> n, n) {
		memset(f, 0, sizeof(f));

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

		int x = 10, y = 10;

		int m;
		cin >> m;
		for (int i = 0; i<m; i++) {
			char dir;
			int step;
			cin >> dir >> step;
			while (step--) {
				if (dir == 'N') { y++; }
				else if (dir == 'S') { y--; }
				else if (dir == 'E') { x++; }
				else { x--; }
				f[y][x] = 0;
			}
		}

		bool yes = true;
		for (int y = 0; y <= 20; y++) {
			for (int x = 0; x <= 20; x++) {
				if (f[y][x]) {
					yes = false;
					goto ANSWER;
				}
			}
		}
	ANSWER:
		if (yes) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}