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>
using namespace std;

#define N 20;
int main(){
  int M,l,a[20][20]={},b;
  int x,y;
  char d;
  while(cin>>b){
    if(b==0)break;

    for(int i=0;i<b;i++){
      cin>>x>>y;
      a[y][x]=1;
    }

    cin>>M;

    x=10;
    y=10;

    for(int i=0;i<M;i++){
      cin>>d>>l;
      
      for(int j=0;j<l;j++){	
	if(d=='N') y++;
	else if(d=='E')x++;
	else if(d=='S')y--;
	else x--;

	if(a[y][x]==1) b--;
	a[y][x]=0;
      }
    }
    if(b==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

int main(){
  int N;
  while(std::cin >> N, N){
    std::cout << N << std::endl;
    std::vector<int> x{},y{};
    x.reserve(N);
    y.reserve(N);
    int x_robo, y_robo;

    while(N--){
      std::cin >> x_robo >> y_robo;
      x.push_back(x_robo);
      y.push_back(y_robo);
    }

    x_robo = 10;
    y_robo = 10;

    int M;
    std::cin >> M;

    char d;
    int l;

    std::vector<int> x_pick_up{},y_pick_up{};
    while(M--){
      std::cin >> d >> l;
      switch(d){
      case 'S':
        l = -l;
        // No break
      case 'N':
        for(auto x_it = std::find(x.begin(),x.end(),x_robo); x.end() != x_it; x_it = std::find(std::next(x_it),x.end(),x_robo)){
          auto y_it = std::next(y.begin(),std::distance(x.begin(),x_it));
          if(y_robo <= (*y_it) && (*y_it) <= y_robo + l){ x_pick_up.push_back(*x_it); y_pick_up.push_back(*y_it); }
        }
        y_robo += l;
        break;
      case 'W':
        l = -l;
        // No break
      case 'E':
        for(auto y_it = std::find(y.begin(),y.end(),y_robo); y.end() != y_it; y_it = std::find(std::next(y_it),y.end(),y_robo)){
          auto x_it = std::next(x.begin(),std::distance(y.begin(),y_it));
          if(x_robo <= (*x_it) && (*x_it) <= x_robo + l){ x_pick_up.push_back(*x_it); y_pick_up.push_back(*y_it); }
        }
        x_robo += l;
        break;
      default:
        break;
      }
    }
    std::cout << ((std::is_permutation(x.begin(),x.end(),x_pick_up.begin()) &&
                   std::is_permutation(y.begin(),y.end(),y_pick_up.begin())) ? "Yes" : "No") << std::endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>

int main()
{
	int numGems = 0;;

	std::cin >> numGems;
	const int gridSize = 21;
	std::vector<bool> gems(gridSize * gridSize, false);
	int gemPointX;
	int gemPointY;
	if (numGems == 0)
	{
		std::cerr << "NO" << std::endl;
		return 0;
	}

	for (int i = 0; i < numGems; i++)
	{
		std::cin >> gemPointX;
		std::cin >> gemPointY;

		gems[gemPointY * gridSize + gemPointX] = true;
	}

	int numOrders = 0;
	std::cin >> numOrders;

	char direction;
	int distance;
	std::pair<int, int> currentPoint(10, 10);
	for (int i = 0; i < numOrders; i++)
	{
		std::cin >> direction;
		std::cin >> distance;

		switch (direction)
		{
		case 'N':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.second += 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'E':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.first += 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'S':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.second -= 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		case 'W':
			for (int i = 0; i < distance; i++)
			{
				currentPoint.first -= 1;
				gems[currentPoint.second * gridSize + currentPoint.first] = false;
			}
			break;
		default:
			break;
		}
	}
	
	for (int i = 0; i < gridSize * gridSize; i++)
	{
		if (gems[i])//???????????????????????????
		{
			std::cerr << "NO" << std::endl;
			return 0;
		}
	}
	std::cerr << "YES" << std::endl;
	return 0;
}

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

const int MAX_N=21,MAX_M=31;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M,sx,sy,tx,ty;
    vector<int> x(MAX_N),y(MAX_N),l(MAX_M),ok(MAX_M);
    vector<char> d(MAX_M);
    while(cin >> N,N){
        for (int i=0;i<N;++i) cin >> x[i] >> y[i],ok[i]=0;
        cin >> M;
        sx=10,sy=10;
        for (int i=0;i<M;++i){
            cin >> d[i] >> l[i];
            if (d[i]=='N') tx=sx,ty=sy+l[i];
            if (d[i]=='E') tx=sx+l[i],ty=sy;
            if (d[i]=='S') tx=sx,ty=sy-l[i];
            if (d[i]=='W') tx=sx-l[i],ty=sy;
            pair<int,int> p=minmax(sx,tx),q=minmax(sy,ty);
            for (int i=0;i<N;++i){
                if (p.first<=x[i]&&x[i]<=p.second&&q.first<=y[i]&&y[i]<=q.second){
                    ok[i]=1;
                }
            }
            sx=tx,sy=ty;
        }
        int f=1;
        for (int i=0;i<N;++i) if (!ok[i]) f=0;
        if (f) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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<=20;i++){
            for(j=0;j<=20;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++){
                    y--;
                    t[x][y]=0;
                }
                break;
            case 'W':
                for(j=0;j<l;j++){
                    x--;
                    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;
}