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 <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>

using namespace std;
#define REP(i,b) for (int i=0;i<(b);i++)
#define FORj(j,a) for (int j=1;j<=a;j++)

int main(void) {

	int map[20][20] = { 0 };
	int rx = 10,ry = 10;
	int n, m, a, b;
	char dir;
	int cnt = 0;

	while (1) {

		scanf("%d", &n);
		if (n == 0)
			break;

		REP(i,n) {
			scanf("%d %d", &a, &b);
			map[a][b] = 1;
		}

		scanf("%d" ,&m);

		REP(i,m) {
			cin >> dir >> a;

			switch (dir) {
			case 'N':
				FORj(j,a) {
					if (map[rx][ry + j] == 1)
						cnt++;
				}
				ry += a;
				break;

			case 'E':
				FORj(j, a) {
					if (map[rx + j][ry] == 1)
						cnt++;
				}
				rx += a;
				break;

			case 'S':
				FORj(j, a) {
					if (map[rx][ry - j] == 1)
						cnt++;
				}
				ry -= a;
				break;

			case 'W':
				FORj(j, a) {
					if (map[rx - j][ry] == 1)
						cnt++;
				}
				rx -= a;
				break;
			}
		}

		if (cnt == n)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
		
		cnt = 0;
		rx = ry = 10;
		
		REP(i, 20) {
			REP(j, 20) {
				map[i][j] = 0;
			}
		}
			
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a[20][20] = {};
	int n;
	int x, y;
	while (cin >> n&&n != 0) {
		for (int i = 0; i < n; i++) {
			cin >> y >> x;
			a[y][x] = 1;
		}
		int m;
		x = 10, y = 10;
		int count = 0;
		int num;
		char c;
		for (cin >> m; m > 0; m--) {
			cin >> c >> num;
			for (int i = 0; i < num; i++) {
				if (c == 'N')y += 1;
				else if (c == 'E')x += 1;
				else if (c == 'S')y -= 1;
				else x -= 1;
				if (a[y][x]) {
					count++;
					a[y][x] = 0;
				}
			}

		}
		if (count == n)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main() {
    int n;
    while (cin >> n, n) {
        vector<vector<int> > g(20, vector<int>(20));
        for (int i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            g[x][y] += 1;
        }

        int r;
        cin >> r;
        int x = 10;
        int y = 10;
        int sum = 0;
        while (r--) {
            char d;
            int c;
            cin >> d >> c;
            int dx = 0;
            int dy = 0;

            if (d == 'N') dy++;
            if (d == 'S') dy--;
            if (d == 'E') dx++;
            if (d == 'W') dx--;

            for (int i = 0; i < c; i++) {
                x += dx;
                y += dy;

                if (g[x][y] > 0) {
                    sum += g[x][y];
                    g[x][y] = 0;
                }
            }
        }

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

    return 0;
}

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

#define pb         push_back

const int INF = 100000000;

bool ma[22][22];

int main(void) {
	while(1){
		int n, m;
		cin >> n;
		if(n == 0) break;

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

		cin >> m;
		int px = 10;
		int py = 10;
		int col = 0;
		if(ma[py][px] == true) {
			col++;
			ma[py][px] = false;
		}
		for(int i=0; i<m; i++){
			char d;
			int l;
			cin >> d >> l;
			int dx = 0;
			int dy = 0;
			switch(d){
				case 'N':
					dy = 1;
					break;
				case 'E':
					dx = 1;
					break;
				case 'S':
					dy = -1;
					break;
				case 'W':
					dx = -1;
					break;
			}

			for(int i=0; i<l; i++){
				px += dx;
				py += dy;
				if(ma[py][px]){
					col++;
					ma[py][px] = false;
				}
			}
		}
		if(col == n){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
	
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
struct JWE{bool f;int x;int y;};

int main(){
bool ma[21][21]={};
JWE JW[21];
int n1,n2,x1,y1,k,x=10,y=10;
char ch;

for(int i=0;i<21;i++)
for(int j=0;j<21;j++)
ma[i][j]=false;

while(scanf("%d",&n1)!=EOF){
	if(n1==0)break;
for(int i=0;i<n1;i++){
cin>>x1>>y1;
JW[i].x=x1;JW[i].y=y1;
}

scanf("%d",&n2);
for(int ii=0;ii<n2;ii++){
cin>>ch>>k;

if(ch=='N'){
for(int j=y;j<=y+k;j++)
ma[x][j]=true;y=y+k;
}
else if(ch=='S'){
for(int j=y;j>=y-k;j--)
ma[x][j]=true;y=y-k;
}
else if(ch=='E'){
for(int j=x;j<=x+k;j++)
ma[j][y]=true;x=x+k;
}
else if(ch=='W'){
for(int j=x;j>=x-k;j--)
ma[j][y]=true;x=x-k;
}

}

int sum=0;
for(int i=0;i<n1;i++)
{if(ma[JW[i].x][JW[i].y]==true)sum++;}
if(n1==sum)printf("Yes\n");
else printf("No\n");
/*
for(int i=0;i<21;i++){
for(int j=0;j<21;j++)
{cout<<" ";
if(ma[j][i]==false)cout<<"*";
else cout<<"1";}
cout<<endl;
}
*/
}
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define INF 100000005
#define MAX 200005

string str = "NESW";
int yy[4] = {1, 0, -1, 0}, xx[4] = {0, 1, 0, -1};
int a[21][21], n, m, py, px;
int solve(int h, int d){
	int ans = 0;
	for(int i = 0;i < d;i++){
		py = py+yy[h];
		px = px+xx[h];
		if(a[py][px])ans++;
	}
	return ans;
}

int main(){
	int d, y, x, h;
	char c;
	while(cin >> n, n){
		int ans = 0;
		py = px = 10;
		fill((int*)a, (int*)(a+21), 0);
		for(int i = 0;i < n;i++){
			cin >> x >> y;
			a[y][x] = 1;
		}
		cin >> m;
		for(int i = 0;i < m;i++){
			cin >> c >> d;
			for(int j = 0;j < 4;j++)if(c == str[j])h = j;
			ans += solve(h, d);
		}
		if(n-ans == 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}