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>
#include <cstring>
using namespace std;
bool s[21][21];
int e[4][2] = {
  { 0,1 }, { 1,0 }, { 0,-1 }, { -1,0 },
};
int main()
{
  int n,x,y,m,i,j;
  char d;
  for(;;){
    cin >> n;
    if(n==0)break;
    memset(s,0,sizeof(s));
    for(j=0;j<n;j++){
      cin >> x >> y;
      s[y][x] = true;
    }
    cin >> m;
    x = y = 10;
    if(s[y][x]) {
      s[y][x] = false;
      n--;
    }
    for(j=0;j<m;j++){
      cin >> d >> i;
      switch(d){
      case 'N': d = 0; break;
      case 'E': d = 1; break;
      case 'S': d = 2; break;
      case 'W': d = 3; break;
      }
      while(i--){
	x += e[d][0];
	y += e[d][1];
	if(s[y][x]) {
	  s[y][x] = false;
	  n--;
	}
      }
    }
    if(n) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include  <stdio.h>
#include  <algorithm>
#include  <math.h>
#include  <vector>
#include  <string>
#include  <sstream>
#include  <numeric>
#include  <set>
#include <map>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long

using namespace std;

int dat[22][22] = { 0 };

int main()
{
 cin.tie(0);
 ios::sync_with_stdio(false);

 int num = 0;
 while (cin >> num && num != 0)
 {
  int ans = 0;
  rep(i, num)
  {
   int tmp = 0, tmp2 = 0;
   cin >> tmp >> tmp2;
   dat[tmp][tmp2] = 1;
  }
  int tmp = 0; cin >> tmp;
  string m; int cmd = 0;
  int now_x = 10, now_y = 10;
  rep(i, tmp)
  {
   cin >> m >> cmd;
   rep(i, cmd)
   {
    switch (m[0])
    {
    case 'N': now_y += 1; break;
    case 'E': now_x += 1; break;
    case 'S': now_y -= 1; break;
    case 'W': now_x -= 1; break;
    }
    ans += dat[now_x][now_y];
    dat[now_x][now_y] = 0;
   }
  }
  if (ans == num) { printf("Yes\n"); }
  else { printf("No\n"); }
 }
 return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

int main(){

  int n;

  while(cin>>n,n){
    int x,y;
    int stone[21][21]={0};
    for(int i=0;i<n;++i){
      cin>>x>>y;
      stone[x][y]=1;
    }
    
    int m;

    cin>>m;

    char dir;
    int dis;
    int x_n=10;
    int y_n=10;
    int cnt=0;

    for(int i=0;i<m;++i){
      cin>>dir>>dis;

      if(dir=='N'){
	for(int j=0;j<dis;++j){
	  y_n++;
	  if(stone[x_n][y_n]==1){
	    cnt++;
	    stone[x_n][y_n]=0;
	  }
	}
      }

      else if(dir=='E'){
	for(int j=0;j<dis;++j){
	  x_n++;
	  if(stone[x_n][y_n]==1){
	    cnt++;
	    stone[x_n][y_n]=0;
	  }
	}
      }

      else if(dir=='S'){
	for(int j=0;j<dis;++j){
	  y_n--;
	  if(stone[x_n][y_n]==1){
	    cnt++;
	    stone[x_n][y_n]=0;
	  }
	}
      }

      else if(dir=='W'){
	for(int j=0;j<dis;++j){
	  x_n--;
	  if(stone[x_n][y_n]==1){
	    cnt++;
	    stone[x_n][y_n]=0;
	  }
	}
      }
    }
    if(cnt==n)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
}

C++: #include <cstdio>
#include <iostream>
using namespace std;
int field[21][21];
int main() {
    int n;
    while (scanf("%d",&n)) {
        if (!n) break;
        for (int i=0; i<21; i++) for (int j=0; j<21; j++) field[i][j]=0;
        for (int i=0; i<n; i++) {
            int x, y; scanf("%d%d",&x,&y);
            field[y][x]=1;
        }
        int m; scanf("%d",&m);
        int rx=10, ry=10;
        field[ry][rx]=0;
        int cnt=0;
        for (int i=0; i<m; i++) {
            char d; cin>>d;
            int dist; scanf("%d",&dist);
            if (d=='N') {
                for (int j=0; j<dist; j++) {
                    ry++;
                    if (field[ry][rx]) {
                        field[ry][rx]=0;
                        cnt++;
                    }
                }
            }
            if (d=='E') {
                for (int j=0; j<dist; j++) {
                    rx++;
                    if (field[ry][rx]) {
                        field[ry][rx]=0;
                        cnt++;
                    }
                }
            }
            if (d=='S') {
                for (int j=0; j<dist; j++) {
                    ry--;
                    if (field[ry][rx]) {
                        field[ry][rx]=0;
                        cnt++;
                    }
                }
            }
            if (d=='W') {
                for (int j=0; j<dist; j++) {
                    rx--;
                    if (field[ry][rx]) {
                        field[ry][rx]=0;
                        cnt++;
                    }
                }
            }
        }
        if (cnt!=n) puts("NO");
        else puts("YES");
    }
}

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

int map[21][21]={} ;
int dx[]={ 0,1,0,-1 } , dy[]={ 1,0,-1,0 } ;
int nx,ny,count;

void research( int dir, int times ){
	for( int j=0 ; j<times ; j++ ){
		nx += dx[dir] ;
		ny += dy[dir] ;
		if( map[nx][ny] == 1 ){
			map[nx][ny] = 0 ;
			count++;
		}
	}
}

int main(){
	
	int n,m,x,y,z;
	char s;
	int temp;
	
	while(1){
		cin >> n ;
		if( n==0 ) break;
		
		for( int i=0 ; i<n ; i++ ){
			cin >> x >> y ;
			map[x][y] = 1 ;
		}
		
		cin >> m ;
		count = 0 ;
		nx = 10 ;  ny = 10 ;
		
		for( int i=0 ; i<m ; i++ ){
			cin >> s >> z ;
			
			if( s=='N' ) temp = 0 ;
			else if( s=='E' ) temp = 1 ;
			else if( s=='S' ) temp = 2 ;
			else if( s=='W' ) temp = 3 ;
			
			research( temp , z ) ;
		}
		
		if( count == n ) cout << "YES" << endl ;
		else cout << "NO" << endl ;
		
		for( int i=0 ; i<21 ; i++ )
			for( int j=0 ; j<21 ; j++ )
				map[i][j] = 0 ;
	}
	
return 0;
}