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 <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
	while (1) {
		int N = 0;
		int matrix[24][24] = {};
		
		cin >> N;
		if (N == 0) break;

		//cout << "xxx" << N << endl;
		for (int i = 0; i < N; i++) {
			int x, y;
			cin >> x >> y;
			//cout << "###" << i << ", " << N << endl;
			matrix[x][y] = 1;
		}

		int M = 0;
		char dir[30] = {};
		int val[30] = {};

		cin >> M;
		//cout << "xxx" << M << endl;

		for(int i = 0; i < M; i++) {
			cin >> dir[i] >> val[i];
		}

		int x = 10, y = 10;
		int deltax;
		int deltay;
		int result = 0;
		for (int i = 0; i < M; i++) {
			if (dir[i] == 'N') {
				deltax = 0;
				deltay = 1;
			}
			else if (dir[i] == 'S') {
				deltax = 0;
				deltay = -1;
			}
			else if (dir[i] == 'W') {
				deltax = -1;
				deltay = 0;
			}
			else if (dir[i] == 'E') {
				deltax = 1;
				deltay = 0;
			}
			for (int j = 0; j < val[i]; j++) {
				x += deltax;
				y += deltay;
				result += matrix[x][y];
			}
		}

		if (result == N) {
			cout << "Yes" << endl;
		}
		else {
			cout << "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<=20; i++){
            for(int j=0; j<=20; 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=0; 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 <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 <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

int field[25][25];

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
string way = "NESW";


int main(){
    int n, m;
    while(cin >> n, n){
        int ans = 0;
        int mx=10, my=10;
        vector<pair<int, int> >jewel;
        for(int i=0; i < 22; i++) for(int j=0; j < 22; j++) field[i][j] = 0;

        for(int i=0; i < n; i++){
            int p, q;
            cin >> p >> q;
            field[p][q] = 1;
        }
        cin >> m;
        for(int i=0; i < m; i++){
            string p; int q;
            cin >> p >> q;

            int course;
            for(int j=0; j < 4; j++) if(way.substr(j,1) == p) course = j;
            for(int j=1; j <= q; j++){
                if(field[my+dy[course]*j][mx+dx[course]*j]) ans++;
            }
            mx += dx[course]*q; my += dy[course]*q;
        }
        if(n == ans) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i)<(N);i++)

int main(){
    int N;
    while(cin >> N, N != 0){
        vector<vector<int>> p(21,vector<int>(21,0));
        int X = 10, Y = 10;
        int stone = 0;
        for(int i=0;i<N;i++){
            int x,y;
            cin >> x >> y;
            p[y][x] = 1;
        }
        int M;
        cin >> M;
        for(int i=0;i<M;i++){
            char C;
            int n;
            cin >> C >> n;
            while(n){
                if(C == 'N') Y++;
                if(C == 'E') X++;
                if(C == 'S') Y--;
                if(C == 'W') X--;
                if(p[Y][X]){
                    stone++;
                    p[Y][X] = 0;
                }
                n--;
            }
        }
        if(stone == N) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
}

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

int map[21][21]={} ;
int dx[]={ 0,1,0,-1 } , dy[]={ 1,0,-1,0 } ;
int nx,ny,count;

void research( int dir, int times ){
	for( int j=0 ; j<times ; j++ ){
		nx += dx[dir] ;
		ny += dy[dir] ;
		if( map[nx][ny] == 1 ){
			map[nx][ny] = 0 ;
			count++;
		}
	}
}

int main(){
	
	int n,m,x,y,z;
	char s;
	int temp;
	
	while(1){
		cin >> n ;
		if( n==0 ) break;
		
		for( int i=0 ; i<n ; i++ ){
			cin >> x >> y ;
			map[x][y] = 1 ;
		}
		
		cin >> m ;
		count = 0 ;
		nx = 10 ;  ny = 10 ;
		
		for( int i=0 ; i<m ; i++ ){
			cin >> s >> z ;
			
			if( s=='N' ) temp = 0 ;
			else if( s=='E' ) temp = 1 ;
			else if( s=='S' ) temp = 2 ;
			else if( s=='W' ) temp = 3 ;
			
			research( temp , z ) ;
		}
		
		if( count == n ) cout << "YES" << endl ;
		else cout << "NO" << endl ;
	}
	
return 0;
}