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 rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
const ll inf = 1e16;
const ll md = 1000000007;

int main() {
  bool t[25][25];
  while(true){
    int n,m,x,y;
    cin>>n;
    if(n==0) break;    
    rep(i,25) rep(j,25) t[i][j]=false;
    rep(i,n){
      cin>>x>>y;
      t[x][y]=true;
    }
    cin>>m;
    x=10,y=10;
    t[10][10]=false;
    rep(i,m){
      char c;
      int d;
      cin>>c>>d;
      if(c=='N'){
        for(int j=y+1;j<=y+d;j++) t[x][j]=false;
        y+=d;
      }
      if(c=='S'){
        for(int j=y-1;j>=y-d;j--) t[x][j]=false;
        y-=d;
      }
      if(c=='E'){
        for(int i=x+1;i<=x+d;i++) t[i][y]=false;
        x+=d;
      }
      if(c=='W'){
        for(int i=x-1;i>=x-d;i--) t[i][y]=false;
        x-=d;
      }
      //cout<<x<<" "<<y<<endl;
    }
    bool ans=false;
    rep(x,25) rep(y,25) ans|=t[x][y];
    if(ans) puts("No");
    else puts("Yes");
  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
  for(;;){
    int houkosu={0};
    int comkosu={0};
    int hou[21][21]={{0},{0}};
    int zahyo[21][21]={{0},{0}};
    int mypox={10};
    int mypoy={10};
    int x={0},y={0};
    int i={0},j={0};
    char dire={0};
    int dis={0};
    int hantei={0};
    char dir[31]={0};
    int di[31]={0};
     
    scanf("%d",&houkosu);
    if(houkosu==0)
      break;
       
    for(i=0;i<houkosu;i++){
      scanf("%d %d",&x,&y);
      hou[x][y]=1;
    }
 
    scanf("%d",&comkosu);
     
    hou[10][10]=0;
    for(i=0;i<2*comkosu;i++){
      scanf("%c",&dire);
      dir[i/2]=dire;
      scanf("%d",&dis);
      di[(i-1)/2]=dis;
    }
     
    for(i=0;i<comkosu;i++){
 
      if(dir[i]=='N'){
        for(j=mypoy+1;j<=mypoy+di[i];j++){
          if(hou[mypox][j]==1)
            hou[mypox][j]=0;
        }
        mypoy+=di[i];
      }else if(dir[i]=='S'){
        for(j=mypoy-1;j>=mypoy-di[i];j--){
          if(hou[mypox][j]==1)
            hou[mypox][j]=0;
        }
        mypoy-=di[i];
      }else if(dir[i]=='E'){
        for(j=mypox+1;j<=mypox+di[i];j++){
          if(hou[j][mypoy]==1)
            hou[j][mypoy]=0;
        }
        mypox+=di[i];
      }else{
        for(j=mypox-1;j>=mypox-di[i];j--){
          if(hou[j][mypoy]==1)
            hou[j][mypoy]=0;
        }
        mypox-=di[i];
      }
    }
     
    for(i=0;i<21;i++){
      for(j=0;j<21;j++){
        if(hou[i][j]!=0)
          hantei=1;
      }
    }
     
    if(hantei==0)
      puts("Yes");
    else
      puts("No");
     
  }
  return 0;
}

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

using namespace std;

int main() {
	int N, M;
	while( cin >> N, N ) {
		vector<vector<int>>VVI( 21, vector<int>( 21 ) );
		for( size_t i = 0; i < N; i++ ) {
			int A, B;
			cin >> A >> B;
			VVI[A][B] = 1;
		}
		int nowA = 10, nowB = 10;
		cin >> M;
		for( size_t i = 0; i < M; i++ ) {
			char A;
			int B, moveA = 0, moveB = 0;
			cin >> A >> B;
			if( A == 'N' ) {
				moveB = 1;
			} else if( A == 'S' ) {
				moveB = -1;
			} else if( A == 'E' ) {
				moveA = 1;
			} else {
				moveA = -1;
			}
			if( VVI[nowA][nowB] ) {
				VVI[nowA][nowB] = 0;
				N--;
			}
			for( size_t i = 0; i < B; i++ ) {
				nowA += moveA;
				nowB += moveB;
				if( VVI[nowA][nowB] ) {
					VVI[nowA][nowB] = 0;
					N--;
				}
			}
		}
		if( N == 0 ) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>
#include <iterator>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;

int main(){
    while (1){
        int n;
        cin >> n;
        if (n == 0){
            break;
        }

        vector<pair<int, int> > gems(n);

        for (auto itr = gems.begin(); itr != gems.end(); ++itr){
            int x, y;
            cin >> x >> y;
            *itr = make_pair(x, y);
        }

        int m;
        cin >> m;

        pair<int, int> pos(10, 10);
        int cnt = 0;

        for (int i = 0; i < m; i++){
            char dir;
            int step;
            cin >> dir >> step;
            if (dir == 'N'){
                for (int j = 0; j < step; j++){
                    pos.second++;
                    auto isGems = find(gems.cbegin(), gems.cend(), pos);
                    if (isGems != gems.cend()){
                        gems.erase(isGems);
                        cnt++;
                    }
                }
            }
            else if (dir == 'E'){
                for (int j = 0; j < step; j++){
                    pos.first++;
                    auto isGems = find(gems.cbegin(), gems.cend(), pos);
                    if (isGems != gems.cend()){
                        gems.erase(isGems);
                        cnt++;
                    }
                }
            }
            else if (dir == 'S'){
                for (int j = 0; j < step; j++){
                    pos.second--;
                    auto isGems = find(gems.cbegin(), gems.cend(), pos);
                    if (isGems != gems.cend()){
                        gems.erase(isGems);
                        cnt++;
                    }
                }
            }
            else{
                for (int j = 0; j < step; j++){
                    pos.first--;
                    auto isGems = find(gems.cbegin(), gems.cend(), pos);
                    if (isGems != gems.cend()){
                        gems.erase(isGems);
                        cnt++;
                    }
                }
            }
        }
        if (cnt == n){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }

    
    return 0;
}