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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n && n){
    vvl(v,21,21,0);
    ll a,b;
    rep(i,n){
      cin >> a >> b;
      v[a][b] = 1;
    }
    ll m,l,x=10,y=10;
    cin >> m;
    string s;
    rep(i,m){
      cin >> s >> l;
      if(s == "N"){
        rep(j,l){
          ++y;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else if(s == "W"){
        rep(j,l){
          --x;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else if(s == "E"){
        rep(j,l){
          ++x;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else{
        rep(j,l){
          --y;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
    }
    if(n) cout << "NO"<<endl;
    else cout << "YES" << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
 
int main(){
    int N,M,t[25][25],l,a,b,i,j,flg=0,k=0,ans[1000];
    int x,y;
    char d;
	for(i=0;i<1000;i++){
		ans[i]=0;
	}
    for(;;k++){
		x=10;y=10;
		flg=0;
		cin>>N;
		if(N==0){break;}
		for(i=0;i<25;i++){
			for(j=0;j<25;j++){
				t[i][j]=0;
			}
		}
        for(i=0;i<N;i++){
            cin>>a>>b;
            t[a][b]=1;
        }
        cin>>M;
        for(i=0;i<M;i++){
            cin>>d>>l;
            switch(d){
            case 'N':
                for(j=0;j<l;j++){
                    y++;
                    t[x][y]=0;
                }
                break;
            case 'E':
                for(j=0;j<l;j++){
                    x++;
                    t[x][y]=0;
                }
                break;
            case 'S':
                for(j=0;j<l;j++){
                    x--;
                    t[x][y]=0;
                }
                break;
            case 'W':
                for(j=0;j<l;j++){
                    y--;
                    t[x][y]=0;
                }
                break;
            default:
                break;
 
 
            }
        }
        for(i=0;i<21;i++){
            for(j=0;j<21;j++){
                if(t[i][j]==1){
                    flg=1;
                }
            }
        }
        if(flg==0){
            ans[k]=1;
        }else{
            ans[k]=2;
        }
    }
	i=0;
	while(ans[i]!=0){
		if(ans[i]==1){
			cout<<"Yes"<<endl;
		}else if(ans[i]==2){
			cout<<"No"<<endl;
		}
		i++;
	}
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int vx[4]={0,1,0,-1};
int vy[4]={1,0,-1,0};
bool map[30][30];
int get;
int N;
int M;
int x,y;

void init(){
	for(int i=0;i<30;i++){
		for(int j=0;j<30;j++){
			map[i][j]=0;
		}
	}
	N=M=get=0;
	y=x=10;
}

int vec(char c){
	if(c=='N'){
		return 0;
	}else if(c=='E'){
		return 1;
	}else if(c=='S'){
		return 2;
	}else{
		return 3;
	}
}

void solve(int v,int d){
	for(int i=0;i<d;i++){
		x+=vx[v];
		y+=vy[v];
		if(map[x][y]){
			map[x][y]=0;
			get++;
		}
	}
}



int main(){
	init();
	while(cin>>N,N!=0){
		//cout<<N<<endl;
		for(int i=0;i<N;i++){
			int a,b;
			cin>>a>>b;
			//cout<<a<<" "<<b<<" pos"<<endl;
			map[a][b]=1;
		}
		cin>>M;
		//cout<<M<<endl;
		//cout<<endl;
		for(int i=0;i<M;i++){
			char c;
			int d;
			scanf(" %c %d",&c,&d);
			//cout<<c<<endl;
			solve(vec(c),d);
		}
		
		if(get==N){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
		init();
	}
}

C++: #include<cstdio>
#include<iostream>

int main(void)
{
	int n,m; //宝の個数、移動回数
	int i; //for変数
	int math[21][21]; //宝の位置、ある場所は1,ない場所は0
	int x=10,y=10;
	int a,b; 
	char d; //方角
	int l; //移動量
	int count; //見つけた宝の数
	int yL=y,xL=x;
	
	for(;;)
	{
		scanf("%d",&n);
		if(n==0) break;
		for(a=0; a<21; a++)
		{
			for(b=0; b<21; b++)
			{
				math[a][b]=0;
			}
		}
		for(i=0; i<n; i++)
		{
			scanf("%d  %d",&a,&b);
			math[a][b]=1;
		}
		
		scanf("%d",&m);
		for(i=0; i<m; i++)
		{
			scanf("%s %d",&d,&l);
		
			if(math[10][10]==1)
			{
				count++;
				math[10][10]=0;
			}	
			if(d=='N')
			{
				yL+=l;
				for(y=y+1; y<=yL; y++)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				y--;
			}
			if(d=='E')
			{
				xL+=l;
				for(x=x+1; x<=xL; x++)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				x--;
			}
			if(d=='S')
			{
				yL-=l;
				for(y=y-1; y>=yL; y--)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				y++;
			}
			if(d=='W')
			{
				xL-=l;
				for(x=x-1; x>=xL; x--)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				x++;
			}
		}
		
		if(count==n) printf("Yes\n");
		else printf("No\n");
		count=0;
		x=10;y=10;
	}
	
	return 0;
}