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>
#include<stdio.h>
using namespace std;

void ini(int* p,int n);
void print(int *p);
void check(int *p);
bool judge(int *p);

int main(){
  int n;
  while(1){
    bool ans;
    cin >> n;
    if(n == 0) break;
    int state[21];
    for(int i = 0; i<21 ; i++){
      state[i] = 0;
    }
    
    ini(state,n);
    //print(state);
    check(state);
    ans = judge(state);
    if(ans == 0) printf("Yes\n");
    else printf("No\n");
    //print(state);
  }
  return 0;
}


void ini(int* state,int n){
  int x, y;
  int mask;
  for(int i = 0; i<n; i++){
    cin >>x >> y;
    mask = (04000000 >> x);
    state[y] =( state[y] | mask);
  }
}

void check(int* state){
  int n;
  char dir;
  int step;
  int nowx = 10, nowy = 10;
  int mask;
  
  cin >> n;
  for(int i  = 0;  i< n; i++){
    //printf("x = %d y = %d",nowx, nowy);
    cin >>dir >> step;
    // printf("%c %d\n",dir,step);
    switch(dir){
    case 'N':
      mask = ~(04000000 >>nowx);
      for(int j = 0; j<step; j++){
	nowy ++;
	//printf("%d\n",nowy);
	state[nowy] = (state[nowy] & mask);
      }
      break;
    case 'S':
      mask = ~(04000000 >>nowx);
      for(int j = 0; j<step; j++){
	nowy --;
	state[nowy] = (state[nowy] & mask);
      }
      break;
    case 'E':
      for(int j = 0; j<step; j++){
	nowx ++;
	mask = ~(04000000 >>nowx);
	state[nowy] = (state[nowy] & mask);
      }
      break;
    case 'W':
      for(int j = 0; j<step; j++){
	nowx --;
	mask = ~(04000000 >>nowx);
	state[nowy] = (state[nowy] & mask);
      }
      break;
    }
  }
}

bool judge(int *state){
  for(int i = 0; i< 21; i++){
    if(state[i] != 0) return 1;
  }
  return 0;
}


	
void print(int *p){
  for(int i = 0; i<21; i++){
    printf("[ %d] %o\n",i,p[i]);
  }
}

C++: #include <stdio.h>
#include <string.h>

#define N 0
#define E 1
#define S 2
#define W 3

int dir[4][2] = { {0,1}, {1,0}, {0,-1}, {-1,0} };
int map[21][21];

int main(void)
{
    while(true) {
        int n, m;
        int px=10, py=10, s=0;

        memset(map, 0, sizeof(map));

        scanf("%d\n", &n);
        if(n==0) break;


        for(int i=0; i < n; i++)
        {
            int x,y;
            scanf("%d%d\n", &x, &y);

            map[x][y] = 1;
        }

        scanf("%d\n", &m);

        map[10][10] = 0;
        for(int i=0; i < m; i++)
        {
            char d;
            int *D, l;
            scanf("%c %d\n", &d, &l);
            switch(d) {
                case 'N':
                    D = dir[N];
                    break;
                case 'E':
                    D = dir[E];
                    break;
                case 'S':
                    D = dir[S];
                    break;
                case 'W':
                    D = dir[W];
                    break;
            }

            for(int i=0; i < l; i++)
            {
                px += *D;
                py += *(D+1);
                map[px][py] = 0;
            }
        }

        for(int i=0; i <= 20; i++)
            for(int j=0; j <= 20; j++)
                s += map[i][j];

        printf( s ? "No\n" : "Yes\n");
    }

    return 0;
}

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

using namespace std;

int main(){
	int n;
	int gems[21][21];
	while(cin >> n && n){
		memset(gems, 0, sizeof(gems));
		for(int i=0;i<n;i++){
			int x, y; cin >> x >> y;
			gems[x][y] = 1;
		}
		int px = 10, py = 10;
		gems[10][10] = 0;
		int m; cin >> m;
		for(int i=0;i<m;i++){
			char c; int d; cin >> c >> d;
			for(int j=0;j<d;j++){
				switch(c){
					case 'N': py++; break;
					case 'E': px++; break;
					case 'S': py--; break;
 					case 'W': px--; break;
				}
				gems[px][py] = 0;
			}
		}
		bool ok = true;
		for(int i=0;i<=20;i++){
			for(int j=0;j<=20;j++)
				if(gems[i][j]) ok = false;
		}
		cout << (ok ? "Yes" : "No") << endl;
	}
}

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

int N, M, cnt = 0;
int Map[21][21];

struct Position{
	int x;
	int y;
}robot;

void initMap(void){
	int i, j;
	for(i = 0; i < 21; i++){
		for(j = 0; j < 21; j++){
			Map[i][j] = 0;
		}
	}
}

void setGems(int x, int y){
	Map[x][y] = 1;
}

int main(){
	int x, y, step;
	char dir;
	while(true){
		initMap();
		robot.x = 10; robot.y = 10;
		cin >> N;
		if(N == 0)	break;
		for(int i = 0; i < N; i++){
			cin >> x >> y;
			setGems(x, y);
		}
		cin >> M;
		for(int i = 0; i < M; i++){
			cin >> dir >> step;
			switch(dir){
				case 'N':
					for(int i = 0; i < step; i++){
						robot.y++;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'E':
					for(int i = 0; i < step; i++){
						robot.x++;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'S':
					for(int i = 0; i < step; i++){
						robot.y--;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'W':
					for(int i = 0; i < step; i++){
						robot.x--;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				default:
					break;

			}
		}
		if(cnt == N){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;	
		}
	}
	return 0;
}

C++: //#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int x = 10, y = 10, i, j;
	int n, X[10], Y[10], N, vn[10],flag;
	char dir[10];   //宝石個数n、移動回数N  
	while (1) {
		flag = 0;

		scanf("%d", &n);
		
		if (n == 0) {
			break;
		}
		for (i = 0; i < n; i++) {
			scanf_s("%d %d", &X[i], &Y[i]);
		}

		scanf("%d", &N);
		
		for (i = 0; i < N; i++) {
			scanf("%c %d", &dir[i], &vn[i]);
		}


		for (i = 0; i < n; i++) {
			for (j = 1; j <= vn[i]; j++) {
				if (dir[i] == 'N')
					y += 1;
				else if (dir[i] == 'E')
					x += 1;
				else if (dir[i] == 'S')
					y -= 1;
				else
					x -= 1;

				if (X[i] == x && Y[i] == y)
					flag += 1;



			}
			

		}
		if (flag == n)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}