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 <bits/stdc++.h>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define SORT(v) sort(ALL(v))
//#define scanf scanf_s
typedef pair<int, int> P;

int n, m;
bool fld[25][25];

int main()
{
	while (1)
	{
		memset(fld, false, sizeof(fld));
		cin >> n;
		if (n == 0) break;
		int x, y;
		REP(i, n)
		{
			cin >> x >> y;
			fld[x][y] = true;
		}
		cin >> m;
		char c; int d;
		x = 10; y = 10;
		int cnt = 0;
		REP(i, m)
		{
			cin >> c >> d;
			if (c == 'N')
			{
				REP(j, d)
				{
					y++;
					if (fld[x][y] == true)
					{
						fld[x][y] = false;
						cnt++;
					}
				}
			}
			if (c == 'S')
			{
				REP(j, d)
				{
					y--;
					if (fld[x][y] == true)
					{
						fld[x][y] = false;
						cnt++;
					}
				}
			}
			if (c == 'E')
			{
				REP(j, d)
				{
					x++;
					if (fld[x][y] == true)
					{
						fld[x][y] = false;
						cnt++;
					}
				}
			}
			if (c == 'W')
			{
				REP(j, d)
				{
					x--;
					if (fld[x][y] == true)
					{
						fld[x][y] = false;
						cnt++;
					}
				}
			}
		}
		if (n - cnt) cout << "No" << endl;
		else cout << "Yes" << endl;

	}
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
bool gem[21][21];
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
int main() {
	int N;
	while(scanf("%d",&N),N) {
		for(int i=0;i<N;i++) {
			int x,y;
			scanf("%d %d",&x,&y);
			gem[x][y]=1;
		}
		int M;
		scanf("%d",&M);
		int x=10,y=10;
		char d[2];
		int l;
		for(int i=0;i<M;i++) {
			scanf("%s %d",d,&l);
			int D=0;
			switch(d[0]) {
			case 'N':D=0;break;
			case 'E':D=1;break;
			case 'S':D=2;break;
			case 'W':D=3;break;
			}
			for(int i=0;i<l;i++) {
				x+=dx[D];
				y+=dy[D];
				if(gem[x][y]) {
					N--;
					gem[x][y]=0;
				}
			}
		}
		printf("%s\n",N>0?"No":"Yes");
	}
}

C++: #include<iostream>

#define MAXMAP 21

using namespace std;

const int dx[]={0,1,-1,0},dy[]={1,0,0,-1};
const char direction[]={'N','E','W','S'};
bool myMap[MAXMAP][MAXMAP]={false};


int main(){
	int N,M,nowX,nowY;
	bool flag;
	
	while(cin>>N,N){
		
		fill((bool*)myMap,(bool*)(myMap+MAXMAP),false);
		nowX=nowY=10;
		flag=false;
		
		for(int i=0;i<N;i++){
			int x,y;
			cin>>x>>y;
			myMap[y][x]=true;
		}
		
		cin>>M;
		for(int i=0;i<M;i++){
			char tempDirec;
			int distance,tempDist;
			
			cin>>tempDirec>>distance;
			
			
			for(int j=0;j<4;j++){
				if(tempDirec==direction[j]){
					
					
					if(dx[j]!=0){
						tempDist=nowX+dx[j]*distance;
						if(dx[j]==1){
							for(int k=nowX;k<=tempDist;k++){
								if(myMap[nowY][k]){
									myMap[nowY][k]=false;
								}
							}
						}
						else if(dx[j]==-1){
							for(int k=nowX;k>=tempDist;k--){
								if(myMap[nowY][k]){
									myMap[nowY][k]=false;
								}
							}
						}
						nowX=tempDist;
					}
					
					
					if(dy[j]!=0){
						tempDist=nowY+dy[j]*distance;
						if(dy[j]==1){
							for(int k=nowY;k<=tempDist;k++){
								if(myMap[k][nowX]){
									myMap[k][nowX]=false;
								}
							}
						}
						else if(dy[j]==-1){
							for(int k=nowY;k>=tempDist;k--){
								if(myMap[k][nowX]){
									myMap[k][nowX]=false;
								}
							}
						}
						nowY=tempDist;
					}
					
					
					break;
				}
			}
		}
		
		
		for(int i=0;i<MAXMAP;i++){
			for(int j=0;j<MAXMAP;j++){
				if(myMap[i][j]==true){
					flag=true;
					//cout<<"i="<<i<<" j="<<j<<endl;
					break;
				}
			}
		}
		
		
		if(flag){
			cout<<"NO"<<endl;
		}
		else{
			cout<<"YES"<<endl;
		}
	}
}