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 <string.h>
#include <iostream>
#include <queue>
#include <complex>
#include <functional>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

typedef complex<double> P;
#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( a.real(), b.real() ) && EQ( a.imag(), b.imag() ) )

#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,n) for(int i=a;i<=n;i++)

//---------------------------------------------------------------------
struct Point {
	int x, y;
};
struct Oridir {
	char o;
	int d;
};
int n, m;
bool check[20];

vector<Point> juel(20);
vector<Oridir> mov(30);

int main() {
	while (cin >> n, n) {
		memset(check, false, sizeof(check));
		rep(i, n) cin >> juel[i].x >> juel[i].y;
		cin >> m;
		rep(i, m) cin >> mov[i].o >> mov[i].d;
		//????????????

		int x = 10, y = 10;
		rep(i, m) {
			while (mov[i].d--) {
				switch (mov[i].o) {
				case 'N': y++; break;
				case 'S': y--; break;
				case 'E': x++; break;
				case 'W': x--; break;
				default: break;
				}
				rep(j, n) {
					if (check[j]) continue;
					if (x == juel[j].x && y == juel[j].y) check[j] = true;
				}
			}
		}

		int suc = true;
		rep(j, n) {
			if (!check[j]) {
				suc = false;
				cout << "No" << endl;
				break;
			}
		}
		if (suc) cout << "Yes" << endl;
	}
	return 0;
}

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

typedef long long LL;

//container util
//------------------------------------------
#define PB push_back
#define MP make_pair
#define DECIM(digits)  cout<<fixed<<setprecision(digits)
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  for(;;){
    int n;
    cin >> n;
    if(!n) return 0;
    vector<pair<int,int> >gem;
    gem.resize(n);
    REP(i,n){
      int x,y;
      cin >> x >> y;
      gem[i]=MP(x,y);
    }
    int m;
    cin >> m;
    pair<int,int> pos=MP(10,10);
    REP(i,m){
      string news;
      int amount;
      cin >> news >> amount;
      while(amount--){
	if(news=="N")
	  pos.second++;
	if(news=="E")
	  pos.first++;
	if(news=="W")
	  pos.first--;
	if(news=="S")
	  pos.second--;
	for(auto j=gem.begin();j!=gem.end();)
	  if(pos==*j) j=gem.erase(j);
	  else ++j;
      }
    }
    if(gem.empty()) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int grid[21][21];
int nowx = 10,nowy = 10;
void init(){
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      grid[j][i] = 0;
    }
  }
}

void serch(int a,int b,int f){
  if(a > b)swap(a,b);
  cout << a << ' ' << b << endl; 
  if(f == 1){
    for(int i = a ; i <= b ; i++ )grid[nowx][i] = 0;
  }else {
    for(int i = a ; i <= b ; i++ )grid[i][nowy] = 0;
  }
}

bool check(){
  bool flag = true; 
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      if(grid[j][i] == 1){flag = false;goto N;}
    }
  }
 N:;
  if(flag)return true;
  else return false;
}

int main(){
  int n;
  while( cin >> n,n ){
    init();
    for(int i = 0 ; i < n ; i++ ){
      int x,y;
      cin >> x >> y;
      grid[x][y] = 1;
    }
    cin >> n;
    for(int i = 0 ; i < n ; i++ ){
      char c;
      int move,f = 0,past;
      cin >> c >> move;
      if(c == 'N'){
	f = 1;
	past = nowy;
	nowy+=move;
      }else if(c == 'S'){
	f = 1;
	past = nowy;
	nowy-=move;
      }else if(c == 'E'){
	past = nowx;
	nowx+=move;
      } else {
	past = nowx;
	nowx-=move;
      }
      if(f == 0)serch(past,nowx,f);
      else serch(past,nowy,f);
    }
    if( check() )cout << "Yes" << endl;
    else cout << "No" << endl; 
  }
  return 0;
}