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>
int main()
{
	int x,y,N,M,i,j,l,z[]={0,1,0,-1,0};
	char d;
	while(scanf("%d",&N),N)
	{
		int a[21][21]={0};
		for(i=0;i<N;++i)scanf("%d%d",&x,&y),a[y][x]=1;
		x=y=10;
		for(scanf("%d",&M),i=0;i<M;++i)
		{
			scanf(" %c%d",&d,&l);
			if(d=='E')d=0;
			if(d=='N')d=1;
			if(d=='S')d=3;
			if(d=='W')d=2;
			for(j=0;j<l;++j)if(a[y+=z[d]][x+=z[d+1]])a[y][x]=0,--N;
		}
		puts(N?"No":"Yes");
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int nextInt(){int a;cin>>a;return a;}

int main(){
  int n,m,onum,count;
  char c;
  vector<pair<int,int>> mp;
  vector<int> juel;
  int robx,roby;

  while(cin>>n){
    if(!n)break;
    
    mp.resize(n);
    juel.resize(n,1);
    REP(i,n){
      mp[i].first = nextInt();
      mp[i].second = nextInt();
    }
    cin >> m;
    robx = 10;roby = 10;count = 0;
    REP(i,m){
      cin >> c >> onum;
      REP(j,onum){
	if(c=='N')roby++;
	else if(c=='S')roby--;
	else if(c=='E')robx++;
	else if(c=='W')robx--;
	REP(k,n){
	  if(robx==mp[k].first && roby==mp[k].second){
	    count += juel[k];
	    juel[k]=0;
	  }
	}
      }
    }
    if(count==n)cout << "Yes" << endl;
    else cout << "No" << endl;
    juel.clear();
    mp.clear();
  }
  
  return 0;
}

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

using namespace std;


int n,cnt,x,y,t;
int fie[25][25];

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		cnt=0;
		memset(fie,0,sizeof(fie));
		for(int i=0;i<n;i++){
			scanf("%d %d",&x,&y);
			fie[x][y]=1;
		}
		x=10,y=10;
		if(fie[x][y]==1){
			fie[x][y]=0;
			cnt++;
		}
		scanf("%d",&t);
		for(int i=0;i<t;i++){
			string str;
			int d;
			cin >> str >> d;
			for(int j=0;j<d;j++){
				if(str=="N")y++;
				if(str=="E")x++;
				if(str=="W")x--;
				if(str=="S")y--;
				if(fie[x][y]==1){
					fie[x][y]=0;
					cnt++;
				}
			}
		}
		printf("%s\n",cnt==n?"Yes":"No");
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	while(cin>>n,n){
		bool dia[41][41]={};
		for(int i=0,x,y;i<n;i++){
			cin>>x>>y;
			dia[y][x]=1;
		}
		int mo;
		cin>>mo;
		string di="NESW";
		int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
		for(int i=0,num,x=10,y=10;i<mo;i++){
			char direction;
			cin>>direction>>num;
			for(int j=0;j<4;j++){
				if(direction==di[j]){
					for(int k=0;k<num;k++){
						x+=dx[j];
						y+=dy[j];
						if(dia[y][x]==true){
							dia[y][x]=false;
							n--;
						}
					}
					break;
				}
			}
		}
		if(n==0)cout<<"Yes\n";
		else cout<<"No\n";
	}
}

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

inline int my_popcount(unsigned x)
{
	x=(x&0x55555555)+(x>>1&0x55555555);
	x=(x&0x33333333)+(x>>2&0x33333333);
	x=(x&0x0f0f0f0f)+(x>>4&0x0f0f0f0f);
	x=(x&0x00ff00ff)+(x>>8&0x00ff00ff);
	return (x&0x0000ffff)+(x>>16&0x0000ffff);
}

int main()
{
	constexpr LOOP=1000000000;
	int sum=0; // ループが削除されてしまわないようにする
	for(int i=0;i<LOOP;i++)
		sum+=__builtin_popcount(i);
		//sum+=my_popcount(i);
	printf("%d\n",sum);
}

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

int main(void)
{

	int n;
	int x1,y1;
	int m;
	char c;
	int l;

	int i,j;

	int f[20][20];

	int x,y;

	int count;


	while(1){

		for (i=0;i<20;i++) {
			for( j=0;j<20;j++){
				f[i][j] = 0;

	//			cout << f[i][j] << " ";
			}
	//		cout << endl;
		}

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


		for(i=0;i<n;i++){

			cin >> x1;
			cin >> y1;
			
			f[y1-1][x1-1] = 1;

		}


		cin >> m;


		x = 9;
		y = 9;
		count = 0;

		for(i=0;i<m;i++){
			cin >> c;
			cin >> l;

			for(j=0;j<l;j++){

				if(c == 'N') y++;
				if(c == 'S') y--;
				if(c == 'E') x++;
				if(c == 'W') x--;

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

		if(count == n) cout << "Yes" << endl;
		else cout << "No" << endl;



	}

	return 0;
}

C++: #include <iostream>
using namespace std;
#define rep(i,n)for(int i = 0 ; i < n ; i++)
#define MAX 20

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

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

    int m;
    cin >> m;
    int rpx = 10, rpy = 10;

    for(int i = 0 ; i < m ; i++){
      char d;
      int l;
      cin >> d >> l;
      int dx = 0, dy = 0;
      if(d == 'N'){
	dy = -1;
      }else if(d == 'E'){
	dx = 1;
      }else if(d == 'S'){
	dy = -1;
      }else if(d == 'W'){
	dx = -1;
      }

      for(int i = 0 ; i < l ; i++){
	rpx += dx;
	rpy += dy;
	for(int j = 0 ; j < n ; j++){
	  if(rpx == x[j] && rpy == y[j]){
	    x[j] = y[j] = -1;
	  }
	}
      }
    }
      bool tf = true;
      rep(i,n){
	if(x[i] != -1){
	  cout << "No" << '\n';
	  tf = false;
	  break;
	}
      }
      if(tf){
	cout << "yes" << '\n';
      }
  }
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define MAX_N 23
#define MAX_M 33

int N,M,x,y;
bool a;
bool field[21][21];
char dir[MAX_M];
int dis[MAX_M];

bool input(){
  x=10;
  y=10;
  a=false;
  REP(i,22){
    REP(j,22){
      field[i][j]=false;
    }
  }
  cin>>N;
  REP(i,N){
    int a,b;
    cin>>a>>b;
    field[a][b]=true;
  }
  if(N!=0){
   cin>>M;
   REP(i,M) cin>> dir[i]>>dis[i];
   }
  return(N!=0);
}

void solve(){
  REP(i,M){
    if(dir[i]=='N'){
      REP(j,dis[i])field[x][y+j]=false;
      y+=dis[i];
      }

    else if(dir[i]=='E'){
      REP(j,dis[i])field[x+j][y]=false;
      x+=dis[i];
      }
  
    else if(dir[i]=='S'){
      REP(j,dis[i])field[x][y-j]=false;
      y-=dis[i];
      }

    else{
      REP(j,dis[i])field[x-j][y]=false;
      x-=dis[i];
  }
  field[x][y]=false;  
  }

  REP(i,21){
    REP(j,21){

      if(field[i][j]){
        cout<<"No"<<endl;
        a=true;
        break;
      }
      if(a)break;
    }
  }
  if(a!=true)cout<<"Yes"<<endl;
}
int main(){
  while(input()){
    solve();
  }
  
  cout<<field[20][1];
return 0;
}