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<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)

using namespace std;

int main(){
    int n;
    while(cin >> n,n){

        int houseki[20][20]={0};
        int a,b;
        REP(i,n){
            cin >> a >> b;
            houseki[a][b] = 1;
        }

        int m;
        cin >> m;
        int cnt = 0;
        char s;
        int l;
        int x = 10,y = 10;
        REP(i,m){
            cin >> s;
            cin >> l;
            switch (s) {
                case 'N':
                    while(l != 0){
                        if(houseki[x][y+1] == 1){
                            cnt++;
                            houseki[x][y+1] = 0;
                        }
                        l--;
                        y++;
                    }
                    break;
                case 'E':
                    while(l != 0){
                        if(houseki[x+1][y] == 1){
                            cnt++;
                            houseki[x+1][y] = 0;
                        }
                        l--;
                        x++;
                    }
                    break;
                case 'S':
                    while(l != 0){
                        if(houseki[x][y-1] == 1){
                            cnt++;
                            houseki[x][y-1] = 0;
                        }
                        l--;
                        y--;
                    }
                    break;
                case 'W':
                    while(l != 0){
                        if(houseki[x-1][y] == 1){
                            cnt++;
                            houseki[x-1][y] = 0;
                        }
                        l--;
                        x--;
                    }
                    break;
                }
        }
        if(n == cnt){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

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

int main()
{
	int num;
	while (scanf("%d", &num), num){
		int map[100][100] = {0};
		
		for (int i = 0; i < num; i++){
			int x, y;
			scanf("%d %d", &x, &y);
			map[x][y] = 1;
		}
		
		int X = 10;
		int Y = 10;
		
		int M;
		scanf("%d", &M);
		for (int i = 0; i < M; i++){
			char c;
			int l;
			scanf(" %c %d", &c, &l);
			
			while (l > 0){
				switch (c){
					case 'N':
					Y++;
					break;
					
					case 'E':
					X++;
					break;
					
					case 'S':
					Y--;
					break;
					
					case 'W':
					X--;
					break;
				}
				num -= map[X][Y];
				map[X][Y] = 0;
				l--;
			}
		}
		
		if (num == 0){
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	
	return 0;
}

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

struct ans{
	int n;
	ans *next;
};

int main(){
	ans *start=new ans();
	start->next=NULL;
	ans *end=start;
	ans *buf;
	char s[20];
	char dir;
	char *ps;
	int **juel;
	int x=10,y=10;
	int state[21][21];
	int i,j,n,m,size;
	while(fgets(s,sizeof(s),stdin)){
		size=atoi(s);
		if(size==0) break;
		memset(state,0x00,sizeof(state));
		state[10][10]=1;
		x=10;
		y=10;
		juel=new int*[size];
		for(i=0;i<size;i++){
			juel[i]=new int[2];
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			juel[i][0]=atoi(ps);
			ps=strtok(NULL," ");
			juel[i][1]=atoi(ps);
		}
		fgets(s,sizeof(s),stdin);
		n=atoi(s);
		for(i=0;i<n;i++){
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			dir=ps[0];
			ps=strtok(NULL," ");
			m=atoi(ps);
			if(dir=='N'){
				for(j=1;j<=m;j++) state[x][y+j]=1;
				y+=m;
			}
			else if(dir=='S'){
				for(j=1;j<=m;j++) state[x][y-j]=1;
				y-=m;
				break;
			}
			else if(dir=='E'){
				for(j=1;j<=m;j++) state[x+j][y]=1;
				x+=m;
			}
			else if(dir=='W'){
				for(j=1;j<=m;j++) state[x-j][y]=1;
				x-=m;
			}
		}
		for(i=0;i<size;i++){
			if(state[juel[i][0]][juel[i][1]]==0) break;
		}
		if(i==size) n=0;
		else n=1;
		buf=new ans();
		buf->n=n;
		buf->next=NULL;
		end->next=buf;
		end=buf;
		for(i=0;i<size;i++) delete [] juel[i];
		delete [] juel;
	}
	buf=start->next;
	while(buf!=NULL){
		if(buf->n==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
		end=buf;
		buf=buf->next;
		delete end;
	}
	return 0;
}

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

enum COO{X, Y};

int main(){
	vector<bool> ansvec;

	for(;;){
		int N;
		cin >> N;
		if (N == 0) break;
		
		bool isGem[21][21] {{false}};
		for (int i = 0; i < N; i++){
			int x, y;
			cin >> x >> y;
			isGem[x][y] = true;
		}
		
		int M;
		cin >> M;
		int collect = 0;
		int now[2] = {10, 10}; // (x, y)
		for (int i = 0; i < M; i++){
			string d;
			int l;
			cin >> d >> l;
			for (int j = 1; j <= l; j++){
				if (d == "N" && isGem[now[X]][now[Y] + j]){
					collect++;
					isGem[now[X]][now[Y] + j] = false;
				}
				else if (d == "E" && isGem[now[X] + j][now[Y]]){
					collect++;
					isGem[now[X] + j][now[Y]] = false;
				}
				else if (d == "S" && isGem[now[X]][now[Y] - j]){
					collect++;
					isGem[now[X]][now[Y] - j] = false;
				}
				else if (d == "W" && isGem[now[X] - j][now[Y]]){
					collect++;
					isGem[now[X] - j][now[Y]] = false;
				}
			}

			now[X] += (d == "E" ? l : d == "W" ? -l : 0);
			now[Y] += (d == "N" ? l : d == "S" ? -l : 0);
		}
		ansvec.push_back(collect == N);
	}

	for (bool ans : ansvec){
		cout << ( ans == true ? "Yes" : "No" ) << endl;
	}
	return 0;
}