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 <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

bool ma[128][128]={0};
int n, m, d;
char c;

int main(){


while(cin >> n, n){
	
	queue<char> com;
	int x=10, y=10;
	
	memset(ma, 0, sizeof(ma));
	
	int a, b;
	
	for(int i=0; i<n; ++i){
		cin >> a >> b;
		ma[b][a] = true;
	}
	
	cin >> m;
	
	for(int i=0; i<m; ++i){
		
		cin >> c >> d;
		
		for(int i=0; i<d; ++i){	
			com.push(c);
		}	
	}
	
	if(ma[y][x]){
		n--;
		ma[y][x]=false;
	}
	
	while(!com.empty()){
		
		c = com.front();
		com.pop();
		
		if(c=='N')
			y++;
		else if(c=='E')
			x++;
		else if(c=='W')
			x--;
		else if(c=='S')
			y--;
			
		if(ma[y][x]){
			n--;
			ma[y][x]=false;
		}
	}
	
	cout << (!n?"YES":"NO") << endl;

}

return 0;
}

C++: #include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
	while (1) {
		int N = 0;
		int matrix[20][20] = {};
		
		cin >> N;
		if (N == 0) break;

		for (int i = 0; i < N; i++) {
			int x, y;
			cin >> x >> y;
			matrix[x][y] = 1;
		}

		int M;
		char dir[30];
		int val[30];

		cin >> M;

		for(int i = 0; i < M; i++) {
			cin >> dir[i] >> val[i];
		}

		int x = 10, y = 10;
		int deltax;
		int deltay;
		int result = 0;
		for (int i = 0; i < M; i++) {
			if (dir[i] == 'N') {
				deltax = 0;
				deltay = 1;
			}
			else if (dir[i] == 'S') {
				deltax = 0;
				deltay = -1;
			}
			else if (dir[i] == 'W') {
				deltax = -1;
				deltay = 0;
			}
			else if (dir[i] == 'E') {
				deltax = 1;
				deltay = 0;
			}
			for (int j = 0; j < val[i]; j++) {
				x += deltax;
				y += deltay;
				result += matrix[x][y];
			}
		}

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

	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iterator>
#include <cstring>

using namespace std;
const int INF = (1<<30);
typedef pair<int, int> P;
typedef long long ll;
#define PB push_back
#define rep(i, a) for (int i = 0; i < a; i++)

int sx, sy;

int gx, gy;

int qqq;

//各座標までの最短距離
int d[100][100];


//移動方向のベクトル
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

//汎用
ll ans = 0;
pair<int, int> red[101], blue[101];
ll BIG = 10000000000;

//累乗
ll POW(ll a, ll b) {
ll c = 1;
for (int i = 0; i < b; ++i) {
c *= a;
}
return c;
}

//階乗
int Kaijou(int a) {
if (a < 2) return 1;
return a * Kaijou(a - 1);
}


int A[200000];
int kinds[200001];


int main() 
{
	int n,m;
	
	while(1){
		cin >> n;
		if (n == 0) break;
		pair<int, int> XY[30] = { make_pair<int,int>(0,0) };
		int get[30] = { 0 };
		rep(i, n) {
			get[i] = 1;
			cin >> XY[i].first >> XY[i].second;
		}

		cin >> m;
		pair<int, int> robo = make_pair<int, int>(10, 10);
		rep(i, m) {
			char dir; int dis;
			cin >> dir >> dis;
			
				if (dir == 'N') {
					rep(i, n) {
						if (XY[i].first == robo.first&&XY[i].second >= robo.second&&XY[i].second <= robo.second + dis)
							get[i] = 0;
					}
						robo.second += dis;
				}
				else if (dir == 'S') {
					rep(i, n) {
						if (XY[i].first == robo.first&&XY[i].second <= robo.second&&XY[i].second >= robo.second - dis)
							get[i] = 0;
					}
						robo.second -= dis;
					
				}
				else if (dir == 'E') {
					rep(i, n) {
						if (XY[i].second == robo.second&&XY[i].first >= robo.first&&XY[i].first <= robo.first + dis)
							get[i] = 0;
					}
						robo.first += dis;
					
				}
				else {
					rep(i, n) {
						if (XY[i].second == robo.second&&XY[i].first <= robo.first&&XY[i].first >= robo.first - dis)
							get[i] = 0;
					}
						robo.first -= dis;
					
				}
			
		}

		int judge = 1;
		rep(i, n) if (get[i]) { judge = 0;}

		if (judge) cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	cin >> qqq;
}

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

int main(void){
    
    while(1) {
        int n;
        cin >> n;
        if (n==0) break;
        int stone[21][21];
        for(int y=0; y<21; y++){
            for(int x=0; x<21; x++){
                stone[y][x] = 0;
            }
        }
        for(int i=0; i<n; i++){
            int x, y;
            cin >> x >> y;
            stone[y][x] = 1;
        }
        int m;
        int x=10, y=10;
        cin >> m;
        for(int i=0; i<m; i++){
            char d;
            int l;
            cin >> d;
            cin >> l;
            for(int j=0; j<l; j++) {
                if(d=='N'){ y++; }
                if(d=='E'){ x++; }
                if(d=='S'){ y--; }
                if(d=='W'){ x--; }
                if(stone[y][x] == 1) {
                    stone[y][x] = 0;
                    n--;
                }
           }
        }
        cout << (n==0 ? "YES" : "NO") << endl;
        
    }
    
}

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

int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};

int main(){
	int n, m, xi, yi, a;
	char c, f[256];
	f['N'] = 0;
	f['S'] = 1;
	f['E'] = 2;
	f['W'] = 3;
	
	while( cin >> n , n ){
		char field[21][21] = {0};
		int x = 10;
		int y = 10;
		
		for(int i=0 ; i < n ; i++ ){
			cin >> xi >> yi;
			field[yi][xi] = 1;
		}
		cin >> m;
		for(int i=0 ; i < m ; i++ ){
			cin >> c >> a;
			for( ; a-- ; ){
				x += dx[ f[c] ];
				y += dy[ f[c] ];
				if( field[y][x] == 1 ){
					n--;
					field[y][x] = 0;
				}
			}
		}
		cout << ( ( n == 0 )? "Yes" : "No" ) << endl;
	}
}