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 <map>
#include <cstring>
using namespace std;

int gem[21][21];
map<char,int> dx = {{'N', 0}, {'E', 1}, {'W', -1}, {'S', 0}};
map<char,int> dy = {{'N', 1}, {'E', 0}, {'W', 0}, {'S', -1}};

int main() {
    int N, M, x, y, l;
    char d;
    while (cin >> N, N) {
        memset(gem, 0, sizeof gem);
        for (int i=0; i<N; ++i) {
            cin >> x >> y;
            gem[y][x] = 1;
        }
        cin >> M;
        int nx = 10, ny = 10;
        int cnt = 0;
        for (int i=0; i<M; ++i) {
            cin >> d >> l;
            for (int j=0; j<l; ++j) {
                nx += dx[d];
                ny += dy[d];
                cnt += gem[ny][nx];
                gem[ny][nx] = 0;
            }
        }
        cout << (cnt == N ? "Yes" : "No") << endl;
    }
    return 0;
}

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

using namespace std;

const int N = 21;

bool treasure[N][N];
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
string str = "NESW";

main(){
  int n;
  while(cin >> n && n){
    fill(treasure[0], treasure[N], false);
    for(int i=0;i<n;i++){
      int a, b;
      cin >> a >> b;
      treasure[b][a] = true;
    }
    int m;
    cin >> m;
    int rem = n;
    int y = 10, x = 10;
    for(int i=0;i<m;i++){
      char d;
      int l;
      cin >> d >> l;
      for(int j=0;j<str.size();j++){
        if(str[j] == d){
          for(int k=0;k<l;k++){
            y += dy[j];
            x += dx[j];
            if(treasure[y][x]){
              treasure[y][x] = false;
              rem--;
            }
          }
        }
      }
    }
    cout << (rem ? "No" : "Yes") << endl;
  }
  return 0;
}

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

#include<algorithm>
#include<cstdlib>
#include<queue>
#include<stack>
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<iomanip>
#include <string.h>
using namespace std;

int pos[22][22];
int main(){
    while(true){
        int N;
        cin>>N;
        if(N==0)
            break;
        memset (pos,0,sizeof(pos));
        for(int i=0;i<N;i++){
            int x,y;
            cin>>x>>y;
            pos[20-y][x]=1;
        }
        int M;
        cin>>M;
        int x=10,y=10;
        for(int i=0;i<M;i++){
            char d;
            int l;
            cin>>d>>l;
            switch(d){
                case'N':
                    for(int i=0;i<=l;i++){
                        pos[y-i][x]=0;
                    }
                    y-=l;
                    break;
                case'S':
                    for(int i=0;i<=l;i++){
                        pos[y+i][x]=0;
                    }
                    y+=l;
                    break;
                case'W':
                    for(int i=0;i<=l;i++){
                        pos[y][x-i]=0;
                    }
                    x-=l;
                    break;
                case'E':
                    for(int i=0;i<=l;i++){
                        pos[y][x+i]=0;
                    }
                    x+=l;
                    break;
            }
            //cout<<x<<"    "<<y<<endl;
        }
        int a=1;
        
        for(int i=0;i<=20;i++){
//            cout<<setw(2) << setfill('.')<<20-i<<": ";
           for(int j=0;j<=20;j++){
//                cout<<setw(2) << setfill('.')<<pos[i][j];
                if(pos[i][j]==1)
                    a=0;
            }
//            cout<<endl;
        }
//        cout<<"    ";
//        for(int i=0;i<=20;i++)
//            cout<<setw(2) << setfill('.')<<i;
//        cout<<endl;
        cout<<(a==1?"Yes":"No")<<endl;
    }
}

C++: #include <stdio.h>

int main(void){
	int i,j;
	int count;
	int map[21][21];
	int n,m;
	int x,y;
	int jx,jy;
	int l;
	char d;
		
	while(1){
		count=0;
		x=10;
		y=10;
		for(i=0;i<21;i++){
			for(j=0;j<21;j++){
				map[i][j]=0;
			}
		}
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		else{
			for(i=0;i<n;i++){
				scanf("%d %d",&jx,&jy);
				map[jx][jy]=1;
			}
		}
		
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("%c", &d);
			scanf("%c %d",&d,&l);
			//printf("%c %d\n",d, l);
			for(j=0;j<l;j++){
				switch(d){
					case 'N': y++;
							  break;
					case 'S':
							  y--;
							  break;
					case 'E':
							  x++;
							  break;
					case 'W':
							  x--;
							  break;
				}
				if(map[x][y]==1) count++;
			}
		}
		
		if(count==n) printf("Yes\n");
		else		 printf("No\n");
	}
	return 0;
}

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    int n;
    while(cin >> n && n)
    {
        bool f[25][25];
        memset(f,0,sizeof(f));

        rep(i,n) {
            int x,y;
            cin >> x >> y;
            f[y][x] = true;
        }

        int m;
        cin >> m;

        int y = 10,x = 10;

        rep(i,m) {
            string s;
            cin >> s;

            int len;
            cin >> len;

            if(s == "N") {
                REP(j,1,len+1) {
                    if(f[y+j][x]) f[y+j][x] = false;
                }

                y += len;
            }
            else if(s == "E") {
                REP(j,1,len+1) {
                    if(f[y][x+j]) f[y][x+j] = false;
                }

                x += len;
            }
            else if(s == "S") {
                REP(j,1,len+1) {
                    if(f[y-j][x]) f[y-j][x] = false;
                }

                y -= len;
            }
            else if(s == "W") {
                REP(j,1,len+1) {
                    if(f[y][x-j]) f[y][x-j] = false;
                }

                x -= len;
            }
        }

        bool flag = true;
        rep(i,21) {
            rep(j,21) if(f[i][j]) flag = false;
        }

        if(flag) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}