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;
int main(){
	int N, i, j;
	while( cin >> N, N ){
		int x, y;
		pair<int, int> robot = make_pair(9,9);
		int map[20][20] = {{}};
		for( i = 0; i < N; i++ ){
			cin >> x >> y;
			map[x-1][y-1] = 1;
		}
		int M;
		cin >> M;
		char news;
		int dist;
		for( i = 0; i < M; i++ ){
			cin >> news >> dist;
			for( j = 0; j < dist; j++ ){
				if( news == 'N' ) robot.second += 1;
				if( news == 'E' ) robot.first += 1;
				if( news == 'W' ) robot.first -= 1;
				if( news == 'S' ) robot.second -= 1;
				if( map[robot.first][robot.second] ) map[robot.first][robot.second] = 0;
			}
		}

		for( i = 0; i < 20; i++ ){
			for( j = 0; j < 20; j++ ){
				if( map[i][j] == 1 ) goto end;
			}
		}
		end:
		if( i == 20 && j == 20 ) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

const int LLINF = 1LL << 60;

char ch[] = "ENWS";
int mx[] = {1, 0, -1, 0};
int my[] = {0, 1, 0, -1};

signed main()
{
  int N, M;
  while(cin >> N, N) {
    
    bool mas[25][25] = {0};
    int A, B; char C;
    int x, y, cnt = 0; x = y = 10;

    Rep(i, N) {
      cin >> A >> B; mas[B][A] = true;
    }
    if(mas[10][10]) mas[10][10] = false, cnt++;
    cin >> M;
    while(M--) {
      cin >> C >> A;
      Rep(i, 4) {
	if(C == ch[i]) {
	  Rep(j, A) {
	    y += my[i], x += mx[i];
	    if(mas[y][x]) mas[y][x] = false, cnt++;
	  }
	}
      }
    }

    if(cnt == N) cout << "Yes" << endl;
    else cout << "No" << endl;
   
  }
  return 0;
}

C++: 2
10 11
11 12
2
N 2
E 1
2
10 11
11 12
2
N 2
W 1
3
0 15
5 10
5 15
5
W 10
S 10
N 20
E 10
S 10
0

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int N,x[20],y[20],f[20],M;

int main(){
	while(cin>>N&&N){
		int cx=10,cy=10;
		rep(i,N)f[i]=0;
		rep(i,N)cin>>x[i]>>y[i];
		rep(i,N)if(cx==x[i]&&cy==y[i])f[i]=1;
		cin>>M;
		rep(i,M){
			char d;int l;
			cin>>d>>l;
			rep(j,l){
				if(d=='E')cx++;
				if(d=='N')cy++;
				if(d=='W')cx--;
				if(d=='S')cy--;
				rep(k,N)if(cx==x[k]&&cy==y[k])f[k]=1;
			}
		}
		int ans=1;
		rep(i,N)if(!f[i])ans=0;
		cout<<(ans?"Yes":"No")<<endl;
	}
}

C++: #include <iostream>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

int N, P[21][21], M, I[30];
char D[30];
int dd[5] = { 0, 1, 0, -1, 0 };
bool v[20];

int main(void) {
  while(cin >> N, N) {
    REP(i, 0, 21) REP(j, 0, 21) P[i][j] = -1;
    REP(i, 0, N) {
      int X, Y;
      cin >> X >> Y;
      P[X][Y] = i;
    }
    cin >> M;
    REP(i, 0, M) cin >> D[i] >> I[i];

    REP(i, 0, 20) v[i] = false;

    int x = 10, y = 10;
    REP(i, 0, M) {
      int dir;
      switch(D[i]) {
        case 'N': dir = 0; break;
        case 'E': dir = 1; break;
        case 'S': dir = 2; break;
        case 'W': dir = 3; break;
      }
      REP(j, 0, I[i]) {
        x += dd[dir];
        y += dd[dir + 1];
        // cout << x << ", " << y << endl;
        if(P[x][y] >= 0) v[P[x][y]] = true;
      }
    }

    int ans = 0;
    REP(i, 0, N) if(v[i]) ans++;
    cout << (ans == N ? "Yes" : "No") << endl;
  }

  return 0;
}

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

struct ans{
	int n;
	ans *next;
};

int main(){
	ans *start=new ans();
	start->next=NULL;
	ans *end=start,*buf;
	char s[20];
	char dir;
	char *ps;
	int **juel;
	int x=10,y=10;
	int state[20][20];
	int i,j,n,m,size;
	while(true){
		fgets(s,sizeof(s),stdin);
		size=atoi(s);
		if(size==0) break;
		memset(state,0,sizeof(state));
		juel=new int*[size];
		for(i=0;i<size;i++){
			juel[i]=new int[3];
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			juel[i][0]=atoi(ps);
			ps=strtok(NULL," ");
			juel[i][1]=atoi(ps);
			juel[i][2]=1;
		}
		fgets(s,sizeof(s),stdin);
		n=atoi(s);
		for(i=0;i<n;i++){
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			dir=ps[0];
			ps=strtok(NULL," ");
			m=atoi(ps);
			switch(dir){
			case 'N':
				for(j=1;j<=m;j++) state[x][y+j]=1;
				y+=m;
				break;
			case 'S':
				for(j=1;j<=m;j++) state[x][y-j]=1;
				y-=m;
				break;
			case 'E':
				for(j=1;j<=m;j++) state[x+j][y]=1;
				x+=m;
				break;
			case 'W':
				for(j=1;j<=m;j++) state[x-j][y]=1;
				x-=m;
				break;
			}
		}
		for(i=0;i<size;i++)if(state[juel[i][0]][juel[i][1]]==0) break;
		if(i==size) n=0;
		else n=1;
		buf=new ans();
		buf->n=n;
		buf->next=NULL;
		end->next=buf;
		end=buf;
	}
	buf=start->next;
	while(buf){
		if(buf->n==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
		end=buf;
		buf=buf->next;
		delete end;
	}
	for(i=0;i<size;i++) delete []juel[i];
	delete []juel;
	return 1;
}

C++: #include <iostream>

using namespace std;

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

int dir(char ch) 
{
    int ret;

    if (ch == 'N')
        ret = 2;
    else if (ch == 'E')
        ret = 3;
    else if (ch == 'S')
        ret = 0;
    else if (ch == 'W')
        ret = 1;

    return ret;
}


int main()
{
    int n;

    while (cin >> n, n) {
        bool map[22][22];
        int x, y, m;

        for (int i = 0; i <= 20; i++)
            for (int j = 0; j <= 20; j++) 
                map[i][j] = false;

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

        x = y = 10;
        cin >> m;
        for (int i = 0; i < m; i++) {
            char d;
            int l;

            cin >> d >> l;
            for (int j = 0; j < l; j++) {
                x += dx[dir(d)];
                y += dy[dir(d)];

                if (map[y][x]) {
                    map[y][x] = false;
                    n--;
                }
            }
        }

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

    return 0;
}