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 <iostream>
using namespace std;

#define HANTEI if(stone[y][x] == 1) { stone[y][x] = 0; n--; }

int main(void){
    
    while(1) {
        int n;
        cin >> n;
        if (n==0) break;
        int stone[21][21];
        for(int y=0; y<21; y++){
            for(int x=0; x<21; x++){
                stone[y][x] = 0;
            }
        }
        for(int i=0; i<n; i++){
            int x, y;
            cin >> x >> y;
            stone[y][x] = 1;
        }
        int m;
        int x=10, y=10;
        cin >> m;
        for(int i=0; i<m; i++){
           char d;
           int l;
           cin >> d;
           cin >> l;
           if(d=='N'){
               for(int j=0; j<l; j++) { y++; HANTEI }
           }
           if(d=='E'){
               for(int j=0; j<l; j++) { x++; HANTEI }
           }
           if(d=='S'){
               for(int j=0; j<l; j++) { y--; HANTEI }
           }
           if(d=='W'){
               for(int j=0; j<l; j++) { x--; HANTEI }
           }
        }
        printf("%s\n", (n==0 ? "YES" : "NO"));
    }
    
}

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

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

int N, M;
int a[21][21];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	while(cin>>N,N) {
		rep(i, 21) {rep(j, 21)a[i][j]=false;}
		
		int x, y;
		rep(i, N) {
			cin>>x>>y;
			a[x][y] = true;
		}
		
		cin>>M;
		x=10;
		y=10;
		rep(i, M) {
			char d;
			int l;
			cin>>d>>l;
			rep(j, l) {
				switch(d) {
					case 'N':y++;break;
					case 'E':x++;break;
					case 'S':y--;break;
					case 'W':x--;break;
				}
				a[x][y]=false;
			}
		}
		
		bool f = true;
		rep(i, 21) {
			rep(j, 21) {
				if(a[i][j]) {
					f=false;
					break;
				}
			}
			if(!f)break;
		}
		cout<<(f?"Yes":"No")<<endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

int main(){
    int n,m,i,j,x[20],y[20],z[30],p[31],q[31],a[20],s;
    char d[i];
    while(1) {
        scanf("%d",&n);
        if (n==0) break;
        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",&d[i],&z[i]);
        }
        p[0]=10;
        q[0]=10;
        for (i=0;i<m;i++) {
            if (d[i]=='N') {q[i+1]=q[i]+z[i];}
            if (d[i]=='S') {q[i+1]=q[i]-z[i];}
            if (d[i]=='E') {p[i+1]=p[i]+z[i];}
            if (d[i]=='W') {p[i+1]=p[i]-z[i];}
        }
        for (i=0;i<n;i++) {
            a[i]=1;
            for (j=0;j<m;j++) {
                if (((x[i]<=p[j]&&x[i]>=p[j+1])||(x[i]>=p[j]&&x[i]<=p[j+1]))&&((y[i]<=q[j]&&y[i]>=q[j+1])||(y[i]>=q[j]&&y[i]<=q[j+1]))) {
                    a[i]=0;
                }
            }
        }
        for (i=0;i<n;i++) {
            s+=a[i];
        }
        if (s==0) {printf("Yes\n");}
        else {printf("No\n");}
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 999999999
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;

int main() {
  int N, M, w;
  while (cin >> N, N) {
    bool mp[25][25] = {};
    int sx = 10, sy = 10;
    rep(i, N) {
      int a, b;
      cin >> a >> b;
      mp[b][a] = 1;
    }
    cin >> M;
    char s;
    rep(i, M) {
      cin >> s >> w;
      if (s == 'N') {
        rep(j, w) {
          sy++;
          mp[sy][sx] = 0;
        }
      }
      if (s == 'S') {
        rep(j, w) {
          sy--;
          mp[sy][sx] = 0;
        }
      }
      if (s == 'E') {
        rep(j, w) {
          sx++;
          mp[sy][sx] = 0;
        }
      }
      if (s == 'W') {
        rep(j, w) {
          sy--;
          mp[sy][sx] = 0;
        }
      }
    }
    bool ans = 1;
    rep(i, 25) rep(j, 25) if (mp[i][j]) ans = 0;
    cout << (ans ? "Yes" : "No") << endl;
  }
  return 0;
}

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

int main(){
	while(1){
	int n;
	cin>>n;
	
	if(n==0) break;
	
	int x[20],y[20];
	for(int i=0;i<n;i++) cin>>x[i]>>y[i];
	
	int vx=10,vy=10;
	int ans[20];
	for(int i=0;i<n;i++) ans[i]=0;
	
	int m;
	cin>>m;
	char s[30];
	int l[30];
	for(int i=0;i<m;i++){
		cin>>s[i]>>l[i];
		
		for(int j=0;j<l[i];j++){
			if(s[i]=='N') vy++;
		    else if(s[i]=='E') vx++;
		    else if(s[i]=='S') vy--;
		    else vx--;
		
		    for(int k=0;k<n;k++){
				if(vx==x[k]&&vy==y[k]) ans[k]=1;
			}
		}
	}
	
	
	int tmp=1;
	for(int i=0;i<n;i++){
		if(ans[i]==0){
			tmp=0;
			break;
		}
	}
	
	
	cout<<((tmp)?"Yes":"No")<<endl;
	}
	
	
	return 0;
}

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

int main() {
	int n, m, a[20][2], flag[20], x, y, flag2, c[30];
	char b[30];
	
	while (1) {
		cin >> n;
		if (n == 0) break;
		for (int i = 0; i < n; i++)
			cin >> a[i][0] >> a[i][1];
		cin >> m;
		for (int i = 0; i < m; i++)
			cin >> b[i] >> c[i];
		
		for (int i = 0; i < n; i++)
			flag[i] = 1;
		x = y = 10;
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < c[i]; j++) {
				if (b[i] == 'N') y++;
				else if (b[i] == 'E') x++;
				else if (b[i] == 'S') y--;
				else x--;
				
				for (int k = 0; k < n; k++)
					if (x == a[k][0] && y == a[k][1])
						flag[k] = 0;
			}
		}
		
		flag2 = 0;
		for (int i = 0; i < n; i++) {
			if (flag[i])  {
				flag2 = 1;
				break;
			}
		}
			
		if (!flag2)
			cout << "Yes\n";
		else
			cout << "No\n";
	}
	return 0;
}