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<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;
					int a = min(mine.second, mine.second + value);
					int b = max(mine.second, mine.second + value);
					if (a <= jem[j].second&&jem[j].second <= b)
					{
						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;
					int a = min(mine.first, mine.first + value);
					int b = max(mine.first, mine.first + value);
					if (a <= jem[j].first&&jem[j].first<= b)
					{
						jem[j].first = -1;
						jem[j].second = -1;
					}
				}
				mine.first += value;
			}
		}
		REP(i, n) 
		{ 
			if (jem[i].first != -1)
			{
				ans = false;
				break;
			}
		}
		if (ans)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

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

int main(){
	int N;
	int x[21],y[21];
	int M;
	char d[30];
	int l[30];

	while (1)
	{
		int now_x = 10;
		int now_y = 10;

		int grid[21][21] = { 0 };
		grid[10][10] = 1;

		int discovered_N = 0;

		//InputData
		cin >> N;
		if (!N) break;
		for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
		cin >> M;
		for (int i = 0; i < M; i++) cin >> d[i] >> l[i];

		for (int i = 0; i < M; i++){
			for (int j = 0; j < l[i]; j++){
				if (d[i] == 'N'){
					now_y++;
					grid[now_x][now_y] = true;
				}
				else if (d[i] == 'E'){
					now_x++;
					grid[now_x][now_y] = true;
				}
				else if (d[i] == 'S'){
					now_y--;
					grid[now_x][now_y] = true;
				}
				else if (d[i] == 'W'){
					now_x--;
					grid[now_x][now_y] = true;
				}
			}
		}


		//判定
		for (int i = 0; i < N; i++){
			if (grid[x[i]][y[i]]) discovered_N++;
		}


		//出力
		(discovered_N == N) ? cout << "Yes\n" : cout<<"No\n";

	}

	return 0;
}

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

using namespace std;

int const INT_MAX = 10000000;

bool map[100][100];

int main(){
	
	while(true){
		
		int n, m;
		
		cin >> n;
		
		if(n == 0){
			break;
		}
		
		for(int i = 0; i < 100; i++){
			for(int j = 0; j < 100; j++){
				map[i][j] = false;
			}
		}
		
		for(int i = 0; i < n; i++){
			int num1, num2;
			cin >> num1 >> num2;
			map[num1][num2] = true;
		}
		
		cin >> m;
		
		int pos_x = 10;
		int pos_y = 10;
		
		for(int loop = 0; loop < m; loop++){
			char c;
			int num;
			cin >> c >> num;
			for(int i = 0; i < num; i++){
				if(c == 'N'){
					pos_y++;
				}else if(c == 'S'){
					pos_y--;
				}else if(c == 'E'){
					pos_x++;
				}else{
					pos_x--;
				}
				map[pos_x][pos_y] = false;
			}
		}
		
		bool flag = true;
		
		for(int i = 0; i <= 20; i++){
			for(int j = 0; j <= 20; j++){
				if(map[i][j]){
					flag = false;
				}
			}
		}
		
		if(flag){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
		
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

using P = pair<int, int>;

bool solve();

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(solve())
        ;
}

bool solve() {
    int n;
    cin >> n;
    if(n == 0) {
        return false;
    }
    set<P> se;
    for(int i = 0; i < n; i++) {
        P tmp;
        cin >> tmp.first >> tmp.second;
        se.insert(tmp);
    }
    P now = P(10, 10);
    int m, ans = 0;
    cin >> m;
    for(int _ = 0; _ < m; _++) {
        char d;
        int l;
        cin >> d >> l;
        // cout << d << " " << l << endl;
        P dir;
        if(d == 'N') {
            dir = P(0, 1);
        } else if(d == 'S') {
            dir = P(0, -1);
        } else if(d == 'E') {
            dir = P(1, 0);
        } else {
            dir = P(-1, 0);
        }
        // cout << dir.first << " " << dir.second << endl;
        for(int i = 0; i < l; i++) {
            now.first += dir.first;
            now.second += dir.second;
            // cout << now.first << " " << now.second << endl;
            if(se.count(now)) {
                ans++;
                se.erase(now);
            }
        }
    }
    cout << (n == ans ? "Yes" : "No") << endl;
    return 1;
}