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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

bool fld[21][21];

signed main()
{
    int N;

    while (cin >> N, N) {
        memset(fld, false, sizeof(fld));
        rep(i, N) {
            int x, y; cin >> x >> y; 

            fld[y][x] = true;
        }

        int cnt = 0;

        pii now = pii(10, 10);

        if (fld[now.fst][now.scd]) {
            fld[now.fst][now.scd] = false;
            cnt++;
        }

        int M;

        cin >> M;

        rep(i, M) {
            char c; cin >> c;
            int v; cin >> v;

            rep(j, v) {
                if (c == 'N') now.fst ++;
                if (c == 'E') now.scd ++;
                if (c == 'S') now.fst ++;
                if (c == 'W') now.scd --;

                if (fld[now.fst][now.scd]) {
                    fld[now.fst][now.scd] = false;
                    cnt++;
                }
            }
        }

        if (cnt == N) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
  int N,M;
  int x,y;
  int i,j;
  int l;
  int check=0;
  char d;
  
  while(1){
    cin >> N;
    if(N==0) break;

    int flag[20][20]={};
    for(i=0;i<N;++i){
      cin >> x >> y;
      flag[x][y]=1;
    }
    check =0;
    int rx=10,ry=10;
    cin >> M;
    for(i=0;i<M;++i){
      scanf("%c%d",&d,&l);

      if(d=='N'){
	for(j=1;j<=l;++j){
	  if(flag[rx][ry+j]==1) check++;
	}
	ry+=l;
      }else if(d=='E'){
	for(j=1;j<=l;++j){
	  if(flag[rx+j][ry]==1) check++;
	}
	rx+=l;
      }else if(d=='S'){
	for(j=1;j<=l;++j){
	  if(flag[rx][ry-j]==1) check++;
	}
	ry-=l;
      }else{
	for(j=1;j<=l;++j){
	  if(flag[rx-j][ry]==1) check++;
	}
	rx-=l;
      }

    }
 
    
    if(check==N){
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }
  }


  return 0;
}

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


int main() {
  while (true) {
    int N;
    
    cin >> N;
    if (N == 0)
      break;

    int gems_pos[21][2];
    for (int i=0; i<N; i++) {
      cin >> gems_pos[i][0];
      cin >> gems_pos[i][1];
    }

    int M;
    cin >> M;
    int count = 0;
    int x = 10;
    int y = 10;
    
    for (int i=0; i<M; i++) {
      char c;
      int diff;

      cin >> c;
      cin >> diff;

      int des_x = x;
      int des_y = y; 
      
      switch (c) {
      case 'N':
	des_y += diff;
	break;
      case 'S':
	des_y -= diff;
	break;
      case 'E':
	des_x += diff;
	break;
      case 'W':
	des_x -= diff;
	break;
      }

      // debug
      // printf("x:%d y:%d\n", des_x, des_y);
      
      for (int i=0; i<N; i++) {
	if (((x <= gems_pos[i][0] && gems_pos[i][0] <= des_x) ||
	    (des_x <= gems_pos[i][0] && gems_pos[i][0] <= x))
	    &&
	    ((y <= gems_pos[i][1] && gems_pos[i][1] <= des_y) ||
	    (des_y <= gems_pos[i][1] && gems_pos[i][1] <= y)))  {
	  count++;
	  // printf("found\n");
	  gems_pos[i][0] = -1;
	}
      }

      x = des_x;
      y = des_y;
    }

    if (count == N) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
  
}

C++: #include<iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int a,zahyou=1010,bx,cy,n,gem[20],q,ans=0;
char pr;
int main(){
	while(cin>>a){
		if(a==0){
		break;}
		for(int i=0;i<a;i++){
		cin>>bx>>cy;
		gem[i]=100*bx+cy;}
	cin>>n;
	for(int j=0;j<n;j++){
	cin>>pr>>q;
	if(pr=='N'){
		for(int l=0;l<q;l++){
		zahyou+=1;
		for(int L=0;L<a;L++){
			if(zahyou==gem[L]){
			ans++;gem[L]=-1;}
		}}
	}else
	if(pr=='S'){
		for(int l=0;l<q;l++){
		zahyou-=1;
		for(int L=0;L<a;L++){
			if(zahyou==gem[L]){
			ans++;gem[L]=-1;}
		}}}else
	if(pr=='W'){
		for(int l=0;l<q;l++){
		zahyou-=100;
		for(int L=0;L<a;L++){
			if(zahyou==gem[L]){
			ans++;gem[L]=-1;}
		}}}else{
		{
		for(int l=0;l<q;l++){
		zahyou+=100;
		for(int L=0;L<a;L++){
			if(zahyou==gem[L]){
			ans++;gem[L]=-1;}
		}}}}}
	if(ans==a){
		cout<<"Yes"<<endl;}else{
		cout<<"No"<<endl;}
	zahyou=1010;ans=0;}

return 0;}