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 <vector>
#include <algorithm>
using namespace std;

struct pos{
  int x;
  int y;

  bool operator==(const pos& rhs) const;
};

bool pos::operator==(const pos& rhs) const
{
  if(x == rhs.x && y == rhs.y)
    return true;
  else
    return false;
}

struct mov{
  char direction;
  int distance;
};

void retrieve(vector<pos>& gems, mov way, pos& robot);


int main()
{
  int N, M;
  while(cin >> N, N != 0){
    vector<pos> gems;
    pos robot;
    pos temp;
    robot.x = 10;
    robot.y = 10;  //robot?????????????????????
    for(int i=0; i<N; ++i){
      cin >> temp.x >> temp.y;
      gems.push_back(temp);
    }
    //??¢??°retrieve??§??????????????????????????§???????????????????????§
    if(find(gems.begin(), gems.end(), robot) != gems.end())
      gems.erase(find(gems.begin(), gems.end(), robot));
    cin >> M;
    for(int i=0; i<M; ++i){
      mov go;
      cin >> go.direction >> go.distance;
      retrieve(gems, go, robot);
    }
    if(gems.size() == 0)
      cout << "Yes\n";
    else
      cout << "No\n";
  } 
}

    
void retrieve(vector<pos>& gems, mov way, pos& robot)
{
  int change, stay;
  pos temp;
  char dir = way.direction;
  if(dir=='N'){
    change = robot.y;
    stay = robot.x;
    while(change < robot.y+way.distance){
      ++change;
      temp.x = stay;
      temp.y = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.y += way.distance;
  }
  else if(dir=='E'){
    change = robot.x;
    stay = robot.y;
    while(change < robot.x+way.distance){
      ++change;
      temp.y = stay;
      temp.x = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.x += way.distance;
  }
  else if(dir=='S'){
    change = robot.y;
    stay = robot.x;
    while(change > robot.x-way.distance){
      --change;
      temp.x = stay;
      temp.y = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.y -= way.distance;
  }
  else if(dir=='W'){
    change = robot.x;
    stay = robot.y;
    while(change > robot.x-way.distance){
      --change;
      temp.y = stay;
      temp.x = change;
      auto itr = find(gems.begin(), gems.end(), temp);
      if(itr != gems.end()){
	gems.erase(itr);
      }
    }
    robot.x -= way.distance;
  }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int x = 10, y = 10, i, j;
	int n, X[10], Y[10], N, vn[10],flag;
	char dir[10];   //宝石個数n、移動回数N  
	while (1) {
		flag = 0;
		for (int i = 0; i < 10; i++)
			X[i] = Y[i] = 0;
		scanf("%d", &n);
		
		if (n == 0) {
			break;
		}
		for (i = 0; i < n; i++) {
			scanf("%d %d", &X[i], &Y[i]);
		}

		scanf("%d", &N);

		for (i = 0; i < N; i++) {
			scanf("%s %d", &dir[i], &vn[i]);
		}


		for (i = 0; i < n; i++) {
			for (j = 1; j <= vn[i]; j++) {
				if (dir[i] == 'N')
					y += 1;
				else if (dir[i] == 'E')
					x += 1;
				else if (dir[i] == 'S')
					y -= 1;
				else
					x -= 1;

				if (X[i] == x && Y[i] == y)
					flag += 1;



			}
			

		}
		if (flag == n)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

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

using namespace std;

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

const char dir[5] = "NESW";

int N, M, D, X, Y, JX[20], JY[20], P[21][21];

char c;

int main()
{
	while (true)
	{
		cin >> N;

		if (N == 0) { break; }

		X = 10; Y = 10;

		memset(P, 0, sizeof(P));

		P[X][Y] = 1;

		for (int i = 0; i < N; i++)
		{
			cin >> JX[i] >> JY[i];
		}

		cin >> M;

		for (int i = 0; i < M; i++)
		{
			cin >> c >> D;

			for (int j = 0; j < 4; j++)
			{
				if (c == dir[j])
				{
					for (int k = 0; k < D; k++)
					{
						X += dx[j];
						Y += dy[j];

						P[X][Y] = 1;
					}
				}
			}
		}

		int A = 0;

		for (int i = 0; i < N; i++)
		{
			A += P[JX[i]][JY[i]];
		}

		printf("%s\n", A == N ? "Yes" : "No");
	}

	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  while(true){
	int N; cin >> N; if(!N) break;
	bool is[30][30];
	fill((bool*)is, (bool*)is+30*30, false);
	REP(i,N){
	  int x, y; cin >> x >> y;
	  is[y][x] = true;
	}
	int M; cin >> M;
	int cx = 10, cy = 10, cnt = 0;
	REP(i,M){
	  char c; int d;
	  cin >> c >> d;
	  switch(c){
	  case 'N':
		for(;d>0;++cy,--d) if(is[cy][cx]){ is[cy][cx] = false; ++cnt;}
		break;
	  case 'E':
		for(;d>0;++cx,--d) if(is[cy][cx]){ is[cy][cx] = false; ++cnt;}
		break;
	  case 'S':
		for(;d>0;--cy,--d) if(is[cy][cx]){ is[cy][cx] = false; ++cnt;}
		break;
	  case 'W':
		for(;d>0;--cx,--d) if(is[cy][cx]){ is[cy][cx] = false; ++cnt;}
		break;
	  }
	  if(is[cy][cx]){ is[cy][cx] = false; ++cnt;}	  
	}
	cout << (cnt == N? "Yes": "No") << endl;
  }
  
  return 0;
}