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 <algorithm>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

int main()
{
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            return 0;
        }

        vector<pair<int, int>> v;
        for (int i = 0; i < n; ++i) {
            int x, y;
            cin >> x >> y;
            v.emplace_back(x, y);
        }

        pair<int, int> pos(10, 10);
        int m;
        cin >> m;
        v.erase(remove(begin(v), end(v), pos), end(v));
        for (int i = 0; i < m; ++i) {
            char d;
            int x;
            cin >> d >> x;
            for (int j = x; j > 0; --j) {
                if (d == 'N' || d == 'S') {
                    int dy = d == 'N' ? 1 : -1;
                    pos.second += dy;
                }
                else {
                    int dx = d == 'E' ? 1 : -1;
                    pos.first += dx;
                }
                v.erase(remove(begin(v), end(v), pos), end(v));
            }
        }

        if (v.empty()) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <map>

using namespace std;
typedef long long LL;
#define REP(i,N) for(int i = 0; i < (int)N; i++)
int dy[4] = {1,0,-1,0};
int dx[4] = {0,1,0,-1};
bool gems[25][25];
vector<bool> hantei;
int main(){
	int n;
	cin >> n;
	while(n!=0){
		REP(i,25)memset(gems[i],0,sizeof(gems[i]));
		REP(i,n){
			int x,y;
			cin >> x >> y;
			gems[x][y] = true;
		}
		int ret=0;
		int m;
		cin >> m;
		int nowx,nowy;
		nowx = nowy = 10;
		REP(i,m){
			char c;
			int nor;
			cin >> c >> nor;
			int dir;
			switch(c){
				case 'N':
					dir = 0;
					break;
				case 'E':
					dir = 1;
					break;
				case 'S':
					dir = 2;
					break;
				case 'W':
					dir = 3;
					break;
			}

			REP(j,nor){
				nowx += dx[dir];
				nowy += dy[dir];
				if(gems[nowx][nowy]){
					ret++;
					gems[nowx][nowy] = false;
				}
			}
		}
		if(ret == n){
			hantei.push_back(1);
		}else{
			hantei.push_back(0);
		}
		cin >> n;
	}
	REP(i,hantei.size()){
		string dis = hantei[i] ? "Yes":"No";
		cout << dis << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <utility>

using namespace std;

#define X first
#define Y second 

int main(){
	for(int N; cin >> N, N;){
		vector<pair<int, int> > tre;
		pair<int, int> cur;
		bool map[21][21];
		for(int i = 0; i < 21; i++)
			for(int j = 0; j < 21; j++)
				map[i][j] = 0;
		for(int i = 0; i < N; i++){
			int x, y; cin >> x >> y;
			tre.push_back(make_pair(x, y));
		}

		int M; cin >> M;
		cur.X = cur.Y = 10;
		map[10][10] = 1;
		for(int i = 0; i < M; i++){
			char op; int I; cin >> op >> I;
			switch(op){
			case 'N' :
				for(int j = 0; j < I; j++){cur.Y++; map[cur.X][cur.Y] = 1;}
			break;

			case 'E' :
				for(int j = 0; j < I; j++){cur.X++; map[cur.X][cur.Y] = 1;}
			break;

			case 'S' :
				for(int j = 0; j < I; j++){cur.Y--; map[cur.X][cur.Y] = 1;}
			break;

			case 'W' :
				for(int j = 0; j < I; j++){cur.X--; map[cur.X][cur.Y] = 1;}
			break;
			}	
		}
		bool res = 1;
		for(int i = 0; i < tre.size(); i++){res *= map[tre[i].X][tre[i].Y];}
		
		res ? cout << "Yes" << endl : cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	int map[21][21],ix,iy,nx,ny,v,ad,cnt;
	int n,m,dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
	char vec[5] ="NESW",vecin;

	while(scanf("%d",&n) && n){
		for(int i = 0; i < 21; i++){
			for(int j = 0; j < 21; j++){
				map[i][j] = 0;
			}
		}
	
		for(int i = 0; i < n; i++){
			scanf("%d%d",&ix,&iy);
			map[ix][iy] = 1;
		}
		scanf("%d",&m);
		nx = ny = 10;
		cnt = 0;
		for(int i = 0; i < m; i++){
			fflush(stdin);
			scanf("%c %d",&vecin,&ad);
			//printf("%c%d",vecin,ad);
			for(v = 0; vecin != vec[v]; v++){}
			//printf("v:%d\n",v);
			for(int i = 0; i < ad; i++){
				if(nx+dx[v] < 0 || ny+dy[v] < 0 || nx+dx[v] > 20 || ny+dy[v] > 20)
					break;
				if(map[nx+dx[v]][ny+dy[v]]==1){
					map[nx+dx[v]][ny+dy[v]]=0;
					cnt++;
				}
				nx += dx[v];
				ny += dy[v];
			}
			/*
			for(int i = 0; i < 22; i++){
				for(int j = 0; j < 22; j++){
					printf("%2d",map[j][i]);
				}
				printf("\n");
			}
			*/
		}
		if(cnt == n)
			printf("Yes\n");
		else
			printf("No\n");
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
  int N,M;
  int x,y;
  int i,j;
  int l;
  int check=0;
  char d;
  
  while(1){
    cin >> N;
    if(N==0) break;

    int flag[20][20]={};
    for(i=0;i<N;++i){
      cin >> x >> y;
      flag[x][y]=1;
    }
    check =0;
    int rx=10,ry=10;
    cin >> M;
    for(i=0;i<M;++i){
      scanf("%c%d",&d,&l);

      if(d=='N'){
	for(j=1;j<=l;++j){
	  if(flag[rx][ry+j]==1) check++;
	}
	ry+=l;
      }else if(d=='E'){
	for(j=1;j<=l;++j){
	  if(flag[rx+j][ry]==1) check++;
	}
	rx+=l;
      }else if(d=='S'){
	for(j=1;j<=l;++j){
	  if(flag[rx][ry-j]==1) check++;
	}
	ry-=l;
      }else{
	for(j=1;j<=l;++j){
	  if(flag[rx-j][ry]==1) check++;
	}
	rx-=l;
      }
      cout << j << endl;

    }
 
    
    if(check==N){
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }
  }


  return 0;
}