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;

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        bool gemsOnField[21][21] = {};
        for (int i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            gemsOnField[y][x] = true;
        }
        int cx = 10, cy = 10, m;
        cin >> m;
        for (int i = 0; i < m; i++) {
            char d;
            int l;
            cin.ignore();
            cin >> d >> l;
            switch (d) {
            case 'N':
                for (int j = 0; j < l; j++) {
                    gemsOnField[++cy][cx] = false;
                }
                break;
            case 'E':
                for (int j = 0; j < l; j++) {
                    gemsOnField[cy][++cx] = false;
                }
                break;
            case 'S':
                for (int j = 0; j < l; j++) {
                    gemsOnField[--cy][cx] = false;
                }
                break;
            case 'W':
                for (int j = 0; j < l; j++) {
                    gemsOnField[cy][--cx] = false;
                }
                break;
            }
        }
        bool isAllGemsRecovered = true;
        for (int y = 0; y < 21; y++) {
            for (int x = 0; x < 21; x++) {
                if (gemsOnField[y][x]) {
                    isAllGemsRecovered = false;
                }
            }
        }
        if (isAllGemsRecovered) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

C++: 


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <functional>

using namespace std;

int INF = 10000000;

int n;



int main()
{

	while(cin >> n && n)
	{
		int sx = 10,sy = 10;
		
		bool cell[21][21];
		memset(cell,0,21*21*sizeof(bool));

		for(int i = 0;i < n;i++)
		{
			int x,y;
			cin >> x >> y;
			cell[x][y] = true;
		}

		cell[sx][sy] = false;

		int m;
		cin >> m;

		for(int i = 0;i < m;i++)
		{
			char order;
			int val;

			cin >> order >> val;

			if(order == 'N')
			{
				for(int j = 0;j < val;j++)
				{
					cell[sx][++sy] = false;
				}
				
			}
			if(order == 'E')
			{
				for(int j = 0;j < val;j++)
				{
					cell[++sx][sy] = false;
				}
			}
			if(order == 'S')
			{
				for(int j = 0;j < val;j++)
				{
					cell[sx][sy--] = false;
				}
			}
			if(order == 'W')
			{
				for(int j = 0;j < val;j++)
				{
					cell[sx--][sy] = false;
				}
			}

		}
		bool flag = false;

		for(int i = 1;i < 21;i++)
		{
			for(int j = 1;j < 21;j++)
			{
				if(cell[i][j])flag = true;
			}
		}

		if(flag)cout << "No" << endl;
		else    cout << "Yes"  << endl;

	}

  return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main() {
	int a[21][21];
	char b[2];
	int n, m;
	int sn, sm;
	int kn, km;
	int x, y, z;
	while (true) {
		f(i, 21) {
			f(j, 21)a[i][j] = 0;
		}
		scanf("%d", &n);
      if(n==0)return 0;
		f(i, n) {
			scanf("%d %d", &x, &y);
			a[x][y] ++;
		}
		scanf("%d", &m);
		x = 10;
		y = 10;
		f(i, m) {
			b[0] = 0;
			b[1] = 0;
			scanf("%s", b);
			scanf("%d", &z);
          f(j,z){
			if (b[0] == 'E') {
				x++;
				if (a[x][y] > 0) {
					n -= a[x][y];
					a[x][y] = 0;
				}
			}
			else if (b[0] == 'W') {
				x--;
				if (a[x][y] > 0) {
					n -= a[x][y];
					a[x][y] = 0;
				}
			}
			else if (b[0] == 'N') {
				y++;
				if (a[x][y] > 0) {
					n -= a[x][y];
					a[x][y] = 0;
				}
			}
			else {
				y--;
				if (a[x][y] > 0) {
					n -= a[x][y];
					a[x][y] = 0;
				}
			}
          }
		}
	if (n == 0)printf("Yes\n");
	else printf("No\n");
	}
	
	return 0;
}

C++: //Mysterious Gems
#include<cstdio>

int now_x, now_y;
int n;
int map[21][21];
int vector[4][2]={{0,1}, {1,0}, {0,-1}, {-1,0}};

void init_map(){
	now_x=now_y=10;
	n=0;
	for(int i=0; i<21; i++)
		for(int j=0; j<21; j++)
			map[i][j]=0;
}

void go(char dir, int dis){
	int d;
	if(dir=='N')d=0;
	else if(dir=='E')d=1;
	else if(dir=='S')d=2;
	else if(dir=='W')d=3;

	for(int i=0; i<dis; i++){
		now_x+=vector[d][0];
		now_y+=vector[d][1];
		if(map[now_y][now_x]==1){
			n++;
			map[now_y][now_x]=0;
		}
	}
}

int main(){
	int N, M;
	while(true){
		scanf("%d", &N);
		if(N==0)break;
		init_map();
		for(int i=0; i<N; i++){
			int x, y;
			scanf("%d %d", &x, &y);
			map[y][x]=1;
		}
		if(map[10][10]==1){
			map[10][10]=0;
			n++;
		}
		scanf("%d", &M);
		for(int i=0; i<M; i++){
			char dir;
			int dis;
			scanf(" %c %d", &dir, &dis);
			go(dir, dis);
		}
		if(N==n) puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
using namespace std;
int field[21][21];
int main() {
    int n;
    while (scanf("%d",&n)) {
        if (!n) break;
        for (int i=0; i<21; i++) for (int j=0; j<21; j++) field[i][j]=0;
        for (int i=0; i<n; i++) {
            int x, y; scanf("%d%d",&x,&y);
            field[y][x]=1;
        }
        int m; scanf("%d",&m);
        int rx=10, ry=10;
        field[ry][rx]=0;
        for (int i=0; i<m; i++) {
            char d; cin>>d;
            int dist; scanf("%d",&dist);
            if (d=='N') {
                for (int j=ry; j<=ry+dist; j++) {
                    field[j][rx]=0;
                }
                ry+=dist;
            }
            if (d=='E') {
                for (int j=rx; j<=rx+dist; j++) {
                    field[ry][j]=0;
                }
                rx+=dist;
            }
            if (d=='S') {
                for (int j=ry; j>=ry-dist; j--) {
                    field[j][rx]=0;
                }
                ry-=dist;
            }
            if (d=='W') {
                for (int j=rx; j>=rx-dist; j--) {
                    field[ry][j]=0;
                }
                rx-=dist;
            }
        }
        int flag=0;
        for (int i=0; i<21; i++) for (int j=0; j<21; j++) flag+=field[i][j];
        if (flag!=0) puts("NO");
        else puts("YES");
    }
}