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;
int main(){
  int N,M;
  int mp[21][21];
  int x,y,n;
  char d;
  int nowx,nowy,ans;
  while(1){
    cin>>N;
    if(N==0) break;
    nowx=10;
    nowy=10;
    ans=0;
    for(int i=0;i<21;i++){
      for(int j=0;j<21;j++){
	mp[i][j]=0;
      }
    }
    for(int i=0;i<N;i++){
      cin>>x>>y;
      mp[x][y]=1;
    }
    /*for(int i=0;i<21;i++){
      for(int j=0;j<21;j++){
	cout<<mp[i][j]<<" ";
      }
      cout<<endl;
      }*/
    cin>>M;
    for(int i=0;i<M;i++){
      cin>>d>>n;
      if(d=='W'){
	for(int j=0;j<n;j++){
	  nowy--;
	  if(mp[nowy][nowx]==1){
	    mp[nowy][nowx]=0;
	    ans++;
	  }
	}
      }
	else if(d=='N'){
	  for(int j=0;j<n;j++){
	    nowx++;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
	else if(d=='E'){
	  for(int j=0;j<n;j++){
	    nowy++;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
	else if(d=='S'){
	  for(int j=0;j<n;j++){
	    nowx--;
	    if(mp[nowy][nowx]==1){
	      mp[nowy][nowx]=0;
	      ans++;
	    }
	  }
	}
    }
    if(ans==N) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<17,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N,M;cin>>N;
        
        if(N==0) return 0;
        
        map<pair<int,int>,int> MA;
        
        for(int i=0;i<N;i++){
            int a,b;cin>>a>>b;
            MA[{a,b}]++;
        }
        
        cin>>M;
        int xnow=10,ynow=10;
        
        while(M--){
            char a;int b;cin>>a>>b;
            if(a=='N'){
                while(b--){
                    ynow++;
                    if(MA[{xnow,ynow}]==1) MA[{xnow,ynow}]--;
                }
            }
            if(a=='E'){
                while(b--){
                    xnow++;
                    if(MA[{xnow,ynow}]==1) MA[{xnow,ynow}]--;
                }
            }
            if(a=='S'){
                while(b--){
                    ynow--;
                    if(MA[{xnow,ynow}]==1) MA[{xnow,ynow}]--;
                }
            }
            if(a=='W'){
                while(b--){
                    xnow--;
                    if(MA[{xnow,ynow}]==1) MA[{xnow,ynow}]--;
                }
            }
        }
        
        int sum=0;
        
        for(auto it=MA.begin();it!=MA.end();it++) sum+=(*it).second;
        
        if(sum==0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

C++: #include <iostream>
using namespace std;
const int size = 21;
int map[size][size] = { 0 };

int main(){
	int n,m;
	while (1){
		cin >> n;
		if (n == 0) break;
		for (int i = 0; i < size; i++){
			for (int j = 0; j < size; j++){
				map[i][j] = 0;
			}
		}
		int cnt = 0; //???????????????????????°
		int rbx = 10, rby = 10; //???????????§?¨?
		//???????????????????????°
		for (int i = 0; i < n; i++){
			int x, y;
			cin >> x >> y;
			map[y][x] = 1;
		}
		//??????????????????
		cin >> m;
		for (int i = 0; i < m; i++){
			char d;
			int t;
			cin >> d >> t;
			switch (d){
			case 'N':
				for (int i = 0; i < t; i++){
					rby++;
					if (map[rby][rbx] == 1){
						cnt++;
						map[rby][rbx] = 0;
					}
				}
				break;

			case 'E':
				for (int i = 0; i < t; i++){
					rbx++;
					if (map[rby][rbx] == 1){
						cnt++;
						map[rby][rbx] = 0;
					}
				}
				break;

			case 'S':
				for (int i = 0; i < t; i++){
					rby--;
					if (map[rby][rbx] == 1){
						cnt++;
						map[rby][rbx] = 0;
					}
				}
				break;

			case 'W':
				for (int i = 0; i < t; i++){
					rbx--;
					if (map[rby][rbx] == 1){
						cnt++;
						map[rby][rbx] = 0;
					}
				}
				break;
			}
		}
		if (cnt == n){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
}