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>
using namespace std;
using ll=long long;

#define itn long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define debug(x) cout << #x << "=" << (x) << endl;
const ll MOD=1e9+7;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  map<char,int> dx,dy;
  dx['E']=dy['N']=1;
  dx['W']= dy['S']=-1;
 
  while(true){
    int N;
    cin>>N;
    if(!N)return;
    vector<vector<int>> G(21,vector<int>(21,0));
    
    int x,y;
    rep(i,N){
      cin>>x>>y;
      G[y][x]=1;
    }
    int M;
    cin>>M;
    x=10;y=10;
    rep(i,M){
      char s;int len;
      cin>>s>>len;
      while(len--){
        x+=dx[s];y+=dy[s];
        G[y][x]=0;
      }
    }
   int ct=0;
   rep(i,21)
    rep(j,21)
      ct+=G[i][j];
    if(ct)
      cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}

C++: #include <stdio.h>
#include <string.h>

char a[21][21];

int main()
{
  int n,x,y,m,s;
  int i;
  char d[3];

  while(1){
    scanf("%d", &n);
    if(n==0)
      break;

    memset(a,0,sizeof(a));

    for(i=0;i<n;i++){
      scanf("%d%d", &x, &y);
      a[x][y]=1;
    }

    scanf("%d", &m);
    x=10,y=10;
    while(m-- > 0){
      scanf("%s%d", d, &s);
      while(s-- > 0){
	if(d[0] == 'E')x++;
	else if(d[0] == 'S')y--;
	else if(d[0] == 'W')x--;
	else if(d[0] == 'N')y++;
	
	if(a[x][y]){
          n--;
          a[x][y]=0;
        }
      }
    }

    if(n==0)
      printf("Yes\n");
    else printf("No\n");
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define MEM(a,n) memset(a,n,sizeof(a))
#define p(S) cout<<(S)<<endl
using namespace std;

int main(){
	int N,M;
	int dx[4]={0,1,0,-1};
	int dy[4]={1,0,-1,0};
	map<char,int> m;
	m['N']=0;
	m['E']=1;
	m['S']=2;
	m['W']=3;
	while(cin>>N,N){
		bool g[20][20];
		MEM(g,false);
		int x,y;
		REP(i,0,N){
			cin>>x>>y;
			g[y][x]=true;
		}
		cin>>M;
		char h;
		int d;
		int nowx=10,nowy=10;
		REP(i,0,M){
			cin>>h>>d;
			REP(j,0,d){
				nowx+=dx[m[h]];
				nowy+=dy[m[h]];
				if(g[nowy][nowx]){
					g[nowy][nowx]=false;
					N--;
				}
			}
		}
		p(N==0?"Yes":"No");
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	while(1){
	int N; cin >> N ;
	if(N==0) break;
	int* tre=new int[2*N];
	for(int i=0;i<N;i++) cin >> tre[2*i] >> tre[2*i+1] ;
	bool* tkr=new bool[N];
	for(int i=0;i<N;i++) tkr[i]=false;
	int M; cin >> M ;
	char ch; int n;
	int now[2]={10,10};
	for(int i=0;i<M;i++){
		cin >> ch >> n ;
		int NS=0; int EW=0;
		if(ch=='N') NS=1; else if(ch=='S') NS=-1;
		else if(ch=='E') EW=1; else if(ch=='W') EW=-1;
		for(int j=0;j<n;j++){
			now[0]+=EW ; now[1]+=NS ;
			for(int k=0;k<N;k++){
				if(tre[2*k]==now[0] && tre[2*k+1]==now[1]) tkr[k]=true;
			};
		};
	};
	string ans="YES";
	for(int i=0;i<N;i++) {
		if(tkr[i]==false) ans="NO";
		if(ans=="NO") break;
	};
	cout << ans << '\n' ;
	delete[] tre;delete[] tkr;
	};
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main(){
	while (1){
		int n, m;
		cin >> n;
		if (n == 0) break;
		int d[30][30] = {};
		rep(i, 0, n){
			int y, x;
			cin >> x >> y;
			d[x][y] = 1;
		}
		int cnt = 0;
		cin >> m;
		int y = 10, x = 10;
		rep(i, 0, m){
			char s;
			int a;
			cin >> s >> a;
			while(a--){
				if (s == 'N') y++;
				else if (s == 'E') x++;
				else if (s == 'W') x--;
				else if (s == 'S') y--;
				if (d[x][y]){
					cnt++; d[x][y] = 0;
				}
			}
		}
		if (cnt == n) o("Yes");
		else o("No");
	}
}

C++: #include <iostream>
using namespace std;
struct {int x, y;} p[21], l;
struct {char a; int d;} o[30];
int main()
{
	int n, m, t, i, j, k, f[21];
	while (cin >> n && (t = n))
	{
		for (i = 0; i < n; f[i] = 1, i++)
			cin >> p[i].x >> p[i].y;
		cin >> m;
		for (i = 0; i < m; i++)
			cin >> o[i].a >> o[i].d;
		for (i = 0, l.x = l.y = 10; i < m; i++)
			switch (o[i].a)
			{
			case 'N':
				for (j = 0; j < o[i].d; j++)
				{
					l.y++;
					for (k = 0; k < n; k++)
						if (f[k] && l.x == p[k].x && l.y == p[k].y)
							f[k] = 0, t--;
				}
				break;
			case 'E':
				for (j = 0; j < o[i].d; j++)
				{
					l.x++;
					for (k = 0; k < n; k++)
						if (f[k] && l.x == p[k].x && l.y == p[k].y)
							f[k] = 0, t--;
				}
				break;
			case 'S':
				for (j = 0; j < o[i].d; j++)
				{
					l.y--;
					for (k = 0; k < n; k++)
						if (f[k] && l.x == p[k].x && l.y == p[k].y)
							f[k] = 0, t--;
				}
				break;
			case 'W':
				for (j = 0; j < o[i].d; j++)
				{
					l.x--;
					for (k = 0; k < n; k++)
						if (f[k] && l.x == p[k].x && l.y == p[k].y)
							f[k] = 0, t--;
				}
				break;
			}
		if (t <= 0)	cout << "Yes" << endl;
		else		cout << "No" << endl;
	}
}