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 <math.h>
#include <algorithm>
#include <string>
using namespace std;

string orCheck(bool matrix[21][21]){
    for(int i = 0; i < 21; i++){
        for(int j = 0; j < 21; j++){
            if(matrix[i][j]) return "No";
        }
    }
    return "Yes";
};

int main(int argc, const char * argv[])
{
    int n;
    while(true){
        cin >> n;
        if(n == 0) break;
        bool tile[21][21];
        for(int i = 0; i < 21; i++){
            for(int j = 0; j < 21; j++){
                tile[i][j] = false;
            }
        }
        
        // 宝石
        for(int i = 0; i < n; i++){
            int gx, gy;
            cin >> gx >> gy;
            tile[gy][gx] = true;
        }
        
        // 命令
        int m;
        cin >> m;
        int x = 10, y = 10;
        tile[y][x] = false;
        for(int i = 0; i < m; i++){
            char direction;
            int distance;
            cin >> direction >> distance;
            //cout << "direction: " << direction << "\tdistance: " << distance << "\n";
            
            switch (direction) {
                case 'N':
                    for(int j = 1; j < distance; j++)
                        tile[y + j][x] = false;
                    y += distance;
                    break;
                    
                case 'S':
                    for(int j = 1; j <= distance; j++)
                        tile[y - j][x] = false;
                    y -= distance;
                    break;
                    
                case 'E':
                    for(int j = 1; j <= distance; j++)
                        tile[y][x + j] = false;
                    x += distance;
                    break;
                    
                case 'W':
                    for(int j = 1; j <= distance; j++)
                        tile[y][x - j] = false;
                    x -= distance;
                    break;
            }
            //cout << "position: " << x << " " << y << "\n";
        }
        cout << orCheck(tile) << "\n";
    }
    return 0;
}

C++: #include<stdio.h>

int main(){
	int n,m,d,x,y,i;
	for(;scanf("%d",&n),n;puts(n?"No":"Yes")){
		int f[21][21] = {0};
		for(i=n;i--;f[y][x] = 1)
			scanf("%d %d",&x,&y);
		scanf("%d",&m);
		x=y=10;
		for(i=m;i--;)
			for(scanf(" %c %d",&m,&d);d--;f[y][x]?n--,f[y][x]=0:0){
				x+=m==69?1:m==87?-1:0;
				y+=m==78?1:m==83?-1:0;
			}
	}
}

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

typedef pair<string, int> P;

int main() {
	int n;
	while(cin >> n && n){
		int x[20], y[20];
		for(int i = 0; i < n; ++i)
			cin >> x[i] >> y[i];
		int m;
		cin >> m;
		queue<P> q;
		string s;
		int d;
		for(int i = 0; i < m; ++i){
			cin >> s >> d;
			q.push(P(s, d));
		}
		int c = n, nowx = 10, nowy = 10;
		bool ca[20] = {false};
		while(!q.empty()){
			P p = q.front(); q.pop();
			for(int i = 0; i < p.second; ++i){
				string str = p.first;
				if(str == "N") nowy++;
				else if(str == "E") nowx++;
				else if(str == "S") nowy--;
				else if(str == "W") nowx--;
				
				for(int j = 0; j < n; ++j){
					if(nowx == x[j] && nowy == y[j] && !ca[j]){
						ca[j] = true;
						c--;
					}
				}
				if(c == 0)
					break;
				
			}
		}
		if(c == 0)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  int mp[21][21]={0};
  int x,y,n;
  char d;
  int nowx,nowy,ans;
  while(1){
    cin>>N;
    if(N==0) break;
    nowx=10;
    nowy=10;
    ans=0;
    for(int i=0;i<N;i++){
      cin>>x>>y;
      mp[x][y]=1;
    }
    /*for(int i=0;i<21;i++){
      for(int j=0;j<21;j++){
	cout<<mp[i][j]<<" ";
      }
      cout<<endl;
      }*/
    cin>>M;
    for(int i=0;i<M;i++){
      cin>>d>>n;
      if(d=='W'){
	for(int j=0;j<n;j++){
	  nowy--;
	  if(mp[nowy][nowx]==1){
	    mp[nowy][nowx]=0;
	    ans++;
	  }
	}
      }
	else if(d=='N'){
	  for(int j=0;j<n;j++){
	    nowx++;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
	else if(d=='E'){
	  for(int j=0;j<n;j++){
	    nowy++;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
	else if(d=='S'){
	  for(int j=0;j<n;j++){
	    nowx--;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
    }
    if(ans==N) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
struct P{
  int x,y;
};

int main(){
  P p;
  int x,y;
  int n,m;
  vector<P> v;
  char c;
  int l;
  int dx,dy;
  while( cin>>n && n ){
    v.clear();
    for( int i=0;i<n;i++ ){
      cin >> p.x >> p.y;
      v.push_back( p );
    }
    x=10;
    y=10;
    cin >> m;
    for( int i=0;i<m;i++ ){
      cin >> c >> l;
      dx=0; dy=0;
      switch(c){
      case 'N': dy=1;  break;
      case 'E': dx=1;  break;
      case 'S': dy=-1; break;
      case 'W': dx=-1; break;
      }

      for( int k=0;k<l;k++ ){
	x+=dx; y+=dy;
	for( unsigned int j=0;j<v.size();j++ ){
	  if( v[j].x==x && v[j].y==y ){
	    v.erase( v.begin()+j );
	    break;
	  }
	}
      }
    }
    if( v.size() )
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  }

  return 0;
}