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<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	

using namespace std;

namespace MyLib {
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
}

using namespace MyLib;
bool ju[21][21];
int rx[30], ry[30];


int main() {
	int m;
	int l[30];
	char buf;

	int x, y;
	int n;
	while (cin >> n, n) {
		REP(i, 21)
			REP(j, 21)
			ju[i][j] = 0;
		REP(i, n)
			cin >> x >> y, ju[y][x] = 1;
		cin >> m;
		REP(i, m) {
			cin >> buf >> l[i];
			if (buf == 'E') {
				rx[i] = 1;
				ry[i] = 0;
			}
			else if (buf == 'W') {
				rx[i] = -1;
				ry[i] = 0;
			}
			else if (buf == 'N') {
				rx[i]= 0;
				ry[i] = 1;
			}
			else if (buf == 'S') {
				rx[i] = 0;
				ry[i] = -1;
			}

		}
		x = 10, y = 10;
		int count = 0;
		REP(i,m)
			REP(j, l[i]) {
				x += rx[i];
				y += ry[i];
				if (ju[y][x]) {
					ju[y][x] = 0;
					count++;
				}
		}
		if (count == n)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}

	return 0;

}

C++: #include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n != 0) {
		int a[21][21] = {};
		for (int i = 0; i < n; i++) {
			int x, y;
			cin >> y >> x;
			a[y][x] = 1;
		}
		int m;
		int x, y;
		x = 10, y = 10;
		int count = 0;
		int num;
		char c;
		cin>>m;
		for(int i=0;i<m;i++){
			cin >> c >> num;
			while(num--) {
				if (c == 'N')y++;
				else if (c == 'E')x++;
				else if (c == 'S')y--;
				else x--;
				if (a[y][x]) {
					count++;
					a[y][x] = 0;
				}
			}

		}
		if (count == n)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

typedef pair<int, int> pii;

int main(void) {

    while (1) {
        int N; cin >> N;
        if (N == 0) break;
        int masu[21][21];
        memset(masu, 0, sizeof(masu));

        for (int i = 0; i < N; i++) {
            int x, y; cin >> x >> y;
            masu[y][x] = 1;
        }

        int M; cin >> M;
        pii pos = pii(10, 10);      // ???????????????????????????
        for (int i = 0; i < M; i++) {
            char dir;
            int dis;
            cin >> dir >> dis;

            switch (dir) {
            case 'N':
                for (int j = 0; j < dis; j++) {
                    pos.second++;
                    if (masu[pos.second][pos.first] == 1) {
                        masu[pos.second][pos.first] = -1;
                        N--;
                    }
                }
                break;
            case 'E':
                for (int j = 0; j < dis; j++) {
                    pos.first++;
                    if (masu[pos.second][pos.first] == 1) {
                        masu[pos.second][pos.first] = -1;
                        N--;
                    }
                }
                break;
            case 'S':
                for (int j = 0; j < dis; j++) {
                    pos.second--;
                    if (masu[pos.second][pos.first] == 1) {
                        masu[pos.second][pos.first] = -1;
                        N--;
                    }
                }
                break;
            case 'W':
                for (int j = 0; j < dis; j++) {
                    pos.first--;
                    if (masu[pos.second][pos.first] == 1) {
                        masu[pos.second][pos.first] = -1;
                        N--;
                    }
                }
                break;
            }
        }

        if (N > 0) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }

    return 0;
}

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

using namespace std;


int map[50][50];
int N;
int x,y;


int main(){

  while(1){

    cin >> N;
    if(N == 0) break;

    memset(map,0,sizeof(map));

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

    int M;
    int l;
    char d;
    int tr = 0;

    cin >> M;
    int nx = 10, ny =10;
    for(int i = 0; i < M ; i++){
      cin >> d >> l;
      if(d == 'N'){
	for(int i = 0 ; i < l; i++){
	  ny++;
	  if(map[nx][ny] == 1){
	    tr++;
	    map[nx][ny] = 0;
	  }
	}
      }else if(d == 'E'){
	for(int i = 0 ; i < l; i++){
	  nx++;
	  if(map[nx][ny] == 1){
	    tr++;
	    map[nx][ny] = 0;
	  }
	}
	
      }else if(d == 'S'){
	for(int i = 0 ; i < l; i++){
	  ny--;
	  if(map[nx][ny] == 1){
	    tr++;
    map[nx][ny] = 0;
	  }
	}
       }else if(d == 'W'){
	for(int i = 0 ; i < l; i++){
	  nx--;
	  if(map[nx][ny] == 1){
	    tr++;
	    map[nx][ny] = 0;
	  }
	}
      }
    }
    if( tr == N ) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++ )
bool map[21][21];

int main(){
	int n, m;
	while( cin >> n, n ){
		rep(i,21) rep(j,21) map[i][j] = false;
		rep(i,n){
			int x,y;
			cin >> x >> y;
			map[x][y] = true;
		}
		int px=10, py=10;
		cin >> m;
		rep(i,m){
			char d;
			int r;
			cin >> d >> r;
			rep(j,r){
					 if(d=='N')	py++;
				else if(d=='E')	px++;
				else if(d=='S')	py--;
				else if(d=='W')	px--;
				map[px][py] = false;
			}
		}
		bool comp=true;
		rep(i,21) rep(j,21) if( map[i][j] ) comp=false;
		cout << (comp?"Yes":"No") << endl;
	}
	return 0;
}