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<stdio.h>
#include<stdlib.h>

int main()
{
	while(1)
	{
		int N,M,JUDGE,judge[20][2],jposi1,jposi2,rposi;
		char move1[2];
		int move2;
		JUDGE=1;
		rposi=220;
		
		scanf("%d",&N);//何個あるか
		if(N!=0)
		{
			for(int i=0;i<N;i++)
			{
				scanf("%d",&jposi1);
				scanf("%d",&jposi2);
				judge[i][0]=21*jposi2+jposi1;
				judge[i][1]=0;
			}
			scanf("%d",&M);//何回動くか
			for(int i=0;i<M;i++)
			{
				scanf("%s",&move1[0]);
				scanf("%d",&move2);
				for(int t=0;t<move2;t++)
				{
					switch(move1[0])
					{
					case 'N':
						rposi+=21;
						break;
					case 'S':
						rposi-=21;
						break;
					case 'E':
						rposi+=1;
						break;
					case 'W':
						rposi-=1;
						break;
					}
					for(int j=0;j<N;j++)
					{
						if(rposi==judge[j][0]) judge[j][1]=1;
					}
				}
			}
			for(int i=0;i<M;i++)
			{
				if(judge[i][1]==0) JUDGE=0;
			}
			if(JUDGE) printf("Yes\n");
			else printf("No\n");
		}
		else break;
	}
}

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

int main(){

  while(1){

    int N, M, l[30], tre[21][21] = {0}, x[30], y[30], xx = 10, yy = 10, cnt = 0;
    char d[30];

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

    for(int i = 0; i < N; i++){
      cin >> x[i] >> y[i];
      tre[x[i]][y[i]] = 1;
    }
    
    cin >> M;
    
    for(int i = 0; i < M ; i++){
      cin >> d[i] >> l[i];
      if(d[i] == 'N'){
	for(int n = 0; n < l[i]; n++){
	  yy+=1;
	  if(tre[xx][yy] == 1) tre[xx][yy] = 3;
	  //  cout << xx << yy << endl;
	}
      }else if(d[i] == 'S'){
	for(int n = 0; n < l[i]; n++){
	  yy-=1;
	  if(tre[xx][yy] == 1) tre[xx][yy] = 3;
	}
      }
      else if(d[i] == 'E'){
	for(int n = 0; n < l[i]; n++){
	  xx+=1;
	  if(tre[xx][yy] == 1) tre[xx][yy] = 3;
	  // cout << xx << yy << endl;
	}
      }
      else if(d[i] == 'W'){
	for(int n = 0; n < l[i]; n++){
	  xx-=1;
	  if(tre[xx][yy] == 1) tre[xx][yy] = 3;
	  
	}
      }
    }
    for(int i = 0; i < 21; i++){
      for(int j = 0; j < 21; j++){
	//	if(tre[i][j] == 3) cnt++;
	if(tre[i][j] == 3) cnt++;
      }
    }
       if(cnt == N) cout << "Yes" << endl;
    else cout << "No" << endl;
    //    cout << cnt << endl;
  }

  return 0;
}

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

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])
	    n--;
	}
      }
      else if(d=='E'){
	for(i=0;i<l;i++){
	  x++;
	  if(a[x][y])
	    n--;
	}
      }
      else if(d=='S'){
	for(i=0;i<l;i++){
	  y--;
	  if(a[x][y])
	    n--;
	}
      }
      else{
	for(i=0;i<l;i++){
	  x--;
	  if(a[x][y])
	    n--;
	}
      }
    }
    if(!n)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int N, i, j;
	while( 1 ){
		cin >> N;
		if( N == 0 ) break;
		int x, y;
		pair<int, int> robot = make_pair(10,10);
		int map[21][21] = {{}};
		for( i = 0; i < N; i++ ){
			cin >> x >> y;
			map[x][y] = 1;
		}
		int M;
		cin >> M;
		char news;
		int dist;
		for( i = 0; i < M; i++ ){
			cin >> news >> dist;
			for( j = 0; j < dist; j++ ){
				if( news == 'N' ) robot.second += 1;
				if( news == 'E' ) robot.first += 1;
				if( news == 'W' ) robot.first -= 1;
				if( news == 'S' ) robot.second -= 1;
				if( map[robot.first][robot.second] ) map[robot.first][robot.second] = 0;
			}
		}
		for( i = 0; i <= 20; i++ ){
			for( j = 0; j <= 20; j++ ){
				if( map[i][j] == 1 ) goto end;
			}
		}
		end:
		if( i == 21 && j == 21 ) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

C++: #include <iostream>

using namespace std;

int main() {
	int n;
	while (cin >> n&& n!=0) {
		int f[21][21] = {};

		for (int i = 0; i<n; i++) {
			int x, y;
			cin >> x >> y;
			f[y][x] = 1;
		}

		int x = 10, y = 10;
		int cnt = 0;

		int m;
		cin >> m;
		for (int i = 0; i<m; i++) {
			char dir;
			int step;
			cin >> dir >> step;
			while (step--) {
				if (dir == 'N') { y++; }
				else if (dir == 'S') { y--; }
				else if (dir == 'E') { x++; }
				else { x--; }

				if (f[y][x]) {
					f[y][x] = 0;
					cnt++;
				}
			}
		}

		if (cnt == n) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
 int a,b,i,f,r;bool c[21][21];char ch;
 while(cin>>i,i){
  memset(c,0,sizeof(c));
  while(i--)cin>>a>>b,c[a][b]=1;
  cin>>i,a=b=10,c[a][b]=0;
  while(i--){
   cin>>ch>>f;
   while(f--){
    switch (ch) {
     case 'N':b++;break;
     case 'E':a++;break;
     case 'S':b--;break;
     case 'W':a--;break;
    }
    c[a][b]=0;
   }
  }
  a=b=20,f=0;
  while(a--)for(r=0;r<21;r++)if(c[a][r])f++;
  cout<<(f?"No":"Yes")<<endl;
 }
}