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<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<bitset>
#include<map>
using namespace std;

struct P{
  int x,y;
};

vector<P> list;
int input(){
  int N;
  cin>>N;
  if(N==0)return false;
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    list.push_back(P{a,b});
  }
  return true;
}

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

bool solve(){
  int M;
  cin>>M;
  P r=P{10,10};
  vector<int> use;
  use.resize(list.size());
  for(int i=0;i<use.size();i++){
    use[i]=0;
  }
  for(int i=0;i<M;i++){
    char c;
    int d;
    cin>>c>>d;
    int v;
    switch(c){
      case 'N':
        v=0;
        break;
      case 'E':
        v=1;
        break;
      case 'S':
        v=2;
        break;
      case 'W':
        v=3;
        break;
    }
    int xx = r.x + vx[v]*d;
    int yy = r.y + vy[v]*d;
    for(int i=0;i<list.size();i++){
      if((yy==r.y&&((r.x<=list[i].x&&list[i].x<=xx&&list[i].y==yy)||(xx<=list[i].x&&list[i].x<=r.x&&list[i].y==yy)))
          ||(xx==r.x&&((r.y<=list[i].y&&list[i].y<=yy&& list[i].x==xx)||(yy<=list[i].y&&list[i].y<=r.y&&list[i].x==xx)))){
        use[i]=true;
      }
    }
    r.x = xx;
    r.y = yy;
  }
  for(int i=0;i<use.size();i++){
    if(!use[i])return false;
  }
  return true;
}


int main(){
  while(input()){
    if(solve()){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n,m,l,x,y;
	string s;
	while(cin>>n,n){
		int d[21][21]={};
		int f=0,dx=10,dy=10;
		for(int i=0;i<n;i++){
			cin>>x>>y;
			d[x][y]=1;
		}
		cin>>m;
		for(int i=0;i<m;i++){
			cin>>s>>l;
			for(int j=0;j<l;j++){
				if(s=="N")
				dy++;
				if(s=="S")
				dy--;
				if(s=="E")
				dx++;
				if(s=="W")
				dx--;
				if(d[dx][dy]==1)
				d[dx][dy]=0;
			}
		}
		for(int i=0;i<=20;i++){
			for(int j=0;j<=20;j++){
				if(d[i][j]==1)
				f=1;
			}
		}
		if(f==1)
		cout<<"No"<<endl;
		else
		cout<<"Yes"<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#define FIELD_SIZE 21

int main () {
  while ( 1 ) {
    int n;
    scanf( "%d", &n );
    if ( !n ) { return EXIT_SUCCESS; }
    
    int field[ FIELD_SIZE ][ FIELD_SIZE ] = {0};
    for ( int i = 0; i < n; i++ ) {
      int x, y;
      scanf( "%d%d", &x, &y );
      field[ y ][ x ] = 1;
    }

    int m;
    char dir[ 2 ];
    int len;
    int px = 10, py = 10;
    int get_num = 0;
    scanf( "%d", &m );
    if ( field[ py ][ px ] ) {
      get_num++;
      field[ py ][ px ] = 0;
    }

    for ( int i = 0; i < m; i++ ) {
      scanf( "%s%d", dir, &len );
      for ( int j = 0; j < len; j++ ) {
          switch ( dir[ 0 ] ) {
            case 'W':
            px--;
            break;
          case 'S':
            py--;
            break;
          case 'E':
            px++;
            break;
          case 'N':
            py++;
            break;
        }
//        printf( "%d, %d: %d\n", px, py, field[ py ][ px ] );
        if ( field[ py ][ px ] ) {
          get_num++;
          field[ py ][ px ] = 0;
        }
      }
    }
    
    puts( get_num == n ? "Yes" : "No" );
  }
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>

using namespace std;

#define INF 999999999

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

C++: #include <iostream>
using namespace std;
int main()
{
    while(1)
    {
        int n;
        cin>>n;if(!n)return 0;
        bool map[21][21]={{false}};
        for(int i=0;i<n;++i){
            int x,y;
            cin>>x>>y;
            map[x][y]=true;
        }
        cin>>n;
        int xp=10,yp=10;
        for(int i=0;i<n;++i){
            char d;
            int v;
            cin>>d>>v;
            if(d=='N'){
                for(int j=0;j<v;++j){
                    yp++;
                    if(map[xp][yp])map[xp][yp]=false;
                }
            }
            if(d=='W'){
                for(int j=0;j<v;++j){
                    xp--;
                    if(map[xp][yp])map[xp][yp]=false;
                }
            }
            if(d=='E'){
                for(int j=0;j<v;++j){
                    xp++;
                    if(map[xp][yp])map[xp][yp]=false;
                }
            }
            if(d=='S'){
                for(int j=0;j<v;++j){
                    yp--;
                    if(map[xp][yp])map[xp][yp]=false;
                }
            }
        }
        bool flag=false;
        for(int i=0;i<21;++i){
            for(int j=0;j<21;++j){
                if(map[i][j])flag=true;
            }
        }
        if(flag)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
}