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 <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n;
    while(scanf("%lld", &n)) {
        if(n == 0) break;
        int board[30][30] = {};
        int r, c;
        rep(i,0,n) {
            scanf("%lld%lld", &c, &r); r--; c--;
            board[r][c] = 1;
        }

        int m; scanf("%lld", &m);
        string st = "NSEW";
        char d; int t;
        int rr = 9, cc = 9;
        int cnt = 0;
        if(board[9][9] == 1) cnt = 1;
        rep(i,0,m) {
            scanf(" %c %lld", &d, &t);
            // printf("debug: m = %lld, input = (%c, %lld)\n", m, d, t);
            int p = st.find(d);
            rep(j,0,t) {
                rr += dx[p], cc += dy[p];
                if(board[rr][cc]) cnt++;
                board[rr][cc] = 0;
            }
        }
        if(cnt == n) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
	
	int n, m;
	while (1)
	{
		cin>>n;
		if(n==0)break;
		int map[21][21]={};

		for (int i = 0; i < n; ++i)
		{
			int x, y;
			cin >> x >> y;
			map[y][x] = 1;
		}
		cin >> m;
		int dx[] = {0, 0, -1, 1};
		int dy[] = {-1, 1, 0, 0};
		int mx, my, count;
		mx = my = 10;
		count = 0;
		for (int i = 0; i < m; ++i)
		{
			char d;
			int l;
			cin >> d >> l;
			switch (d)
			{
			case 'N':
				d = 1;
				break;
			case 'S':
				d = 0;
				break;
			case 'E':
				d = 3;
				break;
			case 'W':
				d = 2;
				break;
			}
			for (int j = 0; j < l; ++j)
			{
				mx += dx[d];
				my += dy[d];
				if (map[my][mx])
				{
					map[my][mx] = 0;
					count++;
				}
			}
		}
		if (count == n)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};

int main(){
    int N;
    while(cin >> N, N){
        vector<vector<bool> > c(21, vector<bool>(21));
        rep(i, N){
            int x, y;
            cin >> x >> y;
            c[y][x] = true;
        }
        int M, x = 10, y = 10;
        cin >> M;
        while(M--){
            char d; int l;
            cin >> d >> l;
            rep(i, 4)if("SWNE"[i] == d){
                while(l--){
                    x += dx[i]; y += dy[i];
                    if(!c[x][y])continue;
                    c[x][y] = false;
                    N--;
                }
            }
        }
        cout << (N? "No\n": "Yes\n");
    }
    return 0;
}

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

using namespace std;

int main(){
	while(true){
		int n; cin >> n;
		if(n == 0 ) break;
		vector<vector<bool> > m(21,vector<bool>(21,false));
		for(int i = 0; i < n; ++i){
			int x,y; cin >> x >> y;
			m[x][y] = true;
		}
		int nx = 10, ny = 10;
		int q; cin >> q;
		for(int i = 0; i < q; ++i){
			char d;
			int dis; cin >> d >> dis;
			int dx = 0,dy = 0;
			switch(d){
				case 'S':
					dy = -1;
					break;
				case 'N':
					dy = 1;
					break;
				case 'W':
					dx = -1;
					break;
				case 'E':
					dx = 1;
					break;
			}
			for(int j = 0; j < dis; ++j){
				nx += dx;
				ny += dy;
				m[nx][ny] = false;
			}
		}
		bool flag = true;
		for(int i = 0; i < 21; ++i)for(int j = 0; j < 21; ++j){
			if(m[i][j]){
				flag = false;
				break;
			}
		}
		if(flag)cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}

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

using namespace std;

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

int main(void)
{
  int n;
  while(cin >> n){
    if(!n) break;
    bool array[21][21] = {};
	
    for(int i = 0; i < n; i++){
      int a, b; cin >> a >> b;
      array[a][b] = true;
    }
    int x = 10;
    int y = 10;
    int m; cin >> m;
    for(int i = 0; i < m; i++){
      int num;
      char input;
      int h = 0;
      
      cin >> input >> num;

      if(input == 'N') h = 0;
      if(input == 'E') h = 1;
      if(input == 'S') h = 2;
      if(input == 'W') h = 3;
      
      for(int j = 0; j < num; j++){
	x += dx[h];
	y += dy[h];
	if(array[x][y] == true){
	  n--;
	  array[x][y] = false;
	}
      }
    }
    if(!n) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;

}

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

using namespace std;

int main() {
  int n;
  while(cin>>n && n!=0) {
    set<pair<int, int> > mySet;
    for(int i=0; i<n; i++) {
      int x, y;
      cin>>x>>y;
      mySet.insert(make_pair(x, y));
    }
    int m;
    cin>>m;
    int nowX = 10, nowY = 10;
    string dir;
    int move;
    for(int i=0; i<m; i++) {
      cin>>dir;
      cin>>move;
      for(int j=0; j<move; j++) {
	if(dir == "N") {
	  nowY++;
	}
	else if(dir == "S") {
	  nowY--;
	}
	else if(dir == "E") {
	  nowX++;
	}
	else if(dir == "W") {
	  nowX--;
	}
	if(mySet.find(make_pair(nowX, nowY)) != mySet.end()) {
	  mySet.erase(make_pair(nowX, nowY));
	}
      }
    }
    if(mySet.empty()) {
      cout<<"Yes"<<endl;
    }
    else {
      cout<<"No"<<endl;
    }
  }
}