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;
typedef long long int lld;
int main(){
  int n,m;
  while(cin >> n , n){
    int mas[22][22];
    memset(mas,0,sizeof(mas));
    for(int i=0;i<n;i++){
      int x,y;
      cin >> x >> y;
      mas[y][x] = 1;
    }
    cin >> m;
    int ny = 10,nx = 10;
    int cnt = 0;
    if(mas[ny][nx] == 1){
      cnt++;
      mas[ny][nx] = 0;
    }
    for(int i=0;i<m;i++){
      char c; int mv;
      cin >> c >> mv;
      if(c == 'N'){
	for(int j=0;j<mv;j++){
	  ny++;
	  if(mas[ny][nx] == 1){
	    cnt++;
	    mas[ny][nx] = 0;
	  }
	}
      }
      else if(c == 'S'){
	for(int j=0;j<mv;j++){
	  ny--;
	  if(mas[ny][nx] == 1){
	    cnt++;
	    mas[ny][nx] = 0;
	  }
	}
      }
      else if(c == 'E'){
	for(int j=0;j<mv;j++){
	  nx++;
	  if(mas[ny][nx] == 1){
	    cnt++;
	    mas[ny][nx] = 0;
	  }
	}
      }
      else {
	for(int j=0;j<mv;j++){
	  nx--;
	  if(mas[ny][nx] == 1){
	    cnt++;
	    mas[ny][nx] = 0;
	  }
	}
      }
    }
    if(cnt == n) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

C++: #include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<string.h>
#include<set>
#include<functional>
using namespace std;

#define INF 1<<21
#define MOD 1000000007

int main() {
  int N;
  while (1) {
	cin >> N;
	if (N == 0)return 0;

	int table[21][21];
	memset(table, 0, sizeof(table));
	for (int i = 0; i < N; i++) {
	  int a, b;
	  cin >> a >> b;
	  table[a][b] = 1;
	}
	int M;
	char c;
	int d;
	int x=10, y=10;
	int cnt=0;
	cin >> M;
	for (int i = 0; i < M; i++) {
	  cin >> c >> d;
	  for (int j = 0; j < d; j++) {
		switch (c) {
		case 'N':y += 1;
		  break;
		case 'E':x += 1;
		  break;
		case 'S':y -= 1;
		  break;
		case 'W':x -= 1;
		  break;
		}
		if (table[x][y] == 1) {
		  table[x][y] = 0;
		  cnt++;
		}
	  }
	}
	if (cnt == N) {
	  cout << "Yes" << endl;
	}
	else cout << "No" << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main()
{
  int n, m, a[21], b[21], d[31];
  int x, y, x0, y0, t;
  char c[31];

  while(1){
    cin >> n;
      x = 10;
      y = 10;
      x0 = 10;
      y0 = 10;
      t = 0;
    if(n==0){
       break;
    }else{
    for(int i=0; i<n; i++){
      cin >> a[i] >> b[i];
    }

    cin >> m;
    for(int i=0; i<m; i++){
      cin >> c[i] >> d[i];
      switch(c[i]){
        case 'N':
          y += d[i];
          break;
        case 'S':
          y -= d[i];
          break;
        case 'E':
          x += d[i];
          break;
        case 'W':
          x -= d[i];
          break;
      }

      for(int j=0; j<n; j++){
        if(((x0<=a[j] && a[j]<=x) || (x<=a[j] && a[j]<=x0)) && ((y0<=b[j] && b[j]<=y) ||
        (y<=b[j] && b[j]<=y0))){
          t++;
        }
      }
      x0 = x;
      y0 = y;
    }
    if(t>=n){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  } 
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
 
int main(){
    int N,M,t[21][21],l,a,b,i,j,flg=0;
    int x,y;
    char d;
    for(;;){
		x=10;y=10;
		flg=0;
		cin>>N;
		if(N==0){break;}
		for(i=0;i<21;i++){
			for(j=0;j<21;j++){
				t[i][j]=0;
			}
		}
        for(i=0;i<N;i++){
            cin>>a>>b;
            t[a][b]=1;
        }
        cin>>M;
        for(i=0;i<M;i++){
            cin>>d>>l;
            switch(d){
            case 'N':
                for(j=0;j<l;j++){
                    y++;
                    t[x][y]=0;
                }
                break;
            case 'E':
                for(j=0;j<l;j++){
                    x++;
                    t[x][y]=0;
                }
                break;
            case 'S':
                for(j=0;j<l;j++){
                    x--;
                    t[x][y]=0;
                }
                break;
            case 'W':
                for(j=0;j<l;j++){
                    y--;
                    t[x][y]=0;
                }
                break;
            default:
                break;
 
 
            }
        }
        for(i=0;i<21;i++){
            for(j=0;j<21;j++){
                if(t[i][j]==1){
                    flg=1;
                }
            }
        }
        if(flg==0){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}

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

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

C++: #include <iostream>


using namespace std;

int main(){
	int N,M;
	while(cin >> N,N){
		int px=10,py=10,x[N],y[N];
		for(int i = 0;i < N;i++) cin >> x[i] >> y[i];
		cin >> M;
		char d;
		int l;
		for(int i = 0;i < M;i++){
			cin >> d >> l;
			for(int t = 0;t < N;t++){
				if(px == x[t]){
					if((d == 'N' && py <= y[t] && y[t] <= py + l) || (d == 'S' && py - l <= y[t] && y[t] <= py)){
						x[t] = 0;
						y[t] = 0;
					}
				} else if(py == y[t]){
					if((d == 'E' && px <= x[t] && x[t] <= px + l) || (d == 'W' && px - l <= x[t] && x[t] <= px)){
						x[t] = 0;
						y[t] = 0;
					}
				}
			}
			if(d == 'N' || d == 'S') py += (d == 'N' ? l : -l);
			else px += (d == 'E' ? l : -l);
		}
		for(int i = 0;i < N;i++) if(x[i] || y[i]) M = -1;
		if(M == - 1) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
}