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>

#define MAXMAP 21

using namespace std;

const int dx[]={0,1,-1,0},dy[]={1,0,0,-1};
const char direction[]={'N','E','W','S'};
bool myMap[MAXMAP][MAXMAP]={false};


int main(){
	int N,M,nowX,nowY;
	bool flag;
	
	while(cin>>N){
		
		if(N==0){
			break;
		}
		fill((bool*)myMap,(bool*)(myMap+MAXMAP),false);
		nowX=nowY=10;
		flag=false;
		
		for(int i=0;i<N;i++){
			int x,y;
			cin>>x>>y;
			myMap[y][x]=true;
		}
		
		cin>>M;
		for(int i=0;i<M;i++){
			char tempDirec;
			int distance,tempDist;
			
			cin>>tempDirec>>distance;
			
			
			for(int j=0;j<4;j++){
				if(tempDirec==direction[j]){
					
					
					if(dx[j]!=0){
						tempDist=nowX+dx[j]*distance;
						if(dx[j]==1){
							for(int k=nowX;k<=tempDist;k++){
								if(myMap[nowY][k]){
									myMap[nowY][k]=false;
								}
							}
						}
						else if(dx[j]==-1){
							for(int k=nowX;k>=tempDist;k--){
								if(myMap[nowY][k]){
									myMap[nowY][k]=false;
								}
							}
						}
						nowX=tempDist;
					}
					
					
					if(dy[j]!=0){
						tempDist=nowY+dy[j]*distance;
						if(dy[j]==1){
							for(int k=nowY;k<=tempDist;k++){
								if(myMap[k][nowX]){
									myMap[k][nowX]=false;
								}
							}
						}
						else if(dy[j]==-1){
							for(int k=nowY;k>=tempDist;k--){
								if(myMap[k][nowX]){
									myMap[k][nowX]=false;
								}
							}
						}
						nowY=tempDist;
					}
					
					
					break;
				}
			}
		}
		
		
		for(int i=0;i<MAXMAP;i++){
			for(int j=0;j<MAXMAP;j++){
				if(myMap[i][j]==true){
					flag=true;
					//cout<<"i="<<i<<" j="<<j<<endl;
					break;
				}
			}
		}
		
		
		if(flag){
			cout<<"No"<<endl;
		}
		else{
			cout<<"Yes"<<endl;
		}
	}
}

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

#define MAX_AREA_SIZE 21

int main()
{
        int jen, jex, jey; // 宝の数、位置X、位置Y 
        bool jewel[MAX_AREA_SIZE][MAX_AREA_SIZE];
        int curX, curY;
        int step;
        char dire;
        int dist;
        bool flag;

        while(1){
                flag = true;
                for(int i=0; i<MAX_AREA_SIZE; i++){
                        for(int j=0; j<MAX_AREA_SIZE; j++){
                                jewel[i][j] = true;
                        }
                }
                // 宝物の位置をセット
                cin >> jen;
                if(jen == 0){ break; }
                for(int i=0; i<jen; i++){
                        cin >> jex >> jey;
                        jewel[jex][jey] = false;
                }
                curX = curY = 10;
                cin >> step; // なんステップ進むかを入手
                for(; step>0; step--){
                        cin >> dire >> dist; // 方向と距離を入手
                        switch(dire){
                        case 'N' : { for(; dist>0; dist--){jewel[curX][++curY]=true;} break; }
                        case 'S' : { for(; dist>0; dist--){jewel[curX][--curY]=true;} break; }
                        case 'W' : { for(; dist>0; dist--){jewel[--curX][curY]=true;} break; }
                        case 'E' : { for(; dist>0; dist--){jewel[++curX][curY]=true;} break; }
                        }
                }
                // 宝が全部ゲットできたかのチェック
                for(int i=0; i<MAX_AREA_SIZE; i++){
                        for(int j=0; j<MAX_AREA_SIZE; j++){
                                if(jewel[i][j]==false){ flag = false; }
                        }
                }

                if( flag == true ){ cout << "Yes" << endl; }
                else{ cout << "No" << endl; }
        }
        
        return 0;
}

C++: #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <map>
#include <numeric>
#include <stack>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <strstream>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef long long ll;

int x=10,y=10;

int measure(char c,int m,bool jewel[][21],int flag){
	if(c == 'N'){
		rep(i,m){
			y++;
			if( jewel[x][y] ){
				flag++;
				jewel[x][y] = false;
				cout << flag <<endl;
			}
		}
	}
	else if(c == 'E'){
		rep(i,m){
			x++;
			if( jewel[x][y] ){
				flag++;
				jewel[x][y] = false;
			}
		}
	}
	else if(c == 'S'){
		rep(i,m){
			y--;
			if( jewel[x][y] ){
				flag++;
				jewel[x][y] = false;
			}
		}
	}
	else if(c == 'W'){
		rep(i,m){
			x--;
			if( jewel[x][y] ){
				flag++;
				jewel[x][y] = false;
				cout << flag <<endl;
			}
		}
	}
	return flag;
}

int main(){
	int n,m;

	while( cin >> n ,n){
		x=10,y=10;
		bool jewel[21][21] = {0};
		int flag = 0;
		
		rep(i,n){
			int x,y;
			cin >> x >> y;
			jewel[x][y] = true;
		}
		
		cin >> m;
		
		rep(i,m){
			char compass;
			int di;
			cin >> compass >> di;
			flag += measure(compass,di,jewel,0);
		}
		if( n == flag ) puts("Yes");
		else puts("No");
	}
	return 0;
}

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

#define HANTEI if(stone[y][x] == 1) { stone[y][x] = 0; n--; }

int main(void){
    
    while(1) {
        int n;
        cin >> n;
        if (n==0) break;
        int stone[21][21];
        for(int y=0; y<21; y++){
            for(int x=0; x<21; x++){
                stone[y][x] = 0;
            }
        }
        for(int i=0; i<n; i++){
            int x, y;
            cin >> x >> y;
            stone[y][x] = 1;
        }
        int m;
        int x=10, y=10;
        cin >> m;
        for(int i=0; i<m; i++){
           char d;
           int l;
           cin >> d;
           cin >> l;
           if(d=='N'){
               for(int j=0; j<l; j++) { y++; HANTEI }
           }
           if(d=='E'){
               for(int j=0; j<l; j++) { x++; HANTEI }
           }
           if(d=='S'){
               for(int j=0; j<l; j++) { y--; HANTEI }
           }
           if(d=='W'){
               for(int j=0; j<l; j++) { x--; HANTEI }
           }
        }
        printf("%s\n", (n==0 ? "YES" : "NO"));
    }
    
}