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>
using namespace std;

int main()
{
	int n;
	while(cin >> n){
		if(!n)
			break;
		bool field[20][20];
		for(int i=0;i<20;i++){
			for(int j=0;j<20;j++){
				field[i][j] = false;
			}
		}
		int x,y;
		for(int i=0;i<n;i++){
			cin >> x >> y;
			field[y][x] = true;
		}
		int m;
		cin >> m;
		int count = 0;
		x = 10; y = 10;
		for(int i=0;i<m;i++){
			char h;
			int l;
			cin >> h >> l;
			switch(h){
				case 'N':
					for(int j=0;j<l;j++){
						y++;
						if(field[y][x]==true)
							count++;
					}
					break;
				case 'E':
					for(int j=0;j<l;j++){
						x++;
						if(field[y][x]==true)
							count++;
					}
					break;
				case 'S':
					for(int j=0;j<l;j++){
						y--;
						if(field[y][x]==true)
							count++;
					}
					break;
				case 'W':
					for(int j=0;j<l;j++){
						x--;
						if(field[y][x]==true)
							count++;
					}
					break;
			}
		}
		if(n == count)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
	while(true){
		bool map[21][21]={};
		int gem,n,get=0,cx=10,cy=10;
		cin>>gem;
		if(gem==0)break;
		for(int i=0;i<gem;i++){
			int x,y;
			cin>>x>>y;
			map[x][y]=true;
		}
		cin>>n;
		for(int i=0;i<n;i++){
			char oder;
			int leng;
			cin>>oder>>leng;
			for(int j=0;j<leng;j++){
			switch (oder){
			case 'N':
				cy++;
				break;
			case 'S':
				cy--;
				break;
			case 'W':
				cx--;
				break;
			case 'E':
				cx++;
				break;
			}
			if(map[cx][cy]){
				map[cx][cy]=false;
				get++;
			}
			}
		}
		cout<<(get==gem?"YES":"NO")<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <map>

using namespace std;
typedef long long LL;
#define REP(i,N) for(int i = 0; i < (int)N; i++)
int dy[4] = {1,0,-1,0};
int dx[4] = {0,1,0,-1};
bool gems[25][25];
int meirei[30];
int main(){
	int n;
	cin >> n;
	while(n!=0){
		REP(i,25)memset(gems[i],0,sizeof(gems[i]));
		REP(i,n){
			int x,y;
			cin >> x >> y;
			gems[y][x] = true;
		}
		int ret=0;
		int m;
		cin >> m;
		int nowx,nowy;
		nowx = nowy = 10;
		if(gems[10][10])ret++;
		REP(i,m){
			char c;
			int nor;
			cin >> c >> nor;
			int dir;
			switch(c){
				case 'N':
					dir = 0;
					break;
				case 'E':
					dir = 1;
					break;
				case 'S':
					dir = 2;
					break;
				case 'W':
					dir = 3;
					break;
			}

			REP(j,nor){
				nowx += dx[dir];
				nowy += dy[dir];
				if(gems[nowy][nowx])ret++;
			}
		}
		if(ret == n){
				cout << "YES" << endl;
		}else{
			 cout << "NO"  << endl;
		}
		cin >> n;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>

using namespace std;
int main() {
  while (true) {
    int N;
    cin >> N;
    if (N == 0)
      break;
    int jew[21*21];
    for (int i = 0; i < 21*21; ++i) {
      jew[i] = 0;
    }
    for (int i = 0; i < N; ++i) {
      int x, y;
      cin >> x >> y;
      jew[x + 21 * y] = 1;
    }
    int M;
    cin >> M;
    int x = 10, y = 10;
    int count = 0;
    for (int i = 0; i < M; ++i) {
      string d;
      int l;
      cin >> d >> l;
      int dx = 0, dy = 0;
      if (d == "N")
        dy = 1;
      if (d == "E")
        dx = 1;
      if (d == "S")
        dy = -1;
      if (d == "W")
        dx = -1;
      for (int k = 0; k <= l; ++k) {
        if (jew[x + (dx * k) + 21 * (y + dy * k)] == 1) {
          jew[x + (dx * k) + 21 * (y + dy * k)] = 0;
          ++count;
        }
      }
      x += dx * l;
      y += dy * l;
    }
    if (count == N)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

C++: #include<iostream>
#include<map>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
bool set[21][21];
int tx[]={1,0,-1,0},ty[]={0,1,0,-1}; //NESWの順
int x,y; //座標
void MOVE(char s,int a);
int main(){
		int n,a,b;
	while(1){
	for(int i=0;i<=20;i++)for(int j=0;j<=20;j++)set[i][j]=false;
	cin >> n;
	if(n==0)break;
	for(int i=0;i<n;i++){
		cin >> a >> b;
		set[a][b]=true;
	}
	cin >> n;
	x=y=10;
	char s;
	for(int i=0;i<n;i++){
		cin >> s >> a;
		MOVE(s,a);
	}
	int flg=0;
	for(int i=0;i<20;i++){
		for(int j=0;j<20;j++){
			if(set[i][j]==true)flg=1;
		}
	}
	if(flg==0)cout << "YES" << endl;
	else cout << "NO" << endl;
}
}
void MOVE(char s,int a){
	int k;
	if(s=='N')k=0;
	else if(s=='E')k=1;
	else if(s=='S')k=2;
	else k=3;

	for(int i=0;i<a;i++){
		x+=ty[k];
		y+=tx[k];
		set[x][y]=false;
	}
	return;
}

C++: #include<iostream>
#include<vector>
#include<complex>
using namespace std;
typedef complex<int> CI;
typedef vector<CI> VCI;
#define REP(i,n) for(int i = 0;i < n;i++)
	
int dx[] = {1,-1,0,0},dy[] = {0,0,1,-1};

int main()
{
	int n;
	while(cin >> n,n)
	{
		VCI v;
		int x=10,y=10,cx,cy;
		REP(i,n)
		{
			cin >> cx >> cy;
			if(!(x == cx && y == cy))
			{
				v.push_back(CI(cx,cy));
			}
		}
		int l;
		cin >> l ;
		char word;
		int len;
		REP(i,l)
		{
			cin >> word >> len;
			int der;
			switch(word)
			{
				case 'N':der = 2;break;
				case 'E':der = 0;break;
				case 'S':der = 3;break;
				case 'W':der = 1;break;
			}
			REP(j,len)
			{
				x+=dx[der];y+=dy[der];
				REP(k,v.size())
				{
					if(x == v[k].real() && y == v[k].imag())
					{
						v.erase(v.begin()+k);
					}
				}
			}
		}
		if(v.size() == 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	
	return 0;
}