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++: // AOJ 2000
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const int XMAX = 30, YMAX = 30, MMAX = 40;

bool field[XMAX][YMAX];
char dir[MMAX];
int dist[MMAX];
int N, M;

void init() {
  REP(x, XMAX) REP(y,YMAX) { field[x][y] = false; }
}

bool solve() {
  int items = 0;
  int x = 10, y = 10;
  REP(i, M) {
    REP(d, dist[i]) {
      x += (dir[i] == 'E' ? 1 : dir[i] == 'W' ? -1 : 0);
      y += (dir[i] == 'N' ? 1 : dir[i] == 'S' ? -1 : 0);

      if (field[x][y]) {
        field[x][y] = false;
        items++;
      }
    }
  }
  return items == N;
}

int main() {
  while (cin >> N and N) {
    init();
    REP(i, N) {
      int x, y;
      cin >> x >> y;
      field[x][y] = true;
    }

    cin >> M;
    REP(i, M) {
      cin >> dir[i] >> dist[i];
    }

    cout << (solve() ? "Yes" : "No") << endl;
  }
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b)-1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n)-1; i >= 0; i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define loop while(true)

#define PB push_back
#define pb push_back
#define MP make_pair
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()

#define PII pair<int, int>
#define pii pair<int, int>
#define VI vector<int>
#define VVI vector<vector<int> >

using namespace std;

using LL = long long;
using ULL = unsigned long long;




signed main()
{
    loop{
        int n;
        cin >> n;
        if(n == 0) break;

        vector<bool> gem_x(20, false);
        vector<bool> gem_y(20, false);
        rep(i, n){
            int x, y;
            cin >> x >> y;
            gem_x[x] = true;
            gem_y[y] = true;
        }

        int pos_x = 10;
        int pos_y = 10;

        int m;
        cin >> m;
        int gem_num = 0;
        rep(i, m){
            char dir;
            int leng;
            cin >> dir >> leng;
            switch(dir){
            case 'N':
                pos_y += leng;
                break;
            case 'E':
                pos_x += leng;
                break;
            case 'S':
                pos_y -= leng;
                break;
            case 'W':
                pos_x -= leng;
                break;
            }

            if(gem_x[pos_x] && gem_y[pos_y]) gem_num++;
        }

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

C++: #include<stdio.h>
#include<stdlib.h>

int main()
{
	while(1)
	{
		int N,M,JUDGE,judge[20][2],jposi1,jposi2,rposi;
		char move1[2];
		int move2;
		JUDGE=1;
		rposi=220;
		
		scanf("%d",&N);//何個あるか
		if(N!=0)
		{
			for(int i=0;i<N;i++)
			{
				scanf("%d",&jposi1);
				scanf("%d",&jposi2);
				judge[i][0]=21*jposi2+jposi1;
				judge[i][1]=0;
			}
			scanf("%d",&M);//何回動くか
			for(int i=0;i<M;i++)
			{
				scanf("%s",&move1[0]);
				scanf("%d",&move2);
				for(int t=0;t<move2;t++)
				{
					switch(move1[0])
					{
					case 'N':
						rposi+=21;
						break;
					case 'S':
						rposi-=21;
						break;
					case 'E':
						rposi+=1;
						break;
					case 'W':
						rposi-=1;
						break;
					}
					for(int j=0;j<N;j++)
					{
						if(rposi==judge[j][0]) judge[j][1]=1;
					}
				}
			}
			for(int i=0;i<M;i++)
			{
				if(judge[i][1]==0) JUDGE=0;
			}
			if(JUDGE) printf("Yes\n");
			else printf("No\n");
		}
		else break;
	}
}

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

using namespace std;

int operate(int num, string way, int count, vector<vector<int>>& stone_place, int& get_num, vector<int>& robot)
{
	if(way == "N"){
		for(int i = 0; i < num; i++){
			if(stone_place[i][0] == robot[0] && robot[1] <= stone_place[i][1] && stone_place[i][1] <= robot[1] + count){
				get_num += 1;
				stone_place[i] = { -1, -1 };
			}
		}
		robot[1] += count;
	}else if(way == "S"){
		for(int i = 0; i < num; i++){
			if(stone_place[i][0] == robot[0] && robot[1] - count <= stone_place[i][1] && stone_place[i][1] <= robot[1]){
				get_num += 1;
				stone_place[i] = { -1, -1 };
			}
		}
		robot[1] -= count;
	}else if(way == "E"){
		for(int i = 0; i < num; i++){
			if(stone_place[i][1] == robot[1] && robot[0] <= stone_place[i][0] && stone_place[i][0] <= robot[0] + count){
				get_num += 1;
				stone_place[i] = { -1, -1 };
			}
		}
		robot[0] += count;
	}else if(way == "W"){
		for(int i = 0; i < num; i++){
			if(stone_place[i][1] == robot[1] && robot[0] - count <= stone_place[i][0] && stone_place[i][0] <= robot[0]){
				get_num += 1;
				stone_place[i] = { -1, -1 };
			}
		}
		robot[0] -= count;
	}
	return 0;
}

int main(void)
{
	int num, step, get_num;
	vector<int> robot;

	while(1){
		robot = { 10, 10 };
		get_num = 0;
		cin >> num;
		if(num == 0)
			break;

		vector<vector<int>> stone_place;
		stone_place = vector<vector<int>>(num, vector<int>(2));
		for(int i = 0; i < num; i++){
			cin >> stone_place[i][0] >> stone_place[i][1];
		}

		cin >> step;
		for(int i = 0; i < step; i++){
			string way;
			int count;

			cin >> way >> count;
			operate(num, way, count, stone_place, get_num, robot);
		}
		
		if(get_num >= num)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}