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<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,*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,0,sizeof(state));
		juel=new int*[size];
		for(i=0;i<size;i++){
			juel[i]=new int[3];
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			juel[i][0]=atoi(ps);
			ps=strtok(NULL," ");
			juel[i][1]=atoi(ps);
			juel[i][2]=1;
		}
		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);
			switch(dir){
			case 'N':
				for(j=1;j<=m;j++) state[x][y+j]=1;
				y+=m;
				break;
			case 'S':
				for(j=1;j<=m;j++) state[x][y-j]=1;
				y-=m;
				break;
			case 'E':
				for(j=1;j<=m;j++) state[x+j][y]=1;
				x+=m;
				break;
			case 'W':
				for(j=1;j<=m;j++) state[x-j][y]=1;
				x-=m;
				break;
			}
		}
		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 1;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<int,int> Pi;
const int INF=(ll)(1LL<<31)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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 dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int d[21][21];
int m;
int main(){
	while(1){
		cin>>n;
		if(n==0)break;
		REP(i,21)
			REP(j,21)
				d[i][j]=0;
		for(int i=0;i<n;i++){
			int t,s;
			cin>>t>>s;
			d[t][s]=1;
		}
		cin>>m;
		int nx=10,ny=10;
		d[nx][ny]=0;
		for(int i=0;i<m;i++){
			char t;
			int s;
			cin>>t>>s;
			for(int j=0;j<s;j++){
				if(t=='N'){
					ny++;
				}else if(t=='E'){
					nx++;
				}else if(t=='S'){
					ny--;
				}else if(t=='W'){
					nx--;
				}
				d[nx][ny]=0;
			}
			//cout<<endl;
		}
		int flag=0;
		for(int i=0;i<21;i++){
			for(int j=0;j<21;j++){
				if(d[i][j]==1)flag=1;
			}
		}
		if(!flag)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
  
int main()
{
	int n,m,o;
	int p[21][21]={0}; //宝石の座標
	int x,y;
	int i,j,k;
	int ans;
	char a;

	while(1){
	scanf("%d",&n);
	if((n==0))
		break;
	//ここまでテンプレ

	ans=0;

	for(i=0;i<n;i++){
		scanf("%d %d",&x,&y);
		p[x][y]=1;
	}

	scanf("%d",&m);

	x=11;y=11;
	p[x][y]=0;

	for(i=0;i<m;i++)
	{
		scanf("%s %d",&a,&o);
		for(j=0;j<o;j++)
		{
			if(a=='N')
				y++;
			if(a=='S')
				y--;
			if(a=='E')
				x++;
			if(a=='W')
				x--;
			p[x][y]=0;
		}
	}

	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++){
			ans+=p[i][j];
		}
	}

	if(ans==0)
		printf("Yes\n");
	else
		printf("No\n");


	//ここからテンプレ
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<vector<bool> > jewel(21, vector<bool>(21, false));
        for(int i=0; i<n; ++i){
            int x, y;
            cin >> x >> y;
            jewel[y][x] = true;
        }

        int m;
        cin >> m;
        int get = 0;
        int y = 10;
        int x = 10;
        for(int i=0; i<m; ++i){
            char c;
            int dist;
            cin >> c >> dist;

            int dy = 0;
            int dx = 0;
            if(c == 'N')
                dy = 1;
            else if(c == 'S')
                dy = -1;
            else if(c == 'E')
                dx = 1;
            else
                dx = -1;

            while(--dist >= 0){
                y += dy;
                x += dx;
                if(jewel[y][x]){
                    jewel[y][x] = false;
                    ++ get;
                }
            }
        }

        if(get == n)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}