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>

using namespace std;

int main() {
    int N, M;
    int x, y, t;
    char d[2];
    bool table[21][21], flag;

    while (cin >> N) {
        if (!N) { break; }

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

        for (int i = 0; i < N; i++) {
            cin >> x >> y;
            table[x][y] = true;
        }

        x = 10; y = 10;
        cin >> M;

        while (M--) {
            cin >> d >> t;
            if (d[0] == 'N') {
                for (int i = 0; i < t; i++) {
                    table[x][++y] = false;
                }
            }
            if (d[0] == 'E') {
                for (int i = 0; i < t; i++) {
                    table[++x][y] = false;
                }
            }
            if (d[0] == 'S') {
                for (int i = 0; i < t; i++) {
                    table[x][--y] = false;
                }
            }
            if (d[0] == 'W') {
                for (int i = 0; i < t; i++) {
                    table[--x][y] = false;
                }
            }
        }

        flag = true;

        for (int i = 0; i < 20; i++) {
            for (int j = 0; j < 20; j++) {
                if (table[i][j]) {
                    flag = false;
                    break;
                }
            }
        }
        cout << (flag ? "Yes" : "No") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<climits>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<list>
#include<string>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int,int>
#define PCC pair<char,char>
#define PCI pair<char,int>
#define PIC pair<int,char>
#define MP make_pair
#define DEBUG(x) cout<<#x<<": "<<x<<endl;


int main()
{
	while (1)
	{
		int n;
		cin >> n;
		if (n == 0)break;
		PII mine = MP(10, 10);
		vector <PII> jem;
		REP(i, n)
		{
			int x, y;
			cin >> x >> y;
			PII temp = MP(x, y);
			jem.push_back(temp);
		}
		int m;
		bool ans = true;
		cin >> m;
		REP(i, m)
		{
			char com;
			int value;
			cin >> com >> value;
			if (com == 'N' || com == 'S')
			{
				if (com == 'S')value = -value;
				REP(j, n)
				{
					if (jem[j].first != mine.first)continue;
					int a = min(mine.second, mine.second + value);
					int b = max(mine.second, mine.second + value);
					if (a <= jem[j].second&&jem[j].second <= b)
					{
						jem[j].first = -1;
						jem[j].second = -1;
					}
				}
				mine.second += value;
			}
			else
			{
				if (com == 'W')value = -value;
				REP(j, n)
				{
					if (jem[j].second != mine.second)continue;
					int a = min(mine.first, mine.first + value);
					int b = max(mine.first, mine.first + value);
					if (a <= jem[j].first&&jem[j].first<= b)
					{
						jem[j].first = -1;
						jem[j].second = -1;
					}
				}
				mine.second += value;
			}
		}
		REP(i, n) 
		{ 
			if (jem[i].first != -1)
			{
				ans = false;
				break;
			}
		}
		if (ans)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

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

 
using namespace std;
 
#define INF 1000000000
#define EPS 1e-9
#define PI acos(-1)
 
typedef long long ll;

#define MAX_N 20
#define MAX_M 30

int N;
int trex[MAX_N], trey[MAX_N];
bool tre[MAX_N];
int M;

vector<string> ans_list;

int main(){

  while(true){
    cin >> N;
    if(N == 0)
      break;
    for(int i = 0; i < N; i++){
      cin >> trex[i] >> trey[i];
      tre[i] = true;
    }
    int ans = N;
    cin >> M;
    int px = 10, py = 10;
    for(int num = 0; num < M; num++){
      int dx[] = {0,1,0,-1};
      int dy[] = {1,0,-1,0};
      char dir;
      int dd;
      int d;
      cin >> dir >> d;
      if(dir == 'N')
	dd = 0;
      else if(dir == 'E')
	dd = 1;
      else if(dir == 'S')
	dd = 2;
      else
	dd = 3;
      for(int i = 0; i < d; i++){
	px += dx[dd];
	py += dy[dd];
	for(int j = 0; j < N; j++){
	  if(tre[j] && px == trex[j] && py == trey[j]){
	    ans--;
	    tre[j] = false;
	  }
	}
      }
    }
    if(ans == 0)
      ans_list.push_back("Yes");
    else
      ans_list.push_back("No");
  }

  for(int i = 0; i < ans_list.size(); i++){
    cout << ans_list[i] << endl;
  }

  return 0;

}

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

void gemretrieve(int flag[][21], char dir, int amo);
void gemcheck(int flag[][21]);

int rx = 10, ry = 10; //?????????????????§?¨?

int main(){

	int gemflag[21][21] = {0, 0, 0}; //?????§???????????°
	int gemamo; //?????§???????????°
	int movcou; //?§???????????????°
	char movdir; //?§??????????
	int movamo;  //?§???????
	int gx, gy; //?????§????????§?¨?
	    
	cin >> gemamo;

	for (int i = 0; i < gemamo; i++){

		cin >> gx >> gy;
		gemflag[gx][gy] = 1;

	}

	cin >> movcou;


	for (int j = 0; j < movcou; j++){

		cin >> movdir >> movamo;

		gemretrieve(gemflag, movdir, movamo);
		

	}

	gemcheck(gemflag); 
	

	return 0;


}

void gemretrieve(int flag[][21], char dir, int amo){

	switch (dir){

	case 'N':{

		for (int k = 0; k < amo; k++){

			ry++;
			flag[rx][ry] = 0;

		}



	} break;

	case 'E':{

		for (int k = 0; k < amo; k++){

			rx++;
			flag[rx][ry] = 0;

		}



	} break;

	case 'S':{

		for (int k = 0; k < amo; k++){

			ry--;
			flag[rx][ry] = 0;

		}



	} break;

	case 'W':{

		for (int k = 0; k < amo; k++){

			rx--;
			flag[rx][ry] = 0;

		}



	} break;


	default:break;

	}




}

void gemcheck(int flag[][21]){


	for (int i = 0; i < 21; i++){

		for (int j = 0; j < 21; j++){

			if (flag[i][j] == 1){
				cout << "NO" << endl;
				return;
			}

		}

	}


	cout << "YES" << endl; 


}