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<cstdio>
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int main(){
    int n;
    while(scanf("%d",&n),n){
        int stage[22][22]={{0}};
        char vis[22][22];
        for(int i = 0; i < 21; i++){
            for(int j = 0; j < 21; j++){
                vis[i][j] = '.';
            }
        }
        for(int i = 0; i < n; i++){
            int hx,hy;
            scanf("%d%d",&hx,&hy);
            stage[hy][hx] = 1;
            vis[hy][hx] = '*';
        }
        int m;
        scanf(" %d",&m);
        int nx = 10;
        int ny = 10;
        int gotten = 0;
        for(int i = 0; i < m; i++){
            //vis[ny][nx] = '#';
            if(i == 0){
                stage[10][10] == 1 ? gotten = 1 : gotten = 0;
            }
            char dir;
            int dist;
            cin >> dir >> dist;
            int fx = nx;
            int fy = ny;
            if(dir == 'N'){
                fy = ny+dist;
                while(ny != fy)if(stage[++ny][nx]-- == 1)gotten++;
            }
            if(dir == 'E'){
                fx = nx+dist;
                while(nx != fx)if(stage[ny][++nx]-- == 1)gotten++;
            }
            if(dir == 'S'){
                fy = ny-dist;
                while(ny != fy)if(stage[--ny][nx]-- == 1)gotten++;
            }
            if(dir == 'W'){
                fx = fx-dist;
                while(nx != fx)if(stage[ny][--nx]-- == 1)gotten++;
            }
        }
        if(stage[ny][nx] == 1)gotten++;
        /*for(int i = 0; i < 21; i++){
            for(int  j = 0; j < 21; j++){
                printf("%c",vis[i][j]);
            }
            puts("");
        }*/
        if(gotten == n)puts("Yes");
        else puts("No");
    }
    return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int N;//宝石の数
int M;//ロボットに与えた命令の個数
int main()
{
  int x,y;
  while(cin>>N,N){
    int juery[30][30];
    int px = 10;
    int py = 10;
    int ans = N;
    for(int i = 0;i <N;i++){
    cin>>x>>y;
    juery[y][x] = 1;
    }
    cin>>M;//命令の数
    char order;
    for(int j = 0;j <M;j++){
      cin>>order;
      cin >>x;//移動距離
      bool flag = false;
      if(order=='N'){
        for(int i =0; i <x;i++){
	  py +=1;
	  if(juery[py][px]==1){
	    flag =true;
	    // cout <<juery[py][px]<<endl;
	    //cout <<"get"<<endl;
	    juery[py][px]=0;
	    ans--;
	  }
	}
      }else if(order=='E'){
	for(int i = 0;i <x;i++){
	  px +=1;
	  if(juery[py][px]==1){
	    flag = true;
	    // cout <<juery[py][px]<<endl;
	    // cout <<"get"<<endl;
	    juery[py][px]=0;
	    ans--;
	  }
	}
      }else if(order=='S'){
	for(int i = 0;i <x;i++){
	  py -=1;
	  if(juery[py][px]==1){
	    flag = true;
	    // cout <<juery[py][px]<<endl;
	    //   juery[py][px]=0;
	  }
	}
      }else if(order=='W'){
	for(int i = 0;i <x;i++){
	  px -=1;
	  if(juery[py][px]==1){
	    flag = true;
	    // cout <<juery[py][x]<<endl;
	    // juery[py][px]=0;
	    ans--;
	  }
	}
      }
    }
    bool ok = true;//すべての宝石が回収できたかどうか
    for(int i =0;i <=20;i++){
      for(int j = 0;j <=20;j++){
	if(juery[i][j]==1){
	  ok = false;
	}
      }
    }
    if(ans==0){
      cout <<"Yes"<<endl;
    }else{
      cout <<"No"<<endl;
    }
  }
    
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n;

int main() {
	cout << fixed << setprecision(18);
	cin>>n;
	while(n!=0){
		long long int x,y,mp[25][25]={},capture=0,nowx=10,nowy=10;
		for(int i=0;i<n;i++){
			cin>>x>>y;
			mp[x][y]=1;
		}
		long long int m,l;
		cin>>m;
		char ch;
		for(int i=0;i<m;i++){
			cin>>ch>>l;

			while(l>0){
				if(ch=='N'){
					nowy++;
				}else if(ch=='S'){
					nowy--;
				}else if(ch=='E'){
					nowx++;
				}else{nowx--;}
				
				
				if(mp[nowx][nowy]==1){
					mp[nowx][nowy]=0;
					capture++;
				}
				l--;
			}
			//cout<<nowx<<" "<<nowy<<endl;
		}
		if(capture==n){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
		cin>>n;
	}
}