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;
#define MAX 21

int main()
{
    int n, m, x, y, i, j, dis, res;
    int gems[MAX][MAX];
    char dir;
    while (cin >> n, n) {
        for (i = 0; i < MAX; ++i)
            for (j = 0; j < MAX; ++j)
                gems[i][j] = 0;
        for (i = 0; i < n; ++i) {
            cin >> x >> y;
            gems[x][y] = 1;
        }
        x = y = 10;
        res = gems[x][y];
        cin >> m;
        for (i = 0; i < m; ++i) {
            cin >> dir >> dis;
            if (dir == 'N')
                for (j = 0; j < dis; ++j) {
                    res += gems[x][++y];
                    gems[x][y] = 0;
                }
            if (dir == 'E')
                for (j = 0; j < dis; ++j) {
                    res += gems[++x][y];
                    gems[x][y] = 0;
                }
            if (dir == 'S')
                for (j = 0; j < dis; ++j) {
                    res += gems[x][--y];
                    gems[x][y] = 0;
                }
            if (dir == 'W')
                for (j = 0; j < dis; ++j) {
                    res += gems[--x][y];
                    gems[x][y] = 0;
                }
        }
        if (res == n)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}

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

int n;
int x[100],y[100];
int m;
char s[30];int l;

int main(){
	int i,j;
	
	while( cin >> n ){
		if( !n )break;
		for( i = 0; i < n; i++ ){
			cin >> x[i] >> y[i];
		}
		
		int befx = 10, befy = 10;
		int nowx = 10, nowy = 10;
		bool flag[100] = {false};
		cin >> m;
		for( i = 0; i < m; i++ ){
			cin >> s >> l;
			if( s[0] == 'N' ){
				nowy += l;
				for( j = 0; j < n; j++ ){
					if( nowx == x[j] && befy <= y[j] && y[j] <= nowy )
						flag[j] = true;
				}
			}
			if( s[0] == 'S' ){
				nowy -= l;
				for( j = 0; j < n; j++ ){
					if( nowx == x[j] && nowy <= y[j] && y[j] <= befy )
						flag[j] = true;
				}
			}
			if( s[0] == 'E' ){
				nowx += l;
				for( j = 0; j < n; j++ ){
					if( nowy == y[j] && befx <= x[j] && x[j] <= nowx )
						flag[j] = true;
				}
			}
			if( s[0] == 'W' ){
				nowy -= l;
				for( j = 0; j < n; j++ ){
					if( nowy == y[j] && nowx <= x[j] && x[j] <= befx )
						flag[j] = true;
				}
			}
			befx = nowx;
			befy = nowy;
		}
		for( i = 0; i < n; i++ ){
			if( flag[i] == false )
				break;
		}
		if( i < n )
			cout << "No" << endl;
		else
			cout << "Yes" << endl;
	}
	return 0;
}

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

int main(){
    int N, M;
    int tr[21][21];
    while(true){
        scanf("%d", &N);
        if(N == 0) break;
        for(int i = 0; i <= 20; i++){
            fill(tr[i], tr[i] + 21, 0);
        }
        for(int i = 0; i < N; i++){
            int x, y;
            scanf("%d%d", &x, &y);
            tr[x][y] = 1;
        }
        scanf("%d", &M);
        int cnt = 0;
        int rx = 10, ry = 10;
        for(int i = 0; i < M; i++){
            char d; int s;
            scanf(" %c%d", &d, &s);
            int dx, dy;
            if(d == 'N'){
                dx = 0, dy = 1;
            }else if(d == 'E'){
                dx = 1, dy = 0;
            }else if(d == 'S'){
                dx = 0, dy = -1;
            }else{
                dx = -1, dy = 0;
            }
            while(s--){
                rx += dx;
                ry += dy;
                if(tr[rx][ry] == 1){
                    tr[rx][ry] = 0;
                    cnt += 1;
                }
            }
        }
        if(cnt == N){
            puts("Yes");
        }else{
            puts("No");
        }
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>

using namespace std;

int operate(int num, string way, int count, vector<vector<int>> stone_place, int& get_num, vector<int>& robot)
{
	if(way == "N"){
		for(int i = 0; i < num; i++){
			if(stone_place[i][0] == robot[0] && robot[1] <= stone_place[i][1] && stone_place[i][1] <= robot[1] + count){
				get_num += 1;
			}
		}
		robot[1] += count;
	}else if(way == "S"){
		for(int i = 0; i < num; i++){
			if(stone_place[i][0] == robot[0] && robot[1] - count <= stone_place[i][1] && stone_place[i][1] <= robot[1]){
				get_num += 1;
			}
		}
		robot[1] -= count;
	}else if(way == "E"){
		for(int i = 0; i < num; i++){
			if(stone_place[i][1] == robot[1] && robot[0] <= stone_place[i][0] && stone_place[i][0] <= robot[0] + count){
				get_num += 1;
			}
		}
		robot[0] += count;
	}else if(way == "W"){
		for(int i = 0; i < num; i++){
			if(stone_place[i][1] == robot[1] && robot[0] - count <= stone_place[i][0] && stone_place[i][0] <= robot[0]){
				get_num += 1;
			}
		}
		robot[0] -= count;
	}
	return 0;
}

int main(void)
{
	int num, step, get_num;
	vector<int> robot = { 10, 10 };

	while(1){
		cin >> num;
		if(num == 0)
			break;

		vector<vector<int>> stone_place;
		stone_place = vector<vector<int>>(num, vector<int>(2));
		for(int i = 0; i < num; i++){
			cin >> stone_place[i][0] >> stone_place[i][1];
		}

		cin >> step;
		for(int i = 0; i < step; i++){
			string way;
			int count;

			cin >> way >> count;
			operate(num, way, count, stone_place, get_num, robot);
		}
		
		if(get_num == num)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

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