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 rrep(i,n) for(int i = n - 1; i >= 0; i--)
#define REP(i,k,n) for(int i = k; i < n; i++)

#define vi vector<int>
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
    int n;
    while(cin >> n,n) {
        bool d[21][21] = {};
        int x,y;
        rep(i,n){
            cin >> x >> y;
            d[y][x] = true;
        }
        int m;
        cin >> m;
        int nx = 10,ny = 10;
        int cnt = 0;
        rep(i,m){
            char dig;
            int l;
            cin >> dig >> l;
            if(dig == 'N') {
                rep(j,l){
                    ny++;
                    if(d[ny][nx] == true) {
                        cnt++;
                        d[ny][nx] = false;
                    }
                }
            }else if(dig == 'S') {
                rep(j,l){
                    ny--;
                    if(d[ny][nx] == true) {
                        cnt++;
                        d[ny][nx] = false;
                    }
                }
            }else if(dig == 'E') {
                rep(j,l){
                    nx++;
                    if(d[ny][nx] == true) {
                        cnt++;
                        d[ny][nx] = false;
                    }
                }
            }else if(dig == 'W') {
                rep(j,l){
                    nx--;
                    if(d[ny][nx] == true) {
                        cnt++;
                        d[ny][nx] = false;
                    }
                }
            }
        }
        if(cnt == n) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

C++: #include<stdio.h>

int main(void){
	int n,x,y,mo,cnt;
	char c;
	int m[21][21];
	for(;;){
		scanf("%d",&n);
		if(n==0)break;
		cnt=0;
		for(int i=0;i<21;i++)for(int j=0;j<21;j++)m[i][j]=0;
		for(int i=0;i<n;i++){
			scanf("%d%d",&x,&y);
			if(x!=10&&y!=10){
				m[x][y]=1;
				cnt++;
			}
		}
		scanf("%d",&n);
		x=y=10;
		for(int i=0;i<n;i++){
			scanf(" %c%d",&c,&mo);
			for(int j=0;j<mo;j++){
				if(c=='N')y++;
				else if(c=='E')x++;
				else if(c=='W')x--;
				else if(c=='S')y--;
				if(m[x][y]==1){
					m[x][y]=0;
					cnt--;
				}
			}
		}
		puts(cnt==0?"Yes":"No");
	}
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;

int main(){

  int x[30],y[30];
  char d[40];
  int l[40];
  int n,m;
  int mama[30];
  while(scanf("%d",&n),n){
    fill(mama,mama+30,0);
    int rx=10,ry=10;

    rep(i,n) scanf("%d %d",&x[i],&y[i]);
    scanf("%d",&m);
    rep(i,m){
      //scanf(" %c%d",&d[i],&l[i]);
      cin >> d[i] >> l[i];
      if(d[i]=='N'){
        reg(j,ry,ry+l[i]){
          rep(k,n){
            if(x[k]==rx && y[k]==j) mama[k]=1;
          }
        }
        ry=ry+l[i];
      }
      else if(d[i]=='E'){
        reg(j,rx,rx+l[i]){
          rep(k,n){
            if(x[k]==j && y[k]==ry) mama[k]=1;
          }
        }
        rx=rx+l[i];
      }
      else if(d[i]=='S'){
        reg(j,ry-l[i],ry){
          rep(k,n){
            if(x[k]==rx && y[k]==j) mama[k]=1;
          }
        }
        ry=ry-l[i];
      }
      else if(d[i]=='W'){
        reg(j,rx-l[i],rx){
          rep(k,n){
            if(x[k]==j && y[k]==ry) mama[k]=1;
          }
        }
        rx=rx-l[i];
      }
    }
    bool yu=true;
    rep(i,n){ if(mama[i]==0) yu=false;}
    if(yu) printf("YES\n");
    else printf("NO\n");
  }

  return 0;

}

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

int main(void)
{
	int n,m; //宝の個数、移動回数
	int i; //for変数
	int math[21][21]; //宝の位置、ある場所は1,ない場所は0
	int x=10,y=10;
	int a,b; 
	char d; //方角
	int l; //移動量
	int count; //見つけた宝の数
	int yL=y,xL=x;
	
	for(;;)
	{
		scanf("%d",&n);
		if(n==0) break;
		for(a=0; a<21; a++)
		{
			for(b=0; b<21; b++)
			{
				math[a][b]=0;
			}
		}
		for(i=0; i<n; i++)
		{
			scanf("%d  %d",&a,&b);
			math[a][b]=1;
		}
		
		scanf("%d",&m);
		for(i=0; i<m; i++)
		{
			scanf("%s %d",&d,&l);
		
			if(math[10][10]==1)
			{
				count++;
				math[10][10]=0;
			}	
			if(d=='N')
			{
				yL+=l;
				for(y=y+1; y<=yL; y++)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				y--;
			}
			if(d=='E')
			{
				xL+=l;
				for(x=x+1; x<=xL; x++)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				x--;
			}
			if(d=='S')
			{
				yL-=l;
				for(y=y-1; y>=yL; y--)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				y++;
			}
			if(d=='W')
			{
				xL-=l;
				for(x=x-1; x>=xL; x--)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
				x++;
			}
		}
		
		if(count==n) printf("Yes\n");
		else printf("No\n");
		count=0;
		x=10;y=10;
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int m,count=n,p[21][21];
		for(int i=0;i<20;++i)for(int j=0;j<20;++j)p[i][j]=0;
		for(int i=0,x,y;i<n;++i){
			cin>>x>>y;
			p[x][y]=1;
		}
		cin>>m;
		for(int i=0,d,cx=10,cy=10;i<m;++i){
			string s;
			cin>>s;
			cin>>d;
			if(s=="N"){
				for(int j=0;j<d;++j){
					++cy;
					if(p[cx][cy]==1){
						count--;
						p[cx][cy]=0;
					}
				}
			}else if(s=="E"){
				for(int j=0;j<d;++j){
					++cx;
					if(p[cx][cy]==1){
						count--;
						p[cx][cy]=0;
					}
				}
			}else if(s=="S"){
				for(int j=0;j<d;++j){
					--cy;
					if(p[cx][cy]==1){
						count--;
						p[cx][cy]=0;
					}
				}
			}else if(s=="W"){
				for(int j=0;j<d;++j){
					--cx;
					if(p[cx][cy]==1){
						count--;
						p[cx][cy]=0;
					}
				}
			}
		}
		if(count==0)cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;
}