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 <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
#define MAX 32

typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int n, m;

bool exist[MAX][MAX];

int main(void) {
    while (cin >> n) {
        if (n == 0) break;
        for (int i = 0; i <= 20; i++) {
            for (int j = 0; j <= 20; j++) {
                exist[i][j] = false;
            }
        }
        for (int i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            exist[y][x] = true;
        }
        int nowx = 10;
        int nowy = 10;
        cin >> m;
        for (int i = 0; i < m; i++) {
            char d;
            int l;
            cin >> d >> l;
            if (d == 'N') {
                for (int j = 0; j < m; j++) {
                    nowy++;
                    if (exist[nowy][nowx]) exist[nowy][nowx] = false;
                }
            }
            if (d == 'S') {
                for (int j = 0; j < m; j++) {
                    nowy--;
                    if (exist[nowy][nowx]) exist[nowy][nowx] = false;
                }
            }
            if (d == 'E') {
                for (int j = 0; j < m; j++) {
                    nowx++;
                    if (exist[nowy][nowx]) exist[nowy][nowx] = false;
                }
            }
            if (d == 'W') {
                for (int j = 0; j < m; j++) {
                    nowx--;
                    if (exist[nowy][nowx]) exist[nowy][nowx] = false;
                }
            }
        }
        bool ok = true;
        for (int y = 0; y <= 20; y++) {
            for (int x = 0; x <= 20; x++) {
                if (exist[y][x]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) break;
        }
        if (ok) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

C++: #include<cstdio>
using namespace std;

int N, x[20], y[20], M;
bool get[20];

void check(int X, int Y) {
  for (int i = 0; i < N; i++) if (x[i] == X && y[i] == Y) get[i] = true;
}

int main() {
  while (1) {
    scanf("%d", &N);
    if (N == 0) break;
    for (int i = 0; i < N; i++) scanf("%d%d", &x[i], &y[i]);
    for (int i = 0; i < N; i++) get[i] = false;
    scanf("%d", &M);
    char dir;
    int l, dx, dy;
    int nowx = 10, nowy = 10;
    check(nowx, nowy);
    for (int i = 0; i < M; i++) {
      scanf("%c", &dir);
      while (!(dir == 'N' || dir == 'E' || dir == 'S' || dir == 'W')) scanf("%c", &dir);
      scanf("%d", &l);
      dx = dy = 0;
      if (dir == 'N') dy = 1;
      if (dir == 'E') dx = 1;
      if (dir == 'S') dy = -1;
      if (dir == 'W') dx = -1;
      for (int j = 0; j < l; j++) {
        nowx += dx;
        nowy += dy;
        check(nowx, nowy);
      }
    }
    bool flag = true;
    for (int i = 0; i < N; i++) if (!get[i]) flag = false;
    if (flag) printf("Yes\n");
    else printf("No\n");
  }
}

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

int main(){
    int n;
    while(cin >> n, n != 0){
        set<pair<int, int> > st;
        for(int i=0;i<n;++i){
            int x, y;
            cin >> x >> y;
            st.insert(pair<int, int>(x, y));
        }
        int m;
        cin >> m;
        int x = 10, y = 10, gem = 0;
        for(int i=0;i<m;++i){
            char d;
            int a;
            cin >> d >> a;
            for(int j=0;j<a;++j){
                if(d == 'N')y++;
                else if(d == 'E')x++;
                else if(d == 'S')y--;
                else x--;
                if(st.count(pair<int, int>(x,y))){
                    gem++;
                    st.erase(pair<int, int>(x,y));
                }
            }
        }
        if(gem == n)cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)

int main()
{
  while(1){
    int N;
    cin >> N;
    if(N == 0){
      break;
    }else{
      int x, y;
      int planet[20][20];
      fill(&planet[0][0], &planet[20][0], 0);
      REP(i, N){
        cin >> x >> y;
        planet[x][y] = 1;
      }
      int M;
      char d;
      int l;
      int px, py;
      px = py = 10;
      cin >> M;
      REP(i, M){
        cin >> d >> l;
        if(d == 'N'){
          REP(j, l + 1)
            planet[px][py + j] = 0;
          py += l;
        }else if(d == 'E'){
          REP(j, l + 1)
            planet[px + j][py] = 0;
          px += l;
        }
        else if(d == 'S'){
          REP(j, l + 1)
            planet[px][py - j] = 0;
          py -= l;
        }else{
          REP(j, l + 1)
            planet[px - j][py] = 0;
          px -= l;
        }
      }
      int c = 0;
      REP(i, 20)
        REP(j, 20)
          if(planet[i][j])
            c++;
      if(c)
        cout << "No" << endl;
      else
        cout << "Yes" << endl;
    }
  }
}