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++: #pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
    int n,m;
  while(1){
   cin>>n;
   if(n==0)return 0;
   V<V<bool>> visited(21,vector<bool>(21,false));
   V<P> d(n);
   for(int i=0;i<n;i++){
       cin>>d[i].fi>>d[i].se;
   }
   cin>>m;
   int nowx=10,nowy=10;
    char c;
    int t;
   for(int i=0;i<m;i++){
       cin>>c;
       cin>>t;
       if(c=='N'){
           for(int j=1;j<=t;j++)visited[nowx][nowy+j]=1;
           nowy+=t;
       }
       else if(c=='S'){
           for(int j=1;j<=t;j++)visited[nowx][nowy-j]=1;
           nowy-=t;
       }
       else if(c=='W'){
           for(int j=1;j<=t;j++)visited[nowx-j][nowy]=1;
           nowx-=t;
       }
       else{
            for(int j=1;j<=t;j++)visited[nowx+j][nowy]=1;
           nowx+=t;
       }
   }
   bool ok=true;
   for(int i=0;i<n;i++){
       if(!visited[d[i].fi][d[i].se])ok=false;
   }
   if(ok)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
  }
}

C++: #include<stdio.h>
int main(void)
{
  int n,i,m,j,k,robo,robox,roboy,sum;
  char news;
  robox=10;
  roboy=10;
  for(;;)
    {
      scanf("%d",&n);
      if(n==0){break;}
      int x[n],y[n],xy[n];
      for(i=0;i<n;i++){xy[i]=0;}
      sum=0;
      for(i=0;i<n;i++){scanf("%d %d",&x[i],&y[i]);}
      /*printf("--------------");*/
      scanf("%d",&m);
      /*printf("..............");*/
      for(i=0;i<m;i++)
	{
	  /*printf("i=%d\n",i);*/
	  scanf(" %c %d",&news,&robo);
	  /*printf("i=%d news=%c robo=%d\n",i,news,robo);*/
	  for(k=0;k<robo;k++)
	    {
	    if(news=='N'){roboy=roboy+1;}
	    if(news=='W'){robox=robox-1;}
	    if(news=='S'){roboy=roboy-1;}
	    if(news=='E'){robox=robox+1;}
	    /*printf("robox=%d roboy=%d\n",robox,roboy);*/
	    for(j=0;j<n;j++){if(x[j]==robox && y[j]==roboy){xy[j]=1;/*printf("xy[%d]=%d\n",j,xy[j]);*/}}
	    }
	}
      for(j=0;j<n;j++){sum=sum+xy[j];}
      /*printf("sum=%d\n",sum);*/
      if(sum==n){printf("Yes\n");}
      else{printf("No\n");}
    }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
  int N, M;
  while(cin >> N, N){
    int plane[21][21] = {{0}};
    int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
    int X = 10, Y = 10, get = 0;
    for(int i = 0; i < N; i++){
      int x, y;
      cin >> x >> y;
      plane[x][y] = 1;
    }
    cin >> M;
    while(M--){
      char d; int l, D;
      cin >> d >> l;
      switch(d){
      case 'N': D = 0; break;
      case 'E': D = 1; break;
      case 'S': D = 2; break;
      case 'W': D = 3; break;
      }
      for(int i = 0; i < l; i++){
	X += dx[D], Y += dy[D];
	get += plane[X][Y]; 
	plane[X][Y] = 0;
      }
    }
    cout << (get == N ? "Yes":"No") << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

bool used[30][30];
int mv[4][2]={{0,1},{0,-1},{1,0},{-1,0}};

bool check(int n){
	int m;
	int i,j,k;
	int a,b,c,d;
	char ca;
	memset(used,false,sizeof(used));
	for(i=0;i<n;i++){
		cin>>a>>b;
		used[a][b]=true;
	}
	a=10,b=10;
	cin>>m;
	for(i=0;i<m;i++){
		cin>>ca>>d;
		if(ca=='N')c=0;
		if(ca=='S')c=1;
		if(ca=='E')c=2;
		if(ca=='W')c=3;
		for(j=0;j<d;j++){
			a+=mv[c][0],b+=mv[c][1];
			if(used[a][b])n--,used[a][b]=false;
		}
	}
	if(n)return false;
	return true;
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	while(cin>>n){
		if(n==0)return 0;
		if(check(n))cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
vector <string> v;
string s;

int main(){
  int N;
  string  ans;
  char drc[] = {'N','W','S','E'};
  int d_xy[][2] = {{0,1},{-1,0},{0,-1},{1,0}};
  cin >>N;

  while (N != 0) {
    ans = "Yes";
    int mp[21][21] = {0};
    int M;
    int jems = 0;

    for(int i = 0;i<N;i++){
      int x,y;
      cin >>x>>y;
      mp[x][y]++;
    }
    cin >>M;
    int x_now = 10, y_now = 10;
    for (int i = 0;i<M;i++){
      char d;
      cin >> d;
      for(int j = 0;j<4;j++){
        if(d == drc[j]){
          int g;
          cin >> g;
          for(int k = 0; k < g; k++){
            jems += mp[x_now += d_xy[j][0]][y_now += d_xy[j][1]];
            if(mp[x_now][y_now])mp[x_now][y_now] = 0;
          }
        }
      }
    }
    if(jems != N)ans = "No";
    v.push_back(ans);
    cin >> N;
  }

  for (int i = 0;i<(int)v.size();i++){
    cout <<v[i]<<endl;
  }
  return 0;
}