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>
#include <algorithm>

using namespace std;

bool map[22][22] = {false};
int main(){
	int m;
	cin >> m;
	while(m != 0){
		int x,y;
		for(int i = 0; i < 22; i++){
			for(int j = 0; j < 22; j++){
				map[i][j] = false;
			}
		}

		for(int i = 0; i < m; i++){
			cin >> x >> y;
			map[x][y] = true;
		}

		int n;
		int ans = 0;
		cin >> n;
		x = y = 10;
		for(int i = 0; i < n; i++){
			char com;
			int move;
			cin >> com >> move;
			if(com == 'N'){
				for(int j = 1; j <= move; j++){
					if(map[x][y + j]){
						map[x][y + j] = false;
						ans++;
					}
				}
				y += move;
			}
			if(com == 'S'){
				for(int j = 1; j <= move; j++){
					if(map[x][y - j]){
						
						map[x][y - j] = false;
						ans++;
					}
				}
				y -= move;
			}
			if(com == 'E'){
				for(int j = 1; j <= move; j++){
					if(map[x + j][y]){
						
						map[x + j][y] = false;
						ans++;
					}
				}
				x += move;
			}
			if(com == 'W'){
				for(int j = 1; j <= move; j++){
					if(map[x - j][y]){
						
						map[x -j][y] = false;
						ans++;
					}
				}
				x -= move;
			}
		}
		if(m == ans){
			cout<< "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}

		cin >> m;
	}
	return 0;
}

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

using namespace std;

int mp[25][25];

int main()
{
    
    int n,m,x,y,l,nx,ny,sum;
    char d;
    
    
    while(cin >> n,n!=0){
        fill_n(*mp,25*25,0);
        for(int i=0;i<n;i++){
            cin >> x >> y;
            mp[y][x] = 1;
        }
    
        ny = 10;
        nx = 10;
        sum = mp[ny][nx];
        mp[ny][nx] = 0;
    
        cin >> m;
        for(int i=0;i<m;i++){
            cin >> d >> l;
            for(int j=0;j<l;j++){
                if(d == 'N') ny++;
                if(d == 'E') nx++;
                if(d == 'W') nx--;
                if(d == 'S') ny--;
                sum += mp[ny][nx];
                mp[ny][nx] = 0;
            }
        }
    
        cout << (sum==n?"Yes":"No") << endl;
    }
    
    return 0;
}

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

int N, M;
int field[21][21];

int main()
{
    while(cin >> N && N) {
        for(int i = 0; i <= 20; i++)
            for(int j = 0; j <= 20; j++)
                field[i][j];
        
        for(int i = 0; i < N; i++) {
            int x, y;
            cin >> x >> y;
            field[y][x] = 1;
        }
        
        cin >> M;
        int x = 10, y = 10, dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}, k, m = 0;
        for(int i = 0; i < M; i++) {
            char c; int a;
            cin >> c >> a;
            if(c == 'N')
                k = 2;
            else if(c == 'E')
                k = 1;
            else if(c == 'S')
                k = 0;
            else 
                k = 3;
            for(int j = 0; j < a; j++) {
                x += dx[k], y += dy[k];
                if(field[y][x] ==  1) {
                    field[y][x] = 0;
                    m++;
                }
            }
        }
        if(m == M)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

C++: #include<stdio.h>
int main(void)
{
  int n,i,m,j,k,robo,robox,roboy,sum,l; 
  char news;
  for(;;)
    {
      robox=10;
      roboy=10;
      scanf("%d",&n);
      if(n==0){break;}
      int x[n],y[n],xy[n];
      for(i=0;i<n;i++){xy[i]=0;}
      sum=0;
      for(i=0;i<n;i++){scanf("%d %d",&x[i],&y[i]);}
      scanf("%d",&m);
      for(i=0;i<m;i++)
	{
	  scanf(" %c %d",&news,&robo);
	  for(k=0;k<robo;k++)
	    {
	    if(news=='N'){roboy=roboy+1;}
	    if(news=='W'){robox=robox-1;}
	    if(news=='S'){roboy=roboy-1;}
	    if(news=='E'){robox=robox+1;}
	    for(j=0;j<n;j++){if(x[j]==robox && y[j]==roboy){xy[j]=1;printf("xy[%d]=%d\n",j,xy[j]);}}
	    }
	}
      for(j=0;j<n;j++){sum=sum+xy[j];}
      if(sum==n){printf("Yes\n");}
      else{printf("No\n");}	
    }
  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 ;
		
		for( int i=0 ; i<m ; i++ ){
			cin >> d >> k ;
			if( d == 'N' ) dir = 2 ;
			else if( d == 'E' ) dir = 1 ;
			else if( d == 'S' ) dir = 0 ;
			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 ;
				}
				
			}

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


int main() {
  while (true) {
    int N;
    
    cin >> N;
    if (N == 0)
      break;

    int gems_pos[21][2];
    for (int i=0; i<N; i++) {
      cin >> gems_pos[i][0];
      cin >> gems_pos[i][1];
    }

    int M;
    cin >> M;
    int count = 0;
    int x = 10;
    int y = 10;
    
    for (int i=0; i<M; i++) {
      char c;
      int diff;

      cin >> c;
      cin >> diff;

      int des_x = x;
      int des_y = y; 
      
      switch (c) {
      case 'N':
	des_y += diff;
	break;
      case 'S':
	des_y -= diff;
	break;
      case 'E':
	des_x += diff;
	break;
      case 'W':
	des_x -= diff;
	break;
      }

      // debug
      // printf("x:%d y:%d\n", des_x, des_y);
      
      for (int i=0; i<N; i++) {
	if (((x <= gems_pos[i][0] &&
	     gems_pos[i][0] <= des_x) ||
	    (des_x <= gems_pos[i][0] &&
	     gems_pos[i][0] <= x)) &&
	    ((y <= gems_pos[i][1] &&
	     gems_pos[i][1] <= des_y) ||
	    (des_y <= gems_pos[i][1] &&
	     gems_pos[i][1] <= y)))  {
	  count++;
	  // printf("found\n");
	  gems_pos[i][0] = -1;
	}
      }

      x = des_x;
      y = des_y;
    }

    if (count == N) {
      puts("YES");
    } else {
      puts("NO");
    }
  }
  
}