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++: #pragma warning( disable : 4996 )
#include <stdio.h>
#include <map>
#include <vector>

typedef unsigned int DWORD;		//DWORD

//２次元ベクトルクラス
class Vector2{

public:

	Vector2(){

		x = y = 0;

	}

	Vector2( int _x , int _y ){

		x = _x;
		y = _y;

	}

	int x;
	int y;

	Vector2 operator +( Vector2 &_Arg ){

		Vector2 ret;
		
		ret.x = x + _Arg.x;
		ret.y = y + _Arg.y;

		return ret;

	}

	void operator +=( Vector2 &_Arg ){

		x += _Arg.x;
		y += _Arg.y;

	}

	Vector2 operator *( int &_Arg ){

		Vector2 ret( x * _Arg , y * _Arg );

		return ret;

	}

	void operator *=( int &_Arg ){

		x *= _Arg;
		y *= _Arg;

	}

	bool operator ==( Vector2 &_Arg ){

		return ( x == _Arg.x && y == _Arg.y );

	}

	bool operator !=( Vector2 &_Arg ){

		return ( x != _Arg.x || y != _Arg.y );

	}

	static Vector2 Normalize( Vector2 _Vec ){

		Vector2 ret;

		if( _Vec.x > 0 ) ret.x = 1;
		else if( _Vec.x < 0 ) ret.x = -1;
		else ret.x = 0;

		if( _Vec.y > 0 ) ret.y = 1;
		else if( _Vec.y < 0 ) ret.y = -1;
		else ret.y = 0;

		return ret;

	}			//正規化

};

//ワールド情報クラス
class World{

public:

	World(){

		for( int i = 0 ; i < Width ; i++ ){

			for( int j = 0 ; j < Height ; j++ ){

				m_ItemFlag[i][j] = false;

			}

		}

	}		//コンストラクタ

	bool IsInArea( Vector2 _Pos ){

		return ( _Pos.x >= 0 && _Pos.x < Width && _Pos.y >= 0 && _Pos.y < Height );

	}			//範囲内か？
	
	bool IsInArea( int _x , int _y ){

		return ( _x >= 0 && _x < Width && _y >= 0 && _y < Height );

	}			//範囲内か？

	void SetItem( Vector2 _Pos ){

		if( IsInArea( _Pos ) ) m_ItemFlag[_Pos.x][_Pos.y] = true;

	}			//アイテムをセット
	
	void SetItem( DWORD _x , DWORD _y ){

		if( IsInArea( _x , _y ) ) m_ItemFlag[_x][_y] = true;

	}			//アイテムをセット

	bool GetItem( Vector2 _Pos ){

		if( IsInArea( _Pos ) && m_ItemFlag[_Pos.x][_Pos.y] ){

			m_ItemFlag[_Pos.x][_Pos.y] = false;
			return true;

		}

		return false;

	}		//指定した座標にあるアイテムを取得
	bool GetItem( DWORD _x , DWORD _y ){

		if( IsInArea( _x , _y ) && m_ItemFlag[_x][_y] ){

			m_ItemFlag[_x][_y] = false;
			return true;

		}

		return false;

	}		//指定した座標にあるアイテムを取得

	DWORD GetItemsPosToPos( Vector2 _Start , Vector2 _MoveVec ){

		DWORD ret = 0;

		Vector2 LoopEnd( 0 , 0 );

		while( _MoveVec != LoopEnd ){

			Vector2 Move = Vector2::Normalize( _MoveVec );

			if( GetItem( _Start + Move ) ) ret++;

			if( _MoveVec.x > 0 ) _MoveVec.x--;
			else if( _MoveVec.x < 0 ) _MoveVec.x++;
			if( _MoveVec.y > 0 ) _MoveVec.y--;
			else if( _MoveVec.y < 0 ) _MoveVec.y++;
			_Start += Move;

		}

		return ret;

	}		//_Startから_MoveVec移動した場合に取得できる

	enum {

		Width = 21 ,	//幅
		Height = 21		//高さ

	};

	DWORD GetItemNum(){

		DWORD ret = 0;

		for( int i = 0 ; i < Width ; i++ ){

			for( int j = 0 ; j < Height ; j++ ){

				if( m_ItemFlag[i][j] ) ret++;

			}

		}

		return ret;

	}			//ワールド上に落ちている残りアイテム数を取得

private:

	bool m_ItemFlag[Width][Height];		//アイテムフラグ

};

int main(){

	std::map< char , Vector2 > MoveMap;		//移動方向
	std::vector< bool > ClearFlag;			//クリアフラグ
	MoveMap['N'] = Vector2( 0 , 1 );
	MoveMap['E'] = Vector2( 1 , 0 );
	MoveMap['S'] = Vector2( 0 , -1 );
	MoveMap['W'] = Vector2( -1 , 0 );

	while( true ){

		DWORD n;
		World w;
		scanf( "%d" , &n );

		if( n == 0 ) break;

		for( DWORD i = 0 ; i < n ; i++ ){

			Vector2 ItemPos;
			scanf( "%d %d" , &ItemPos.x , &ItemPos.y );
			w.SetItem( ItemPos );

		}

		DWORD m;
		scanf( "%d" , &m );

		Vector2 Position( 10 , 10 );

		for( DWORD i = 0 ; i < m ; i++ ){

			char c , Dummy;
			int v;
			scanf( "%c%c %d" , &Dummy , &c , &v );

			Vector2 MoveVec = MoveMap[c] * v;
			
			w.GetItemsPosToPos( Position , MoveVec );
			Position += MoveVec;

		}

		ClearFlag.push_back( w.GetItemNum() == 0 );

	}

	for( DWORD i = 0 ; i < ClearFlag.size() ; i++ ){

		if( ClearFlag[i] ) printf( "Yes\n" );
		else printf( "No\n" );

	}

	return 0;

}

C++: #include <iostream>
using namespace std;
#define FOR(i,a) for(int i=0;i<a;i++)
int a[20][20];
int main() {
	while(1){
		int n;
		cin>>n;
		if(n==0){break;}
		FOR(i,20){FOR(j,20){a[i][j]=0;}}
		FOR(i,n){int d,f;cin>>d>>f;a[d-1][f-1]++;}
		int m;
		cin>>m;
		int x=9;int y=9;
		a[9][9]=0;
		FOR(i,m){
			char p;int move;
			cin>>p>>move;
			int h;
			int dy[4]={1,0,-1,0};
			int dx[4]={0,1,0,-1};
			if(p=='N'){h=1;}
			else if(p=='E'){h=2;}
			else if(p=='S'){h=3;}
			else{h=4;}
			FOR(j,move){
				x+=dx[i];y+=dy[i];
				a[x][y]=0;
				cout<<x<<" "<<y<<endl;
			}
		}
		int ans=0;
		FOR(i,20){FOR(j,20){if(a[i][j]!=0){ans++;}}}
		if(ans==0){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
	}
	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[k].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[k].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[k].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[k].y = INF;
						}
					}
				}
			}
		}
		if(count == N)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
}

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