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 <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define LOOP(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) LOOP(i, 0, n)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define MAX_N 20
#define MAX_M 30

int main(void) {
  while (true) {
    int n;
    cin >> n;
    if (n == 0)
      break;
    int x[MAX_N], y[MAX_M];
    REP(i, n) cin >> x[i] >> y[i];
    int m;
    cin >> m;
    bool cnt[MAX_N];
    memset(cnt, false, sizeof(cnt));
    int mx = 10, my = 10;
    REP(i, m) {
      string dir;
      int dist;
      cin >> dir >> dist;
      if (dir == "N") {
        REP(i, n) {
          if (x[i] == mx && my + dist >= y[i] && my <= y[i])
            cnt[i] = true;
        }
        my += dist;
      } else if (dir == "E") {
        REP(i, n) {
          if (y[i] == my && mx + dist >= x[i] && mx <= x[i])
            cnt[i] = true;
        }
        mx += dist;
      } else if (dir == "S") {
        REP(i, n) {
          if (x[i] == mx && my - dist <= y[i] && my >= y[i])
            cnt[i] = true;
        }
        my -= dist;
      } else if (dir == "W") {
        REP(i, n) {
          if (y[i] == my && mx - dist <= x[i] && mx >= x[i])
            cnt[i] = true;
        }
        mx -= dist;
      }
    }

    bool flag = true;
    REP(i, n) if (!cnt[i]) flag = false;
    if (flag)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }

  return 0;
}

C++: #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
//#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
//#define EXIST(s, e) ((s).find(e)!=(s).end())
//#define SORT(c) sort(begin(c),end(c))
//#define pb emplace_back
//#define MP make_pair
//#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007

//ここから編集する
bool solve() {
    int N;
    cin >> N;
    if (N == 0) return false;
    vector<vector<int> > field(25, vector<int>(25, 0));
    vector<vector<int> > used(25, vector<int>(25, 0));
    int cx = 10, cy = 10;
    used[cx][cy] = 1;
    rep(i, 0, N) {
        int x, y;
        cin >> x >> y;
        field[x][y] = 1;
    }
    int M;
    cin >> M;
    char dir[4] = {'N', 'S', 'W', 'E'};
    int dx[4] = {0, 0, -1, 1};
    int dy[4] = {1, -1, 0, 0};
    rep(i, 0, M) {
        char d;
        cin >> d;
        int l;
        cin >> l;
        rep(j, 0, 4) {
            if (d == dir[j]) {
                rep(k, 0, l) {
                    cx += dx[j];
                    cy += dy[j];
                    used[cx][cy] = 1;
                }
                break;
            }
        }

    }

    rep(x, 0, 25) {
        rep(y, 0, 25) {
            if (field[x][y] == 1 && used[x][y] == 0) {
                cout << "No" << endl;
                return true;
            }
        }
    }
    cout << "Yes" << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    while (solve());

    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main()
{
    while(true){
        int n; cin >> n;
        if(n == 0) break;
        int f[21][21];
        int tmpx = 10,tmpy = 10;
        for(int i = 0; i < 21; i++){
            for(int j = 0; j < 21; j++){
                f[i][j] = 0;
            }
        }
        for(int i = 0; i < n; i++){
            int x,y; cin >> x >> y;
            f[y][x] = 1;
        }
        int m; cin >> m;
        for(int i = 0; i < m; i++){
            char dir;
            int l;
            cin >> dir >> l;
            if(dir=='N'){
                for(int j = 0; j < l; j++){
                    tmpy += 1;
                    f[tmpy][tmpx] = 0;
                }
            }else if(dir=='S'){
                for(int j = 0; j < l; j++){
                    tmpy -= 1;
                    f[tmpy][tmpx] = 0;
                }
            }else if(dir=='E'){
                for(int j = 0; j < l; j++){
                    tmpx += 1;
                    f[tmpy][tmpx] = 0;
                }
            }else{
                for(int j = 0; j < l; j++){
                    tmpx -= 1;
                    f[tmpy][tmpx] = 0;
                }
            }
        }
        bool e = false;
        for(int i = 0; i < 21; i++){
            for(int j = 0;j < 21; j++){
                if(f[i][j] == 1){
                    e = true;
                }
            }
        }
        if(e){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
}