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>
using namespace std;

void gemretrieve(int flag[][21], char dir, int amo);
void gemcheck(int flag[][21]);

int rx, ry;

int main(){

	int gemflag[21][21];
	int gemamo;
	int movcou;
	char movdir;
	int movamo;
	int gx, gy;

	while (true){

		rx = 10;
		ry = 10;

		for (int i = 0; i < gemamo; i++){
			for (int j = 0; j < gemamo; j++){
				gemflag[i][j] = 0;
			}
		}

		cin >> gemamo;

		if (gemamo == 0)
			break;

		for (int i = 0; i < gemamo; i++){

			cin >> gx >> gy;
			gemflag[gx][gy] = 1;

		}

		cin >> movcou;


		for (int j = 0; j < movcou; j++){

			cin >> movdir >> movamo;

			gemretrieve(gemflag, movdir, movamo);


		}

		gemcheck(gemflag);

	}


	return 0;


}

void gemretrieve(int flag[][21], char dir, int amo){

	switch (dir){

	case 'N':{

		for (int k = 0; k < amo; k++){

			ry++;
			flag[rx][ry] = 0;

		}



	} break;

	case 'E':{

		for (int k = 0; k < amo; k++){

			rx++;
			flag[rx][ry] = 0;

		}



	} break;

	case 'S':{

		for (int k = 0; k < amo; k++){

			ry--;
			flag[rx][ry] = 0;

		}



	} break;

	case 'W':{

		for (int k = 0; k < amo; k++){

			rx--;
			flag[rx][ry] = 0;

		}



	} break;


	default:break;

	}




}

void gemcheck(int flag[][21]){


	for (int i = 0; i < 21; i++){

		for (int j = 0; j < 21; j++){

			if (flag[i][j] == 1){
				cout << "NO" << endl;
				return;
			}

		}

	}


	cout << "YES" << endl;


}

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

int main()
{
	int N, M, x, y, l, rx, ry;
	char d;
	while (cin >> N, N) {
		vector< vector<bool> > a(21, vector<bool>(21, false));
		rx = ry = 10;
		for (int i = 0; i < N; i++) {
			cin >> x >> y;
			a[x][y] = true;
		}
		cin >> M;
		for (int i = 0; i < M; i++) {
			cin >> d >> l;
			switch (d) {
			case 'N':
				for (int j = 0; j < l; j++) {
					ry++;
					if (a[rx][ry])
						a[rx][ry] = false;
				}
				break;
			case 'S':
				for (int j = 0; j < l; j++) {
					ry--;
					if (a[rx][ry])
						a[rx][ry] = false;
				}
				break;
			case 'E':
				for (int j = 0; j < l; j++) {
					rx++;
					if (a[rx][ry])
						a[rx][ry] = false;
				}
				break;
			case 'W':
				for (int j = 0; j < l; j++) {
					rx--;
					if (a[rx][ry])
						a[rx][ry] = false;
				}
				break;
			}
		}
		for (int i = 0; i < 21; i++) {
			for (int j = 0; j < 21; j++) {
				if (a[i][j]) {
					cout << "No" << endl;
					goto rabel;
				}
			}
		}
		cout << "Yes" << endl;
	rabel:
		;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){

  int n;

  while (cin >> n,n){
    int x[100];
    int y[100];

    int gem[25][25] = {1};

    REP(i,n){
      cin >> x[i] >> y[i];
      gem[x[i]][y[i]] = 0;
    }
    int m;

cin >> m;

    char d[100];
    int l[100];

    int nowx=10;
    int nowy=10;

    REP(j,m){
      cin >> d[j] >> l[j];
      if (d[j]=='N'){
	REP(k,l[k]){
	  gem[nowx+k][nowy]=1;
	    }
	nowx +=l[j];
      }else if(d[j]=='S'){
	REP(k,l[k]){
	  gem[nowx-k][nowy]=1;
	    }
	nowx -=l[j];
      }else if(d[j]=='W'){
	REP(k,l[k]){
	  gem[nowx][nowy-k]=1;
	    }
	nowx -=l[j];
      }else if(d[j]=='E'){
	REP(k,l[k]){
	  gem[nowx][nowy+k]=1;
	    }
	nowx +=l[j];
      }
    }
    int tf;

    REP(hoge,25){
      REP(huga,25){
	tf +=gem[25][25];
	  }
    }

    if(tf){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

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

#define STX 10
#define STY 10

int main(){
  int n, m, x, y, mer;
  char dim;
  cin >> n;
  vector<int> ans;
  while(n){
    vector< vector<int> > gem(21, vector<int>(21));
    for(int i = 0; i < n; i++){
      cin >> x >> y;
      gem[x][y] = 1;
    }
    cin >> m;
    int nowx = STX;
    int nowy = STY;
    for(int j = 0; j < m; j++){
      cin >> dim >> mer;
      switch (dim) {
        case 'N':{
          for(int k = 1; k <= mer; k++){
            nowy++;
            gem[nowx][nowy]--;
          }
          break;
        }
        case 'E':{
          for(int k = 1; k <= mer; k++){
            nowx++;
            gem[nowx][nowy]--;
          }
          break;
        }
        case 'S':{
          for(int k = 1; k <= mer; k++){
            nowx--;
            gem[nowx][nowy]--;
          }
          break;
        }
        case 'W':{
          for(int k = 1; k <= mer; k++){
            nowy--;
            gem[nowx][nowy]++;
          }
          break;
        }
      }
    }
    int maxi = 0;
    for(int i = 0; i <= 20; i++)
      for(int j = 0; j <= 20; j++)
        if(maxi < gem[i][j]) maxi = 1;
    ans.push_back(maxi);
    cin >> n;

  }
  for(int i = 0; i < ans.size(); i++){
    if(!ans[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

C++: for(int i=0;i<21;i++){
      for(int j=0;j<21;j++){