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(){

  while(1){
    int n,m;
    cin >> n;
    if(n==0)break;

    int map[25][25]={},ans=0;

    for(int i=0;i<n;++i){
      int x ,y;
      cin >> x >> y;
      map[y][x]=1;
    }
    cin >> m;
    int nx=10,ny=10;
    for(int i=0;i<m;++i){
      string s;
      int d,dx,dy;
      cin >> s >> d;

      if(s=="N"){
	dy=1;dx=0;
      }
      else if(s=="S"){
	dy=-1;dx=0;
      }
      else if(s=="E"){
	dy=0;dx=1;
      }
      else if(s=="W"){
	dy=0;dx=-1;
      }

      for(int j=0;j<d;j++){
	nx=nx+dx; ny=ny+dy;
	if(map[ny][nx] == 1){
	  ans++;
	  map[ny][nx]=0;
	}
      }
    }
    if(ans == n)cout << "YES" <<endl;
    else cout << "NO" <<endl;


  }
  return 0;
}

C++: #include <iostream>
using namespace std;
#define rep(i,n)for(int i = 0 ; i < n ; i++)
#define MAX 20

int main()
{
  while(true){
    int n;
    cin >> n;
    if(n == 0) break;

    int x[MAX], y[MAX];
    rep(i,n){
      cin >> x[i] >> y[i];
    }
    for(int i = n ; i < MAX ; i++){
      x[i] = y[i] = -1;
    }

    int m;
    cin >> m;
    int rpx = 10, rpy = 10;

    for(int i = 0 ; i < m ; i++){
      char d;
      int l;
      cin >> d >> l;
      int dx = 0, dy = 0;
      if(d == 'N'){
	dy = 1;
      }else if(d == 'E'){
	dx = 1;
      }else if(d == 'S'){
	dy = -1;
      }else if(d == 'W'){
	dx = -1;
      }

      for(int i = 0 ; i < l ; i++){
	rpx += dx;
	rpy += dy;
	for(int j = 0 ; j < n ; j++){
	  if(rpx == x[j] && rpy == y[j]){
	    x[j] = y[j] = -1;
	  }
	}
      }
    }
      bool tf = true;
      rep(i,n){
	if(x[i] != -1){
	  cout << "No" << '\n';
	  tf = false;
	  break;
	}
      }
      if(tf){
	cout << "yes" << '\n';
      }
  }
}

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

