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 <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

struct Gem{
	int x = 10; int y = 10; bool isFound = false;
};

int main(){
	int n;

	while(cin >> n && n != 0){
		Gem gems[20], robot;
		for (int i = 0; i < n; ++i){
			cin >> gems[i].x >> gems[i].y;
		}

		int m;
		cin >> m;
		for (int i = 0; i < m; ++i){
			char s; int dist;
			cin >> s >> dist;
			
			switch (s)
			{
			case (int)'N':
				robot.y += dist;
				break;
			case (int)'E':
				robot.x += dist;
				break;
			case (int)'S':
				robot.y -= dist;
				break;
			case (int)'W':
				robot.x -= dist;
				break;
			}
			for (int i = 0; i < n; ++i){
				if (robot.x == gems[i].x &&  robot.y == gems[i].y){
					gems[i].isFound = true;
				}
			}

		}


		int res = 1;
		for (int i = 0; i < n; ++i){
				res *= gems[i].isFound;
		}
		cout << ((res == 1) ? "Yes" : "No") << endl;


	}


	return 0;
}

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;
    jems += mp[10][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(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;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int grid[21][21];
int nowx,nowy;
void init(){
  nowx = 10,nowy = 10;
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      grid[j][i] = 0;
    }
  }
}

void serch(int a,int b,int f){
  if(a > b)swap(a,b);
  if(f == 1){
    for(int i = a ; i <= b ; i++ )grid[nowx][i] = 0;
  }else {
    for(int i = a ; i <= b ; i++ )grid[i][nowy] = 0;
  }
}

bool check(){
  bool flag = true; 
  for(int i = 0 ; i <= 20 ; i++ ){
    for(int j = 0 ; j <= 20 ; j++ ){
      if(grid[j][i] == 1){flag = false;goto N;}
    }
  }
 N:;
  if(flag)return true;
  else return false;
}

int main(){
  int n;
  while( cin >> n,n ){
    init();
    for(int i = 0 ; i < n ; i++ ){
      int x,y;
      cin >> x >> y;
      grid[x][y] = 1;
    }
    cin >> n;
    for(int i = 0 ; i < n ; i++ ){
      char c;
      int move,f = 0,past;
      cin >> c >> move;
      if(c == 'N'){
	f = 1;
	past = nowy;
	nowy+=move;
      }else if(c == 'S'){
	f = 1;
	past = nowy;
	nowy-=move;
      }else if(c == 'E'){
	past = nowx;
	nowx+=move;
      } else {
	past = nowx;
	nowx-=move;
      }
      if(f == 0)serch(past,nowx,f);
      else serch(past,nowy,f);
    }
    if( check() )cout << "Yes" << endl;
    else cout << "No" << endl; 
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int n;
    while(cin>>n){
        if(n==0)return 0;
        
    int ansx[n],ansy[n];
    
    for(int i=0;i<n;i++){
        cin>>ansx[i]>>ansy[i];
    }
    
    char ch[n];
    int m[n];
    int x=10,y=10;
    int move=0;
    cin>>move;
        
    int count=0;
    
    for(int j=0;j<move;j++){
        cin>>ch[j]>>m[j];
    }

    for(int l=0;l<move;l++){
        int r=0;
        
        if(ch[l]=='N'){
            for(r=0;r<m[l];r++){
                y++;
                if(x==ansx[l]&&y==ansy[l]) count++;
            }
        }
        
        if(ch[l]=='E'){
            for(r=0;r<m[l];r++){
                x++;
                if(x==ansx[l]&&y==ansy[l]) count++;
            }
        }
        
        if(ch[l]=='S'){
            for(r=0;r<m[l];r++){
                y--;
                if(x==ansx[l]&&y==ansy[l]) count++;
            }
        }
        if(ch[l]=='W'){
            for(r=0;r<m[l];r++){
                x--;
                if(x==ansx[l]&&y==ansy[l]) count++;
            }
        }
    
    }
    
    if(count==n)  cout<<"Yes"<<endl;
    else           cout<<"No"<<endl;
        
    }
    return 0;
}

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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;


int main(void) {
	
	while (1) {
		int n;
		int x, y;
		int count = 0;
		int posx = 10;
		int posy = 10;
		int jwe[21][21] = {};
		int m;
		char d;
		int l;

		cin >> n;
		if (n == 0) {
			break;
		}
		FOR(i, 1, n) {
			cin >> x >> y;
			jwe[x][y]++;
		}
		cin >> m;
		FOR(i, 1, m) {
			cin >> d >> l;
			switch (d) {
			case 'N':
				y++;
				break;
			case 'E':
				x++;
				break;
			case 'S':
				y--;
				break;
			case'W':
				x--;
				break;
			}
			if (jwe[x][y] > 0) {
				count++;
				jwe[x][y]--;
			}
		}
		if (n == count) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

}