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, a[21], b[21], d[31];
  int x, y, x0, y0;
  int t = 0;
  char c[31];

  while(1){
    cin >> n;
      x = 10;
      y = 10;
      x0 = 10;
      y0 = 10;
    if(n==0){
       break;
    }else{
    for(int i=0; i<n; i++){
      cin >> a[i] >> b[i];
    }

    cin >> m;
    for(int i=0; i<m; i++){
      cin >> c[i] >> d[i];
      switch(c[i]){
        case 'N':
          y += d[i];
          break;
        case 'S':
          y -= d[i];
          break;
        case 'E':
          x += d[i];
          break;
        case 'W':
          x -= d[i];
          break;
      }

      for(int j=0; j<n; j++){
        if(((x0<=a[j] && a[j]<=x) || (x<=a[j] && a[j]<=x0)) && ((y0<=b[j] && b[j]<=y) ||
        (y<=b[j] && b[j]<=y0))){
          t++;
        }
      }
      x0 = x;
      y0 = y;
    }
    if(t>=n){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  } 
  }

  return 0;
}

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

const int INF = 1 << 30;
const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, -1, 0, 1 };

int main()
{
	int N, M;
	while (scanf("%d", &N) != EOF) {
		if (N == 0)
			break;

		set<pair<int, int> > juel;
		for (int i = 0; i < N; ++i) {
			pair<int, int> p;
			scanf("%d %d", &p.first, &p.second);
			juel.insert(p);
		}

		scanf("%d", &M);
		int ans = 0;
		pair<int, int> s = pair<int, int>(10, 10);
		for (int i = 0; i < M; ++i) {
			pair<char, int> d;
			cin >> d.first >> d.second;
			int dir;
			switch (d.first) {
			case 'N':
				dir = 3;
				break;
			case 'E':
				dir = 0;
				break;
			case 'S':
				dir = 1;
				break;
			case 'W':
				dir = 2;
				break;
			}

			for (int j = 0; j < d.second; ++j) {
				s.first += dx[dir];
				s.second += dy[dir];

				set<pair<int, int> >::iterator it = juel.find(s);
				if (it != juel.end()) {
					++ans;
					juel.erase(it);
				}
			}
		}

		if (ans == N)
			printf("Yes\n");
		else
			printf("No\n");

	}

	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define MAX_N 23
#define MAX_M 33

int N,M,x,y;
bool a;
bool field[21][21];
char dir[MAX_M];
int dis[MAX_M];

bool input(){
  x=10;
  y=10;
  a=false;
  REP(i,22){
    REP(j,22){
      field[i][j]=false;
    }
  }
  cin>>N;
  REP(i,N){
    int a,b;
    cin>>a>>b;
    field[a][b]=true;
  }
  if(N!=0){
   cin>>M;
   REP(i,M) cin>> dir[i]>>dis[i];
   }
  return(N!=0);
}

void solve(){
  REP(i,M){
    if(dir[i]=='N'){
      REP(j,dis[i])field[x][y+j]=false;
      y+=dis[i];
      }

    else if(dir[i]=='E'){
      REP(j,dis[i])field[x+j][y]=false;
      x+=dis[i];
      }
  
    else if(dir[i]=='S'){
      REP(j,dis[i])field[x][y-j]=false;
      y-=dis[i];
      }

    else{
      REP(j,dis[i])field[x-j][y]=false;
      x-=dis[i];
  }
  field[x][y]=false;  
  }

  REP(i,21){
    REP(j,21){

      if(field[i][j]){
        cout<<"No"<<endl;
        a=true;
        break;
      }
      if(a)break;
    }
  }
  if(a!=true)cout<<"Yes"<<endl;
}
int main(){
  while(input()){
    solve();
  }
  
  cout<<field[20][1];
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
  cin.sync_with_stdio(false);
  int n;
  while(cin >> n, n) {
    vector<P> juery(n);
    rep(i, n) cin >> juery[i].fi >> juery[i].se;
    int m;
    cin >> m;
    vector<P> move;
    int x = 10, y = 10;
    rep(i, m) {
      char d;
      int l;
      cin >> d >> l;
      switch(d) {
        case 'N':
        rep(j, l) move.pb(P(x, ++y)); break;
        case 'E':
        rep(j, l) move.pb(P(++x, y)); break;
        case 'S':
        rep(j, l) move.pb(P(x, --y)); break;
        case 'W':
        rep(j, l) move.pb(P(--x, y)); break;
      }
    }

    bool ok;
    rep(i, n) {
      ok = false;
      rep(j, move.size()) {
        if (juery[i] == move[j]) ok = true;
      }
      if (!ok) break;
    }

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}