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>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){

  int n;

  while (cin >> n,n){
    int x[100];
    int y[100];

    int gem[25][25] = {0};

    REP(i,n){
      cin >> x[i] >> y[i];
      gem[x[i]][y[i]] = 1;
    }
    int m;

    cin >> m;

    char d[100];
    int l[100];

    int nowx=10;
    int nowy=10;

    REP(j,m){
      cin >> d[j] >> l[j];
      if (d[j]=='N'){
	REP(k,l[k]){
	  gem[nowx+k+1][nowy]=0;
	    }
	nowx +=l[j];
      }else if(d[j]=='S'){
	REP(k,l[k]){
	  gem[nowx-k+1][nowy]=0;
	    }
	nowx -=l[j];
      }else if(d[j]=='W'){
	REP(k,l[k]){
	  gem[nowx][nowy-k+1]=0;
	    }
	nowx -=l[j];
      }else if(d[j]=='E'){
	REP(k,l[k]){
	  gem[nowx][nowy+k+1]=0;
	    }
	nowx +=l[j];
      }
    }
    int tf=0;

    //    REP(piyo,25){
    //      REP(are,25){
    //	cout << gem[piyo][are] << ",";
    //      }}

    REP(hoge,25){
      REP(huga,25){
	tf +=gem[25][25];
	if(tf>0) break;
	  }
      if(tf>0) break;
    }

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

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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  int N;
  while(cin >> N && N){
    vector<vector<int> > xy(21, vector<int>(21, 0));
    for(int i = 0; i < N; i++){
      int x, y;
      cin >> x >> y;
      xy[y][x] = 1;
    }
    int M;
    cin >> M;
    pair<int, int> player_pos = make_pair(10, 10);  //(y, x)
    int get = 0;
    for(int i = 0; i < M; i++){
      char d;
      int l;
      cin >> d >> l;
      if(d == 'N'){
        player_pos.first += l;
        for(int j = player_pos.first - l; j <= player_pos.first; j++){
          if(xy[j][player_pos.second] == 1)get++;
        }
      }else if(d == 'S'){
        player_pos.first -= l;
        for(int j = player_pos.first + l; j >= player_pos.first; j--){
          if(xy[j][player_pos.second] == 1)get++;
        }
      }else if(d == 'E'){
        player_pos.second += l;
        for(int j = player_pos.second - l; j <= player_pos.second; j++){
          if(xy[player_pos.first][j] == 1)get++;
        }
      }else if(d == 'W'){
        player_pos.second -= l;
        for(int j = player_pos.second + l; j >= player_pos.second; j--){
          if(xy[player_pos.first][j] == 1)get++;
        }
      }
      // cout << "(" << player_pos.second << ", " << player_pos.first << ")" << endl;
    }
    // cout << get << endl;
    if(get == N)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
bool gem[21][21];
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
int main() {
	int N;
	while(scanf("%d",&N),N) {
		for(int i=0;i<=20;i++) {
			for(int j=0;j<=20;j++) gem[i][j]=0;
		}
		for(int i=0;i<N;i++) {
			int x,y;
			scanf("%d %d",&x,&y);
			gem[x][y]=1;
		}
		int M;
		scanf("%d",&M);
		int x=10,y=10;
		char d[2];
		int l;
		for(int i=0;i<M;i++) {
			scanf("%s %d",d,&l);
			int D=0;
			switch(d[0]) {
			case 'N':D=0;break;
			case 'E':D=1;break;
			case 'S':D=2;break;
			case 'W':D=3;break;
			}
			for(int j=0;j<l;j++) {
				x+=dx[D];
				y+=dy[D];
				if(gem[x][y]) {
					N--;
					gem[x][y]=0;
				}
			}
		}
		printf("%s\n",N>0?"No":"Yes");
	}
}

C++: #include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
	while (1) {
		int N = 0;
		int matrix[20][20] = {};
		
		cin >> N;
		if (N == 0) break;

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

		int M;
		char dir[30];
		int val[30];

		cin >> M;

		for(int i = 0; i < M; i++) {
			cin >> dir[i] >> val[i];
		}

		int x = 10, y = 10;
		int deltax;
		int deltay;
		int result = 0;
		for (int i = 0; i < M; i++) {
			if (dir[i] == 'N') {
				deltax = 0;
				deltay = 1;
			}
			else if (dir[i] == 'S') {
				deltax = 0;
				deltay = -1;
			}
			else if (dir[i] == 'W') {
				deltax = -1;
				deltay = 0;
			}
			else if (dir[i] == 'E') {
				deltax = 1;
				deltay = 0;
			}
			for (int j = 0; j < val[i]; j++) {
				x += deltax;
				y += deltay;
				result += matrix[x][y];
			}
		}

		if (result == N) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

C++: #include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, counter = 0, w, h;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
//vector<vector<ll>> vv(50, vector<ll>(50, 0));

int main()
{
	while (true)
	{
		cin >> n;
		if (!n) return 0;
		vector<vector<ll>> vv(50, vector<ll>(50, 0));
		counter = 0;
		REP(i, n)
		{
			ll a, b;
			cin >> a >> b;
			vv[a][b] = 1;
		}
		ll m;
		cin >> m;
		ll px = 10, py = 10;
		if (vv[px][py]) counter++;
		REP(i,m)
		{
			char c;
			ll d;
			cin >> c >> d;
			if (c == 'N')
			{
				REP(i, d)
				{
					py++;
					if (vv[px][py])
					{
						counter++;
						vv[px][py] = 0;
					}
				}
			}
			if (c == 'E')
			{
				REP(i, d)
				{
					px++;
					if (vv[px][py])
					{
						counter++;
						vv[px][py] = 0;
					}
				}
			}
			if (c == 'W')
			{
				REP(i, d)
				{
					px--;
					if (vv[px][py])
					{
						counter++;
						vv[px][py] = 0;
					}
				}
			}
			if (c == 'S')
			{
				REP(i, d)
				{
					py--;
					if (vv[px][py])
					{
						counter++;
						vv[px][py] = 0;
					}
				}
			}
		}
		cout << (counter == n ? "Yes" : "No") << endl;
	}
}