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>
#include <algorithm>
#include <cstring>

using namespace std;

int main(){

  int n, m;

  while(cin >> n, n){
    int x, y, move, j;
    int lux[21][21];
    char c;
    memset(lux, 0, sizeof(lux));
    for(int i = 0; i < n; i++){
      cin >> x >> y;
      lux[x][y] = 1;
    }
    cin >> m;
    x = y = 10;
    for(int i = 0; i < m; i++){
      cin >> c >> move;
      if(c == 'N'){
        for(j = 1; j <= move; j++) lux[x][y+j] = 0;
        y += move;
      }else if(c == 'E'){
        for(j = 1; j <= move; j++) lux[x+j][y] = 0;
        x += move;
      }else if(c == 'S'){
        for(j = 1; j <= move; j++) lux[x][y-j] = 0;
        y -= move;
      }else if(c == 'W'){
        for(j = 1; j <= move; j++) lux[x-j][y] = 0;
         x -= move;
      }
    }
    int flag = 1;
    for(int i = 0; i < 21; i++){
      for(int j = 0; j < 21; j++){
        if(lux[i][j] == 1){
          flag = 0;
        }
      }
    }
    if(flag){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
using namespace std;

const int dy[4]={1,0,-1,0},dx[4]={0,1,0,-1};

int main(){
	int N;
	while(cin>>N,N){
		int X,Y;
		bool fld[21][21]={};
		for(int i=0;i<N;i++){
			cin>>X>>Y;
			fld[Y][X] = true;
		}
		int M,L,direct,y=10,x=10,cnt=0;
		char D;
		cin>>M;
		for(int i=0;i<M;i++){
			cin>>D>>L;
			if(D=='N') direct = 0;
			else if(D=='E') direct = 1;
			else if(D=='S') direct = 2;
			else if(D=='W') direct = 3;
			for(int j=0;j<L;j++){
				y += dy[direct]; x += dx[direct];
				if(fld[y][x]==true) cnt++;
			}
		}
		if(cnt==N) puts("Yes");
		else puts("No");
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  int n,m,x,y;
  while(true){
    cin >> n;
    if (n == 0)
      break;
    bool jew[21][21];
    for(int i=0;i<441;i++)
      jew[i%21][i/21] = true;
    for(int i=0;i<n;i++){
      cin >> x >> y;
      jew[x][y] = false;
    }
    cin >> m;
    char dir[m];
    int len[m];
    for(int i=0;i<m;i++)
      cin >> dir[i] >> len[i];
    x=10;
    y=10;
    int correct = 0;
    for(int i=0;i<m;i++){
      while(len[i]>0){
	switch(dir[i]){
	case 'N':
	  y++;
	  break;
	case 'E':
	  x++;
	  break;
	case 'S':
	  y--;
	  break;
	case 'W':
	  x--;
	  break;
	}
	if (!jew[x][y]){
	  jew[x][y] = true;
	  n--;
	}
	len[i]--;
      }
    }
    if (n)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  }
   
  return 0;
}

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

int main() {
	int n, x, y, m, i;
	char d;
	while (true)
	{
		int cnt = 0;
		int fx = 10;
		int fy = 10;
		int fld[21][21] = { 0 };

		cin >> n;
		if (n == 0) break;
		for (int j = 0; j < n; j++) {
			cin >> x >> y;
			fld[x][y] = 1;
		}
		cin >> m;
		for (int j = 0; j < m; j++) {
			cin >> d >> i;
			for (int k = 0; k < i; k++) {
				switch (d) {
				case 'N':
					if (fld[fx][++fy] == 1) cnt++;
					break;
				case 'E':
					if (fld[++fx][fy] == 1) cnt++;
					break;
				case 'S':
					if (fld[fx][--fy] == 1) cnt++;
					break;
				case 'W':
					if (fld[--fx][fy] == 1) cnt++;
					break;
				default:
					break;
				}
			}
		}
		if (cnt == n) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int N;//宝石の数
int M;//ロボットに与えた命令の個数
int main()
{
  int x,y;
  while(cin>>N,N){
    int juery[30][30];
    int px = 10;
    int py = 10;
    int ans = N;
    for(int i = 0;i <N;i++){
    cin>>x>>y;
    juery[y][x] = 1;
    }
    cin>>M;//命令の数
    char order;
    for(int j = 0;j <M;j++){
      cin>>order;
      cin >>x;//移動距離
      bool flag = false;
      if(order=='N'){
        for(int i =0; i <x;i++){
	  py +=1;
	  if(juery[py][px]==1){
	    flag =true;
	    // cout <<juery[py][px]<<endl;
	    //cout <<"get"<<endl;
	    juery[py][px]=0;
	    ans--;
	  }
	}
      }else if(order=='E'){
	for(int i = 0;i <x;i++){
	  px +=1;
	  if(juery[py][px]==1){
	    flag = true;
	    // cout <<juery[py][px]<<endl;
	    // cout <<"get"<<endl;
	    juery[py][px]=0;
	    ans--;
	  }
	}
      }else if(order=='S'){
	for(int i = 0;i <x;i++){
	  py -=1;
	  if(juery[py][px]==1){
	    flag = true;
	    // cout <<juery[py][px]<<endl;
	    //   juery[py][px]=0;
	  }
	}
      }else if(order=='W'){
	for(int i = 0;i <x;i++){
	  px -=1;
	  if(juery[py][px]==1){
	    flag = true;
	    // cout <<juery[py][x]<<endl;
	    // juery[py][px]=0;
	    ans--;
	  }
	}
      }
    }
    bool ok = true;//すべての宝石が回収できたかどうか
    for(int i =0;i <=20;i++){
      for(int j = 0;j <=20;j++){
	if(juery[i][j]==1){
	  ok = false;
	}
      }
    }
    if(ans!=0){
      cout <<"No"<<endl;
    }else{
      cout <<"Yes"<<endl;
    }
  }
    
  return 0;
}