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<cstdio>

#define REP(i,b,c) for(int i=b;i<(int)c;i++)
#define rep(i,c) REP(i,0,c)

using namespace std;

int main(){
  char move1[100];
  int i,j,k,n,m,jewel[100][100],move2[100],count;
  int mapQ[21][21],startx,starty;


  for(i=0;i<=20;i++){
    for(j=0;j<=20;j++)mapQ[i][j]=0;
  }

  while(1){
    count = 0;
    cin >> n;
    if(n == 0)break;

    rep(i,n){
      cin >> jewel[i][0] >> jewel[i][1];
      mapQ[jewel[i][1]][jewel[i][0]]=1; //ツ陛ウツ静篠づ個暗環置ツづーツマツッツプツ湘」ツづ可篠ヲツつキツ（ツ１ツづ可渉可甘コツ可サツ）
	
	}

  

    cin >> m;

    rep(i,m)cin >> move1[i] >> move2[i];

    startx=10;
    starty=10;
    mapQ[starty][startx]=2; //ツスツタツーツトツ地ツ点ツづー2ツづ可渉可甘コツ可サ

    rep(i,m){
      for(j=1;j<=move2[i];j++){
	if(move1[i] == 'N'){
	  mapQ[++starty][startx];
	  if(mapQ[starty][startx] == 1)count++;
	  mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'E'){
	  mapQ[starty][++startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'S'){
	  mapQ[starty][--startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}
	else if(move1[i] == 'W'){
	  mapQ[--starty][startx];
	  if(mapQ[starty][startx] == 1)count++;
	 mapQ[starty][startx]=0;
	}

      }
    }
    //   rep(i,21){
    //   rep(j,21)cout << mapQ[i][j] << " - " ;
    //   cout << endl; 
    //   }
    //   cout << "count =" << count <<  " n =" << n << endl;    

    
    count == n ? cout << "Yes" << endl : cout << "No" << endl ; 
    
    
  }
  
  
 return 0;
 
}

C++: #include<iostream>
#include<climits>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<list>
#include<string>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int,int>
#define PCC pair<char,char>
#define PCI pair<char,int>
#define PIC pair<int,char>
#define MP make_pair
#define DEBUG(x) cout<<#x<<": "<<x<<endl;


int main()
{
	while (1)
	{
		int n;
		cin >> n;
		if (n == 0)break;
		PII mine = MP(10, 10);
		vector <PII> jem;
		REP(i, n)
		{
			int x, y;
			cin >> x >> y;
			PII temp = MP(x, y);
			jem.push_back(temp);
		}
		int m;
		bool ans = true;
		cin >> m;
		REP(i, m)
		{
			char com;
			int value;
			cin >> com >> value;
			if (com == 'N' || com == 'S')
			{
				if (com == 'S')value = -value;
				REP(j, n)
				{
					if (jem[j].first != mine.first)continue;
					if (mine.second <= jem[j].second&&jem[j].second <= mine.second + value)
					{
						jem[j].first = -1;
						jem[j].second = -1;
					}
				}
				mine.second += value;
			}
			else
			{
				if (com == 'W')value = -value;
				REP(j, n)
				{
					if (jem[j].second != mine.second)continue;
					if (mine.first <= jem[j].first&&jem[j].first<= mine.first+ value)
					{
						jem[j].first = -1;
						jem[j].second = -1;
					}
				}
				mine.second += value;
			}
		}
		REP(i, n) 
		{ 
			if (jem[i].first != -1)
			{
				ans = false;
				break;
			}
		}
		if (ans)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

C++: import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		int[][] field = new int[21][21];
		Scanner sc = new Scanner(System.in);
		while(true){
			int nowx = 10;
			int nowy = 10;
			for(int i=0;i<21;i++){
				for(int j=0;j<21;j++){
					field[i][j] = 0;
				}
			}
			int n = sc.nextInt();
			if(n == 0) break;
			for(int i=0;i<n;i++){
				int x = sc.nextInt();
				int y = sc.nextInt();
				field[x][y] = 1;
			}
			int m = sc.nextInt();
			for(int i=0;i<m;i++){
				String h = sc.next();
				int l = sc.nextInt();
				switch(h){
				case "N":
					for(int j=0;j<l;j++){
						nowy++;
						if(field[nowx][nowy] == 1){
							n--;
							field[nowx][nowy] = 0;
						}
					}
					break;
				case "S":
					for(int j=0;j<l;j++){
						nowy--;
						if(field[nowx][nowy] == 1){
							n--;
							field[nowx][nowy] = 0;
						}
					}
					break;
				case "E":
					for(int j=0;j<l;j++){
						nowx++;
						if(field[nowx][nowy] == 1){
							n--;
							field[nowx][nowy] = 0;
						}
					}
					break;
				case "W":
					for(int j=0;j<l;j++){
						nowx--;
						if(field[nowx][nowy] == 1){
							n--;
							field[nowx][nowy] = 0;
						}
					}
					break;
				}
			}
			if(n == 0) System.out.println("Yes");
			else System.out.println("No");
		}
	}
}

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

using namespace std;

int main(){
	int n;
	while(scanf("%d",&n),n){
		bool stage[22][22]={{0}};
		char vis[22][22];
		for(int i = 0; i < 21; i++){
			for(int j = 0; j < 21; j++){
				vis[i][j] = '.';
			}
		}
		for(int i = 0; i < n; i++){
			int hx,hy;
			scanf("%d%d",&hx,&hy);
			stage[hy][hx] = 1;
			vis[hy][hx] = '*';
		}
		int m;
		scanf(" %d",&m);
		int nx = 10;
		int ny = 10;
		int gotten = 0;
		for(int i = 0; i < m; i++){
			//vis[ny][nx] = '#';
			if(i == 0){
				stage[10][10] == 1 ? gotten = 1 : gotten = 0;
			}
			char dir;
			int dist;
			cin >> dir >> dist;
			int fx = nx;
			int fy = ny;
			if(dir == 'N'){
				fy = ny+dist;
				while(ny != fy)if(stage[++ny][nx] == 1)gotten++;
			}
			if(dir == 'E'){
				fx = nx+dist;
				while(nx != fx)if(stage[ny][++nx] == 1)gotten++;
			}
			if(dir == 'S'){
				fy = ny-dist;
				while(ny != fy)if(stage[--ny][nx] == 1)gotten++;
			}
			if(dir == 'W'){
				fx = fx-dist;
				while(nx != fx)if(stage[ny][--nx] == 1)gotten++;
			}
		}
		if(stage[ny][nx] == 1)gotten++;
		/*for(int i = 0; i < 21; i++){
			for(int  j = 0; j < 21; j++){
				printf("%c",vis[i][j]);
			}
			puts("");
		}*/
		if(gotten >= n)puts("Yes");
		else puts("No");
	}
	return 0;
}