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;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
void syori(int a[21][21],int i,int j,int r,int *n)
{
   if(a[i][j]) {
      *n -=a[i][j];
      a[i][j]=0;
   }
}
int main()
{
   int i,j,k,l;
   int o;
   int cnt=1;
   int x;
   int y;
   int c,r;
   static int a[21][21];
   static int judge[10000];
   int n,m;
   for(o=0;;o++) {
      scanf("%d",&n);
      if(n==0)
         break;
      for(i=0;i<n;i++) {
         scanf("%d %d",&x,&y);
         a[x][y]++;
      }
      scanf("%d",&m);
      i=10;j=10;
      for(k=0;k<m;k++) {
         scanf("%c %d",&c,&r);
         if(c == 'N') {
            for(l=0;l<r;l++) {
               j++;
               syori(a,i,j,r,&n);
            }
         }
         else if(c == 'E') {
            for(l=0;l<r;l++) {
               i++;
               syori(a,i,j,r,&n);
            }
         }
         else if(c == 'S') {
            for(l=0;l<r;l++) {
               i--;
               syori(a,i,j,r,&n);
            }
         }
         else if(c == 'W') {
            for(l=0;l<r;l++) {
               j--;
               syori(a,i,j,r,&n);
            }
         }
      }
      printf("n=%d\n",n);
      if(n==0)
         judge[o]=1;
   }
   for(i=0;i<o;i++) {
      if(judge[i])
         printf("Yes\n");
      else 
         printf("No\n");
   }
   return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
 
using namespace std;
 
int g[20][20];
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
 
int main(void){
 
    int n,m;
    map<char,int>dd;
    dd['N']=0;
    dd['E']=1;
    dd['S']=2;
    dd['W']=3;
 
    while(cin >> n,n){
        fill(g[0],g[20],0);
 
        for(int i=0;i<n;i++){
            int x,y;
            cin >> x >> y;
            g[y][x]=1;
        }
 
        cin >> m;
        int x=10,y=10;
        g[y][x]=0;
        for(int i=0;i<m;i++){
            char dir;
            int dis;
            cin >> dir >> dis;
            for(int k=0;k<dis;k++){
                x+=dx[dd[dir]],y+=dy[dd[dir]];
                g[y][x]=0;
            }
        }
 
        bool fg=true;
        for(int i=0;i<20;i++)
            for(int j=0;j<20;j++)
                fg&=(g[i][j]==0);
 
        if(fg)cout << "Yes" << endl;
        else cout << "No" << endl;
    }
 
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<bitset>
#include<map>
using namespace std;

struct P{
  int x,y;
};

vector<P> list;
int input(){
  int N;
  cin>>N;
  list.clear();
  if(N==0)return false;
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    list.push_back(P{a,b});
  }
  return true;
}

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

bool solve(){
  int M;
  cin>>M;
  P r=P{10,10};
  vector<int> use;
  use.resize(list.size());
  for(int i=0;i<use.size();i++){
    use[i]=0;
  }
  for(int i=0;i<M;i++){
    char c;
    int d;
    cin>>c>>d;
    int v;
    switch(c){
      case 'N':
        v=0;
        break;
      case 'E':
        v=1;
        break;
      case 'S':
        v=2;
        break;
      case 'W':
        v=3;
        break;
    }
    int xx = r.x + vx[v]*d;
    int yy = r.y + vy[v]*d;
    for(int j=0;j<list.size();j++){
      if((yy==r.y&&((r.x<=list[j].x&&list[j].x<=xx&&list[j].y==yy)||(xx<=list[j].x&&list[j].x<=r.x&&list[j].y==yy)))
          ||(xx==r.x&&((r.y<=list[j].y&&list[j].y<=yy&& list[j].x==xx)||(yy<=list[j].y&&list[j].y<=r.y&&list[j].x==xx)))){
        use[j]=true;
      }
    }
    r.x = xx;
    r.y = yy;
  }
  for(int i=0;i<use.size();i++){
    if(!use[i])return false;
  }
  return true;
}


int main(){
  while(input()){
    if(solve()){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}

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;
					}
				}
			}
		}
		s=0;
		for(int i=0;i<n;i++){
			s=s+a[i];
		}
		if(s==0){
			cout<<"Yes"<<endl;
		} else{
			cout<<"No"<<endl;
		}
	}
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
	int robo[2];
	int n,m,h;//nは宝石の数
	char com;
	scanf("%d",&n);
	while(n!=0){
		robo[0]=10;	 robo[1]=10;//ロボットの初期位置(x,y)
		int houseki[n][2],tn=n;//tn==0でクリア
		for(int i=0;i<n;i++){
			scanf("%d %d",&houseki[i][0],&houseki[i][1]);//宝石の位置(x,y)
		}
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			scanf(" %c %d",&com,&h);
			if(com=='N'){//y軸方向+の移動
				for(int j=0;j<n;j++){
					if(houseki[j][0]==robo[0]){
						if(robo[1]<houseki[j][1]&&robo[1]+h>=houseki[j][1]){//通った判定
							tn--;
							houseki[j][0]=-1;
							houseki[j][1]=-1;
						}
					}
				}
				robo[1]+=h;
			}
			else if(com=='S'){//y軸方向-の移動
				for(int j=0;j<n;j++){
					if(houseki[j][0]==robo[0]){
						if(robo[1]>houseki[j][1]&&robo[1]-h<=houseki[j][1]){//通った判定
							tn--;
							houseki[j][0]=-1;
							houseki[j][1]=-1;
						}
					}
				}
				robo[1]-=h;
			}	
			else if(com=='E'){//x軸方向+の移動
				for(int j=0;j<n;j++){
					if(houseki[j][1]==robo[1]){
						if(robo[0]<houseki[j][0]&&robo[0]+h>=houseki[j][0]){//通った判定
							tn--;
							houseki[j][0]=-1;
							houseki[j][1]=-1;
						}
					}
				}
				robo[0]+=h;
			}
			else if(com=='W'){//x軸方向-の移動
				for(int j=0;j<n;j++){
					if(houseki[j][1]==robo[1]){
						if(robo[0]>houseki[j][0]&&robo[0]-h<=houseki[j][0]){//通った判定
							tn--;
							houseki[j][0]=-1;
							houseki[j][1]=-1;
						}
					}
				}
				robo[0]-=h;
			}
			if(tn<=0){
				printf("Yes\n");
				break;
			}
		}
		if(tn>0)	printf("No\n");
		scanf("%d",&n);
	}
	return 0;
}