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;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    map<P, bool> mp;
    for(int i=0;i<n;++i) {
      int x, y; cin >> x >> y;
      mp[{x, y}] = true;
    }
    int m; cin >> m;
    vector<int> d(m), l(m);
    for(int i=0;i<m;++i) {
      char c; cin >> c >> l[i];
      if(c == 'N') {
        d[i] = 0;
      } else if(c == 'E') {
        d[i] = 1;
      } else if(c == 'S') {
        d[i] = 2;
      } else {
        d[i] = 3;
      }
    }
    int nowx = 10, nowy = 10;
    int cnt = 0;
    for(int i=0;i<m;++i) {
      for(int j=0;j<l[i];++j) {
        nowx += dx[d[i]];
        nowy += dy[d[i]];
        if(mp[{nowx, nowy}]) {
          cnt++;
          mp[{nowx, nowy}] = false;
        }
      }
    }
    if(cnt == n) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#define INF 999999999

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int n, m, x, y, l;
char d;

int main()
{
	while (cin >> n) {
		if (n == 0)return 0;
		int field[25][25];
		for (int i = 0; i < 25; i++) {
			for (int j = 0; j < 25; j++) {
				field[i][j] = 0;
			}
		}
		for (int i = 0; i < n; i++) {
			cin >> x >> y;
			field[x][y]--;
		}
		cin >> m;
		int rx = 10, ry = 10;
		for (int i = 0; i < m; i++) {
			cin >> d >> l;
			if (d == 'N') {
				for (int j = 0; j < l; j++) {
					ry++;
					field[rx][ry]++;
				}
			}
			if (d == 'E') {
				for (int j = 0; j < l; j++) {
					rx++;
					field[rx][ry]++;
				}
			}
			if (d == 'S') {
				for (int j = 0; j < l; j++) {
					ry--;
					field[rx][ry]++;
				}
			}
			if (d == 'W') {
				for (int j = 0; j < l; j++) {
					rx--;
					field[rx][ry]++;
				}
			}
		}
		int k = 0;
		for (int i = 0; i <= 20; i++) {
			for (int j = 0; j <= 20; j++) {
				if (field[i][j] < 0) {
					k++;
					break;
				}
			}
		}
		if (k > 0)cout << "No" << endl;
		else cout << "Yes" << endl;
	}

	return 0;
}

C++: ffffffffffff

C++: #include <iostream>

using namespace std;

const int MAX_N = 21;

bool gem[MAX_N][MAX_N];

int main() {
  int N;
  while (cin >> N) {
    if (N == 0) break;
    for (int i = 0; i <= 20; i++) {
      for (int j = 0; j <= 20; j++) {
        gem[i][j] = false;
      }
    }
    for (int i = 0; i < N; i++) {
      int x, y;
      cin >> x >> y;
      gem[x][y] = true;
    }
    int M;
    cin >> M;
    int pos_x = 10, pos_y = 10;
    int count = 0;
    for (int i = 0; i < M; i++) {
      char c;
      int d;
      cin >> c >> d;
      while (d--) {
        if (c == 'N') pos_y++;
        if (c == 'S') pos_y--;
        if (c == 'E') pos_x++;
        if (c == 'W') pos_x--;
        if (gem[pos_x][pos_y]) {
          gem[pos_x][pos_y] = false;
          count++;
        }
      }
    }
    if (count == N) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}

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

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		int h[21][21];
		lp(i,21){
			lp(j,21){
				h[i][j]=0;
			}
		}
		lp(i,n){
			int a,b;
			cin>>a>>b;
			h[a][b]=1;
		}
		int m,count=0;
		cin>>m;
		int nowx=10,nowy=10;
		if(h[nowx][nowy]==1){
			count++;
			h[nowx][nowy]=0;
		}
		lp(i,m){
			char a;
			int b;
			cin>>a>>b;
			if(a=='N'){
				lp(j,b){
					nowy++;
					if(h[nowx][nowy]==1){
						h[nowx][nowy]=0;
						count++;
					}
				}
			}
			if(a=='S'){
				lp(j,b){
					nowy--;
					if(h[nowx][nowy]==1){
						h[nowx][nowy]=0;
						count++;
					}
				}
			}			
			if(a=='E'){
				lp(j,b){
					nowx++;
					if(h[nowx][nowy]==1){
						h[nowx][nowy]=0;
						count++;
					}
				}
			}
			if(a=='W'){
				lp(j,b){
					nowx++;
					if(h[nowx][nowy]==1){
						h[nowx][nowy]=0;
						count++;
					}
				}
			}
		}
		if(count==n)
			cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
  char dir; //direction                                          
  int a,b,j,k;
  int dist; //distance                                           
  int xy[21][21];
    while (cin >> j && j){
      for(int i=0;i<j;i++){
        cin >> a >> b;
        xy[a][b]=1;
      }
      cin >> k;
      a=10;
      b=10;
      int m=0;
      for(int i=0;i<k;i++){
        cin >> dir >> dist;
        for(int l=0;l<dist;l++){
          if(dir == 'N')
            b++;
          else if(dir=='S')
            b--;
          else if(dir=='W')
            a--;
          else if(dir=='E')
            a++;
          if(xy[a][b]==1){
            m++;
            xy[a][b]=0;
          }
        }
      }
      if(j==m)
          cout << "Yes" << endl;
        else
          cout << "No" << endl;
    }
}