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 <= y[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 <iostream>

using namespace std;

int main()
{
	for(int n,m;cin>>n,n;){
		int cx=10,cy=10;
		int grid[21][21]={};
		grid[cy][cx]=1;
		
		int xs[20],ys[20];
		for(int i=0;i<n;i++)
			cin>>xs[i]>>ys[i];
		cin>>m;
		for(int i=0;i<m;i++){
			char d; int len;
			cin>>d>>len;
			int dx=0,dy=0;
			if(d=='N') dx=0,dy=1;
			if(d=='E') dx=1,dy=0;
			if(d=='S') dx=0,dy=-1;
			if(d=='W') dx=-1,dy=0;
			for(int j=0;j<len;j++){
				cx+=dx,cy+=dy;
				grid[cy][cx]=1;
			}
		}
		int res=0;
		for(int i=0;i<n;i++)
			res+=grid[ys[i]][xs[i]];
		cout<<(res==n?"Yes":"No")<<endl;
	}
	
	return 0;
}

C++: #include<iostream>

using namespace std;
typedef pair<int, int> pii;

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

int md(char c){
    if(c=='N') return 0;
    if(c=='E') return 1;
    if(c=='S') return 2;
    else return 3;
}

int main(){

    while(1){
        int N;
        cin>> N;
        if(N==0) break;
        for(int i=0; i<=N; i++){
            for(int j=0; j<=N; j++){
                fld[i][j]=0;
            }
        }
        for(int i=0; i<N; i++){
            int x, y;
            cin>> x>> y;
            fld[y][x]=1;
        }
        int X, Y;
        X=Y=10;
        int cnt=0;
        int M;
        cin>> M;
        for(int i=0; i<M; i++){
            char d; int l;
            cin>> d>> l;
            int j=md(d);
            for(int k=1; k<=l; k++){
                X+=dx[j];
                Y+=dy[j];
                if(fld[Y][X]==1) cnt++;
                fld[Y][X]=0;
            }
        }

        cout<< (cnt==N? "Yes": "No")<< endl;
    }

    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int stone;
    while(cin >> stone, stone){
        int map[20][20] = {0};
        int x, y;
        x = y = 10;
        rep(i, stone){
            int a, b;
            cin >> a >> b;
            map[a][b] = 1;
        }
        int order;
        cin >> order;
        rep(i, order){
            int distance;
            char direction;
            cin >> direction >> distance;
            rep(j, distance){
                if(direction == 'N'){
                    y++;
                }else if(direction == 'E'){
                    x++;
                }else if(direction == 'S'){
                    y--;
                }else{
                    x--;
                }
                stone-= map[x][y];
            }
        }
        if(!stone) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

using namespace std;

bool check(vector< vector< int > > vv){
		for (int i = 0; i <= 20; i++){
				for (int j = 0; j <= 20; j++){
						if (vv[i][j] ) return false;
				}
		}
		return true;
}

int main(){
		while(1){
				int n; cin >> n;
				if (n == 0) break;
				vector< vector< int > > field(22, vector<int>(22, 0));
				vector<int> x(n),y(n);
				for (int i = 0; i < n; i++){
						cin >> x[i] >> y[i];
						field[x[i]][y[i]] = 1;
				}

				int m; cin >> m;
				int nx = 10; 
				int ny = 10;
				for (int i = 0; i < m; i++){
						//N:1, E:2, S:3, W:4
						char dir; cin >> dir;
						int dis; cin >> dis;
						if (dir == 'N'){
								for (int j = 1; j <= dis; j++){
										ny++;
										field[nx][ny] = 0;
								}
						}else if (dir == 'E'){
								for (int j = 1; j <= dis; j++){
										nx++;
										field[nx][ny] = 0;
								}
						}else if (dir == 'S'){
								for (int j = 1; j <= dis; j++){
										ny--;
										field[nx][ny] = 0;
								}
						}else if (dir == 'W'){
								for (int j = 1; j <= dis; j++){
										nx--;
										field[nx][ny] = 0;
								}
						}

				}
				if (check(field)){
						cout << "Yes" << endl;
				}else{
						cout << "No" << endl;
				}
		}
		return 0;
}