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<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;
//|\_
//g++ -std=c++1z temp.cpp
//./a.out





int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int n,m,i,j,x,y;
    char c;
    while(1){
        cin>>n;
        if(n==0)break;
        set<pair<int,int>> s;
        rep(i,n){
            cin>>x>>y;
            s.insert(make_pair(x,y));
        }
        cin>>n;
        x=10;
        y=10;
        rep(j,n){
            cin>>c>>m;
            if(c=='N'){
                rep(i,m){
                    y++;
                    if(s.find(make_pair(x,y))!=s.end()){
                        s.erase(make_pair(x,y));
                    }
                }
            }
            else if(c=='S'){
                rep(i,m){
                    y--;
                    if(s.find(make_pair(x,y))!=s.end()){
                        s.erase(make_pair(x,y));
                    }
                }
            }
            else if(c=='E'){
                rep(i,m){
                    x++;
                    if(s.find(make_pair(x,y))!=s.end()){
                        s.erase(make_pair(x,y));
                    }
                }
            }
            else{
                rep(i,m){
                    x--;
                    if(s.find(make_pair(x,y))!=s.end()){
                        s.erase(make_pair(x,y));
                    }
                }
            }
            // cout<<x<<" "<<y<<endl;
        }
        
        if(s.size()>0)fin("No");
        else cout<<"Yes"<<endl;
    }

//////////////////////////////////////////////////////
return 0;}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
#include<cmath>
typedef long long int ll;
#define VI vector<int>

#define rep(i,a) for(int i=0;i<(a);i++)

int map[21][21]={};
int X,Y;

using namespace std;
void check(char d,int l){
	if(d=='N'){
		for(int i=0;i<=l;i++)
			map[Y+i][X]=1;
		Y+=l;
	}
	if(d=='W'){
		for(int i=0;i<=l;i++)
			map[Y][X-1]=1;
		X-=l;
	}
	if(d=='S'){
		for(int i=0;i<=l;i++)
			map[Y-i][X]=1;
		Y-=l;
	}
	if(d=='E'){
		for(int i=0;i<=l;i++)
			map[Y][X+i]=1;
		X+=l;
	}
}

int main(){
	while(1){
		rep(i,21)rep(j,21)map[i][j]=0;
		X=Y=10;
		int m,n;
		cin>>n;
		if(n==0)break;
		rep(i,n){
			int x,y;
			cin>>x>>y;
			map[y][x]=3;
		}

		cin>>m;
		rep(i,m){
			char d;
			int l;
			cin>>d>>l;
			check(d,l);
		}
		int least=0;
		rep(i,21){
			rep(j,21){
				if(map[i][j]==3){
					least++;

				}
			}
		}
		if(least==0)cout<<"Yes"<<endl;
		else		cout<<"No"<<endl;
	}	
	return 0;
}

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[20][20] = {};
		
		cin >> N;
		if (N == 0) break;

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

		int M;
		char dir[30];
		int val[30];

		cin >> M;

		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;
			}
			if (dir[i] == 'S') {
				deltax = 0;
				deltay = -1;
			}
			if (dir[i] == 'W') {
				deltax = -1;
				deltay = 0;
			}
			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<stdio.h>

int main(){
	int n,m,d,x,y,i;
	
	for( ; scanf("%d",&n) , n ; puts(n?"No":"Yes") ){
		int f[21][21] = {0};
		
		for( i=n ; i-- ; ){
			scanf("%d %d",&x,&y);
			f[y][x] = 1;
		}
		scanf("%d",&m);
		x=y=10;
		for( i=m ; i-- ; ){
			scanf(" %c %d",&m,&d);
			for( ; d-- ; ){
				x += (m=='E')? 1 : (m=='W')? -1 : 0;
				y += (m=='N')? 1 : (m=='S')? -1 : 0;
				if( f[y][x] ){
					n--;
					f[y][x] = 0;
				}
			}
		}
	}
}

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

int main(){
  int n,m;
  while(cin>>n,n){
    bool jems[30][30];
    bool gred[30][30];
    memset(jems,0,sizeof(jems));
    memset(gred,0,sizeof(gred));
    int x,y;
    for(int i=0;i<n;i++){
      cin>>x>>y;
      jems[20-y][x]=true;
    }
    cin>>m;
    gred[10][10]=true; 
    x=y=10;
    for(int i=0;i<m;i++){
      char dire;
      int dist;
      cin>>dire>>dist;
      for(int j=0;j<dist;j++){
	if(dire=='N'){
	  gred[--y][x]=true;
	}else if(dire=='S'){
	  gred[++y][x]=true;
	}else if(dire=='W'){
	  gred[y][--x]=true;
	}else{
	  gred[y][++x]=true;
	}
      }
    }
    bool ans=true;
    for(int i=0;i<30;i++){
      for(int j=0;j<30;j++){
	if(jems[i][j]==false)continue;
	if(jems[i][j]==true && gred[i][j]==false)ans=false;
      }
    }
    if(ans==true){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}