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;

void gemretrieve(int flag[][21], char dir, int amo, int *rx, int *ry);
void gemcheck(int flag[][21]);

int main(){

	int gemflag[21][21] = {0, 0, 0}; //?????§???????????°
	int gemamo; //?????§???????????°
	int movcou; //?§???????????????°
	char movdir; //?§??????????
	int movamo;  //?§???????
	int gx, gy; //?????§????????§?¨?
	int rx, ry; //?????????????????§?¨?
	

	rx = 10;
	ry = 10;
    
	cin >> gemamo;

	for (int i = 0; i < gemamo; i++){

		cin >> gx >> gy;
		gemflag[gx][gy] = 1;

	}

	cin >> movcou;

	for (int j = 0; j < movcou; j++){

		cin >> movdir >> movamo;

		gemretrieve(gemflag, movdir, movamo, &rx, &ry);
		

	}

	gemcheck(gemflag);



	return 0;


}

void gemretrieve(int flag[][21], char dir, int amo, int *rx, int *ry){

	switch (dir){

	case 'N':{

		for (int k = 0; k < amo; k++){

			*ry++;
			flag[*rx][*ry] = 0;

		}



	} break;

	case 'E':{

		for (int k = 0; k < amo; k++){

			*rx++;
			flag[*rx][*ry] = 0;

		}



	} break;

	case 'S':{

		for (int k = 0; k < amo; k++){

			*ry--;
			flag[*rx][*ry] = 0;

		}



	} break;

	case 'W':{

		for (int k = 0; k < amo; k++){

			*rx--;
			flag[*rx][*ry] = 0;

		}



	} break;


	default:break;

	}




}

void gemcheck(int flag[][21]){


	for (int i = 0; i < 21; i++){

		for (int j = 0; j < 21; j++){

			if (flag[i][j] == 1)
				cout << "NO" << endl; return;

		}

	}


	cout << "YES" << endl; return;


}

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

using namespace std;

int main(void) {
  while (true) {
    int field[21][21]; // ?????£???????????????????¨??????§?¨?
    int N; // ??????????????°
    int M; // ??????????????°
    int positionX = 10; // ????????????????????????x??§?¨?
    int positionY = 10; // ????????????????????????y??§?¨?
    memset(field, 0, sizeof(field));

    cin >> N;
    if (N == 0) {
      break;
    }
    for (int i=0; i<N; i++) {
      int x, y;
      cin >> x >> y;
      field[y][x] = 1;
    }

    cin >> M;
    for (int i=0; i<M; i++) {
      char direction;
      int distance;
      cin >> direction >> distance;
      switch (direction) {
      case 'N':
        for (int j=0; j<=distance; j++) {
          field[positionY+j][positionX] = 0;
        }
        positionY += distance;
        break;
      case 'E':
        for (int j = 0; j <= distance; j++) {
          field[positionY][positionX+j] = 0;
        }
        positionX += distance;
        break;
      case 'S':
        for (int j = 0; j <= distance; j++) {
          field[positionY-j][positionX] = 0;
        }
        positionY -= distance;
        break;
      case 'W':
        for (int j = 0; j <= distance; j++) {
          field[positionY][positionX-j] = 0;
        }
        positionX -= distance;
        break;
      }
    }

    bool ans = true;
    for (int i = 0; i < 21; i++) {
      for (int j = 0; j < 21; j++) {
        if (field[i][j] == 1) {
          ans = false;
        }
      }
    }
    if (ans) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int grid[21][21];
int nowx,nowy;
void init(){
  nowx = 10,nowy = 10;
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      grid[j][i] = 0;
    }
  }
}

void serch(int a,int b,int f){
  if(a > b)swap(a,b);
  cout << a << ' ' << b << endl; 
  if(f == 1){
    for(int i = a ; i <= b ; i++ )grid[nowx][i] = 0;
  }else {
    for(int i = a ; i <= b ; i++ )grid[i][nowy] = 0;
  }
}

bool check(){
  bool flag = true; 
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      if(grid[j][i] == 1){flag = false;goto N;}
    }
  }
 N:;
  if(flag)return true;
  else return false;
}

int main(){
  int n;
  while( cin >> n,n ){
    init();
    for(int i = 0 ; i < n ; i++ ){
      int x,y;
      cin >> x >> y;
      grid[x][y] = 1;
    }
    cin >> n;
    for(int i = 0 ; i < n ; i++ ){
      char c;
      int move,f = 0,past;
      cin >> c >> move;
      if(c == 'N'){
	f = 1;
	past = nowy;
	nowy+=move;
      }else if(c == 'S'){
	f = 1;
	past = nowy;
	nowy-=move;
      }else if(c == 'E'){
	past = nowx;
	nowx+=move;
      } else {
	past = nowx;
	nowx-=move;
      }
      if(f == 0)serch(past,nowx,f);
      else serch(past,nowy,f);
    }
    if( check() )cout << "Yes" << endl;
    else cout << "No" << endl; 
  }
  return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define MAX_N 23
#define MAX_M 33

int N,M,x,y;
bool a;
bool field[21][21];
char dir[MAX_M];
int dis[MAX_M];

bool input(){
  x=10;
  y=10;
  a=false;
  REP(i,21){
    REP(j,21){
      field[i][j]=false;
    }
  }
  cin>>N;
  REP(i,N){
    int a,b;
    cin>>a>>b;
    field[a][b]=true;
  }
  if(N!=0){
   cin>>M;
   REP(i,M) cin>> dir[i]>>dis[i];
   }
  return(N!=0);
}

void solve(){
  REP(i,M){
    if(dir[i]=='N'){
      REP(j,dis[i])field[x][y+j]=false;
      y+=dis[i];
      }

    else if(dir[i]=='E'){
      REP(j,dis[i])field[x+j][y]=false;
      x+=dis[i];
      }
  
    else if(dir[i]=='S'){
      REP(j,dis[i])field[x][y-j]=false;
      y-=dis[i];
      }

    else{
      REP(j,dis[i])field[x-j][y]=false;
      x-=dis[i];
  }
  field[x][y]=false;  
  }

  REP(i,21){
    REP(j,21){

      if(field[i][j]){
        cout<<"No"<<endl;
        a=true;
        break;
      }
      if(a)break;
    }
  }
  if(a!=true)cout<<"Yes"<<endl;
}
int main(){
  while(input()){
    solve();
  }
  
  cout<<field[20][1];
return 0;
}