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, 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;
				}
			}
		}
		if (cnt == n) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

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

int main()
{
	int n;
	while(cin >> n){
		if(!n)
			break;
		bool field[21][21];
		for(int i=0;i<21;i++){
			for(int j=0;j<21;j++){
				field[i][j] = false;
			}
		}
		int x,y;
		for(int i=0;i<n;i++){
			cin >> x >> y;
			field[y][x] = true;
		}
		int m;
		cin >> m;
		int count = 0;
		x = 10; y = 10;
		if(field[y][x] == true)
			count++;
		for(int i=0;i<m;i++){
			char h;
			int l;
			cin >> h >> l;
			switch(h){
				case 'N':
					for(int j=0;j<l;j++){
						y++;
						if(field[y][x]==true)
							count++;
					}
					break;
				case 'E':
					for(int j=0;j<l;j++){
						x++;
						if(field[y][x]==true)
							count++;
					}
					break;
				case 'S':
					for(int j=0;j<l;j++){
						y--;
						if(field[y][x]==true)
							count++;
					}
					break;
				case 'W':
					for(int j=0;j<l;j++){
						x--;
						if(field[y][x]==true)
							count++;
					}
					break;
			}
		}
		if(n == count)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int x = 10, y = 10, i, j;
	int n, X[10], Y[10], N, vn[10],flag;
	char dir[10];   //宝石個数n、移動回数N  
	while (1) {
		flag = 0;

		scanf_s("%d", &n);
		
		if (n == 0) {
			break;
		}
		for (i = 0; i < n; i++) {
			scanf_s("%d %d", &X[i], &Y[i]);
		}

		scanf("%d", &N);
		
		for (i = 0; i < N; i++) {
			scanf("%c %d", &dir[i], &vn[i]);
		}


		for (i = 0; i < n; i++) {
			for (j = 1; j <= vn[i]; j++) {
				if (dir[i] == 'N')
					y += 1;
				else if (dir[i] == 'E')
					x += 1;
				else if (dir[i] == 'S')
					y -= 1;
				else
					x -= 1;

				if (X[i] == x && Y[i] == y)
					flag += 1;



			}
			

		}
		if (flag == n)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

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

int main(void)
{
	int n,m; //宝の個数、移動回数
	int i; //for変数
	int math[21][21]; //宝の位置、ある場所は1,ない場所は0
	int x=10,y=10;
	int a,b; 
	char d; //方角
	int l; //移動量
	int count; //見つけた宝の数
	int yL=y,xL=x;
	
	for(;;)
	{
		scanf("%d",&n);
		if(n==0) break;
		for(a=0; a<21; a++)
		{
			for(b=0; b<21; b++)
			{
				math[a][b]=0;
			}
		}
		for(i=0; i<n; i++)
		{
			scanf("%d  %d",&a,&b);
			math[a][b]=1;
		}
		
		scanf("%d",&m);
		for(i=0; i<m; i++)
		{
			scanf("%s %d",&d,&l);
			if(d=='N')
			{
				yL+=l;
				for(; y<yL; y++)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
			}
			if(d=='E')
			{
				xL+=l;
				for(; x<xL; x++)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
			}
			if(d=='S')
			{
				yL-=l;
				for(; y>yL; y--)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
			}
			if(d=='W')
			{
				xL-=l;
				for(; x>xL; x--)
				{
					if(math[x][y]==1)
					{
						count+=1;
						math[x][y]=0;
					}
				}
			}
		}
		
		if(count!=n) printf("Yes\n");
		else printf("No\n");
	}
	
	return 0;
}

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

typedef pair<string, int> P;
int main() {
	int n;
	while(cin >> n && n){
		int x[20], y[20];
		for(int i = 0; i < n; ++i)
			cin >> x[i] >> y[i];
		int m;
		cin >> m;
		queue<P> q;
		string s;
		int d;
		for(int i = 0; i < n; ++i){
			cin >> s >> d;
			q.push(P(s, d));
		}
		int c = n, nowx = 10, nowy = 10;
		bool ca[20] = {false};
		while(!q.empty()){
			P p = q.front(); q.pop();
			for(int i = 0; i < p.second; ++i){
				string str = p.first;
				if(str == "N") nowy++;
				else if(str == "E") nowx++;
				else if(str == "S") nowy--;
				else if(str == "W") nowx--;
				
				for(int j = 0; j < n; ++j){
					if(nowx == x[j] && nowy == y[j] && !ca[j]){
						ca[j] = true;
						c--;
					}
				}
				
			}
		}
		if(c == 0)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int jewel[21][21]={0};
  int robot[21][21]={0};
  bool ans=true;
  int n;
  while(cin >>n,n){
    int pos_x=10,pos_y=10;
    for(int i=0;i<n;i++){
      int x,y;
      cin >> x >> y;
      jewel[x][y]=1;
    }
    int m;
    cin >> m;
    for(int i=0;i<m;i++){
    char d;
    cin >> d;
    int l;
    cin >> l;
    if(d=='N'){
      for(int j=0;j<l;j++){
        robot[pos_x][pos_y]=1;
        pos_y++;
        robot[pos_x][pos_y]=1;
      }
    }
    else if(d=='E'){
      for(int j=0;j<l;j++){
        robot[pos_x][pos_y]=1;
        pos_x++;
        robot[pos_x][pos_y]=1;
      }
    }
    else if(d=='S'){
      for(int j=0;j<l;j++){
        robot[pos_x][pos_y]=1;
        pos_y--;
        robot[pos_x][pos_y]=1;
      }
    }
    else{
      for(int j=0;j<l;j++){
        robot[pos_x][pos_y]=1;
        pos_x--;
        robot[pos_x][pos_y]=1;
      }
    }
  }
  for(int i=0;i<=20;i++){
    for(int j=0;j<=20;j++){
      if(jewel[i][j]==1){
        if(robot[i][j]==0) ans=false;
      }
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  jewel[21][21]={0};
  robot[21][21]={0};
  }
}