Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"reflect"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func scanBoard() [][]int {
	ret := make([][]int, 8)
	for k := range ret {
		ret[k] = make([]int, 8)
		for l := range ret[k] {
			ret[k][l] = 0
		}
	}
	for i := 0; i < 8; i++ {
		scanner.Scan()
		row := strings.Split(scanner.Text(), "")
		if reflect.DeepEqual(row, []string{}) {
			break
		}
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

var emptyBoard = [][]int{{0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
						 {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0},
	                     {0,0,0,0,0,0,0,0}}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, emptyBoard) {
			break
		}
		// fmt.Println(board)
		for i := 0; i < 7; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i][j+1] == 1 && board[i+1][j+1] == 1 {
					ans = "A"
				}
			}
		}
		for i := 0; i < 5; i++ {
			for j := 0; j < 8; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i+2][j] == 1 && board[i+3][j] == 1 {
					ans = "B"
				}
			}
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 5; j++ {
				if board[i][j] == 1 && board[i][j+1] == 1 && board[i][j+2] == 1 && board[i][j+3] == 1 {
					ans = "C"
				}
			}
		}
		for i := 0; i < 6; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j+1] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 && board[i+2][j] == 1 {
					ans = "D"
				}
			}
		}
		for i := 0; i < 7; i++ {
			for j := 0; j < 6; j++ {
				if board[i][j] == 1 && board[i][j+1] == 1 && board[i+1][j+1] == 1 && board[i+1][j+2] == 1 {
					ans = "E"
				}
			}
		}
		for i := 0; i < 7; i++ {
			for j := 0; j < 6; j++ {
				if board[i][j+1] == 1 && board[i][j+2] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 {
					ans = "G"
				}
			}
		}
		for i := 0; i < 6; i++ {
			for j := 0; j < 7; j++ {
				if board[i][j] == 1 && board[i+1][j] == 1 && board[i+1][j+1] == 1 && board[i+2][j+1] == 1 {
					ans = "F"
				}
			}
		}
		fmt.Println(ans)
	}
}

C++: #include <cstdio>

using namespace std;

int answer[] = {18, 48, 6, 30, 20, 34, 16};

int main() {
	int i, t, sum;
	char line[10];
	char c, a;

	while(true) {
		t = -1, sum = 0;
		for(i = 0; i < 64; i++) {
			c = getchar();
			if(c == EOF) return 0;
			if(c == '1') {
				if(t == -1) t = i;
				sum += i - t;
			}
			if(i % 8 == 7) getchar();
		}
		getchar();
		for(i = 0; i < 7; i++) {
			if(answer[i] == sum)
			a = 'A' + i;
		}
		printf("%c\n", a);
	}

	return 0;
}

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

using namespace std;

#define ROW 8
#define COLUMN 8

#define INSIDE_INDEX( x1 , y1 ) ( (x1 >= 0 && x1 < ROW) && (y1 >= 0 && y1 < COLUMN) )

void get_answer( string *matrix_str , char& ans );
bool get_ans( string *matrix_str , int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4 );

int main(void)
{
	string matrix_str[ROW+3];
	char c;

	while(1)
	{
		char ans = '0';
		int flag = 0; // 二重ループ脱出用
		for( int i = 0 ; i < COLUMN ; i++ )
		{
			cin >> matrix_str[i];
			if( cin.eof() )
			{
				flag = 1;
				break;
			}
		}
		if( flag == 1 )
		{
			break;
		}
		get_answer( matrix_str , ans );
		cout << ans << endl;
	}

	return 0;
}

void get_answer( string *matrix_str , char& ans )
{
	for( int i = 0 ; i < ROW ; i++ )
	{
		for( int j = 0 ; j < COLUMN ; j++ )
		{
			if( get_ans( matrix_str ,  j ,  i ,  j+1 ,  i ,  j ,  i+1 ,  j+1 ,  i+1 ) )
			{
				ans = 'A';
			}

			if( get_ans( matrix_str , j , i , j , i+1 , j , i+2 , j , i+3 ) )
			{
				ans = 'B';
			}

			if( get_ans( matrix_str , j , i , j+1 , i , j+2 , i , j+3 , i ) )
			{
				ans = 'C';
			}

			if( get_ans( matrix_str , j , i , j-1 , i+1 , j , i+1 , j-1 , i+2 ) )
			{
				ans = 'D';
			}

			if( get_ans( matrix_str , j , i , j+1 , i ,  j+1 , i+1 , j+2 , i+1) )
			{
				ans = 'E';
			}

			if( get_ans( matrix_str , j , i , j , i+1 , j+1 , i+1 , j+1 , i+2) )
			{
				ans = 'F';
			}

			if( get_ans( matrix_str , j , i , j+1 , i , j-1 , i+1 , j , i+1 ) )
			{
				ans = 'G';
			}
		}
	}
}

