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 int long long

signed main() {
	int n;
	while ( cin >> n, n ) {
		bool used[21][21] = {{0}};
		for ( int i = 0; i < n; i++ ) {
			int x, y;
			cin >> x >> y;
			used[y][x] = 1;
		}

		int m;
		cin >> m;
		int nx = 10, ny = 10;
		used[ny][nx] = 0;
		for ( int i = 0; i < m; i++ ) {
			char c;
			int d;
			cin >> c >> d;
			if ( c == 'N' ) {
				for ( int i = 0; i < d; i++ ) {
					used[++ny][nx] = 0;
				}
			}
			if ( c == 'E' ) {
				for ( int i = 0; i < d; i++ ) {
					used[ny][++nx] = 0;
				}
			}
			if ( c == 'S' ) {
				for ( int i = 0; i < d; i++ ) {
					used[--ny][nx] = 0;
				}
			}
			if ( c == 'W' ) {
				for ( int i = 0; i < d; i++ ) {
					used[ny][--nx] = 0;
				}
			}			
		}
		int cnt = 0;
		for ( int i = 0; i < 21; i++ ) {
			for ( int j = 0; j < 21; j++ ) cnt += used[i][j];
		}

		if ( cnt ) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
}

C++: #include <bits/stdc++.h>

#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e09
struct P{
  int x; int y; bool got=false;
};

using namespace std;

int main(){
  int n, m, x, y;
  while(cin >> n and n){
    x = 10; y = 10;
    P gem[n];
    REP(i, n) { cin >> gem[i].x >> gem[i].y; }
    cin >> m;
    int cnt = 0;
    REP(i, m) {
      char dir; int step;
      int dx = 0; int dy = 0;
      cin >> dir >> step;
      if(dir == 'N') dy = step;
      if(dir == 'S') dy = -step;
      if(dy != 0)
        REP(k, n)
          if(gem[k].got == false and gem[k].x == x and gem[k].y <= max(y, y+dy) and gem[k].y >= min(y, y+dy)){ gem[k].got = true; cnt++;}
      if(dir == 'E') dx = step;
      if(dir == 'W') dx = -step;
      if(dx != 0)
        REP(k, n)
          if(gem[k].got == false and gem[k].y == y and gem[k].x <= max(x, x+dx) and gem[k].x >= min(x, x+dx)){ gem[k].got = true; cnt++;}
      x += dx; y += dy;
    }
    cout << (cnt == n ? "Yes" : "No") << endl;
  }
}

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

int main()
{
	int numGems = -1;

	while (true)
	{
		std::cin >> numGems;
		if (numGems == 0)
		{
			break;
		}
		const int gridSize = 21;
		std::vector<bool> gems(gridSize * gridSize, false);
		int gemPointX = 0;
		int gemPointY = 0;

		for (int i = 0; i < numGems; i++)
		{
			std::cin >> gemPointX;
			std::cin >> gemPointY;

			gems[gemPointY * gridSize + gemPointX] = true;
		}

		int numOrders = 0;
		std::cin >> numOrders;

		char direction = ' ';
		int distance = 0;
		std::pair<int, int> currentPoint(10, 10);

		for (int i = 0; i < numOrders; i++)
		{
			std::cin >> direction;
			std::cin >> distance;

			switch (direction)
			{
			case 'N':
				for (int i = 0; i < distance; i++)
				{
					currentPoint.second += 1;
					gems[currentPoint.second * gridSize + currentPoint.first] = false;
				}
				break;
			case 'E':
				for (int i = 0; i < distance; i++)
				{
					currentPoint.first += 1;
					gems[currentPoint.second * gridSize + currentPoint.first] = false;
				}
				break;
			case 'S':
				for (int i = 0; i < distance; i++)
				{
					currentPoint.second -= 1;
					gems[currentPoint.second * gridSize + currentPoint.first] = false;
				}
				break;
			case 'W':
				for (int i = 0; i < distance; i++)
				{
					currentPoint.first -= 1;
					gems[currentPoint.second * gridSize + currentPoint.first] = false;
				}
				break;
			default:
				break;
			}
		}

		bool isAllGemCorrected = true;
		for (int i = 0; i < gridSize * gridSize; i++)
		{
			isAllGemCorrected = isAllGemCorrected && !gems[i];
		}
		if (isAllGemCorrected)
		{
			std::cout << "Yes" << std::endl;
		}
		else
		{
			std::cout << "No" << std::endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <memory>
using namespace std;
int main() {
    int N;
    while (cin >> N && N != 0) {
        int gems[21][21]; // 宝石の位置を記録する配列
        memset(gems, 0, sizeof gems);

        int x, y;
        for (int i=0; i<N; ++i) {
            cin >> x >> y;
            gems[y][x] = 1;
        }

        int trace[21][21]; // 回収範囲を記録する配列
        memset(trace, 0, sizeof trace);

        int nx = 10; int ny = 10; // 初期位置

        int M; cin >> M;

        int dx[256], dy[256];
        dx['N'] = 0; dx['E'] = 1; dx['W'] = -1; dx['S'] = 0; 
        dy['N'] = 1; dy['E'] = 0; dy['W'] = 0;  dy['S'] = -1;

        for (int i=0; i<M; ++i) {
            trace[ny][nx] = 1;

            char d; cin >> d;
            int l; cin >> l;
            for (int j=0; j<l; ++j) {
                nx += dx[d];
                ny += dy[d];
                trace[ny][nx] = 1;
            }
        }

        string output = "Yes";
        for (int i=0; i<21; ++i) {
            for (int j=0; j<21; ++j) {
                if (gems[i][j] == 1 && trace[i][j] != 1) {
                    output = "No";
                }
            }
        }

        cout << output << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
  int n, m, a[20], b[20], d[20];
  int x, y, x0, y0;
  int t = 0, k = 0;
  char c[20];

  while(1){
    cin >> n;
    if(n==0){
       break;
    }else{
      x = 10;
      y = 10;
      x0 = 10;
      y0 = 10;
    for(int i=0; i<n; i++){
      cin >> a[i] >> b[i];
    }

    cin >> m;
    for(int i=0; i<m; i++){
      cin >> c[i] >> d[i];
      switch(c[i]){
        case 'N':
          y += d[i];
          break;
        case 'S':
          y -= d[i];
          break;
        case 'E':
          x += d[i];
          break;
        case 'W':
          x -= d[i];
          break;
      }

      for(int j=0; j<n; j++){
        if(x0<=a[j] && a[j]<=x && y0<=b[j] && b[j]<=y){
          t++;
          x0 = x;
          y0 = y;
        }else{
          x0 = x;
          y0 = y;
        }
      }
    }
    if(t==n){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  } 
  }

  return 0;
}