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;
bool gem[21][21];
int main() {
    int N;
    while(scanf("%d",&N),N) {
        memset(gem,0,sizeof(gem));
        for(int i=0;i<N;i++) {
            int x,y;
            scanf("%d %d",&x,&y);
            gem[x][y]=1;
        }
        int M;
        int X=10,Y=10;
        int sum=0;
        scanf("%d",&M);
        for(int i=0;i<M;i++) {
            char d[2];
            int l;
            scanf("%s %d",d,&l);
            if(d[0]=='N') {
                for(int i=1;i<=l;i++) if(gem[X][Y+i]) {gem[X][Y+i]=0;sum++;}
                Y+=l;
            }
            if(d[0]=='E') {
                for(int i=1;i<=l;i++) if(gem[X+i][Y]) {gem[X+i][Y]=0;sum++;}
                X+=l;
            }
            if(d[0]=='S') {
                for(int i=1;i<=l;i++) if(gem[X][Y-i]) {gem[X][Y-i]=0;sum++;}
                Y-=l;
            }
            if(d[0]=='W') {
                for(int i=1;i<=l;i++) if(gem[X-i][Y]) {gem[X-i][Y]=0;sum++;}
                X-=l;
            }
        }
        if(sum==N) printf("Yes\n"); else printf("No\n");
     }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
bool grid[21][21];
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};

int main(void){
  int N,M;
  while(cin>>N){
    if(N==0) break;
    int px,py,l,r=-1;
    int x=10, y=10;
    char d;
    memset(grid,0,sizeof(grid));
    REP(i,N){
      cin>>px>>py;
      grid[py][px] = true;
    }
    grid[y][x] = false;
    cin>>M;
    REP(i,M){
      cin>>d>>l;
      if(d=='N') r = 0;
      else if(d=='E') r=1;
      else if(d=='S') r=2;
      else if(d=='W') r=3;
      else cout<<"ERROR"<<endl;
      REP(k,l){
        x+=dx[r];
        y+=dy[r];
        grid[y][x] = false;
      }
    }
    bool yes = true;
    REP(y,21)REP(x,21)if(grid[y][x]) yes=false;
    if(yes) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#define MAX 20
using namespace std;
string S;

int main(){
    while (1) {
        int p;
        cin >> p;
        if (p!=0) {
            int stx[MAX],sty[MAX];
            for (int i = 0; i<p; i++){
                cin >> stx[i] >> sty[i];
            }
            int area[MAX][MAX]={};
            int pointx=10,pointy=10;
            int ord_num,ord_dis;
            char ord_dir;
            cin >> ord_num;
            for (int i =0; i<ord_num; i++) {
                cin >> ord_dir >> ord_dis;
                if (ord_dir=='N') {
                    for (int j=0; j<ord_dis; j++) {
                        pointy++;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='E') {
                    for (int j=0; j<ord_dis; j++) {
                        pointx++;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='S') {
                    for (int j=0; j<ord_dis; j++) {
                        pointy--;
                        area[pointx][pointy]=1;
                    }
                }if (ord_dir=='W') {
                    for (int j=0; j<ord_dis; j++) {
                        pointx--;
                        area[pointx][pointy]=1;
                    }
                }
            }
            int flag=0;
            for (int i=0; i<p; i++) {
                if (area[stx[i]][sty[i]]==1) {
                    flag++;
                }
            }
            if (flag==p) {
                cout << "Yes"<<"\n";
            }else{
                cout << "No" << "\n";
                
            }
        }else{
            break;
        }
    }
    
}

C++: #include<iostream>
#include<iomanip>
#include<cstdlib>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
		int N;
		cin>>N;
		if(N==0) break;
		vector<vector<bool> > map(21, vector<bool>(21, false));
		int set = 0;
		REP(i, N) {
			int x, y;
			cin>>x>>y;
			map[x][y] = true;
		}
		int nx = 10, ny = 10;
		int ans = 0;
		if(map[nx][ny]) {
			++ans;
			map[nx][ny] = false;
		}
		int M;
		cin>>M;
		REP(i, M) {
			char dir;
			int l;
			cin>>dir>>l;
			if(dir == 'E') {
				REP(j, l) {
					nx = nx + dx[0];
					ny = ny + dy[0];
					if(map[nx][ny]) {
						++ans;
						map[nx][ny] = false;
					}
				}
			}
			if(dir == 'N') {
				REP(j, l) {
					nx = nx + dx[1];
					ny = ny + dy[1];
					if(map[nx][ny]) {
						++ans;
						map[nx][ny] = false;
					}
				}
			}
			if(dir == 'W') {
				REP(j, l) {
					nx = nx + dx[2];
					ny = ny + dy[2];
					if(map[nx][ny]) {
						++ans;
						map[nx][ny] = false;
					}
				}
			}
			if(dir == 'S') {
				REP(j, l) {
					nx = nx + dx[3];
					ny = ny + dy[3];
					if(map[nx][ny]) {
						++ans;
						map[nx][ny] = false;
					}
				}
			}
		}
		if(ans == N) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}