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(){
  int n,m;
  bool jems[30][30];
  bool gred[30][30];
  while(cin>>n,n){
    memset(jems,0,sizeof(jems));
    memset(gred,0,sizeof(gred));
    int x,y;
    for(int i=0;i<n;i++){
      cin>>x>>y;
      jems[y][x]=true;
    }
    cin>>m;
    gred[10][10]=true; 
    x=y=10;
    for(int i=0;i<m;i++){
      char dire;
      int dist;
      cin>>dire>>dist;
      for(int j=0;j<dist;j++){
	if(dire=='N'){
	  gred[++y][x]=true;
	}else if(dire=='S'){
	  gred[--y][x]=true;
	}else if(dire=='W'){
	  gred[y][--x]=true;
	}else{
	  gred[y][++x]=true;
	}
      }
    }
    bool ans=true;
    for(int i=0;i<30;i++){
      for(int j=0;j<30;j++){
	//cout << jems[i][j];
	//cout << gred[i][j];
	if(jems[i][j]==false)continue;
	if(jems[i][j]==true && gred[i][j]==false)ans=false;
      }
      //cout << endl;
    }
    if(ans==true){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;

#define INF 1000000000

bool field[21][21];

int main(){

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

    rep(i,21)
      rep(j,21) field[i][j]=false;

    rep(i,n){
      int x,y;
      scanf("%d %d" ,&x, &y);
      field[x][y]=true;
    }

    scanf("%d\n", &m);

    int x=10, y=10;
    rep(i,m){
      char c; int d;
      scanf("%c %d\n", &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){
	x+=dx; y+=dy;
	if(field[x][y]){
	  n--;
	  field[x][y]=false;
	}
      }
    }

    if(n==0) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

}

C++: #include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include <deque>

using namespace std;
typedef long long ll;

vector<bool> ans;

int main() {
	while (1) {
		ll N, x, y, M, l[31] = {}, collected = 0, cur1 = 10, cur2 = 10;
		bool jewel[21][21] = {};
		char d[31] = {};
		cin >> N;
		if (N == 0)break;
		for (int i = 1; i <= N; i++) {
			cin >> x >> y;
			jewel[x][y] = true;
		}
		cin >> M;
		for (int i = 1; i <= M; i++) {
			cin >> d[i] >> l[i];
			if (jewel[10][10])collected++;
			for (int j = 1; j <= l[i]; j++) {
				switch (d[i]) {
				case 'N':
					cur2++;
					if (jewel[cur1][cur2]) {
						jewel[cur1][cur2] = false;
						collected++;
					}
					break;
				case 'E':
					cur1++;
					if (jewel[cur1][cur2]) {
						jewel[cur1][cur2] = false;
						collected++;
					}
					break;
				case 'S':
					cur2--;
					if (jewel[cur1][cur2]) {
						jewel[cur1][cur2] = false;
						collected++;
					}
					break;
				case 'W':
					cur1--;
					if (jewel[cur1][cur2]) {
						jewel[cur1][cur2] = false;
						collected++;
					}
				}
			}
		}
		ans.push_back(collected == N);
	}
	for (int i = 0; i < ans.size(); i++) {
		if (ans[i]) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	

using namespace std;

namespace MyLib {
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
}

using namespace MyLib;
bool ju[21][21];
int rx[30], ry[30];


int main() {
	int m;
	int l[30];
	char buf;

	int x, y;
	int n;
	while (cin >> n, n) {
		REP(i, 21)
			REP(j, 21)
			ju[i][j] = 0;
		REP(i, n)
			cin >> x >> y, ju[y][x] = 1;
		cin >> m;
		REP(i, m) {
			cin >> buf >> l[i];
			if (buf == 'E') {
				rx[i] = 1;
				ry[i] = 0;
			}
			else if (buf == 'W') {
				rx[i] = -1;
				ry[i] = 0;
			}
			else if (buf == 'N') {
				rx[i]= 0;
				ry[i] = 1;
			}
			else if (buf == 'S') {
				rx[i] = 0;
				ry[i] = -1;
			}

		}
		x = 10, y = 10;
		int count = 0;
		REP(i,m)
			REP(j, l[i]) {
				x += rx[i];
				y += ry[i];
				
				if (ju[y][x]) {
					debug(x);
					debug(y);
					count++;
				}
		}
		if (count == n)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;


	}

	return 0;

}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int stone;
    while(cin >> stone, stone){
        int map[24][24] = {0};
        int x, y;
        x = y = 10;
        rep(i, stone){
            int a, b;
            cin >> a >> b;
            map[a][b] = 1;
        }
        int order;
        cin >> order;
        rep(i, order){
            int distance;
            char direction;
            cin >> direction >> distance;
            rep(j, distance){
                if(direction == 'N'){
                    y++;
                }else if(direction == 'E'){
                    x++;
                }else if(direction == 'S'){
                    y--;
                }else{
                    x--;
                }
                stone-= map[x][y];
                map[x][y] = 0;
            }
        }
        if(!stone) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}