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 <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

vector<string> mat;
pair<int, int> cur;

int move(char direction, int dis) {
    int tmp = 0;
    rep(i, dis) {
        if (direction=='N') cur.second++;
        if (direction=='S') cur.second--;
        if (direction=='E') cur.first++;
        if (direction=='W') cur.first--;
        if (mat[cur.first][cur.second]=='1') {
            tmp++;
            mat[cur.first][cur.second]='0';
        }
    }
    return tmp;
}

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

    while (true) {
        int n; cin >> n;
        if (n==0) break;
        mat.assign(21, string(21, '0'));
        rep(i, n) {
            int x, y;
            cin >> x >> y;
            mat[x][y] = '1';
        }
        int achieved = 0;
        int m; cin >> m;
        cur = make_pair(10, 10);
        rep(i, m) {
            char d; int dis;
            cin >> d >> dis;
            achieved += move(d, dis);
        }

        if (achieved == n) puts("Yes");
        else puts("No");
    }
}

C++: #include<iostream>
#include<complex>
using namespace std;
int main(){

    int n;
    while(cin>>n,n){

        complex<int> gem[30];
        for(int i = 0;i < n;i++){
            cin>>gem[i].real()>>gem[i].imag();
            if(gem[i].real() == 10 && gem[i].imag() == 10)gem[i].real() = gem[i].imag() = -1;
        }

        int m;
        cin>>m;

        const char way[] = "NESW";
        const int dx[] = {0,1,0,-1};
        const int dy[] = {1,0,-1,0};
        complex<int> com[50];
        complex<int> pos;
        pos.real() = pos.imag() = 10;
        for(int i = 0;i < m;i++){
            char c;
            int x;
            cin>>c>>x;
            for(int j = 0;j < 4;j++){
                if(c == way[j]){
                    com[i].real() = dx[j],com[i].imag() = dy[j];
                    while(x--){
                        pos+=com[i];
                        for(int j = 0;j < n;j++){
                            if(pos == gem[j])gem[j].real() = gem[j].imag() = -1;
                        }
                    }
                }
            }


        }

        bool flg = true;
        for(int i = 0;i < n;i++){
           // cout<<gem[i].real()<<", "<<gem[i].imag()<<endl;
            if(gem[i].real() != -1)flg = false;
        }
        if(flg)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;



    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m;
  while (cin >> n, n) {

    bool c[30][30] = {false};
    int y = 10, x = 10;

    for (int i = 0; i < n; ++i) {
      int a, b;
      cin >> a >> b;
      c[b][a] = true;
    }

    cin >> m;
    for (int i = 0; i < m; ++i) {
      char a;
      int b, dx = 0, dy = 0;
      cin >> a >> b;
      if (a == 'S') dy = -1;
      if (a == 'N') dy = 1;
      if (a == 'W') dx = -1;
      if (a == 'E') dx = 1;
      for (int j = 0; j < b; ++j) {
        x += dx;
        y += dy;
        c[y][x] = false;
      }
    }

    bool f = true;
    for (int i = 0; i < 30; ++i) {
      for (int j = 0; j < 30; ++j) {
        if (c[i][j]) f = false;
      }
    }

    cout << (f ? "Yes" : "No") << endl;
  }
}

C++: #include <stdio.h>
int main()
{
  char sute,h;
  int scood[21][2],i,j,m,rx,ry,t,cou,k,s;
  while(1){
    scanf("%d",&s);
    if(s==0)break;
    for(i=0;i<s;i++){
      scanf("%d %d",&scood[i][0],&scood[i][1]);
    }
    scanf("%d%c",&m,&sute);
    rx=10;
    ry=10;
    cou=0;
    //    printf("%d",m);
    for(i=0;i<m;i++){
      scanf("%c %d%c",&h,&k,&sute);

      //printf("%c %d\n",h,k);
      for(j=0;j<k;j++){
	if(h=='N')ry++;
	if(h=='E')rx++;
	if(h=='S')ry--;
	if(h=='W')rx--;


	//printf("%d %d \n",rx,ry);///
	for(t=0;t<s;t++){
	  if(scood[t][0]==rx&&scood[t][1]==ry)cou++;
	}
      }
    }
    //printf("%d",cou);///
    if(cou==s)printf("Yes\n");
    else if(cou!=s)printf("No\n");
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<bitset>
#include<map>
using namespace std;

struct P{
  int x,y;
};

vector<P> list;
int input(){
  int N;
  cin>>N;
  if(N==0)return false;
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    list.push_back(P{a,b});
  }
  return true;
}

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

bool solve(){
  int M;
  cin>>M;
  P r=P{10,10};
  vector<int> use;
  use.resize(list.size());
  for(int i=0;i<use.size();i++){
    use[i]=0;
  }
  for(int i=0;i<M;i++){
    char c;
    int d;
    cin>>c>>d;
    int v;
    switch(c){
      case 'N':
        v=0;
        break;
      case 'E':
        v=1;
        break;
      case 'S':
        v=2;
        break;
      case 'W':
        v=3;
        break;
    }
    int xx = r.x + vx[v]*d;
    int yy = r.y + vy[v]*d;
    for(int j=0;j<list.size();j++){
      if((yy==r.y&&((r.x<=list[j].x&&list[j].x<=xx&&list[j].y==yy)||(xx<=list[j].x&&list[j].x<=r.x&&list[j].y==yy)))
          ||(xx==r.x&&((r.y<=list[j].y&&list[j].y<=yy&& list[j].x==xx)||(yy<=list[j].y&&list[j].y<=r.y&&list[j].x==xx)))){
        use[j]=true;
      }
    }
    r.x = xx;
    r.y = yy;
  }
  for(int i=0;i<use.size();i++){
    if(!use[i])return false;
  }
  return true;
}


int main(){
  while(input()){
    if(solve()){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}