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 loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

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

int main(){
	int n;
	while(cin>>n,n){
		int x[n],y[n];
		bool check[n];
		rep(i,n)cin>>x[i]>>y[i];
		int m,dir,l,nowx=10,nowy=10;
		char d;
		cin>>m;
		rep(i,m){
			cin>>d>>l;
			if(d=='N')dir=1;
			if(d=='W')dir=2;
			if(d=='S')dir=3;
			if(d=='E')dir=0;
			rep(k,l){
				nowx+=dx[dir];
				nowy+=dy[dir];
				rep(j,n)if(nowx==x[j] && nowy==y[j])check[j]=true;
			}
		}
		bool ans=true;
		rep(i,n)if(!check[i])ans=false;
		cout<<((ans)?"Yes":"No")<<endl;
	}
	return 0;
}

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] = 1;

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

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

    int nowx=10;
    int nowy=10;

    REP(j,m){
      cin >> d[j] >> l[j];
      if (d[j]==N){
	REP(k,l[k]){
	  gem[nowx+k][nowy]=1
	    }
	nowx +=l[j];
      }else if(d[j]==S){
	REP(k,l[k]){
	  gem[nowx-k][nowy]=1
	    }
	nowx -=l[j];
      }else if(d[j]==W){
	REP(k,l[k]){
	  gem[nowx][nowy-k]=1
	    }
	nowx -=l[j];
      }else if(d[j]==E){
	REP(k,l[k]){
	  gem[nowx][nowy+k]=1
	    }
	nowx +=l[j];
      }
    }
    int tf;

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

    if(tf){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))

using namespace std;
using LL=long long;

int F[21][21];

int main(){
    int n,m,x,y,d,cnt;
    string c;
    while(1){
        cin>>n;
        if(!n) break;
        cnt=0;
        for(int i=0;i<21;i++) for(int j=0;j<21;j++) F[i][j]=0;
        for(int i=0;i<n;i++){
            cin>>x>>y;
            F[y][x]=1;
        }
        cin>>m;
        x=y=10;
        for(int i=0;i<m;i++){
            cin>>c>>d;
            if(c=="N"){
                for(int j=0;j<=d;j++){
                    if(F[y+j][x]){
                        cnt++;
                        F[y+j][x]=0;
                    }
                }
                y+=d;
            }
            else if(c=="S"){
                for(int j=0;j<=d;j++){
                    if(F[y-j][x]){
                        cnt++;
                        F[y-j][x]=0;
                    }
                }
                y-=d;
            }
            else if(c=="W"){
                for(int j=0;j<=d;j++){
                    if(F[y][x-j]){
                        cnt++;
                        F[y][x-j]=0;
                    }
                }
                x-=d;
            }
            else if(c=="E"){
                for(int j=0;j<=d;j++){
                    if(F[y][x+j]){
                        cnt++;
                        F[y][x+j]=0;
                    }
                }
                x+=d;
            }
        }
        if(cnt==n) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}

C++: #include <iostream> // C++の入出力
#include <stdio.h> // C の入出力
#include <algorithm> // sort などのアルゴリズム
#include <string.h> // C の文字列用
#include <ctype.h> // C の文字種用
#include <string> // C++の文字列
#include <math.h>
#include <sstream>

using namespace std;
int main(void){
    while(true){
        int n;
        cin>>n;
        if(n==0)break;
        int inx,iny;
        bool  takara[21][21]={0};
        for(int i=0;i<n;i++){
            cin>>inx>>iny;
            takara[inx][iny]=1;
        }
        int k,cnt=0;
        cin>>k;
        int x=10,y=10,oldx=10,oldy=10;
        string houi;
        int idou;
        for(int i=0;i<k;i++){
            oldx=x;oldy=y;
            cin>>houi>>idou;
            if(houi=="N"){
                for(int s=0;s<idou;s++){
                    y++;
                    if(takara[x][y]==1){
                        takara[x][y]=0;
                        cnt++;
                    }
                }
            }else if(houi=="S"){
                for(int s=0;s<idou;s++){
                    y--;
                    if(takara[x][y]==1){
                        takara[x][y]=0;
                        cnt++;
                    }
                }
            }else if(houi=="E"){
                for(int s=0;s<idou;s++){
                    x++;
                    if(takara[x][y]==1){
                        takara[x][y]=0;
                        cnt++;
                    }
                }
            }else if(houi=="W"){
                for(int s=0;s<idou;s++){
                    x--;
                    if(takara[x][y]==1){
                        takara[x][y]=0;
                        cnt++;
                    }
                }
            }
            
        }
        if(cnt==n)cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}

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

int main(){
	while(true){
		bool map[21][21]={};
		int gem,n,get=0,cx=10,cy=10;
		cin>>gem;
		if(gem==0)break;
		for(int i=0;i<gem;i++){
			int x,y;
			cin>>x>>y;
			map[x][y]=true;
		}
		cin>>n;
		for(int i=0;i<n;i++){
			char oder;
			int leng;
			cin>>oder>>leng;
			for(int j=0;j<leng;j++){
			switch (oder){
			case 'N':
				cy++;
				break;
			case 'S':
				cy--;
				break;
			case 'W':
				cx--;
				break;
			case 'E':
				cx++;
				break;
			}
			if(map[cx][cy]){
				map[cx][cy]=false;
				get++;
			}
			}
		}
		cout<<(get==gem?"Yes":"No")<<endl;
	}
	return 0;
}