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 ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n && n){
    vvl(v,21,21,0);
    ll a,b;
    rep(i,n){
      cin >> a >> b;
      v[a][b] = 1;
    }
    ll m,l,x=10,y=10;
    cin >> m;
    string s;
    rep(i,m){
      cin >> s >> l;
      if(s == "N"){
        rep(j,l){
          ++y;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else if(s == "W"){
        rep(j,l){
          --x;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else if(s == "E"){
        rep(j,l){
          ++x;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
      else if(s == "S"){
        rep(j,l){
          --y;
          if(v[x][y]){
            --n;
            v[x][y]=0;
          }
        }
      }
    }
    if(n != 0) cout << "No"<<endl;
    else cout << "Yes" << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
	while (true) {
		int N;
		scanf("%d", &N);

		if (N == 0) break;

		int gem[21][21] = {};
		for (int i = 0; i < N; i++) {
			int x, y;
			scanf("%d %d\n", &x, &y);
			gem[x][y] = 1;
		}

		pair<int, int> bot = make_pair(10, 10);

		int M;
		scanf("%d%*c", &M);

		int x = 10, y = 10;
		int cnt = gem[10][10];
		for (int i = 0; i < M; i++) {
			char c;
			int l;
			scanf("%c %d%*c", &c, &l);

			pair<int, int> d;
			if (c == 'N') d = make_pair(0, 1);
			if (c == 'E') d = make_pair(1, 0);
			if (c == 'W') d = make_pair(-1, 0);
			if (c == 'S') d = make_pair(0, -1);
			for (int j = 0; j < l; j++) {
				x += d.first;
				y += d.second;
				cnt += gem[x][y];
			}
		}

		if (cnt == N) printf("Yes\n");
		else printf("No\n");
	}

	return 0;
}

C++: #include <bits/stdc++.h>
#include <sys/time.h>
using namespace std;

double myclock()
{
	timeval t; gettimeofday(&t,0);
	return t.tv_sec+t.tv_usec*1e-6;
}

inline int my_popcount(unsigned x)
{
	x=(x&0x55555555)+(x>>1&0x55555555);
	x=(x&0x33333333)+(x>>2&0x33333333);
	x=(x&0x0f0f0f0f)+(x>>4&0x0f0f0f0f);
	x=(x&0x00ff00ff)+(x>>8&0x00ff00ff);
	return (x&0x0000ffff)+(x>>16&0x0000ffff);
}

int main()
{
	constexpr int LOOP=100000000;
	
	int sum1=0,sum2=0; // ループが削除されてしまわないようにする
	
	double t0=myclock();
	
	for(int i=0;i<LOOP;i++)
		sum1+=__builtin_popcount(i);
	
	double t1=myclock();
	
	for(int i=0;i<LOOP;i++)
		sum2+=my_popcount(i);
	
	double t2=myclock();
	
	printf("sum1=%d sum2=%d\n",sum1,sum2);
	printf("__builtin_popcount: %f[s]\n",t1-t0);
	printf("my_popcount:        %f[s]\n",t2-t1);
}

C++: 


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <functional>

using namespace std;

int INF = 10000000;

int n;



int main()
{

	while(cin >> n && n)
	{
		int sx = 10,sy = 10;
		
		bool cell[21][21];
		memset(cell,0,21*21*sizeof(bool));

		for(int i = 0;i < n;i++)
		{
			int x,y;
			cin >> x >> y;
			cell[x][y] = true;
		}

		cell[sx][sy] = false;

		int m;
		cin >> m;

		for(int i = 0;i < m;i++)
		{
			char order;
			int val;

			cin >> order >> val;

			if(order == 'N')
			{
				for(int j = 0;j < val;j++)
				{
					cell[sx][++sy] = false;
				}
				
			}
			if(order == 'E')
			{
				for(int j = 0;j < val;j++)
				{
					cell[++sx][sy] = false;
				}
			}
			if(order == 'S')
			{
				for(int j = 0;j < val;j++)
				{
					cell[sx][--sy] = false;
				}
			}
			if(order == 'W')
			{
				for(int j = 0;j < val;j++)
				{
					cell[--sx][sy] = false;
				}
			}

		}
		bool flag = false;

		for(int i = 0;i < 21;i++)
		{
			for(int j = 0;j < 21;j++)
			{
				if(cell[i][j])flag = true;
			}
		}

		if(flag)cout << "No" << endl;
		else    cout << "Yes"  << endl;

	}

  return 0;
}

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

using namespace std;

int main(){
  int n, m, x, y, mer;
  char dim;
  cin >> n;
  vector<int> ans;
  while(n){
    vector< vector<int> > gem(21, vector<int>(21));
    for(int i = 0; i < n; i++){
      cin >> x >> y;
      gem[y][x] = 1;
    }
    cin >> m;
    int nowx = 10;
    int nowy = 10;
    for(int j = 0; j < m; j++){
      cin >> dim >> mer;
      for(int k = 1; k <= mer; k++){
        if(dim == 'N') nowy++;
        if(dim == 'E') nowx++;
        if(dim == 'S') nowx--;
        if(dim == 'W') nowy--;
        gem[nowy][nowx] = 0;
      }
    }
    int boo = 0;
    for(int i = 0; i <= 20; i++){
      for(int j = 0; j <= 20; j++){
        if(gem[i][j])boo = 1;
      }
    }
    ans.push_back(boo);
    cin >> n;
  }
  for(int i = 0; i < (int)ans.size(); i++){
    if(!ans[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}