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 n,m,i,x,y,z;
bool data[21][21];
char h[1];
int main(){
	while(cin>>n){
		if(n==0){break;}
		for(x=0;x<=20;x++){
			for(y=0;y<=20;y++){
				data[x][y]=0;
			}
		}
		for(i=0;i<n;i++){
			cin>>x>>y;
			data[x][y]=1;
		}
		cin>>n;
		x=10,y=10;
		data[x][y]=0;
		for(i=0;i<n;i++){
			cin>>h>>m;
			switch(h[0]){
			case 'N':
				for(z=0;z<m;z++){
					y+=1;
					data[x][y]=0;
				}
				break;
			case 'S':
				for(z=0;z<m;z++){
					y-=1;
					data[x][y]=0;
				}
				break;
			case 'E':
				for(z=0;z<m;z++){
					x+=1;
					data[x][y]=0;
				}
				break;
			case 'W':
				for(z=0;z<m;z++){
					x-=1;
					data[x][y]=0;
				}
				break;
			}
		}
		m=0;
		for(x=0;x<=20;x++){
			for(y=0;y<=20;y++){
				m+=data[x][y];
			}
		}
		if(m==0){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n; cin >> n;
        if(n == 0) return 0;
        else{
            vector<pair<int, int>> P(n);
            REP(i, n) cin >> P[i].first >> P[i].second;
            int m; cin >> m;
            vector<pair<char, int>> Go(m);
            REP(i, m) cin >> Go[i].first >> Go[i].second;
            pair<int, int> now = make_pair(10, 10);
            vector<bool> Get(n, false);
            REP(i, m){
                REP(j, Go[i].second){
                    if(Go[i].first == 'N') now.second++;
                    else if(Go[i].first == 'S') now.second--;
                    else if(Go[i].first == 'E') now.first++;
                    else if(Go[i].first == 'W') now.first--;
                    REP(p, n){
                        if(P[p] == now) Get[p] = true;
                    }
                }
            }
            bool ok = true;
            REP(i, n) if(Get[i] == false) ok = false;
            cout << (ok ? "Yes" : "No") << endl;
        }       
    }
}

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

using namespace std;

struct DATA{
  int x;
  int y;
};

void North(int, int&, int&, vector<DATA>&);
void South(int, int&, int&, vector<DATA>&);
void East(int, int&, int&, vector<DATA>&);
void West(int, int&, int&, vector<DATA>&);

int main(){
  int i, n, m, x, y, d;
  string s;
  DATA _data;
  vector<DATA> data;

  while(1){
    cin >> n;
    if(n == 0) break;

    for(i=0; i<n; ++i){
      cin >> x >> y;
      _data.x = x;
      _data.y = y;
      data.push_back(_data);
    }

    cin >> m;

    for(i=0, x=10, y=10; i<m; ++i){
      cin >> s >> d;

      if(data.size() != 0){
	if(s == "N") North(d, x, y, data);
	else if(s == "S") South(d, x, y, data);
	else if(s == "E") East(d, x, y, data);
	else if(s == "W") West(d, x, y, data);
      }
    }

    if(data.size() == 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;

    data.clear();
  }

  return 0;
}

void North(int d, int& x, int& y, vector<DATA>& data){
  vector<DATA>::iterator i = data.begin();
  while(i != data.end()){
    if(x == (*i).x && y <= (*i).y && y+d >= (*i).y)
      i = data.erase(i);
    else
      ++i;
  }
  y += d;
}

void South(int d, int& x, int& y, vector<DATA>& data){
  vector<DATA>::iterator i = data.begin();
  while(i != data.end()){
    if(x == (*i).x && y-d <= (*i).y && y >= (*i).y)
      i = data.erase(i);
    else
      ++i;
  }
  y -= d;
}

void East(int d, int& x, int& y, vector<DATA>& data){
  vector<DATA>::iterator i = data.begin();
  while(i != data.end()){
    if(y == (*i).y && x <= (*i).x && x+d >= (*i).x)
      i = data.erase(i);
    else
      ++i;
  }
  x += d;
}

void West(int d, int& x, int& y, vector<DATA>& data){
  vector<DATA>::iterator i = data.begin();
  while(i != data.end()){
    if(y == (*i).y && x-d <= (*i).x && x >= (*i).x)
      i = data.erase(i);
    else
      ++i;
  }
  x -= d;
}

C++: #include <iostream>
using namespace std;
int main(){
    int n;
    while(cin>>n){
        if(n==0) return 0;
        
    int ansx[n],ansy[n];
    
    for(int i=0;i<n;i++){
        cin>>ansx[i]>>ansy[i];
    }
    
    char ch[n];
    int m[n];
    int x=10,y=10;
    int move=0;
    cin>>move;
        
    int count=0;
    
    for(int j=0;j<move;j++){
        cin>>ch[j]>>m[j];
    }

    for(int l=0;l<move;l++){
        int r=0;
        
        if(ch[l]=='N'){
            for(r=0;r<m[l];r++){
                y++;
                if(x==ansx[l]&&y==ansy[l]) count++;
                break;
            }
        }
        
        if(ch[l]=='E'){
            for(r=0;r<m[l];r++){
                x++;
                if(x==ansx[l]&&y==ansy[l]) count++;
                break;
            }
        }
        
        if(ch[l]=='S'){
            for(r=0;r<m[l];r++){
                y--;
                if(x==ansx[l]&&y==ansy[l]) count++;
                break;
            }
        }
        if(ch[l]=='W'){
            for(r=0;r<m[l];r++){
                x--;
                if(x==ansx[l]&&y==ansy[l]) count++;
                break;
            }
        }
    
    }
    
    if(count==n)  cout<<"Yes"<<endl;
    else           cout<<"No"<<endl;
        
    }
    return 0;
}