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<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;

#define ll long long int
#define ld long long double
#define reps(i,f,n) for(int i=f;i<n;i++)
#define rep(i,n) reps(i,0,n)
#define m1 cout<<"move1"<<endl
#define m2 cout<<"move2"<<endl
#define m3 cout<<"move3"<<endl
#define m4 cout<<"move4"<<endl

int judge(int  v[][21]){
  // cout<<endl;         
  rep(i,21){
    rep(j,21){
      //cout<<v[i][j]<<" ";
      if(v[i][j] == 1)
      return 1;
    }
    //cout<<endl;
  }
  return 0;
}
  
  


int main(){
  ll N;
  ll M;
  char C;
  ll X,Y;
  ll length;
  int  v[21][21];
  ll x,y;

  while(cin>>N,N){
    x = 10; y = 10;
    rep(i,21)
      rep(j,21)
      v[i][j] = 0;
    rep(i,N){
    cin>>X>>Y;
    v[Y][X] = 1;
    }
    cin>>M;
    rep(j,M){
      cin>>C;
      //cout<<C<<endl;
      cin>>length;
      if(C == 'N'){
	reps(i,y+1,length + 1 + y){
	  v[i][x] = 0;
	}
	y +=length;
      }
      if( C== 'S'){
	for(int i = y-1; i >= y -length; i--){
	  v[i][x] = 0;
	}
	y -= length;
      }
      if(C == 'E'){
	reps(i,x+1,length+x+1){
	  v[y][i] = 0;
	}
	x += length;
      }
      if(C =='W'){
	for(int i = x-1; i >= x - length;i--){
	  v[y][i] = 0;
	}
	x -= length;
      }
    }
    if(judge(v))
      cout<<"NO"<<endl;
    else
      cout<<"YES"<<endl;

  }

  return 0;
}

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

string dir = "NESW";
int dx[4] = { 0, 1, 0,-1};
int dy[4] = { 1, 0,-1, 0};

int n;
vector<pair<int, int> > jewels;
bool isGotten[20] = {false};

void getJewel(int x, int y, int &cnt){
    for(int i = 0; i < n; i++){
        if(!isGotten[i] && x == jewels[i].first && y == jewels[i].second){
            isGotten[i] = true;
            cnt++;
        }
    }
}

int main(int argc, const char * argv[]) {
    while(1){
        cin >> n;
        if(!n) break;
        
        jewels.clear();
        for(int i = 0; i < n; i++){
            int x, y; cin >> x >> y;
            jewels.push_back(make_pair(x, y));
            isGotten[i] = false;
        }
        
        int m; cin >> m;
        int cnt = 0;
        pair<int, int> pos = make_pair(10, 10);
        for(int i = 0; i < m; i++){
            char d_char; int r; cin >> d_char >> r;
            int d_id = dir.find(d_char);
            while(r){
                getJewel(pos.first, pos.second, cnt);
                pos.first += dx[d_id];
                pos.second += dy[d_id];
                r--;
            }
            getJewel(pos.first, pos.second, cnt);
        }
        
        if(cnt == n) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

int main() {
  int N;
  while (scanf("%d", &N), N) {
    vector<pair<int, int>> stones(N);
    for (int i = 0; i < N; ++i) {
      int x, y; scanf("%d%d", &x, &y);
      stones[i] = {x, y};
    }
    vector<bool> collected(N, false);
    int M; scanf("%d", &M);
    int x = 10, y = 10;
    for (int i = 0; i < M; ++i) {
      char d; int l; scanf(" %c%d", &d, &l);
      int ny = y, nx = x;
      switch (d) {
      case 'N': ny += l; break;
      case 'E': nx += l; break;
      case 'S': ny -= l; break;
      case 'W': nx -= l; break;
      }
      for (int j = 0; j < N; ++j) {
        auto p = stones[j];
        if ((x == nx && nx == p.first && min(y, ny) <= p.second && p.second <= max(y, ny)) ||
            (y == ny && ny == p.second && min(x, nx) <= p.first && p.first <= max(x, nx))) {
          collected[j] = true;
        }
      }
      x = nx; y = ny;
    }
    bool ok = true;
    for (bool b : collected) {
      if (!b) { ok = false; break; }
    }
    puts(ok ? "Yes" : "No");
  }
}

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

struct pos{
  int x;
  int y;

  bool operator==(const pos& rhs) const;
};

bool pos::operator==(const pos& rhs) const
{
  if(x == rhs.x && y == rhs.y)
    return true;
  else
    return false;
}

struct mov{
  char direction;
  int distance;
};

void retrieve(vector<pos>& gems, mov way, pos& robot);


int main()
{
  int N, M;
  while(cin >> N, N != 0){
    vector<pos> gems;
    pos robot;
    pos temp;
    robot.x = 10;
    robot.y = 10;  //robot?????????????????????
    for(int i=0; i<N; ++i){
      cin >> temp.x >> temp.y;
      gems.push_back(temp);
    }
    //??¢??°retrieve??§??????????????????????????§???????????????????????§
    if(find(gems.begin(), gems.end(), robot) != gems.end())
      gems.erase(find(gems.begin(), gems.end(), robot));
    cin >> M;
    for(int i=0; i<M; ++i){
      mov go;
      cin >> go.direction >> go.distance;
      retrieve(gems, go, robot);
    }
    if(gems.size() == 0)
      cout << "Yes\n";
    else
      cout << "No\n";
  } 
}

    
void retrieve(vector<pos>& gems, mov way, pos& robot)
{
  int change, stay;
  pos temp;
  char dir = way.direction;
  if(dir=='N'){
    change = robot.y;
    stay = robot.x;
    while(change <= robot.y+way.distance){
      ++change;
      temp.x = stay;
      temp.y = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.y += way.distance;
  }
  else if(dir=='E'){
    change = robot.x;
    stay = robot.y;
    while(change <= robot.x+way.distance){
      ++change;
      temp.y = stay;
      temp.x = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.x += way.distance;
  }
  else if(dir=='S'){
    change = robot.y;
    stay = robot.x;
    while(change >= robot.x-way.distance){
      --change;
      temp.x = stay;
      temp.y = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.y -= way.distance;
  }
  else if(dir=='W'){
    change = robot.x;
    stay = robot.y;
    while(change >= robot.x-way.distance){
      --change;
      temp.y = stay;
      temp.x = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.x -= way.distance;
  }
}