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++: #ifndef _WIN32
#include<iostream>
#endif

using namespace std;
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<iomanip>
#include<stack>
#include<set>
#include<functional>
#include<map>

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int dr[] = { 0, 1, 0, -1 };
const int dc[] = { 1, 0, -1, 0 };
#define NN 1
#define EE 0
#define WW 2
#define SS 3
typedef pair<int, int> P;
int main(){
	int N,M;
	while (cin >> N, N){
		set<P> gem;
		string s; int cnt;
		int r = 10, c = 10;
		REP(i, N){
			int a, b;
			cin >> a >> b;
			gem.insert({ b, a });
		}
		cin >> M;
		REP(i, M){
			cin >> s >> cnt;
			int d;
			if (s == "N")d = NN;
			if (s == "W")d = WW;
			if (s == "E")d = EE;
			if (s == "S")d = SS;
			REP(_, cnt){
				r = r + dr[d];
				c = c + dc[d];
				if (gem.count({ r, c }))gem.erase({ r, c });
			}

		}
		if (gem.size())cout << "No" << endl;
		else cout << "yes" << endl;
	}

	return 0;
}

C++: #include <iostream>
#include  <stdio.h>
#include  <algorithm>
#include  <math.h>
#include  <vector>
#include  <string>
#include  <sstream>
#include  <numeric>
#include  <set>
#include <map>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long

using namespace std;

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

	int num = 0;
	while (cin >> num && num != 0)
	{

		int ans = 0;
		vector<vector<int>> dat(22, vector<int>(22, 0));
		rep(i, num)
		{
			int tmp = 0, tmp2 = 0;
			cin >> tmp >> tmp2;
			dat[tmp][tmp2] = 1;
			if (tmp == 10 && tmp2 == 10) { ans += 1; }
		}
		int tmp = 0; cin >> tmp;
		string m; int cmd = 0;
		int now_x = 10, now_y = 10;
		rep(i, tmp)
		{
			cin >> m >> cmd;
			rep(i, cmd)
			{
				switch (m[0])
				{
				case 'N': now_y += 1; break;
				case 'E': now_x += 1; break;
				case 'S': now_y -= 1; break;
				case 'W': now_x -= 1; break;
				}
				ans += dat[now_x][now_y];
				dat[now_x][now_y] = 0;
				printf("%d %d\n", now_x, now_y);
			}
		}
		if (ans == num) { printf("Yes\n"); }
		else { printf("No\n"); }
	}
	return 0;
}

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

using namespace std;

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

void solve(int n) {
    int place[21][21];
    memset(place, 0, sizeof(place));
    rep(i,n) {
        int x,y; cin>>x>>y;
        place[y][x] = 1;
    }

    int m; cin >> m;
    int x=10, y=10;
    place[y][x] = 0;
    rep(i,m) {
        char d;
        int l;
        cin >> d >> l;
        rep(j,l) {
            if(d == 'N') y++; 
            if(d == 'S') y--;
            if(d == 'E') x++;
            if(d == 'W') x--;
            place[y][x] = 0;
        }
    }

    bool f = true;
    rep(i,21) rep(j,21) if(place[i][j] == 1) f = false;
    cout << (f ? "Yes" : "No") << "\n";
    return ;
}

int main() {
    for(int n;cin>>n && n;) solve(n);
    return 0;
}

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

  while(1){
    cin >> n;
    if(n==0){
       break;
    }else{
      x = 10;
      y = 10;
      x0 = 10;
      y0 = 10;
    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;
    }
  } 
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int N;
	while ( cin >> N, N ) {
		int m[21][21] = {0};
		for (int i = 0; i < N; ++i) {
			int x, y; cin >> x >> y;
			++m[y][x];
		}
		int px = 10, py = 10;
		int M; cin >> M;
		int ans = m[py][px];
		for (int i = 0; i < M; ++i) {
			char d; int l; cin >> d >> l;
			int dx = d == 'E' ? 1 : d == 'W' ? -1 : 0;
			int dy = d == 'N' ? 1 : d == 'S' ? -1 : 0;
			for (int j = 0; j < l; ++j) {
				px += dx, py += dy;
				ans += m[py][px];
				m[py][px] = 0;
			}
		}
		if (ans == N) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

C++: #include<stdio.h>
int main(void)
{
  int n,i,m,j,k,robo,robox,roboy,sum,l; 
  char news;
  for(;;)
    {
      robox=10;
      roboy=10;
      scanf("%d",&n);
      if(n==0){break;}
      int x[n],y[n],xy[n];
      for(i=0;i<n;i++){xy[i]=0;}
      sum=0;
      for(i=0;i<n;i++){scanf("%d %d",&x[i],&y[i]);}
      scanf("%d",&m);
      for(i=0;i<m;i++)
	{
	  scanf(" %c %d",&news,&robo);
	  for(k=0;k<robo;k++)
	    {
	    if(news=='N'){roboy=roboy+1;}
	    if(news=='W'){robox=robox-1;}
	    if(news=='S'){roboy=roboy-1;}
	    if(news=='E'){robox=robox+1;}
	    for(j=0;j<n;j++){if(x[j]==robox && y[j]==roboy){xy[j]=1;}}
	    }
	}
      for(j=0;j<n;j++){sum=sum+xy[j];}
      if(sum==n){printf("Yes\n");}
      else{printf("No\n");}	
    }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main(){
	while(true){
		int n,m;
		scanf("%d",&n);
		if(n==0) break;
		bool v[21][21]={},j[21][21]={};
		rep(i,n){
			int x,y;
			scanf("%d%d",&x,&y);
			j[x][y]=1;
		}
		scanf("%d",&m);
		v[10][10]=1;
		int nx=10,ny=10;
		rep(i,m){
			char c;
			int d,h;
			cin >> c >> d;
			if(c=='E') h=0;
			if(c=='N') h=1;
			if(c=='W') h=2;
			if(c=='S') h=3;
			rep(k,d) nx+=dx[h],ny+=dy[h],v[nx][ny]=1;
		}
		bool ok=true;
		rep(i,21) rep(k,21) if(j[i][k] && !v[i][k]) ok=false;
		cout << (ok ? "Yes\n" : "No\n");
	}
}