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<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;

struct ans{
	int n;
	ans *next;
};

int main(){
	ans *start=new ans();
	start->next=NULL;
	ans *end=start;
	ans *buf;
	char s[20];
	char dir;
	char *ps;
	int **juel;
	int x=10,y=10;
	int state[21][21];
	state[10][10]=1;
	int i,j,n,m,size;
	while(fgets(s,sizeof(s),stdin)){
		size=atoi(s);
		if(size==0) break;
		memset(state,0x00,sizeof(state));
		juel=new int*[size];
		for(i=0;i<size;i++){
			juel[i]=new int[2];
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			juel[i][0]=atoi(ps);
			ps=strtok(NULL," ");
			juel[i][1]=atoi(ps);
		}
		fgets(s,sizeof(s),stdin);
		n=atoi(s);
		for(i=0;i<n;i++){
			fgets(s,sizeof(s),stdin);
			ps=strtok(s," ");
			dir=ps[0];
			ps=strtok(NULL," ");
			m=atoi(ps);
			if(dir=='N'){
				for(j=1;j<=m;j++) state[x][y+j]=1;
				y+=m;
			}
			else if(dir=='S'){
				for(j=1;j<=m;j++) state[x][y-j]=1;
				y-=m;
				break;
			}
			else if(dir=='E'){
				for(j=1;j<=m;j++) state[x+j][y]=1;
				x+=m;
			}
			else if(dir=='W'){
				for(j=1;j<=m;j++) state[x-j][y]=1;
				x-=m;
			}
		}
		for(i=0;i<size;i++){
			if(state[juel[i][0]][juel[i][1]]==0) break;
		}
		if(i==size) n=0;
		else n=1;
		buf=new ans();
		buf->n=n;
		buf->next=NULL;
		end->next=buf;
		end=buf;
		for(i=0;i<size;i++) delete [] juel[i];
		delete [] juel;
	}
	buf=start->next;
	while(buf!=NULL){
		if(buf->n==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
		end=buf;
		buf=buf->next;
		delete end;
	}
	return 0;
}

C++: #include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
using namespace std;

int main(void) {
	vector<string> r;
	while (true)
	{
		int gem=0,gemgot=0;
		int map[21][21]={{0}};
		cin >> gem;
		if (gem==0){break;}
		for(int i=0;i<gem;i++)
		{
			int x=0,y=0;
			scanf("%d %d",&x,&y);
			map[x][y] = 1;
		}
		int rx=10,ry=10;
		int n;
		cin >> n;
		for(int i=0;i<n;i++)
		{
			int d=0;
			int dx=0,dy=0;
			char dest[1];
			scanf("%s %d",dest,&d);
			if (*dest == 'N'){
				dy = 1;
			} else if (*dest == 'S'){
				dy = -1;
			} else if (*dest == 'W'){
				dx = -1;
			} else if (*dest == 'E'){
				dx = 1;
			}
			for (int j=0;j<d;j++)
			{
				rx += dx;
				ry += dy;
				if (rx > 20){
					rx = 20;
				} else if (rx < 0) {
					rx = 0;
				}
				if (ry > 20){
					ry = 20;
				} else if (ry < 0) {
					ry = 0;
				}
				if (map[rx][ry] == 1)
				{
					map[rx][ry] = 0;
					gemgot++;
				}
			}
		}
		if (gem == gemgot){
			r.push_back("YES");
		} else {
			r.push_back("NO");
		}
	}
	for(int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstring>
using namespace std;

int main(void){
	int i,j,x,y,n,m,d,sum;
	int field[24][24];
	string s;

	while(cin>>n && n){
		sum = 0;
		memset(field,0,sizeof(field));
		for(i=0;i<n;i++){
			cin>>x>>y;
			field[y][x] = 1;
		}
		cin>>m;
		i=j=10;
		while(m--){
			cin>>s>>d;
			while(d--){
				if(s == "N") i++;
				if(s == "S") i--;
				if(s == "W") j--;
				if(s == "E") j++;
				if(field[i][j] == 1){
					sum++;
					field[i][j] = 0;
				}
			}
		}
		if(sum == n) cout<<"Yes\n";
		else cout<<"No\n";
	}

	return 0;
}

C++: #include <iostream>
using namespace std;

void gemretrieve(int flag[][21], char dir, int amo);
void gemcheck(int flag[][21]);

int rx = 10, ry = 10; //?????????????????§?¨?

int main(){

	int gemflag[21][21] = {0, 0, 0}; //?????§???????????°
	int gemamo; //?????§???????????°
	int movcou; //?§???????????????°
	char movdir; //?§??????????
	int movamo;  //?§???????
	int gx, gy; //?????§????????§?¨?
	    
	while (true){

		cin >> gemamo;

		if (gemamo == 0)
			break;

		for (int i = 0; i < gemamo; i++){

			cin >> gx >> gy;
			gemflag[gx][gy] = 1;

		}

		cin >> movcou;


		for (int j = 0; j < movcou; j++){

			cin >> movdir >> movamo;

			gemretrieve(gemflag, movdir, movamo);


		}

		gemcheck(gemflag);

	}
	

	return 0;


}

void gemretrieve(int flag[][21], char dir, int amo){

	switch (dir){

	case 'N':{

		for (int k = 0; k < amo; k++){

			ry++;
			flag[rx][ry] = 0;

		}



	} break;

	case 'E':{

		for (int k = 0; k < amo; k++){

			rx++;
			flag[rx][ry] = 0;

		}



	} break;

	case 'S':{

		for (int k = 0; k < amo; k++){

			ry--;
			flag[rx][ry] = 0;

		}



	} break;

	case 'W':{

		for (int k = 0; k < amo; k++){

			rx--;
			flag[rx][ry] = 0;

		}



	} break;


	default:break;

	}




}

void gemcheck(int flag[][21]){


	for (int i = 0; i < 21; i++){

		for (int j = 0; j < 21; j++){

			if (flag[i][j] == 1){
				cout << "NO" << endl;
				return;
			}

		}

	}


	cout << "YES" << endl; 


}

C++: #include <stdio.h>
int main()
{
  int I, n, x, y, i, j, r=0, a, b;
  int d[21][21];
  char l;

  while(1)
    {
      r = 0;
      for ( i = 0; i < 21; i++){
	for ( j = 0; j < 21; j++){
	  d[i][j] = 0;
	}
      }
      scanf("%d", &I);
      if ( I == 0 ) return 0;
      for ( i = 0; i < I; i++){
	scanf("%d %d", &x, &y);
	d[x][y] = 1;
      }
      scanf("%d", &n);
      a = 10;
      b = 10;
      if ( d[a][b] == 1){
	r += 1;
      }
      for ( i = 0; i < 2 * n; i++)
	{
	  scanf("%c %d", &l, &x);
	  if ( l == 'E') {
	    for ( j = a; j < a+x; j++){
	      if ( d[j][b] == 1){ 
		r += 1;
		d[j][b] = 0;
	      }
	    }
	    a = j;
	    if ( d[a][b] == 1){
	      r += 1;
	    }
	  }
	  else if ( l == 'W' ){
	    for ( j = a; j > a-x; j--){
	      if ( d[j][b] == 1 ){
		r += 1;
		d[j][b] = 0;
	      }
	    }
	    a = j;
	    if ( d[a][b] == 1){
	      r += 1;
	    }
	  }
	  else if ( l == 'N' ){
	    for ( j = b; j < b+x; j++){
	      if ( d[a][j] == 1 ){
		r += 1;
		d[a][j] = 0;
	      }
	    }
	    b = j;
	    if ( d[a][b] == 1){
	      r += 1;
	    }
	  }
	  else if ( l == 'S' ){
	    for ( j = b; j > b-x; j--){
	      if ( d[a][j] == 1 ){
		r += 1;
		d[a][j] = 0;
	      }
	    }
	    b = j;
	    if ( d[a][b] == 1){
	      r += 1;
	    }
	  }
	}
      if ( r == I )
	{
	  printf("Yes\n");
	}
      else if ( r != I )
	{
	  printf("No\n");
	}
    }
  return 0;
}