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>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
using namespace std;

#define Getsign(n) ((n > 0) - (n < 0))

typedef vector<int> Ivec;
typedef pair<int, int> Pos;
const map<string, Pos> Dir = { //??????
	{ "N",{ 0,1 } },
	{ "S",{ 0,-1 } },
	{ "E",{ 1,0 } },
	{ "W",{ -1,0 } }
};
int main() {
	int n, m;
	
	while (scanf("%d", &n)) {
		if (!n)
			return 0;
		vector<Pos> jpos;
		for (int i = 0; n > i; i++) {
			int a, b;
			scanf("%d %d", &a, &b);
			jpos.push_back({ a,b });
		}

		Pos mpos = {10,10};
		scanf("%d", &m);
		for (int i = 0; m > i; i++) {
			char a[2];
			int b;
			scanf("%s %d", &a, &b);
			int &ch = (a[0] == 'E' || a[0] == 'W' ? mpos.first : mpos.second),
				gen = ch+(a[0] == 'E' || a[0] == 'W' ? Dir.at(a).first*b : Dir.at(a).second*b);
			int sign = Getsign(gen-ch);
			for (ch+=sign; sign*ch <= sign*gen; ch+=sign) {
				auto itr = find(jpos.begin(), jpos.end(), mpos);
				if (itr != jpos.end()) {
					jpos.erase(itr);
				}
			}
			ch-=sign;
		}
		if (jpos.size()) {
			printf("No\n");
		}
		else {
			printf("Yes\n");
		}
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
  int n, m, a[21], b[21], d[31];
  int x=10, y=10, x0=10, y0=10, t=0;
  char c[31];

  while(1){
    cin >> n;
    if(n==0){
       break;
    }else{
    for(int i=0; i<n; i++){
      cin >> a[i] >> b[i];
    }

    cin >> m;
    for(int i=0; i<m; i++){
      cin >> c[i] >> d[i];
      switch(c[i]){
        case 'N':
          y += d[i];
          break;
        case 'S':
          y -= d[i];
          break;
        case 'E':
          x += d[i];
          break;
        case 'W':
          x -= d[i];
          break;
      }

      for(int j=0; j<n; j++){
        if(((x0<=a[j] && a[j]<=x) || (x<=a[j] && a[j]<=x0)) && ((y0<=b[j] && b[j]<=y) ||
        (y<=b[j] && b[j]<=y0))){
          t++;
        }
      }
      x0 = x;
      y0 = y;
    }
    if(t>=n){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
      x = 10;
      y = 10;
      x0 = 10;
      y0 = 10;
      t = 0;
  } 
  }

  return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i = 0;i < n;++i)

int main(){
  int n,o;
  while(cin >> n,n){
    int v[22][22] = {};
    int x,y;
    rep(i,n){
      cin >> x >> y;
      v[x][y] = 1;
    }
    int ans = 0;
    cin >> o;
    x = 10, y = 10;
    int d;
    string s;
    rep(i,o){
      cin >> s >> d;
      if(s == "W"){
        for(int j = x + d-1; j > x;--j){
          ans += v[j][y];
          v[j][y] = 0;
        }
        x -= d;
      }
      if(s == "E"){
        for(int j = x ; j <= x+d;++j){
          ans += v[j][y];
          v[j][y] = 0;
        }
        x += d;
      }
      if(s == "S"){
        for(int j = y + d-1; j > y;--j){
          ans += v[x][j];
          v[x][j] = 0;
        }
        y -= d;
      }
      if(s == "N"){
        for(int j = y ; j <= y+d;++j){
          ans += v[x][j];
          v[x][j] = 0;
        }
        y += d;
      }
    /* cout << x << ' ' << y << endl; */
    }
    if(ans == n){
      cout << "Yes" << endl;
    }
    else
      cout << "No" << endl;
  }
  return 0;
}

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

int main()
{
	int N;
	int M;
	int x[20];
	int y[20];
	char d;
	int l;

	while (cin >> N && N != 0)
	{
		int initX = 10;
		int initY = 10;
		int cnt = 0;

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

		cin >> M;

		for (int i = 0; i < M; i++)
		{
			cin >> d;
			cin >> l;
			int dx = 0;
			int dy = 0;

			for (int k = 0; k <= l; k++)
			{
				if (d == 'S' || d == 'W')
				{
					if (d == 'S')
					{
						for (int j = 0; j < N; j++)
						{
							if (x[j] == initX && y[j] == initY - k)
							{
								cnt++;
							}
						}
					}
					else
					{
						for (int j = 0; j < N; j++)
						{
							if (x[j] == initX - k && y[j] == initY)
							{
								cnt++;
							}
						}
					}
				}
				else
				{
					if (d == 'N')
					{
						for (int j = 0; j < N; j++)
						{
							if (x[j] == initX && y[j] == initY + k)
							{
								cnt++;
							}
						}
					}
					else
					{
						for (int j = 0; j < N; j++)
						{
							if (x[j] == initX + k && y[j] == initY)
							{
								cnt++;
							}
						}
					}
				}
			}
			if (d == 'S' || d == 'W')l = -l;
			if (d == 'S' || d == 'N')dy = l;
			if (d == 'W' || d == 'E')dx = l;

			initX += dx;
			initY += dy;
		}
		if (cnt == N)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}

	}
	return 0;
}