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>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	bool a[21][21];
	while (cin >> n&&n != 0) {
		for (int i = 0; i <= 20; i++) {
			for (int j = 0; j <= 20; j++) a[i][j] = false;
		}
		int c, d;
		for (int i = 0; i<n; i++) {
			cin >> c >> d;
			a[c][d] = true;
		}
		int sum = n, m;
		int x = 10, y = 10;
		cin >> m;
		char g;
		for (int i = 0; i<m; i++) {
			cin >> g >> c;
			int e=0, f=0;
			int x2 = x, y2 = y;
			if (g == 'N') {
				y += c;
				f = 1;
			}
			else if (g == 'S') {
				y -= c;
				f = -1;
			}
			else if (g == 'E') {
				x += c;
				e = 1;
			}
			else {
				x -= c;
				e = -1;
			}
			int j = y2, i2 = x2;
			for (;;) {
				if (i2 == x&&j == y) break;
				if (a[i2][j]) {
					sum--;
					a[i2][j] = false;
				}
				j += f;
				i2 += e;
			}
			if (a[x][y]) {
				sum--;
				a[x][y] = false;
			}
		}
		if (sum == 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

C++: // AOJ 2000
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const int XMAX = 30, YMAX = 30, MMAX = 40;

bool field[XMAX][YMAX];
char dir[MMAX];
int dist[MMAX];
int N, M;

void init() {
  REP(x, XMAX) REP(y,YMAX) { field[x][y] = false; }
}

bool solve() {
  int items = 0;
  int x = 10, y = 10;
  REP(i, M) {
    REP(d, dist[i]) {
      x += (dir[i] == 'E' ? 1 : dir[i] == 'W' ? -1 : 0);
      y += (dir[i] == 'N' ? 1 : dir[i] == 'S' ? -1 : 0);

      if (field[x][y]) {
        field[x][y] = false;
        items++;
      }
    }
  }
  return items == N;
}

int main() {
  while (cin >> N and N) {
    init();
    REP(i, N) {
      int x, y;
      cin >> x >> y;
      field[x][y] = true;
    }

    cin >> M;
    REP(i, M) {
      cin >> dir[i] >> dist[i];
    }

    cout << (solve() ? "Yes" : "No") << endl;
  }
}

C++: #include <bits/stdc++.h>

using namespace std;

long long INF=1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    while(1){
        int n;
        cin>>n;

        if(n==0)break;

        int a[30][30]={};

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

        int m;
        cin>>m;

        int b[30][30]={};
        b[10][10]=1;

        int pos_x=10,pos_y=10;

        for(int i=0;i<m;i++){
            char c;
            int d;
            cin>>c>>d;
            if(c=='N'){
                for(int j=pos_y;j<=pos_y+d;j++)b[pos_x][j]=1;
                pos_y+=d;
            }
            else if(c=='S'){
                for(int j=pos_y;j>=pos_y-d;j--)b[pos_x][j]=1;
                pos_y-=d;
            }
            else if(c=='E'){
                for(int j=pos_x;j<=pos_x+d;j++)b[j][pos_y]=1;
                pos_x+=d;
            }
            else{
                for(int j=pos_x;j>=pos_x-d;j--)b[j][pos_y]=1;
                pos_x-=d;
            }
        }
        
        int ans=0;

        for(int i=1;i<=20;i++){
            for(int j=1;j<=20;j++){
                if(a[i][j]==1&&b[i][j]==1)ans++;
            }
        }

        if(ans==n)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;

    }
}

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

using namespace std;

int main(){
    map<char,pair<int,int> > d;
    d.insert(make_pair('N',make_pair(0,1)));
    d.insert(make_pair('E',make_pair(1,0)));
    d.insert(make_pair('S',make_pair(0,-1)));
    d.insert(make_pair('W',make_pair(-1,0)));

    int n;
    while(cin >> n,n){
        int cx = 10,cy = 10;
        vector<pair<int,int> > jewel;
        for(int i=0;i<n;i++){
            int x,y;
            cin >> x >> y;
            jewel.push_back(make_pair(x,y));
        }
        int m;
        cin >> m;
        for(int i=0;i<m;i++){
            char dir;
            int dis;
            cin >> dir >> dis;
            for(int i=0;i<dis;i++){
                cx = cx + d[dir].first;
                cy = cy + d[dir].second;
                vector<pair<int,int> >::iterator it = find(jewel.begin(),jewel.end(),make_pair(cx,cy));
                if(it != jewel.end()){
                    n--;
                }
            }
        }
        if(n == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}