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 <iostream>
using namespace std;
int n,x,y,m,l,z,s;
char d;
int main(){
	while(cin>>n){
		if(n==0) break;
		int a[n];
		for(int i=0;i<n;i++){
			cin>>x>>y;
			a[i]=30*x+y;
		}
		cin>>m;
		z=310;
		for(int i=0;i<m;i++){
			cin>>d>>l;
			if(d=='N'){
				for(int j=0;j<l;j++){
					z++;
					for(int k=0;k<n;k++){
						if(a[k]==z) a[k]=0;
					}
				}
			}
			else if(d=='S'){
				for(int j=0;j<l;j++){
					z--;
					for(int k=0;k<n;k++){
						if(a[k]==z) a[k]=0;
					}
				}
			}
			else if(d=='E'){
				for(int j=0;j<l;j++){
					z=z+30;
					for(int k=0;k<n;k++){
						if(a[k]==z) a[k]=0;
					}
				}
			}
			else if(d=='W'){
				for(int j=0;j<l;j++){
					z=z-30;
					for(int k=0;k<n;k++){
						if(a[k]==z) a[k]=0;
					}
				}
			}
		}
		for(int i=0;i<n;i++){
			s=0;
			s=s+a[i];
		}
		if(s==0){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
    return 0;
}

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

int map[21][21] = {} ;
int dx[] = { 0,1,0,-1 } ;
int dy[] = { 1,0,-1,0 } ;

int main(){
	
	int n , x , y ;
	char d ;
	int m , k , dir;
	int nx , ny , count ;
	
	while(1){
		cin >> n ;
		if( n==0 ) break;
		
		for( int i=0 ; i<n ; i++ ){
			cin >> x >> y ;
			map[x][y] = 1 ;
		}
		
		cin >> m ;
		nx = 10 ;
		ny = 10 ;
		count = 0 ;
		if( map[nx][ny] == 1 ){
					count++;
					map[nx][ny] = 0 ;
				}
		
		for( int i=0 ; i<m ; i++ ){
			cin >> d >> k ;
			if( d == 'N' ) dir = 0 ;
			else if( d == 'E' ) dir = 1 ;
			else if( d == 'S' ) dir = 2 ;
			else if( d == 'W' ) dir = 3 ;
			
			for( int j=0 ; j<k ; j++ ){
				nx += dx[dir] ;
				ny += dy[dir] ;
				if( map[nx][ny] == 1 ){
					count++;
					map[nx][ny] = 0 ;
				}
			}
			//cout << nx << "," << ny << endl;
		}
		
		if( count == n ) cout << "YES" << endl ;
		else if( count != n ){
			cout << "NO" << endl ;
			
			for( int i=0 ; i<21 ; i++ )
				for( int j=0 ; j<21 ; j++ )
					map[i][j] = 0;
		}
	}
	
return 0;
}

C++: #include <stdio.h>
#include<iostream>
using namespace std;
int main(){
  int box[20][20]={};
  int N,T,t,x,y,I,i,n,k,P,m,X,Y,l;
  char h;
  while(1){
    X=9;
    m=0;
    Y=9;
    for(T=0;T<20;T++){
      for(t=0;t<20;t++){
	box[T][t]=0;
      }
    }
    scanf("%d",&N);
    if(N==0) break;
    else {
      
      for(i=1;i<=N;i++){
	scanf("%d %d",&x,&y);
	//	printf("i%d\n",i);
	box[x-1][y-1]=1;
      }

      scanf("%d",&n);
      //printf("%d\n",n);
      for(l=1;l<=n;l++){
	//	printf("%d\n",l);
	cin >> h >> k;
	//	scanf("%c %d",&h,&k);

	//printf("%d\n",l);
	//printf("%c\n",h);
	if(h=='N'){
	  for(I=1;I<=k;I++){
	    Y++;
	    box[X][Y]=0; 
	   
	  }
	 
	}
	if(h=='E'){
	  for(I=1;I<=k;I++){
	    X++;
	    box[X][Y]=0;
	  }
	 
	}
	if(h=='W'){
	  for(I=1;I<=k;I++){
	    X--;
	    box[X][Y]=0;
	  }
	 
	}

	if(h=='S'){
	  for(I=1;I<=k;I++){
	    Y--;
	    box[X][Y]=0;
	  }
	  
	} 

	
      }
      //printf("aaa\n");
      for(I=0;I<20;I++){
	for(P=0;P<20;P++){
	  if(box[I][P]==0) m++;
	}
      }
      if(m==400) printf("Yes\n");
      else printf("No\n");
    }
  }
 
  return 0;
  
}

C++: #include <iostream>
using namespace std;
int main()
{
  char dir; //direction                                          
  int x,y,j,k;
  int dist; //distance                                           
  int xy[21][21];
    while (cin >> j && j){
      for(int i=0;i<j;i++){
        cin >> x >> y;
        xy[x][y]=1;
      }
      cin >> k;
      x=10;
      y=10;
      int m=0;
      for(int i=0;i<k;i++){
        cin >> dir >> dist;
        for(int l=0;l<dist;l++){
          if(dir == 'N')
            y++;
          else if(dir=='S')
            y--;
          else if(dir=='W')
            x--;
          else if(dir=='E')
            x++;
          if(xy[x][y]==1){
            m++;
            xy[x][y]=0;
          }
        }
      }
      if(j==m)
          cout << "Yes" << endl;
        else
          cout << "No" << endl;
    }
}

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

void show(int m[20][20],int x,int y){
  for(int i=0;i<20;i++){
    for(int j=0;j<20;j++){
      if(i==x&&j==y){
        cout << "X";
        continue;
      }
      cout << m[i][j];
    }
    cout << endl;
  }
  cout << endl;
}
int main(){
  while(1){
    int N=0;
    cin >> N;
    if(N==0)break;
    int m[21][21]={0};
    for(int i=0;i<N;i++){
      int x,y;
      cin >> x >> y;
      m[x][y]=1;
    }
    int M;
    cin >> M;
    map<char,pair<int,int> > mp;
    mp['N'].first=0;
    mp['N'].second=1;
    mp['E'].first=1;
    mp['E'].second=0;
    mp['S'].first=0;
    mp['S'].second=-1;
    mp['W'].first=-1;
    mp['W'].second=0;
    int count=0;
    int nx=10,ny=10;
    if(m[nx][ny]==1){
      count++;
      m[nx][ny]=0;
    }
    for(int i=0;i<M;i++){
      char Q;
      int D;
      cin >> Q >> D;
      for(int j=0;j<D;j++){
        nx+=mp[Q].first;
        ny+=mp[Q].second;
        if(m[nx][ny]==1){
          count++;
          m[nx][ny]=0;
        }
      }
    }
    if(count==N){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

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

using namespace std;

#define NMAX 20

struct point{
	int x,y;
};

int main(){

	int N,M;
	char dir;
	string dirdata("WSNE");
	int dx[]={-1,0,0,1};
	int dy[]={0,-1,1,0};
	int x,y,dis;
	point robo,juel[NMAX];
	int cnt;

	while(1){

		cin>>N;
		if(N==0) break;

		robo.x=10,robo.y=10;
		cnt=0;

		for(int i=0;i<N;i++){
			cin>>x>>y;
			if(x==10&&y==10) cnt++,x=-1,y=-1;
			juel[i].x=x,juel[i].y=y;
		}

		cin>>M;
		for(int i=0;i<M;i++){
			cin>>dir>>dis;
			for(int i=0;i<dis;i++){
				robo.x+=dx[dirdata.find(dir)];
				robo.y+=dy[dirdata.find(dir)];
				for(int j=0;j<N;j++){
					if(robo.x==juel[j].x&&robo.y==juel[j].y){
						cnt++;
						juel[j].x=-1,juel[j].y=-1;
					}
				}
			}
		}
		if(cnt==N) puts("Yes");
		else puts("No");
	}


	return 0;
}