bool gem[21][21];
int dx(char c)
{
  switch(c)
  {
    case 'N': case 'S': return 0;
    case 'E': return 1;
    case 'W': return -1;
  }
  return 0;
}
int dy(char c)
{
  switch(c)
  {
    case 'E': case 'W': return 0;
    case 'N': return 1;
    case 'S': return -1;
  }
  return 0;
}
int main()
{
loop:
  int n, m, x, y, t;
  char c;
  cin >> n;
  if(!n)
    return 0;
  for(int i = 0; i < n; i++)
  {
    cin >> x >> y;
    gem[x][y] = true;
  }
  x = 10; y = 10;
  if(gem[10][10])
  {
    gem[10][10] = false;
    n--;
  }
  cin >> m;
  for(int i = 0; i < m; i++)
  {
    cin >> c >> t;
    for(int j = 0; j < t; j++)
    {
      x += dx(c);
      y += dy(c);
      if(gem[x][y])
      {
        gem[x][y] = false;
        n--;
      }
    }
  }
  cout << (!n ? "Yes" : "No") << endl;
  goto loop;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	bool a[21][21];
	while (cin >> n&&n != 0) {
		for (int i = 0; i <= 20; i++) {
			for (int j = 0; j <= 20; j++) a[i][j] = false;
		}
		int c, d;
		for (int i = 0; i<n; i++) {
			cin >> c >> d;
			a[c][d] = true;
		}
		int sum = n, m;
		int x = 10, y = 10;
		cin >> m;
		char e;
		for (int i = 0; i<m; i++) {
			cin >> e >> c;
			int e=0, f=0;
			int x2 = x, y2 = y;
			if (e == 'N') {
				y += c;
				e = 1;
			}
			else if (e == 'S') {
				y -= c;
				e = -1;
			}
			else if (e == 'E') {
				x += c;
				f = 1;
			}
			else {
				x -= c;
				f = -1;
			}
			int j = y2;
			for (int i = x2;;) {
				if (i == x&&j == y) break;
				if (a[i][j]) {
					sum--;
					a[i][j] = false;
				}
				i += e;
				j += f;
			}
		}
		if (sum == 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[])
{
	int n;
	while(cin>>n,n)
	{
		bool a[21][21]={};
		int x,y;
		for (int i = 0; i < n; ++i) cin>>x>>y,a[x][y]=1;
		int m;
		cin>>m;
		int nx=10,ny=10,r;
		char c;
		for (int i = 0; i < m; ++i)
		{
			cin>>c>>r;
			if(c=='N')
			{
				for (int i = 1; i <= r; ++i) if(a[nx][ny+i]) a[nx][ny+i]=0,--n;
				ny+=r;
			}
			else if(c=='E')
			{
				for (int i = 1; i <= r; ++i) if(a[nx+i][ny]) a[nx+i][ny]=0,--n;
				nx+=r;
			}
			else if(c=='W')
			{
				for (int i = 1; i <= r; ++i) if(a[nx-i][ny]) a[nx-i][ny]=0,--n;
				nx-=r;
			}
			else
			{
				for (int i = 1; i <= r; ++i) if(a[nx][ny-i]) a[nx][ny-i]=0,--n;
				ny-=r;
			}
		}
		cout<<((n==0)?"Yes\n":"No\n");
	}
	return 0;
}

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

int main()
{
	int N, M, x, y, l, rx, ry;
	char d;
	while (cin >> N, N) {
		vector< vector<bool> > a(20, vector<bool>(20, false));
		rx = ry = 10;
		for (int i = 0; i < N; i++) {
			cin >> x >> y;
			a[x][y] = true;
		}
		cin >> M;
		for (int i = 0; i < M; i++) {
			cin >> d >> l;
			switch (d) {
			case 'N':
				for (int i = 0; i < l; i++) {
					ry++;
					if (a[rx][ry])
						a[rx][ry] = false;
				}
				break;
			case 'S':
				for (int i = 0; i < l; i++) {
					ry--;
					if (a[rx][ry])
						a[rx][ry] = false;
				}
				break;
			case 'E':
				for (int i = 0; i < l; i++) {
					rx++;
					if (a[rx][ry])
						a[rx][ry] = false;
				}
				break;
			case 'W':
				for (int i = 0; i < l; i++) {
					rx--;
					if (a[rx][ry])
						a[rx][ry] = false;
				}
				break;
			}
		}
		for (int i = 0; i < 20; i++) {
			for (int j = 0; j < 20; j++) {
				if (a[i][j]) {
					cout << "NO" << endl;
					goto rabel;
				}
			}
		}
		cout << "YES" << endl;
	rabel:
		;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	bool a[21][21];
	while (cin >> n&&n != 0) {
		for (int i = 0; i <= 20; i++) {
			for (int j = 0; j <= 20; j++) a[i][j] = false;
		}
		int c, d;
		for (int i = 0; i<n; i++) {
			cin >> c >> d;
			a[c][d] = true;
		}
		int sum = n, m;
		int x = 10, y = 10;
		cin >> m;
		char e;
		for (int i = 0; i<m; i++) {
			cin >> e >> c;
			int e=0, f=0;
			int x2 = x, y2 = y;
			if (e == 'N') {
				y += c;
				f = 1;
			}
			else if (e == 'S') {
				y -= c;
				f = -1;
			}
			else if (e == 'E') {
				x += c;
				e = 1;
			}
			else {
				x -= c;
				e = -1;
			}
			int j = y2;
			for (int i = x2; i <= x;) {
				if (i == x&&j == y) break;
				if (a[i][j]) {
					sum--;
					a[i][j] = false;
				}
				i += e;
				j += f;
			}
			if (a[x][y]) {
				sum--;
				a[x][y] = false;
			}
		}
		if (sum == 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}