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>

#pragma warning(disable: 4996)

int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

char dir[5] = "NESW";

int N, M, D, X, Y, A, i, j, k, C[20], R[20], P[21][21];

char c;

int main()
{
	while (true)
	{
		scanf("%d", &N);

		if (N == 0) { break; }

		memset(P, 0, sizeof(P));

		X = Y = 10; A = 0; P[X][Y] = 1;

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

		scanf("%d", &M);

		for (i = 0; i < M; i++)
		{
			std::cin >> c >> D;

			for (j = 0; j < 4; j++)
			{
				if (c == dir[j])
				{
					for (k = 0; k < D; k++) { X += dx[j]; Y += dy[j]; P[X][Y] = 1; }
				}
			}
		}

		for (i = 0; i < N; i++) { A += P[C[i]][R[i]]; }

		printf("%s\n", A == N ? "Yes" : "No");
	}

	return 0;
}

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

typedef long long LL;

//container util
//------------------------------------------
#define PB push_back
#define MP make_pair
#define DECIM(digits)  cout<<fixed<<setprecision(digits)
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int main(void)
{
  for(;;){
    int n;
    cin >> n;
    if(!n) return 0;
    vector<pair<int,int> >gem;
    gem.resize(n);
    REP(i,n){
      int x,y;
      cin >> x >> y;
      gem[i]=MP(x,y);
    }
    int m;
    cin >> m;
    pair<int,int> pos=MP(10,10);
    REP(i,m){
      string news;
      int amount;
      cin >> news >> amount;
      while(amount--){
	if(news=="N")
	  pos.second++;
	if(news=="E")
	  pos.first++;
	if(news=="W")
	  pos.first--;
	if(news=="S")
	  pos.second--;
	for(auto j=gem.begin();j!=gem.end();)
	  if(pos==*j) j=gem.erase(j);
	  else ++j;
      }
    }
    if(gem.empty()) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

int main()
{
	int numGems = 0;;
	std::cin >> numGems;
	const int gridSize = 21;
	std::vector<bool> gems(gridSize * gridSize, false);
	int gemPointX = 0;
	int gemPointY = 0;
	if (numGems == 0)
	{
		std::cerr << "NO" << std::endl;
		return 0;
	}
	return 0;
}

C++: #include <stdio.h>
#include <cmath>
#include <iostream>

using namespace std;

int main() {
	int k;
	char d;
	int a,b;
	int counter;
	int robx;
	int roby;
	int kari;
	while (cin >> k) {
		if (k == 0) {
			break;
		}
		counter = 0;
		int hyou[20][20] = {0};
		int koudou[30][2] = {0};
		for (int i = 0; i < k; i++) {
			cin >> a >> b;
			hyou[a][b] = 1;
			counter++;
		}
		cin >> k;
		for (int i = 0; i < k; i++) {
			cin >> d >> a;
			if (d == 'N') {
				koudou[i][0] = a;
			} else if (d == 'S') {
				koudou[i][0] = -a;
			} else if (d == 'E') {
				koudou[i][1] = a;
			} else {
				koudou[i][1] = -a;
			}
		}
		robx = 10;
		roby = 10;
		if (hyou[10][10] == 1) {
			hyou[10][10] = 0;
			counter--;
		}
		for (int i = 0; i < k; i++) {
			if (koudou[i][0] == 0) {
				kari = 1;
			} else {
				kari = 0;
			}
			for (int j = 0; j < abs(koudou[i][kari]); j++) {
				if (koudou[i][kari] > 0) {
					if (kari == 0) {
						roby++;
					} else {
						robx++;
					}
				} else {
					if (kari == 0) {
						roby--;
					} else {
						robx--;
					}
				}
				//printf("%d %d\n",robx,roby);
				if (hyou[robx][roby] == 1) {
					hyou[robx][roby] = 0;
					counter--;
				}
			}
		}
		if (counter == 0) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include  <stdio.h>
#include  <algorithm>
#include  <math.h>
#include  <vector>
#include  <string>
#include  <sstream>
#include  <numeric>
#include  <set>
#include <map>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int num = 0;
	while (cin >> num && num != 0)
	{

		int ans = 0, dat[20][20] = { 0 };
		rep(i, num)
		{
			int tmp = 0, tmp2 = 0;
			cin >> tmp >> tmp2;
			dat[tmp][tmp2] = 1;
			if (tmp == 10 && tmp2 == 10) { ans += 1; }
		}
		int tmp = 0; cin >> tmp;
		string m; int cmd = 0;
		int now_x = 10, now_y = 10;
		rep(i, tmp)
		{
			cin >> m >> cmd;
			rep(i, cmd)
			{
				switch (m[0])
				{
				case 'N': now_y += 1; break;
				case 'E': now_x += 1; break;
				case 'S': now_y -= 1; break;
				case 'W': now_x -= 1; break;
				}
				ans += dat[now_x][now_y];
				dat[now_x][now_y] = 0;
				printf("%d %d\n", now_x, now_y);
			}
		}
		if (ans == num) { printf("Yes\n"); }
		else { printf("No\n"); }
	}
	return 0;
}

C++: #include <iostream>


using namespace std;

int main(){
	int N,M;
	while(cin >> N,N){
		int map[21][21]={0},num = 0,l;
		int x,y;
		for(int i = 0;i < N;i++,num++) {
			cin >> x >> y;
			map[x][y] = 1;
		}
		x = 10;
		y = 10;
		cin >> M;
		char d;
		for(int i = 0;i < M;i++){
			cin >> d >> l;
			for(;l > 0;l--){
				if(d == 'N') y++;
				if(d == 'E') x++;
				if(d == 'S') y--;
				if(d == 'W') x--;
				num -= map[x][y];
				map[x][y] = 0;
			}
		}
		if(num == 0) cout << "Yes" << endl;
		else cout << "No" << endl;
}