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<bits/stdc++.h>
using namespace std;

//ofstream outputfile("test.txt");
int main(){
    int n,m;
    while(cin>>n){
        if(n==0)break;
        vector<pair<int,int>>xy(n);
        for(int i=0;i<n;i++)cin>>xy[i].first>>xy[i].second;
        cin>>m;
        vector<pair<char,int>>mo(m);
        for(int i=0;i<m;i++)cin>>mo[i].first>>mo[i].second;
        auto now = make_pair(10,10);
//        now.first=10;now.second=10;
        int ans = 0;
        int v[n];
        memset(v,0,sizeof(v));
        //pair<int,int>before;
        for(int i=0;i<m;i++){
            //before = now;
            if(mo[i].first=='N'){   
                for(int j=0;j<mo[i].second;j++){
                    now = make_pair(now.first,now.second+1);
                    for(int k=0;k<n;k++){
                        if(now.first==xy[k].first&&now.second==xy[k].second){
                            if(v[k]==1)continue;
                            //cout<<"AAA:"<<now.first<<" "<<now.second<<endl;
                            v[k]=1;
                            ans++;
                        }
                    }
                }
            }else if(mo[i].first=='E'){
                for(int j=0;j<mo[i].second;j++){
                    now = make_pair(now.first+1,now.second);
                    for(int k=0;k<n;k++){
                        if(now.first==xy[k].first&&now.second==xy[k].second){
                            if(v[k]==1)continue;
                            v[k]=1;
                            ans++;
                        }
                    }
                }
            }else if(mo[i].first=='S'){
                for(int j=0;j<mo[i].second;j++){
                    now = make_pair(now.first,now.second-1);
                    for(int k=0;k<n;k++){
                        if(now.first==xy[k].first&&now.second==xy[k].second){
                            if(v[k]==1)continue;
                            v[k]=1;
                            ans++;
                        }
                    }
                }
            }else if(mo[i].first=='W'){
                for(int j=0;j<mo[i].second;j++){
                    now = make_pair(now.first-1,now.second);
                    //cout<<"test:"<<now.first<<" "<<now.second<<" ans:"<<ans<<endl;
                    for(int k=0;k<n;k++){
                        if(now.first==xy[k].first&&now.second==xy[k].second){
                            if(v[k]==1)continue;
                            //cout<<"test:"<<now.first<<" "<<now.second<<endl;
                            v[k]=1;
                            ans++;
                        }
                    }
                }
            }
        }
        if(ans==n){
            cout<<"Yes"<<endl;
            //outputfile<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
          //  outputfile<<"No"<<endl;
        }
    }
        //outputfile.close();
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, m;
int pos[50][50];
char d;
int I;

int main(){
	while (cin >> n&&n){
		REP(i, 50)REP(j, 50)pos[i][j] = 0;
		int sy = 10, sx = 10;
		REP(i, n){
			ll x, y;
			cin >> x >> y;
			pos[y][x] = 1;
		}
		int co = 0;
		if (pos[sy][sx] == 1){
			pos[sy][sx] = 0;
			co++;
		}
		cin >> m;
		REP(i, m){
			cin >> d >> I;
			REP(i, I){
				if (d == 'N') sy++;
				else if (d == 'E') sx++;
				else if (d == 'S') sy--;
				else sx--;
				if (pos[sy][sx]){
					pos[sy][sx] = 0;
					co++;
				}
			}
		}
		if (co == n)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

C++: #include<iostream>
using namespace std;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

int N,M,a,b;
int t[30][30];

void init(){
  for(int i=0;i<30;i++)
    for(int j=0;j<30;j++)
      t[i][j]=0;
}
int main(){
  while(1){
    cin>>N;
    if(N==0)break;
    init();
    for(int i=0;i<N;i++){
      cin>>a>>b;
      t[b][a]=1;
    }
    cin>>M;
    int y=10,x=10,ans=0;
    for(int i=0;i<M;i++){
      char ch;
      cin>>ch>>a;
      if(ch=='N')b=2;
      if(ch=='S')b=0;
      if(ch=='E')b=1;
      if(ch=='W')b=3;
      for(int j=0;j<a;j++){
	y+=dy[b];
	x+=dx[b];
	if(t[y][x])ans++,t[y][x]=0;
      }
    }
    cout<<(N==ans?"Yes":"No")<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int box[21][21]={};
  while(1){
    int N,i,I,n,x,y,X=9,Y=9,a=0,l;
    char h;
    cin>>N;
    if(N==0) break;
    else{
      for(i=0;i<N;i++){    
      cin>>x>>y;
      box[x-1][y-1]=1;
      }
      cin>>n;
      for(i=0;i<n;i++){
	cin>>h>>l;
	if(h=='N'){
	  for(I=0;I<l;I++){
	    Y++;
	    box[X][Y]=0;
	  }
	}	
	if(h=='S'){
	  for(I=0;I<l;I++){
	    Y--;
	   box[X][Y]=0;
	  }
	}	
	if(h=='E'){
	  for(I=0;I<l;I++){
	    X++;
	    box[X][Y]=0;
	  }
	}	
	if(h=='W'){
	  for(I=0;I<l;I++){
	    X--;
	    box[X][Y]=0;
	  }
	}
      }
      for(i=0;i<21;i++){
	for(I=0;I<21;I++){
	  if(box[i][I]==0) a++;
	}
      }
     
      if(a==441) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
    }
    a=0;
    X=9;
    Y=9;
    for(i=0;i<21;i++){
      for(I=0;I<21;I++){
	box[i][I]=0;
      }
    }
  }
  return 0;
}