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 FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b)-1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n)-1; i >= 0; i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define loop while(true)

#define PB push_back
#define pb push_back
#define MP make_pair
#define mp make_pair
#define ALL(a) (a).begin(),(a).end()
#define all(a) (a).begin(),(a).end()

#define PII pair<int, int>
#define pii pair<int, int>
#define VB vector<bool>
#define VVB vector<vector<bool> >
#define VI vector<int>
#define VVI vector<vector<int> >

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

signed main()
{
    loop{
        int n;
        cin >> n;
        if(n == 0) break;

        VVB gem(21);
        rep(i, 21){
            gem[i].resize(21);
        }
        
        rep(i, n){
            int x, y;
            cin >> x >> y;
            gem[y][x] = true;
        }

        int pos_x = 10;
        int pos_y = 10;

        int m;
        cin >> m;
        int gem_num = 0;
        rep(i, m){
            char dir;
            int leng;
            cin >> dir >> leng;
            switch(dir){
            case 'N':
                rep(dy, leng){
                    if(gem[++pos_y][pos_x]){
                        gem_num++;
                        gem[pos_y][pos_x] = false;
                    }
                }
                break;
            case 'E':
                rep(dx, leng){
                    if(gem[pos_y][++pos_x]){
                        gem_num++;
                        gem[pos_y][pos_x] = false;
                    }
                }
                break;
            case 'S':
                rep(dy, leng){
                    if(gem[--pos_y][pos_x]){
                        gem_num++;
                        gem[pos_y][pos_x] = false;
                    }
                }
                break;
            case 'W':
                rep(dx, leng){
                    if(gem[pos_y][--pos_x]){
                        gem_num++;
                        gem[pos_y][pos_x] = false;
                    }
                }
                break;
            }

        }

        if(gem_num == n){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n != 0) {
		int a[21][21] = {};
		for (int i = 0; i < n; i++) {
			int x, y;
			cin >> x >> y;
			a[y][x] = 1;
		}
		int x = 10, y = 10;
		int count = 0;
		int m;
		cin>>m;
		for(int i=0;i<m;i++){
			int num;
			char c;
			cin >> c >> num;
			while(num--) {
				if (c == 'N')y++;
				else if (c == 'E')x++;
				else if (c == 'S')y--;
				else x--;
				if (a[y][x]) {
					count++;
					a[y][x] = 0;
				}
			}

		}
		if (count == n)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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[21][21]={};

    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){
      
      cin >> d >> l;
      
      for(j=1;j<=l;++j){
	
	if(d=='N'){
	  ry++;
	}else if(d=='E'){
	  rx++;
	}else if(d=='S'){
	  ry--;
	}else{
	  rx--;
	}
	if(flag[rx][ry]==1){
	  check++;
	  flag[rx][ry]=0;
	}
      }
    }
 
    
    if(check==N){
      cout << "Yes\n";
    }else{
      cout << "No\n";
    }
  }


  return 0;
}

C++: #include <iostream>

using namespace std;

struct po{
	int x;
	int y;
	bool vis;
};

int main()
{
	int n, m, s, t, u;
	po jw[21];
	char c;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		s = t = 10;
		for(int i = 0; i < n; i++){
			cin >> jw[i].x >> jw[i].y;
			jw[i].vis = false;
		}
		cin >> m;
		for(int i = 0; i < m; i++){
			cin >> c >> u;
			
			if(c == 'N'){
				u += t;
				if(u > 20){
					u = 20;
				}
				for(int i = 0; i < n; i++){
					if(jw[i].x == s && t <= jw[i].y && jw[i].y <= u){
						jw[i].vis = true;
					}
				}
				t = u;
			} else if(c == 'E'){
				u += s;
				if(u > 20){
					u = 20;
				}
				for(int i = 0; i < n; i++){
					if(jw[i].y == t && s <= jw[i].x && jw[i].x <= u){
						jw[i].vis = true;
					}
				}
				s = u;
			} else if(c == 'S'){
				u = t-u;
				if(u < 0){
					u = 0;
				}
				for(int i = 0; i < n; i++){
					if(jw[i].x == s && u <= jw[i].y && jw[i].y <= t){
						jw[i].vis = true;
					}
				}
				t = u;
			} else {
				u = s-u;
				if(u < 0){
					u = 0;
				}
				for(int i = 0; i < n; i++){
					if(jw[i].y == t && u <= jw[i].x && jw[i].x <= s){
						jw[i].vis = true;
					}
				}
				s = u;
			}
		}
		bool f = true;
		
		for(int i = 0; i < n; i++){
			f = jw[i].vis;
			if(!f){
				break;
			}
		}
		
		if(f){
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0) 
			break;
		int da[22][22]={};
		int x,y;
		for(int i=0;i<n;i++){
			cin>>x>>y; 
			da[y][x]=1;
		}
		int m;
		cin>>m;
		char v;
		int l;
		int nx=10,ny=10;
		for(int i=0;i<m;i++){
			cin>>v;
			cin>>l;
			if(v=='N'){
				for(int j=1;j<=l;j++)
					da[ny+j][nx]=0;
				ny+=l;
			}
			if(v=='E'){
				for(int j=1;j<=l;j++)
					da[ny][nx+j]=0;
				nx+=l;
			}
			if(v=='S'){
				for(int j=1;j<=l;j++)
					da[ny-j][nx]=0;
				ny-=l;
			}
			if(v=='W'){
				for(int j=1;j<=l;j++)
					da[ny][nx-j]=0;
				nx-=l;
			}
		}
		for(int i=0;i<22;i++){
			for(int j=0;j<22;j++){
				if(da[i][j]==1){
					cout<<"No"<<endl;
					j=30; 
					i=30;
					break;
				}