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 <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

int main() {
	int n;
	while (cin >> n&&n) {
		bool treasure[20][20] = {};
		int x, y;
		for (int i = 0; i < n; i++) {
			cin >> x >> y;
			treasure[y][x] = true;
		}
		int m;
		cin >> m;
		char c;
		int a;
		int ans = 0;
		int posx = 10, posy = 10;
		for (int i = 0; i < m; i++) {
			cin >> c >> a;
			if (c == 'S') {
				for (int count = 1; count <= a; count++) {
					if (treasure[posy - count][posx])ans++;
				}
				posy = posy - a;
			}
			if (c == 'N') {
				for (int count = 1; count <= a; count++) {
					if (treasure[posy + count][posx])ans++;
				}
				posy = posy + a;
			}
			if (c == 'E') {
				for (int count = 1; count <= a; count++) {
					if (treasure[posy][posx+count])ans++;
				}
				posx = posx + a;
			}
			if (c == 'W') {
				for (int count = 1; count <= a; count++) {
					if (treasure[posy][posx-count])ans++;
				}
				posx = posx - a;
			}
		}
		cout << (ans==n?"Yes":"No") << endl;
	}
}

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

int map[21][21];

void search(int a[][21], string d, int i, int *x, int *y) {

	if (d == "N") {
		for (int j = 1; j <= i; j++) a[*y + j][*x] = 2;
		*y += i;
	} else if (d == "S") {
		for (int j = 1; j <= i; j++) a[*y - j][*x] = 2;
		*y -= i;
	} else if (d == "E") {
		for (int j = 1; j <= i; j++) a[*y][*x + j] = 2;
		*x += i;
	} else if (d == "W") {
		for (int j = 1; j <= i; j++) a[*y][*x - j] = 2;
		*x -= i;
	}

}

int judge (int a[][21]) {
	for (int i = 0; i < 21; i++) {
		for (int j = 0; j < 21; j++) {
			if (a[i][j] == 1) return 0;
		}
	}
	return 1;
}

void print (int a[][21]) {
	for (int i = 0; i < 21; i++) {
		for (int j = 0; j < 21; j++) {
			cout << a[i][j] << " ";
		}
		cout << "\n";
	}
}


int main(void) {
	int N, x, y, M, i, nowx, nowy;
	string d;

	cin.tie(0);
	//ios::sync_with_stdio(false);

	while (cin >> N, N) {
		nowx = nowy = 10;
		for (int k = 0; k < 21; k++) {
			for (int l = 0; l < 21; l++) {
				map[k][l] = 0;
			}
		}


		for (int j = 0; j < N; j++) {
			cin >> x >> y;
			map[y][x] = 1;
		}

		map[nowy][nowx] = 2;

		print(map);

		cin >> M;

		for (int k = 0; k < M; k++) {
			cin >> d >> i;
			search(map, d, i, &nowx, &nowy);
			print(map);
		}
		cout << (judge(map) == 1 ? "YES" : "NO") << "\n";

	}

	return 0;
}

C++: // AOJ 2000
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const int XMAX = 30, YMAX = 30, MMAX = 40;

bool field[XMAX][YMAX];
char dir[MMAX];
int dist[MMAX];
int N, M;

void init() {
  REP(x, XMAX) REP(y,YMAX) { field[x][y] = false; }
}

bool solve() {
  int items = 0;
  int x = 10, y = 10;
  REP(i, M) {
    REP(d, dist[i]) {
      x += (dir[i] == 'E' ? 1 : dir[i] == 'W' ? -1 : 0);
      y += (dir[i] == 'N' ? 1 : dir[i] == 'S' ? -1 : 0);

      if (field[x][y]) {
        field[x][y] = false;
        items++;
      }
    }
  }
  return items == N;
}

int main() {
  while (cin >> N and N) {
    init();
    REP(i, N) {
      int x, y;
      cin >> x >> y;
      field[x][y] = true;
    }

    cin >> M;
    REP(i, M) {
      cin >> dir[i] >> dist[i];
    }

    cout << (solve() ? "Yes" : "No") << endl;
  }
}

C++: #pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 61
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
//typedef pair<ll,ll> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};

signed main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    while(true){
        int N;
        cin>>N;
        if(N==0) return 0;
        int C[21][21];
        for(int i=0;i<21;i++){
            for(int j=0;j<21;j++) C[i][j]=0;
        }
        for(int i=0;i<N;i++){
            int x,y;
            cin>>x>>y;
            C[y][x]++;
        }
        int M;
        cin>>M;
        int x=10,y=10;
        while(M--){
            char d;
            int l;
            cin>>d>>l;
            if(d=='N'){
                for(int i=0;i<l;i++){
                    y++;
                    if(C[y][x]){
                        C[y][x]--;
                        N--;
                    }
                }
            }else if(d=='W'){
                for(int i=0;i<l;i++){
                    x--;
                    if(C[y][x]){
                        C[y][x]--;
                        N--;
                    }
                }
            }else if(d=='S'){
                for(int i=0;i<l;i++){
                    y--;
                    if(C[y][x]){
                        C[y][x]--;
                        N--;
                    }
                }
            }else{
                for(int i=0;i<l;i++){
                    x++;
                    if(C[y][x]){
                        C[y][x]--;
                        N--;
                    }
                }
            }
        }
        if(N==0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}