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;
 
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }
 
static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;
 
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int MAX_N = 30;
const int MAX_X = 30;
const int MAX_Y = 30;
int n, m;
int x[MAX_N], y[MAX_N];
map<char, int> hm;
char c;
int d;
bool flag[MAX_X+1][MAX_Y+1];
 
int main()
{
  hm['W'] = 0;
  hm['S'] = 1;
  hm['E'] = 2;
  hm['N'] = 3;
 
  while(cin >> n, n){
    int cnt = 0;
    int hx = 10;
    int hy = 10;
    erep(i, 0, MAX_X) erep(j, 0, MAX_Y) flag[i][j] = false;
 
    rep(i, n){
      cin >> x[i] >> y[i];
      flag[x[i]][y[i]] = true;
      cnt += 1;
    }
 
    cin >> m;
    rep(i, m){
      cin >> c >> d;
      rep(j, d){
        hx += dx[hm[c]];
        hy += dy[hm[c]];
        if(flag[hx][hy]){
          cnt -= 1;
          flag[hx][hy] = false;
        }
      }
    }
 
    puts(cnt == 0 ? "Yes" : "No");
  }
 
  return 0;
}

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

int main(void){
    
    while(1) {
        int n;
        cin >> n;
        if (n==0) {
        	break;
        }
        int stone[21][21];
        for(int y=0; y<21; y++){
            for(int x=0; x<21; x++){
                stone[y][x] = 0;
            }
        }
        for(int i=0; i<n; i++){
            int x, y;
            cin >> x >> y;
            stone[y][x] = 1;
        }
        int m;
        int x=10, y=10;
        cin >> m;
        for(int i=0; i<m; i++){
            char d;
            int l;
            cin >> d;
            cin >> l;
            if(d=='N'){
           	    for(int j=0; j<l; j++){
               	    y++;
               	    if(stone[y][x] == 1){
               	    	stone[y][x] = 0;
               	    	n--;
               	    }
               	}
            }
            if(d=='E'){
           	    for(int j=0; j<l; j++){
               	    x++;
               	    if(stone[y][x] == 1){
               	    	stone[y][x] = 0;
               	    	n--;
               	    }
               	}
            }
            if(d=='S'){
           	    for(int j=0; j<l; j++){
               	    y--;
               	    if(stone[y][x] == 1){
               	    	stone[y][x] = 0;
               	    	n--;
               	    }
               	}
            }
            if(d=='W'){
           	    for(int j=0; j<l; j++){
               	    x--;
               	    if(stone[y][x] == 1){
               	    	stone[y][x] = 0;
               	    	n--;
               	    }
               	}
            }
        }
        if (n==0) {
        	printf("YES\n");
        } else {
        	printf("NO\n");
        }
    }
    
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };



int main()
{
	int n;
	cin >> n;
	while (n)
	{
		int a[25][25] = {};
		int x = 10, y = 10;

		for (int i = 0; i < n; i++)
		{
			int X, Y;
			cin >> X >> Y;
			a[X][Y] = 1;
		}
		int m;
		cin >> m;
		char v;
		int s;
		for (int i = 0; i < m; i++)
		{
			cin >> v >> s;
			switch (v)
			{
			case'N':
				for (int z = 0; z < s; z++)
				{
					y++;
					if (a[x][y] == 1)
					{
						a[x][y] = 0;
						n--;
					}
				}
				break;
			case'E':
				for (int z = 0; z < s; z++)
				{
					x++;
					if (a[x][y] == 1)
					{
						a[x][y] = 0;
						n--;
					}
				}
				break;
			case'S':
				for (int z = 0; z < s; z++)
				{
					y--;
					if (a[x][y] == 1)
					{
						a[x][y] = 0;
						n--;
					}
				}
				break;
			case'W':
				for (int z = 0; z < s; z++)
				{
					x--;
					if (a[x][y] == 1)
					{
						a[x][y] = 0;
						n--;
					}
				}
				break;
			}

		}




		if (n)cout << "No" << endl; else cout << "Yes" << endl;
		cin >> n;
	}


	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int m,count=n,p[20][20];
		for(int i=0;i<20;++i)for(int j=0;j<20;++j)p[i][j]=0;
		for(int i=0,x,y;i<n;++i){
			cin>>x>>y;
			p[x][y]=1;
		}
		cin>>m;
		for(int i=0,d,cx=10,cy=10;i<m;++i){
			string s;
			cin>>s>>d;
			if(s=="N"){
				for(int j=0;j<d;++j){
					++cy;
					if(p[cx][cy]==1){
						count--;
						p[cx][cy]=0;
					}
				}
			}else if(s=="E"){
				for(int j=0;j<d;++j){
					++cx;
					if(p[cx][cy]==1){
						count--;
						p[cx][cy]=0;
					}
				}
			}else if(s=="S"){
				for(int j=0;j<d;++j){
					--cy;
					if(p[cx][cy]==1){
						count--;
						p[cx][cy]=0;
					}
				}
			}else if(s=="W"){
				for(int j=0;j<d;++j){
					--cx;
					if(p[cx][cy]==1){
						count--;
						p[cx][cy]=0;
					}
				}
			}
		}
		if(count==0)cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;
}