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 <stdio.h>
#define N 20
int main(){
  int i,j,x,y,n,step,gems,xy[N+1][N+1],rx,ry,count;
  char dir;
  while(1){
    for(i=0;i<N+1;i++){
      for(j=0;j<N+1;j++){
	xy[i][j] = 0;
      }
    }
    rx = 10;
    ry = 10;
    count = 0;

    scanf("%d",&n);
    if( n==0 ) break;
    gems = n;
    for(i=0;i<n;i++){
      scanf("%d %d",&x,&y);
      xy[y][x] = 1;
    }

    scanf("%d",&n);
    for(j=0;j<n;j++){
      scanf(" %c %d",&dir,&step);
      if( dir == 'E'){
	for(i=rx;i<=rx+step;i++){
	  if( xy[ry][i] == 1 ){
	    count++;
	    xy[ry][i] = 0;
	  }
	}
	rx = i-1;
      }
      else if( dir == 'W'){
	for(i=rx;i>=rx-step;i--){
	  if( xy[ry][i] == 1 ){
	    count++;
	    xy[ry][i] = 0;
	  }
	}
	rx = i+1;
      }
      else if( dir == 'N' ){
	for(i=ry;i<=ry+step;i++){
	  if( xy[i][rx] == 1 ) {
	    count++;
	    xy[i][rx] = 0;
	  }
	}
	ry = i-1;
      }
      else if( dir == 'S' ){
	for(i=ry;i>=ry-step;i--){
	  if( xy[i][rx] == 1 ) {
	    count++;
	    xy[i][rx] = 0;
	  }
	}
	ry = i+1;
      }
    }
    if( count == gems ){
      printf("Yes\n");
    }
    else{
      printf("No\n");

    }
  }
  return 0;
}

C++: #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
  
int main()
{
	int n,m,o;
	int p[21][21]={0}; //宝石の座標
	int x,y;
	int i,j,k;
	int ans;
	char a;

	while(1){
	scanf("%d",&n);
	if((n==0))
		break;
	//ここまでテンプレ

	ans=0;

	for(i=0;i<n;i++){
		scanf("%d %d",&x,&y);
		p[x][y]=1;
	}

	scanf("%d",&m);

	x=10;y=10;
	p[x][y]=0;

	for(i=0;i<m;i++)
	{
		scanf(" %c %d",&a,&o);
		for(j=0;j<o;j++)
		{
			if(a=='N'){
				y++;}
			else if(a=='S'){
				y--;}
			else if(a=='E'){
				x++;}
			else if(a=='W'){
				x--;}
			p[x][y]=0;
		}
	}

	for(i=0;i<21;i++)
	{
		for(j=0;j<21;j++){
			ans+=p[i][j];
		}
	}

	if(ans==0){
		printf("Yes\n");}
	else if(ans>0){
		printf("No\n");
	}

	//ここからテンプレ
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <stack>

#define rep(i,x) for(int i=0;i<x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rep_to(a,i,x) for(int i=a;i<x;i++)

using namespace std;

int main()
{
	int N,M;

	while(cin >> N && N)
	{
		int robot_x=10,robot_y=10;
		int item_x[100000]={};
		int item_y[100000]={};
		int count=0;
		
		rep(i,N)cin >> item_x[i] >> item_y[i];
		
		cin >> M;
		rep(i,M)
		{
			char muki[10];
			int L=0;
			int flag[100][100]={};

			cin >> muki >> L;
			
			rep(j,L)
			{
				if(muki[0]=='N')robot_y++;
				else if(muki[0]=='E')robot_x++;
				else if(muki[0]=='S')robot_y--;
				else if(muki[0]=='W')robot_x--;

				rep(k,N)
				{
					if(robot_x == item_x[k] && robot_y == item_y[k] && flag[robot_x][robot_y]!=1)
					{
						count++;
						flag[robot_x][robot_y]=1;
					}
				}
			}
		} 

		if(N==count)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

int main(){
    int N,x,y,M,l;
    char d;
    map<char,int> D;
    int dx[4]={1,-1,0,0};
    int dy[4]={0,0,1,-1};
    D['E']=0; D['W']=1; D['N']=2; D['S']=3;
    while(cin>>N,N){
        bool a[21][21]={};
        rep(i,N){
            cin>>x>>y;
            a[x][y]=true;
        }
        x=y=10;
        cin>>M;
        rep(i,M){
            cin>>d>>l;
            while(l--){
                if(a[x+=dx[D[d]]][y+=dy[D[d]]]){
                    a[x][y]=false;
                    N--;
                }
            }
        }
        cout<<(N?"No":"Yes")<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#define f first
#define s second
#define x first
#define y second
using namespace std;

typedef pair<int,int>pii;

void func(char dir, int dist, set<pii>&gems, pii &current){
  if(dir == 'E' || dir == 'W'){
    for(int i=0;i<dist;i++){
      current.x += (dir=='E'?1:-1);
      gems.erase(current);
    }
  }
  else{
    for(int i=0;i<dist;i++){
      current.y += (dir=='N'?1:-1);
      gems.erase(current);
    }
  }
}

int main(void){
  int n,m;

  while(cin >> n, n){
    set<pii>gems;
    for(int i=0;i<n;i++){
      int a,b;
      cin >> a >> b;
      gems.insert(pii(a,b));
    }
    cin >> m;
    pii curr=pii(10,10);
    for(int i=0;i<m;i++){
      char dir;
      int dist;
      cin >> dir >> dist;
      func(dir,dist,gems,curr);
    }
    cout << (gems.size()==0?"Yes":"No") << endl;
  }
  return 0;
}

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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

void take(vector<vector<bool>> &m, int &x, int &y, char dir, int dis){
	m[x][y] = false;
	switch(dir) {
		case'N':
			for(int i = 0; i < dis; i++){
				m[x][++y] = false;
			}
			break;
		case'S':
			for(int i = 0; i < dis; i++){
				m[x][--y] = false;
			}
			break;
		case'E':
			for(int i = 0; i < dis; i++){
				m[++x][y] = false;
			}
			break;
		case'W':
			for(int i = 0; i < dis; i++){
				m[--x][y] = false;
			}
			break;
	}
	m[x][y] = false;
}

bool calc(vector<vector<bool>> &m){
	//for(auto a: m){for(auto e : a) if(e)cerr << 1; else cerr << 0;cerr << endl;}
	for(auto a: m)for(auto e : a) if(e) return false;
	return true;
}

signed main(){
	int n;
	while(true){
		cin >> n;
		if(n == 0) break;
		vector<pair<int, int>> jewel(n);
		for(auto &&e: jewel) cin >>e.first >> e.second;
		vector<vector<bool>> m(21, vector<bool>(21,false));
		for(auto e : jewel) m[e.first][e.second] = true;

		int iter; cin >> iter;
		int x = 10, y = 10;
		for(int i = 0; i < iter; i++){
			char c;
			int dis; cin >> c >> dis;
			//cerr << x << " " << y << endl;
			take(m,x,y,c,dis);
			//cerr << x << " " << y << endl;
		}
		if(calc(m)) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}