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>
 
int N, M;
int t[21][21];
 
int main() {
  while (true) {
    scanf("%d", &N);
    if (N == 0) break;
    for (int i=0;i<=20;i++) {
      for (int j=0;j<=20;j++) t[i][j] = 0;
    }
    for (int i=0;i<N;i++) {
      int x, y;
      scanf("%d %d", &x, &y);
      t[x][y]++;
    }
    scanf("%d", &M);
    int rx = 10, ry = 10;
    for (int i=0;i<M;i++) {
      char d;
      int  l;
      scanf(" %c %d", &d, &l);
      for (int j=0;j<l;j++) {
        switch (d) {
        case 'N': ry++; break;
        case 'E': rx++; break;
        case 'S': ry--; break;
        case 'W': rx--; break;
        }
        N -= t[rx][ry];
        t[rx][ry] = 0;
      }
    }
    if (N == 0) puts("Yes");
    else puts("No");
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <stack>
#include <queue>

#define MAX 32

using namespace std;

int main(void) {
	while(1) {
		int n, m;
		int x[MAX], y[MAX];
		int m_x = 10, m_y = 10;
		char d;
		int l;
		bool moved[MAX][MAX] = {false};
		moved[10][10] = true;
		bool collect = true;

		scanf("%d", &n);
		if(n == 0) break;
		for(int i = 0; i < n; i++) {
			scanf("%d %d", &x[i], &y[i]);
		}
		scanf("%d", &m);
		for(int i = 0; i < m; i++) {
			cin >> d >> l;
			if(d == 'N') {
				for(int j = 0; j <= l; j++) {
					moved[m_x][m_y + j] = true;
				}
				m_y += l;
			}
			if(d == 'E') {
				for(int j = 0; j <= l; j++) {
					moved[m_x + j][m_y] = true;
				}
				m_x += l;
			}
			if(d == 'S') {
				for(int j = 0; j <= l; j++) {
					moved[m_x][m_y - j] = true;
				}
				m_y -= l;
			}
			if(d == 'W') {
				for(int j = 0; j <= l; j++) {
					moved[m_x - j][m_y] = true;
				}
				m_x -= l;
			}
		}

		for(int i = 0; i < n; i++) {
			if(!moved[x[i]][y[i]]) collect = false;
		}

		printf("%s\n", collect ? "Yes" : "No");
	}
	return 0;
}

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

int map[21][21] = {} ;
int dx[] = { 0,1,0,-1 } ;
int dy[] = { 1,0,-1,0 } ;

int main(){
	
	int n , x , y ;
	char d ;
	int m , k , dir;
	int nx , ny , count ;
	
	while(1){
		cin >> n ;
		if( n==0 ) break;
		
		for( int i=0 ; i<n ; i++ ){
			cin >> x >> y ;
			map[x][y] = 1 ;
		}
		
		cin >> m ;
		nx = 10 ;
		ny = 10 ;
		count = 0 ;
		
		for( int i=0 ; i<m ; i++ ){
			cin >> d >> k ;
			if( d == 'N' ) dir = 0 ;
			else if( d == 'E' ) dir = 1 ;
			else if( d == 'S' ) dir = 2 ;
			else if( d == 'W' ) dir = 3 ;
			
			for( int j=0 ; j<k ; j++ ){
				nx += dx[dir] ;
				ny += dy[dir] ;
				if( map[nx][ny] == 1 ){
					count++;
					map[nx][ny] = 0 ;
				}
			}
		}
		
		if( count == n ) cout << "Yes" << endl ;
		else {
			cout << "No" << endl ;
			
			for( int i=0 ; i<21 ; i++ )
				for( int j=0 ; j<21 ; j++ )
					map[i][j] = 0;
		}
	}
	
return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;


int main(){
	while(1){
		int n,m,x[22],y[22],dist[33];
		char dir[33];
		bool f[22]={};
		bool ok=false;
		cin>>n;
		if(n==0)break;
		rep(i,0,n)cin>>x[i]>>y[i];
		cin>>m;
		rep(i,0,m)cin>>dir[i]>>dist[i];
		int nx=10,ny=10,px,py;
		rep(i,0,m){
			px=nx,py=ny;
			if(dir[i]=='N'){
				ny+=dist[i];
				rep(j,0,n)if(nx==x[j]&&py<=y[j]&&ny>=y[j])f[j]=true;
			}
			if(dir[i]=='S'){
				ny-=dist[i];
				rep(j,0,n)if(nx==x[j]&&ny<=y[j]&&py>=y[j])f[j]=true;
			}
			if(dir[i]=='E'){
				nx+=dist[i];
				rep(j,0,n)if(ny==y[j]&&px<=x[j]&&nx>=x[j])f[j]=true;
			}
			if(dir[i]=='W'){
				nx-=dist[i];
				rep(j,0,n)if(ny==y[j]&&nx<=x[j]&&px>=x[j])f[j]=true;
			}
		}
		rep(j,0,n){
			if(!f[j])break;
			if(j==n-1)ok=true;
		}
		if(ok?print("Yes"):print("No"));
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
    int n;
    while(cin>>n&&n){
        vector<vector<int>> fie(30,vector<int>(30,0));
        rep(i,n){
            int x,y;
            cin>>x>>y;
            fie[y][x]++;
        }
        
        
        int tx=10,ty=10;
        int m;
        cin>>m;
        rep(i,m){
            char dir;
            int dist;
            cin>>dir>>dist;
            int dy[]={1,0,-1,0};
            int dx[]={0,1,0,-1};
            map<char,int> mp;
            mp['N']=0;
            mp['E']=1;
            mp['S']=2;
            mp['W']=3;
            
            int d = mp[dir];
            for(int k=1;k<=dist;k++){
                tx+=dx[d];
                ty+=dy[d];
                n-=fie[ty][tx];
                fie[ty][tx]=0;
            }
        }
        if(n==0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

C++: #include<iostream>
#define MAX 20
#define GEM 1
using namespace std;
int main(){
	while(true){
		int map[MAX+1][MAX+1]={{0,},};
		int ri=10,rj=10;
		int n,m;
		int cnt = 0;

		cin>>n;
		if(n==0)break;
		for(int i = 0; i < n; ++i){
			int ji,jj;
			cin>>ji>>jj;
			map[MAX-jj][ji]=GEM;
		}
		cin>>m;
		for(int i = 0; i < m; ++i){
			char dir;
			int len;
			cin>>dir>>len;
			switch(dir){
				case 'N':
					for(int j = 0; j < len; ++j){
						--ri;
						if( map[ri][rj] == GEM ){
							map[ri][rj] = 0;
							++cnt;
						}
					}
					break;
				case 'E':
					for(int j = 0; j < len; ++j){
						++rj;
						if( map[ri][rj] == GEM ){
							map[ri][rj] = 0;
							++cnt;
						}
					}
					break;
				case 'W':
					for(int j = 0; j < len; ++j){
						--rj;
						if( map[ri][rj] == GEM ){
							map[ri][rj] = 0;
							++cnt;
						}
					}
					break;
				case 'S':
					for(int j = 0; j < len; ++j){
						++ri;
						if( map[ri][rj] == GEM ){
							map[ri][rj] = 0;
							++cnt;
						}
					}
					break;
			}
		}
		if( cnt == n )
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}