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 <stdio.h>
#include <cmath>
#include <iostream>
 
using namespace std;
 
int main() {
    int k;
    char d;
    int a,b;
    int counter;
    int robx;
    int roby;
    int kari;
    while (cin >> k) {
        if (k == 0) {
            break;
        }
        counter = 0;
        int hyou[30][30] = {0};
        int koudou[30][2] = {0};
        for (int i = 0; i < k; i++) {
            cin >> a >> b;
            hyou[a][b] = 1;
            counter++;
        }
        cin >> k;
        for (int i = 0; i < k; i++) {
            cin >> d >> a;
            if (d == 'N') {
                koudou[i][0] = a;
            } else if (d == 'S') {
                koudou[i][0] = -a;
            } else if (d == 'E') {
                koudou[i][1] = a;
            } else {
                koudou[i][1] = -a;
            }
        }
        robx = 10;
        roby = 10;
        if (hyou[10][10] == 1) {
            hyou[10][10] = 0;
            counter--;
        }
        for (int i = 0; i < k; i++) {
            if (koudou[i][0] == 0) {
                kari = 1;
            } else {
                kari = 0;
            }
            for (int j = 0; j < abs(koudou[i][kari]); j++) {
                if (koudou[i][kari] > 0) {
                    if (kari == 0) {
                        roby++;
                    } else {
                        robx++;
                    }
                } else {
                    if (kari == 0) {
                        roby--;
                    } else {
                        robx--;
                    }
                }
                //printf("%d %d\n",robx,roby);
                if (hyou[robx][roby] == 1) {
                    hyou[robx][roby] = 0;
                    counter--;
                }
            	//cout<<robx<<" "<<roby<<endl;
            }
        }
        if (counter == 0) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int N, M;
bool feeld[25][25];

void solve() {
	int x = 10, y = 10;
	for (int i = 0; i < M; i++) {
		char c;
		int d;
		
		cin >> c >> d;
		if (c == 'N') {
			for (int j = 0; j < d; j++) {
				feeld[++y][x] = 0;
			}
		}
		if (c == 'E') {
			for (int j = 0; j < d; j++) {
				feeld[y][++x] = 0;
			}
		}
		if (c == 'S') {
			for (int j = 0; j < d; j++) {
				feeld[--y][x] = 0;
			}
		}
		if (c == 'W') {
			for (int j = 0; j < d; j++) {
				feeld[y][--x] = 0;
			}
		}
	}
	
	bool isok = true;
	for (int i = 0; i <= 20; i++) {
		for (int j = 0; j <= 20; j++) {
			isok *= !feeld[i][j];
		}	
	}
	
	if (isok) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main() {
	while (1) {
		cin >> N; if (N == 0) break;
		
		memset(feeld, 0, sizeof(feeld));
		for (int i = 0; i < N; i++) {
			int x, y; cin >> x >> y;
			feeld[y][x] = 1;
		}
		
		cin >> M;
		solve();
	}
	
	return 0;
}

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

class Point {
public:
	int x;
	int y;
	Point() {
		x = 0;
		y = 0;
	}
};

class Robot {
public:
	int x;
	int y;
	int h;
	Robot(int N, Point* r) {
		x = 10;
		y = 10;
		h = 0;
		for (int i = 0; i < N; i++) {
			if (x == r[i].x&&y == r[i].y)h++;
		}
	}
	void e() { x++; }
	void n() { y++; }
	void w() { x--; }
	void s() { y--; }
};


int main() {
	int N;
	while (cin >> N&&N) {
		Point ruby[20];
		for (int i = 0; i < N; i++) cin >> ruby[i].x >> ruby[i].y;
		int M;
		cin >> M;
		Robot robot(N, ruby);
		for (int i = 0; i < M; i++) {
			char o;
			int t;
			cin >> o >> t;
			switch (o) {
			case 'N':
				for (int j = 0; j < t; j++) {
					robot.n();
					for (int k = 0; k < N; k++)if (robot.x == ruby[k].x&&robot.y == ruby[k].y)robot.h++;
				}
				break;
			case 'S':
				for (int j = 0; j < t; j++) {
					robot.s();
					for (int k = 0; k < N; k++)if (robot.x == ruby[k].x&&robot.y == ruby[k].y)robot.h++;
				}
				break;
			case 'E':
				for (int j = 0; j < t; j++) {
					robot.e();
					for (int k = 0; k < N; k++)if (robot.x == ruby[k].x&&robot.y == ruby[k].y)robot.h++;
				}
				break;
			case 'W':
				for (int j = 0; j < t; j++) {
					robot.w();
					for (int k = 0; k < N; k++)if (robot.x == ruby[k].x&&robot.y == ruby[k].y)robot.h++;
				}
				break;
			default:break;
			}
			cout << robot.h << endl;
		}
		if (robot.h == N)puts("Yes");
		else puts("No");


	}
	return 0;
}

C++: #include<stdio.h>

int main(){
	int n,m,d,x,y,i;
	for(;scanf("%d",&n),n;puts(n?"No":"Yes")){
		int f[21][21] = {0};
		for(i=n;i--;f[y][x] = 1)
			scanf("%d %d",&x,&y);
		scanf("%d",&m);
		x=y=10;
		for(i=m;i--;)
			for(scanf(" %c %d",&m,&d);d--; ){
				x += (m=='E')? 1 : (m=='W')? -1 : 0;
				y += (m=='N')? 1 : (m=='S')? -1 : 0;
				if(f[y][x]){
					n--;
					f[y][x] = 0;
				}
			}
	}
}

C++: #include <iostream>
#include <vector>
#include <map>
#define F(a, b) for (int j = a; j < b; j++)
using namespace std;
typedef pair<int, int> mypair;
int main(void)
{
	int n, m;
	while (1)
	{
		cin >> n;
		if (n == 0)
			break;
		vector<vector<int> > t(21, vector<int>(21, 0));
		mypair p;
		int c = 0;
		int x, y;
		for (int i = 0; i < n; i++)
		{
			cin >> x >> y;
			t[x][y] = 1;
		}
		mypair now(10, 10);
		cin >> m;
		char a;
		for (int i = 0; i < m; i++)
		{
			cin >> a >> x;
			if (a == 'N')
			{
				F(0, x)
				{
					now.second++;
					if (t[now.first][now.second] == 1)
					{
						c++;
						t[now.first][now.second] = 0;
					}
				}
				
			}
			else if (a == 'W')
			{
			
				F(0,x)
				{
					now.first--;
					if (t[now.first][now.second] == 1)
					{
						c++;
						t[now.first][now.second] = 0;
					}
				}
				
			}
			else if (a == 'E')
			{
				F(0,x)
				{	
					now.first++;
					if (t[now.first][now.second] == 1)
					{
						c++;
						t[now.first][now.second] == 0;
					}
				}
				
			}
			else
			{
				F(0,x)
				{
					now.second--;
					if (t[now.first][now.second]==1)
					{
						c++;
						t[now.first][now.second] == 0;
					}
				}
				
			}
		}
		if (c == n)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	return 0;
}