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 main()
{
	int N;
	int M;
	int x[20];
	int y[20];
	int flag[20][20] = {};
	char d;
	int l;

	while (cin >> N && N != 0)
	{
		int initX = 10;
		int initY = 10;
		int cnt = 0;

		for (int i = 0; i < N; i++)
		{
			cin >> x[i];
			cin >> y[i];
			flag[y[i]][x[i]] = 1;
		}

		cin >> M;

		for (int i = 0; i < M; i++)
		{
			cin >> d;
			cin >> l;
			int dx = 0;
			int dy = 0;

			for (int k = 0; k <= l; k++)
			{
				if (d == 'S' || d == 'W')
				{
					if (d == 'S')
					{
						for (int j = 0; j < N; j++)
						{
							if (x[j] == initX && y[j] == initY - k && flag[y[j]][x[j]] == 1)
							{
								cnt++;
								flag[y[j]][x[j]] = 0;
							}
						}
					}
					else
					{
						for (int j = 0; j < N; j++)
						{
							if (x[j] == initX - k && y[j] == initY && flag[y[j]][x[j]] == 1)
							{
								cnt++;
								flag[y[j]][x[j]] = 0;
							}
						}
					}
				}
				else
				{
					if (d == 'N')
					{
						for (int j = 0; j < N; j++)
						{
							if (x[j] == initX && y[j] == initY + k && flag[y[j]][x[j]] == 1)
							{
								cnt++;
								flag[y[j]][x[j]] = 0;
							}
						}
					}
					else
					{
						for (int j = 0; j < N; j++)
						{
							if (x[j] == initX + k && y[j] == initY && flag[y[j]][x[j]] == 1)
							{
								cnt++;
								flag[y[j]][x[j]] = 0;
							}
						}
					}
				}
			}
			if (d == 'S' || d == 'W')l = -l;
			if (d == 'S' || d == 'N')dy = l;
			if (d == 'W' || d == 'E')dx = l;

			initX += dx;
			initY += dy;
		}
		if (cnt == N)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}

	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a[21][21] = {};
	int n;
	int x, y;
	while (cin >> n&&n != 0) {
		for (int i = 0; i < n; i++) {
			cin >> y >> x;
			a[y][x] = 1;
		}
		int m;
		x = 10, y = 10;
		int count = 0;
		int num;
		char c;
		cin>>m;
		for (m--) {
			cin >> c >> num;
			for (int i = 0; i < num; i++) {
				if (c == 'N')y++;
				else if (c == 'E')x++;;
				else if (c == 'S')y--;
				else x--;
				if (a[y][x]) {
					count++;
					a[y][x] = 0;
				}
			}

		}
		if (count == n)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int dx[512]={0};
	int dy[512]={0};
	dy['N']=1;
	dy['S']=-1;
	dx['E']=1;
	dx['W']=-1;
	int n;
	while(cin>>n,n){
		int mp[21][21]={0};
		for(int i=0;i<n;i++){
			int x,y;
			cin>>x>>y;
			mp[x][y]=1;
		}
		int m;
		cin>>m;
		
		int X=10,Y=10;
		for(int i=0;i<m;i++){
			int l;
			char c;
			cin>>c>>l;
			for(int j=0;j<l;j++){
				X+=dx[c];
				Y+=dy[c];
				if(mp[X][Y]){
					mp[X][Y]=0;
					n--;
				}
			}
		}
		if(n)cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	return 0;
}

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

int main(){
	int robo[2];
	int n,m,h;//nは宝石の数
	char com;
	refrain:
	scanf("%d",&n);
	if(n==0) return 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");
			goto refrain;
		}
	}
	printf("No\n");
	goto refrain;
}

C++: #include <iostream>
#include <memory.h>
#include <cstdio>
using namespace std;
int main(){
  int i,n,m,l,x,y,a[21][21];
  char d;
  while(1){
    cin>>n;
    if(!n)
      break;
    memset(a,0,sizeof(a));
    for(i=0;i<n;i++){
      scanf("%d %d",&x,&y);
      a[x][y]=1;
    }
    x=y=10;
    scanf("%d",&m);
    while(m--){
      cin>>d>>l;
      if(d=='N'){
	for(i=0;i<l;i++){
	  y++;
	  if(a[x][y]){
	    a[x][y]=0;
	    n--;
	  }
	}
      }
      else if(d=='E'){
	for(i=0;i<l;i++){
	  x++;
	  if(a[x][y]){
	    a[x][y]=0;
	    n--;
	  }
	}
      }
      else if(d=='S'){
	for(i=0;i<l;i++){
	  y--;
	  if(a[x][y]){
	    a[x][y]=0;
	    n--;
	  }
	}
      }
      else{
	for(i=0;i<l;i++){
	  x--;
	  if(a[x][y]){
	    a[x][y]=0;
	    n--;
	  }
	}
      }
    }
    if(!n)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}

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

int main(void) {
	int n, x, y, m, i;
	char d;
	while (true)
	{
		int cnt = 0;
		int fx = 10;
		int fy = 10;
		int fld[21][21] = { 0 };

		cin >> n;
		if (n == 0) break;
		for (int j = 0; j < n; j++) {
			cin >> x >> y;
			fld[x][y] = 1;
		}
		cin >> m;
		for (int j = 0; j < m; j++) {
			cin >> d >> i;
			for (int k = 0; k < i; k++) {
				switch (d) {
				case 'N':
					if (fld[fx][++fy] == 1) cnt++;
					break;
				case 'E':
					if (fld[++fx][fy] == 1) cnt++;
					break;
				case 'S':
					if (fld[fx][--fy] == 1) cnt++;
					break;
				case 'W':
					if (fld[--fx][fy] == 1) cnt++;
					break;
				default:
					break;
				}
				fld[fx][fy] = 0;
			}
		}
		if (cnt == n) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}