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;

class Point{
	public:
		int x;
		int y;
};

class Treasure : public Point{
	public:
		bool get;
		Treasure();
};

Treasure::Treasure(){
	get = false;
}

int main(){
	int N;	//# of treasure
	int M;	//# of command
	char direction;
	int move;	//l移動距離
	int num; //見つけた宝の数

	do	{
		cin >> N;
		if (N == 0){
			break;
		}

		Point Robot;
		Robot.x = 10;
		Robot.y = 10;
		
		int oldx;
		int oldy;

		Treasure* T = new Treasure[N];

		for (int i = 0; i < N; i++){
			cin >> T[i].x >> T[i].y;
		}

		num = 0;

		cin >> M;
		// 命令を読んで宝を探す
		for (int j = 0; j < M && num < N; j++){
			cin >> direction >> move;
			switch (direction){
				case 'N':
					oldy = Robot.y;
					Robot.y += move;
					for (int i = 0; i < N; i++){
						if (T[i].get == false && T[i].x == Robot.x && oldy <= T[i].y && T[i].y <= Robot.y){
							T[i].get = true;
							num++;
						}
					}
					break;
				case 'E':
					oldx = Robot.x;
					Robot.x += move;
					for (int i = 0; i < N; i++){
						if (T[i].get == false && T[i].y == Robot.y && oldx <= T[i].x && T[i].x <= Robot.x){
							T[i].get = true;
							num++;
						}
					}
					break;
				case 'S':
					oldy = Robot.y;
					Robot.y -= move;
					for (int i = 0; i < N; i++){
						if (T[i].get == false && T[i].x == Robot.x && oldy >= T[i].y && T[i].y >= Robot.y){
							T[i].get = true;
							num++;
						}
					}
					break;
				case 'W':
					oldx = Robot.x;
					Robot.x -= move;
					for (int i = 0; i < N; i++){
						if (T[i].get == false && T[i].y == Robot.y && oldx >= T[i].x && T[i].x >= Robot.x){
							T[i].get = true;
							num++;
						}
					}
					break;
				default:
					break;
			}
		}

		if (num == N){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}

	} while (N != 0);
	
	return 0;
}

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

using namespace std;
#define INF 999999999
class Position
{
public:
	int x, y;
};

void solve()
{
	int N;
	while(cin >> N, N)
	{
		vector<Position> p(N);
		for(int i = 0; i < N; ++i)
		{
			cin >> p[i].x >> p[i].y;
		}
		Position current;
		current.x = 10;
		current.y = 10;
		int M;
		cin >> M;
		int count = 0;
		for(int i = 0; i < M; ++i)
		{
			char c;
			int move;
			cin >> c >> move;
			if(c == 'N')
			{
				for(int j = 0; j < move; ++j)
				{
					current.y += 1;
					for(int k = 0; k < N; ++k)
					{
						if(current.x == p[k].x && current.y == p[k].y)
						{
							++count;
							p[k].x = INF;
							p[i].y = INF;
						}
					}
				}
			}
			else if(c == 'E')
			{
				for(int j = 0; j < move; ++j)
				{
					current.x += 1;
					for(int k = 0; k < N; ++k)
					{
						if(current.x == p[k].x && current.y == p[k].y)
						{
							++count;
							p[k].x = INF;
							p[i].y = INF;
						}
					}
				}
			}
			else if(c == 'S')
			{
				for(int j = 0; j < move; ++j)
				{
					current.y -= 1;
					for(int k = 0; k < N; ++k)
					{
						if(current.x == p[k].x && current.y == p[k].y)
						{
							++count;
							p[k].x = INF;
							p[i].y = INF;
						}
					}
				}
			}
			else if(c == 'W')
			{
				for(int j = 0; j < move; ++j)
				{
					current.x -= 1;
					for(int k = 0; k < N; ++k)
					{
						if(current.x == p[k].x && current.y == p[k].y)
						{
							++count;
							p[k].x = INF;
							p[i].y = INF;
						}
					}
				}
			}
		}
		if(count == N)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: // icpc.cpp : R\[ AvP[VÌGg |Cgðè`µÜ·B
//


#include <iostream>
#include <stdio.h>
struct P{
	int x, y;
};

int main(int argc, char* argv[])
{
	int N;
	
	while(1){
		scanf("%d", &N);
		if(N == 0){
			break;
		}
		P dia[20];
		for(int i = 0; i < N; i++){
			scanf("%d %d", &dia[i].x, &dia[i].y);
			if(dia[i].x == 10 && dia[i].y == 10){
				dia[i].x = dia[i].y = -1;
			}
		}
		int x = 10, y = 10;
		int M;
		scanf("%d", &M);
		for(int i = 0; i < M; i++){
			char ch;
			int dx, dy;
			scanf(" %c", &ch);
			switch(ch){
			case 'N': dx = 0; dy = 1; break;
			case 'E': dx = 1; dy = 0; break;
			case 'S': dx = 0; dy = -1; break;
			case 'W': dx = -1; dy = 0; break;
			}
			int d = 0;
			scanf("%d", &d);
			for(int j = 0; j < d; j++){
				x += dx; y += dy;
				for(int k = 0; k < N; k++){
					if(dia[k].x == x && dia[k].y == y){
						dia[k].x = dia[k].y = -1;
						break;
					}
				}
			}
		}
		bool f = false;
		for(int k = 0; k < N; k++){
			if(dia[k].x != -1 && dia[k].y != -1){
				f = true;
				break;
			}
		}
		printf(f ? "No\n" : "Yes\n");


	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <stack>

#define rep(i,x) for(int i=0;i<x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rep_to(a,i,x) for(int i=a;i<x;i++)

using namespace std;

int main()
{
	int N,M;
	FILE *fp;
	fp=fopen("ans.txt","w");

	while(cin >> N && N)
	{
		int robot_x=10,robot_y=10;
		int item_x[100000]={};
		int item_y[100000]={};
		int flag[100][100]={};
		int count=0;

		rep(i,N)cin >> item_x[i] >> item_y[i];
		
		cin >> M;
		rep(i,M)
		{
			char muki[10]={};
			int L=0;

			cin >> muki >> L;
			
			rep(j,L)
			{
				if(muki[0]=='N')robot_y++;
				else if(muki[0]=='E')robot_x++;
				else if(muki[0]=='S')robot_y--;
				else if(muki[0]=='W')robot_x--;

				rep(k,N)
				{
					if(robot_x == item_x[k] && robot_y == item_y[k] && flag[robot_x][robot_y] == 0)
					{
						count++;
						flag[robot_x][robot_y]=1;
					}
				}
			}
		} 
		if(N<=count)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	fclose(fp);
	return 0;
}