bool get_ans( string *matrix_str , int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4 )
{
	if( INSIDE_INDEX( x1 , y1 ) && INSIDE_INDEX( x2 , y2 ) && INSIDE_INDEX( x3 , y3 ) && INSIDE_INDEX( x4 , y4 ) )
	{
		if( matrix_str[y1].at(x1) == '1' &&
			matrix_str[y2].at(x2) == '1' &&
			matrix_str[y3].at(x3) == '1' &&
			matrix_str[y4].at(x4) == '1' )
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		return false;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
string str[8]; 
void ans(int i,int k){
	if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k] == '1' ){
		cout << "A" << endl;  
		} else if(str[i+1][k] == '1' && str[i+2][k] == '1'&& str[i+3][k] == '1' ){
		cout << "B" << endl; 
		} else if(str[i][k+1] == '1' && str[i][k+2] == '1'&& str[i][k+3] == '1' ){
		cout << "C" << endl;  
		} else if(str[i+1][k] == '1' && str[i+1][k-1] == '1'&& str[i+2][k-1] == '1' ){
		cout << "D" << endl; 
		} else if(str[i][k+1] == '1' && str[i+1][k+1] == '1'&& str[i+1][k+2] == '1' ){
		cout << "E" << endl; 
		} else if(str[i+1][k] == '1' && str[i+1][k+1] == '1'&& str[i+2][k+1] == '1' ){
		cout << "F" << endl;  
		} else if(str[i][k+1] == '1' && str[i+1][k] == '1'&& str[i+1][k-1] == '1' ){
		cout << "G" << endl; 
		}

}

int main(){
	
	while(1){
	
	for(int i =0;i<8;i++)
	if(!(cin>>str[i]))return 0;
	
	
	for(int i=0;i<64;i++)
	if(str[i/8][i%8] == '1')
	ans(i/8,i%8);
	break;

	
	}
	
}

C++: #include <iostream>

using namespace std;
int main()
{
  string a[8];
  for(;cin>>a[0];)
    {
      for(int i=1;i<8;i++)
	cin>>a[i];
      char n='X';
      for(int i=0;i<8;i++)
	for(int j=0;j<8;j++)
	  if(a[i][j]=='1')
	    {
	      if(i<7&&j<7&&a[i][j+1]=='1' &&a[i+1][j]=='1' &&a[i+1][j+1]=='1')
		n='A';
	      else if(i<5&&a[i+1][j]=='1' &&a[i+2][j]=='1' &&a[i+3][j]=='1')
		n='B';
	      else if(j<5&&a[i][j+1]=='1' &&a[i][j+2]=='1' &&a[i][j+3]=='1')
		n='C';
	      else if(i>1&&j<6&&a[i][j+1]=='1' &&a[i-1][j+1]=='1' &&a[i-1][j+2]=='1')
		n='D';
	      else if(i<7&&j<6&&a[i][j+1]=='1' &&a[i+1][j+1]=='1' &&a[i+1][j+2]=='1')
		n='E';
	      else if(i<6&&j<7&&a[i+1][j]=='1' &&a[i+1][j+1]=='1' &&a[i+2][j+1]=='1')
		n='F';
	      
	      if(n!='X')
		break;
	    }
      if(n=='X')
	n='G';
      cout<<n<<endl;

    }
}

C++: #include <iostream>

using namespace std;


int main(){

	char c, ans;
	bool p[10][11];



	while (1){
		ans = '-';

		for (int i = 0; i < 10; i++){
			for (int j = 0; j < 11; j++){
				p[i][j] = 0;
			}
		}

		for (int i = 0; i < 8; i++){
			for (int j = 0; j < 8; j++){
				cin >> c;
				p[i][j + 1] = c - '0';
			}
		}

		if (cin.eof())break;


		for (int i = 0; i < 8; i++){
			for (int j = 0; j < 8; j++){
				if (p[i][j + 1] == 1){
					if (p[i][j + 3] == 1) ans = 'C';
					else if (p[i + 2][j + 1] == 1) ans = 'B';
					else if (p[i + 2][j] == 1) ans = 'D';
					else if (p[i + 1][j + 3] == 1) ans = 'E';
					else if (p[i + 2][j + 2] == 1) ans = 'F';
					else if (p[i + 1][j] == 1) ans = 'G';
					else if (p[i + 1][j + 2] == 1) ans = 'A';
				}
				if (ans != '-')break;
			}
			if (ans != '-')break;
		}

		cout << ans << endl;
	}


	return 0;
}

C++: #include<iostream>
#include<vector>
#define MAX  999999
bool prime[MAX];
using namespace std;

int main(void){
  int n ;
  
  vector<int> dp(0,0);
  //isPrime();

  fill(prime,prime+MAX,true);
  int cnt = 0;
  prime[0]=prime[1]=false;
  for(int i = 2 ; i < MAX ; i ++){
    if(prime[i]){
      cnt += i;
      for(int j = 2 ; j * i < MAX ; j ++){
        prime[i*j] = false;
      }
    dp.push_back(cnt);
    }
  }  
  
  
  while(cin>>n,n)
  cout<<dp[n-1]<<endl;
}