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++: #define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

string solve(int N) {
    vector<vector<int>> posi(21, vector<int>(21, 0));
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        posi[y][x] = 1;
    }

    // for(int i = 0; i < 21; i++){
    //     for(int j = 0; j < 21; j++){
    //         cout<<posi[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }

    int M;
    cin >> M;
    vector<pair<char, int>> order;
    char c;
    int a;
    for (int i = 0; i < M; i++) {
        cin>>c;
        cin >> a;
        order.push_back(make_pair(c, a));
    }

    pair<int, int> machine_position = make_pair(10, 10);
    int cnt                         = 0;
    for (int i = 0; i < M; i++) {
        // cout<<"test"<<endl;
        
            if(order[i].first == 'N'){
                for (int j = 0; j <= order[i].second; j++) {
                    if (posi[machine_position.first + j][machine_position.second] == 1) {
                        cnt++;
                        posi[machine_position.first + j][machine_position.second] = 0;
                    }
                }
                machine_position = make_pair(machine_position.first + order[i].second, machine_position.second);
            }
            else if(order[i].first == 'S'){
                for (int j = 0; j <= order[i].second; j++) {
                    if (posi[machine_position.first - j][machine_position.second] == 1) {
                        cnt++;
                        posi[machine_position.first - j][machine_position.second] = 0;
                    }
                }
                machine_position = make_pair(machine_position.first - order[i].second, machine_position.second);
                }

            else if(order[i].first == 'E'){
                for (int j = 0; j <= order[i].second; j++) {
                    if (posi[machine_position.first][machine_position.second + j] == 1) {
                        cnt++;
                        posi[machine_position.first][machine_position.second + j] = 0;
                    }
                }
                machine_position = make_pair(machine_position.first, machine_position.second + order[i].second);
            }

            else if(order[i].first == 'W'){
                for (int j = 0; j <= order[i].second; j++) {
                    if (posi[machine_position.first][machine_position.second - j] == 1) {
                        cnt++;
                        posi[machine_position.first][machine_position.second - j] = 0;
                    }
                }
                machine_position = make_pair(machine_position.first, machine_position.second - order[i].second);
            }
            else cout<<order[i].first<<endl;

    }
    // cout<<cnt<<endl;
    if (cnt == N) return "Yes";
    return "No";
}

int main() {
    int N;
    vector<string> ans;
    while (cin >> N) {
        if (!N) break;
        ans.push_back(solve(N));
    }
    for(string a:ans) cout<<a<<endl;
}

C++: #include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <vector>
using namespace std;

int main(){
  int N;
  while((cin>>N)&&(N!=0)){
    int locx=10;
    int locy=10;
    vector<int> x;
    vector<int> y;

    //cout << N << endl;
    for(int i=0;i<N;i++){
      //      cout << "whei" << endl;
      int var;
      cin>>var;
      //     cout << "x = " << var << " ";
      x.push_back(var);
      cin>>var;
      //   cout << "y = " << var << endl;
      y.push_back(var);
    }

    int M;
    cin >> M;
    int cnt=0; 
    for(int i=0;i<M;i++){
      char direction;
      cin >> direction;
      if(direction == 'W'){
        int a;
        cin >> a;
        for(int j=0;j<a;j++){
          locx -= 1;
          for(int k=0;k<N;k++){
            if(locx==x[k]&&locy==y[k]){
              cnt++;
            }
          }
        }
      }else if(direction == 'E'){
        int a;
        cin >> a;
        for(int j=0;j<a;j++){
          locx += 1;
          for(int k=0;k<N;k++){
            if(locx==x[k]&&locy==y[k]) cnt++;
          }
        }
      }else if(direction == 'N'){
        int a;
        cin >> a;
        for(int j=0;j<a;j++){
          locy += 1;
          for(int k=0;k<N;k++){
            if(locx==x[k]&&locy==y[k]) cnt++;
          }
        }
      }else if(direction == 'S'){
        int a;
        cin >> a;
        for(int j=0;j<a;j++){
          locy -= 1;
          for(int k=0;k<N;k++){
            if(locx==x[k]&&locy==y[k]) cnt++;
          }
        }
      }
    }
    if(cnt==N)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

int N, M, cnt = 0;
int Map[21][21];

struct Position{
	int x;
	int y;
}robot;

void initMap(void){
	int i, j;
	for(i = 0; i < 21; i++){
		for(j = 0; j < 21; j++){
			Map[i][j] = 0;
		}
	}
}

void setGems(int x, int y){
	Map[x][y] = 1;
}

int main(){
	int x, y, step;
	char dir;
	while(true){
		initMap();
		cnt = 0;
		robot.x = 10; robot.y = 10;
		cin >> N;
		if(N == 0)	break;
		for(int i = 0; i < N; i++){
			cin >> x >> y;
			setGems(x, y);
		}
		//------------Print Map------------
		//for(int i = 20; i >= 0; i--){
		//	for(int j = 0; j < 21; j++){
		//		cout << Map[j][i];
		//	}
		//	cout << endl;
		//}
		cin >> M;
		for(int i = 0; i < M; i++){
			cin >> dir >> step;
			switch(dir){
				case 'N':
					for(int i = 0; i < step; i++){
						robot.y++;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'E':
					for(int i = 0; i < step; i++){
						robot.x++;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'S':
					for(int i = 0; i < step; i++){
						robot.y--;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				case 'W':
					for(int i = 0; i < step; i++){
						robot.x--;
						if(Map[robot.x][robot.y] == 1)	cnt++;
					}
					break;
				default:
					break;

			}
		}
		if(cnt == N){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;	
		}
	}
	return 0;
}