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 <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){
	int N,table[21][21],row,col,m,div;
	char dist[2];
	bool FLG;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		for(int i=0; i < 21; i++){
			for(int k = 0; k < 21; k++){
				table[i][k] = 0;
			}
		}

		for(int i=0; i < N; i++){
			scanf("%d %d",&col,&row);
			table[row][col] = 1;
		}

		row = 10,col = 10;

		scanf("%d",&m);

		for(int i=0; i < m; i++){
			scanf("%s %d",dist,&div);
			switch(dist[0]){
			case 'N':
				for(int k = row;  k <= row+div; k++){
					table[k][col] = 0;
				}
				row += div;
				break;
			case 'S':
				for(int k = row;  k >= row-div; k--){
					table[k][col] = 0;
				}
				row -= div;
				break;
			case 'E':
				for(int k = col; k <= col+div; k++){
					table[row][k] = 0;
				}
				col += div;
				break;
			case 'W':
				for(int k = col; k >= col-div; k--){
					table[row][k] = 0;
				}
				col -= div;
				break;
			}
		}

		FLG = true;

		for(int i=0; i < 21; i++){
			for(int k=0; k < 21; k++){
				if(table[i][k] == 1){
					FLG = false;
					break;
				}
			}
			if(!FLG)break;
		}

		if(FLG)printf("Yes\n");
		else{
			printf("No\n");
		}

	}


    return 0;
}

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

using namespace std;

bool map[22][22] = {false};
int main(){
	int m;
	cin >> m;
	while(m != 0){
		int x,y;
		for(int i = 0; i < 22; i++){
			for(int j = 0; j < 22; j++){
				map[i][j] = false;
			}
		}

		for(int i = 0; i < m; i++){
			cin >> x >> y;
			map[x][y] = true;
		}

		int n;
		int ans = 0;
		cin >> n;
		x = y = 10;
		for(int i = 0; i < n; i++){
			char com;
			int move;
			cin >> com >> move;
			if(com == 'N'){
				for(int j = 1; j <= move; j++){
					if(map[x][y + j]){
						ans++;
					}
				}
				y += move;
			}
			if(com == 'S'){
				for(int j = 1; j <= move; j++){
					if(map[x][y - j]){
						ans++;
					}
				}
				y -= move;
			}
			if(com == 'E'){
				for(int j = 1; j <= move; j++){
					if(map[x + j][y]){
						ans++;
					}
				}
				x += move;
			}
			if(com == 'W'){
				for(int j = 1; j <= move; j++){
					if(map[x - j][y]){
						ans++;
					}
				}
				x -= move;
			}
		}
		if(m == ans){
			cout<< "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}

		cin >> m;
	}
	return 0;
}

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

#define REP(i,b,c) for(int i=b;i<(int)c;i++)
#define rep(i,c) REP(i,0,c)

using namespace std;

int main(){
  char move1[100];
  int i,j,k,n,m,jewel[100][100],move2[100],count;
  int mapQ[21][21],startx,starty;


  for(i=0;i<=20;i++){
    for(j=0;j<=20;j++)mapQ[i][j]=0;
  }

  while(1){
    count = 0;
    cin >> n;
    if(n == 0)break;

    rep(i,n){
      cin >> jewel[i][0] >> jewel[i][1];
      mapQ[jewel[i][1]][jewel[i][0]]=1; //ツ陛ウツ静篠づ個暗環置ツづーツマツッツプツ湘」ツづ可篠ヲツつキツ（ツ１ツづ可渉可甘コツ可サツ）
	
	}

  

    cin >> m;

    rep(i,m)cin >> move1[i] >> move2[i];

    startx=10;
    starty=10;
    mapQ[starty][startx]=2; //ツスツタツーツトツ地ツ点ツづー2ツづ可渉可甘コツ可サ

    rep(i,m){
      for(j=1;j<=move2[i];j++){
	if(move1[i] == 'N'){
	  mapQ[++starty][startx];
	  if(mapQ[starty][startx] == 1)count++;
	  mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'E'){
	  mapQ[starty][++startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'S'){
	  mapQ[starty][--startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'W'){
	  mapQ[--starty][startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}

      }
    }
    //   rep(i,21){
    //   rep(j,21)cout << mapQ[i][j] << " - " ;
    //   cout << endl; 
    //   }
    //   cout << "count =" << count <<  " n =" << n << endl;    

    
    count == n ? cout << "Yes" << endl : cout << "No" << endl ; 
    
    
  }
  
  
 return 0;
 
}

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

int main() {
	int n;
	int dxy[] = { 0,1,0,-1,0 };
	//char f2d[] = { 'N','E','S','W' };
	string f2d = "NESW";
	while (cin >> n) {
		if (!n)break;
		
		vector<vector<int> > field(21,vector<int>(21,0));
		
		for (int i = 0; i < n; ++i) {
			int _x, _y;
			cin >> _x >> _y;
			field[_x][_y] = 1;
			
		}
		int x = 10, y = 10;
		int m;
		cin >> m;

		int move; char f;

		for (int i = 0; i < m; ++i) {
			cin >> f >> move;
			int idx = (int)f2d.find(f);

			for(int j=0;j<move;j++){
				x += dxy[idx];
				y += dxy[idx+1];
				if (field[x][y]) {
					field[x][y] = 0;
					n--;
				}

			}
		}

		if (!n)cout << "Yes" << endl;
		else cout << "No" << endl;
		
	}
	return 0;
}