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 <stdio.h>
#include <math.h>
#include <iostream>

using namespace std;

int main() {
	int k;
	char d;
	int a,b;
	int counter;
	int robx;
	int roby;
	int kari;
	while (cin >> k) {
		if (k == 0) {
			break;
		}
		counter = 0;
		int hyou[20][20] = {0};
		int koudou[30][2] = {0};
		for (int i = 0; i < k; i++) {
			cin >> a >> b;
			hyou[a][b] = 1;
			counter++;
		}
		cin >> k;
		for (int i = 0; i < k; i++) {
			cin >> d >> a;
			if (d == 'N') {
				koudou[i][0] = a;
			} else if (d == 'S') {
				koudou[i][0] = -a;
			} else if (d == 'E') {
				koudou[i][1] = a;
			} else {
				koudou[i][1] = -a;
			}
		}
		robx = 10;
		roby = 10;
		if (hyou[10][10] == 1) {
			hyou[10][10] = 0;
			counter--;
		}
		for (int i = 0; i < k; i++) {
			if (koudou[i][0] == 0) {
				kari = 1;
			} else {
				kari = 0;
			}
			for (int j = 0; j < abs(koudou[i][kari]); j++) {
				if (koudou[i][kari] > 0) {
					if (kari == 0) {
						roby++;
					} else {
						robx++;
					}
				} else {
					if (kari == 0) {
						roby--;
					} else {
						robx--;
					}
				}
				//printf("%d %d\n",robx,roby);
				if (hyou[robx][roby] == 1) {
					hyou[robx][roby] = 0;
					counter--;
				}
			}
		}
		if (counter == 0) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}
	return 0;
}

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

using namespace std;
int map[21][21];

#define NUM 21

int move();

int main(){
	int n;
	int x,y;

	while(cin>>n,n){
		for(int i=0;i<NUM;i++)
			for(int j=0;j<NUM;j++)
				map[i][j]=0;
		for(int i=0;i<n;i++){
			cin>>x>>y;
			map[x][y]=1;
		}
		if(move()) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}


int move(){

	char dir;
	int c,num,d;
	int dx[4]={1,-1,0,0};
	int dy[4]={0,0,1,-1};
	int sx=10;
	int sy=10;

	cin >> c;
	for(int i=0;i<c;i++){
		cin>>dir>>num;
		if(dir=='N') d=2;
		else if(dir=='W') d=1;
		else if(dir=='S') d=3;
		else if(dir=='E') d=0;
		for(int j=0;j<num;j++){
			sx+=dx[d];
			sy+=dy[d];
			map[sx][sy]=0;
		}
	}
	for(int i=0;i<NUM;i++)
		for(int j=0;j<NUM;j++)
			if(map[i][j]==1)
				return 0;
	return 1;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){

  int n;

  while (cin >> n,n){
    int x[100];
    int y[100];

    int gem[25][25] = {0};

    REP(i,n){
      cin >> x[i] >> y[i];
      gem[x[i]][y[i]] = 1;
    }
    int m;

    cin >> m;

    char d[100];
    int l[100];

    int nowx=10;
    int nowy=10;

    REP(j,m){
      cin >> d[j] >> l[j];
      if (d[j]=='E'){
	REP(k,l[j]){
	  nowx ++;
	  gem[nowx][nowy]=0;
	}
      }else if(d[j]=='W'){
	REP(k,l[j]){
	  nowx --;
	  gem[nowx][nowy]=0;
	}
      }else if(d[j]=='S'){
	REP(k,l[j]){
	  nowy --; 
	  gem[nowx][nowy]=0;
	} 
      }else if(d[j]=='N'){
	REP(k,l[j]){
	  nowy ++;
	  gem[nowx][nowy]=0;
	}
      }
      //      cout << nowx << "," << nowy << endl; //
    }
    int tf=0;


    /*  
	REP(piyo,25){
	REP(are,25){
	cout << gem[piyo][are] << ",";
	}}
    */


    REP(hoge,25){
      REP(huga,25){
	tf += gem[hoge][huga];
      }
    }

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

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX  999999
int main(){
    while(true){
    int ans = 0;
    vvi v(21, vi (21 ,INF));
    vc c(100,0);vi d(100,0);
    vi x(100,0); vi y(100,0);
        int m ;cin >>m; if(!m) break;
        int tempx = 10,tempy = 10;rep(i,m){cin >> x[i] >> y[i];v[y[i]][x[i]] = 0;}
    int n; cin >> n; rep(i,n) {cin >> c[i] >> d[i];
        if(c[i] == 'N'){
            for(int k =1;k<=d[i];k++)if(v[tempy+k][tempx] == 0)ans++;tempy+=d[i];
        }
        if(c[i] == 'E'){
            for(int k =1;k<=d[i];k++)if(v[tempy][tempx+k] == 0) ans++; tempx+=d[i];
        }
        if(c[i] == 'S'){
            for(int k =1;k<=d[i];k++)if(v[tempy-(k)][tempx] == 0)ans++;tempy-=d[i];

        }
        if(c[i] == 'W'){
            for(int k =1;k<=d[i];k++)if(v[tempy][tempx-k] == 0)ans++;tempx-=d[i];

        }
    }
        if(ans == m)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}

C++: #include<iostream>
#include<string.h>
#include<map>
using namespace std;

int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};

int main()
{
	int n;
	while(cin>>n && n!=0){
		bool goal[20];
		memset(goal,false,sizeof(goal));
		int gx[20],gy[20];
		map<pair<int,int>,int> Idx;
		for(int i=0;i<n;i++){
			cin>>gx[i]>>gy[i];
			Idx[make_pair(gx[i],gy[i])]=i;
		}

		int m; 
		cin>>m;
		int x=10,y=10;
		for(int i=0;i<m;i++){
			int r=0,dist;
			char c;cin>>c>>dist;
			if(c=='N') r=2;
			else if(c=='E') r=1;
			else if(c=='S') r=0;
			else r=3;

			if(Idx.count(make_pair(x,y))){
				goal[Idx[make_pair(x,y)]]=true;
			}


			for(int k=0;k<dist;k++){
//				cout<<x<<" "<<y<<endl;
				x+=dx[r];y+=dy[r];
				if(Idx.count(make_pair(x,y))){
					goal[Idx[make_pair(x,y)]]=true;
				}
			}
		}
		bool ok=true;
		for(int i=0;i<n;i++){
			if(!goal[i]) ok=false;
		}
		if(ok) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}