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(), "")
		for j := 0; j < 8; j++ {
			ret[i][j], _ = strconv.Atoi(row[j])
		}
	}
	return ret
}

func main() {
	for {
		var board [][]int
		var ans string
		if board = scanBoard(); reflect.DeepEqual(board, [][]int{}) {
			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 <iostream>
#include <string>
using namespace std;

int main(){
	int k, l, a[11][11] = {};
	string in[8], mm;
	while (true)
	{
		for (int i=0;i<8;i++){
			cin >> in[i];
		}
		if (cin.eof()) { break; }

		for (k = 0; k<8; k++) {
			for (l = 0; l<8; l++) {
				mm = in[k][l];
				a[k][l] = stoi(mm);
			}
		}
		for (k = 0; k<8; k++) {
			int z = false;
			for (l = 0; l<8; l++) {
				if(1 ==a[k][l]){
					z = true;
					break;
				}
			}
			if (z) { break; }
		}
		if (a[k + 3][l] == 1) { cout << "B" << endl; }
		else if (a[k][l+3] == 1) { cout << "C" << endl; }
		else if (a[k+1][l + 2] == 1) { cout << "E" << endl; }
		else if (a[k+2][l + 1] == 1) { cout << "F" << endl; }
		else if (a[k+1][l + 1] == 1) { cout << "A" << endl; }
		else if (a[k+2][l - 1] == 1) { cout << "D" << endl; }
		else { cout << "G" << endl; }
	}
return 0;
}

C++: #include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	char table[8][9];

	while(scanf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",table[0],table[1],table[2],table[3],table[4],table[5],table[6],table[7])!=EOF){
		getchar();
		bool FLG = false;
		for(int i=0; i < 8; i++){
			for(int k=0; k<8; k++){
				if(table[i][k] == '1'){
					if(i <= 6 && k <= 6 && table[i][k+1] == '1' && table[i+1][k] == '1' && table[i+1][k+1] == '1'){
						printf("A\n");
						FLG = true;
						break;
					}else if(i <= 4 && table[i+1][k] == '1' && table[i+2][k] == '1' && table[i+3][k] == '1'){
						printf("B\n");
						FLG = true;
						break;
					}else if(k <= 4 && table[i][k+1] == '1' && table[i][k+2] == '1' && table[i][k+3] == '1'){
						printf("C\n");
						FLG = true;
						break;
					}else if(i <= 5 && k >= 1 && table[i+1][k-1] == '1' && table[i+1][k] == '1' &&
							table[i+2][k-1] == '1'){
						printf("D\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 5 && table[i][k+1] == '1' && table[i+1][k+1] == '1' &&
							table[i+1][k+2] == '1'){
						printf("E\n");
						FLG = true;
						break;
					}else if(i <= 5 && k <= 6 && table[i+1][k] == '1' && table[i+1][k+1] == '1' &&
							table[i+2][k+1] == '1'){
						printf("F\n");
						FLG = true;
						break;
					}else if(i <= 6 && k <= 6 && k >= 1 && table[i][k+1] == '1' && table[i+1][k-1] == '1' &&
							table[i+i][k] == '1'){
						printf("F\n");
						FLG = true;
						break;
					}
				}
			}
			if(FLG)break;
		}

	}


	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;
}

C++: #include<bits/stdc++.h>
using namespace std;
char str[9][9];
int mx[4]={1,0,-1,0},my[4]={0,1,0,-1},moving[4];
void serch(int mo,int y,int x)
{
    for(int i=0;i<4;i++){
            if(str[my[i]+y][x+mx[i]]=='1'&&my[i]+y>=0&&my[i]+y<9&&mx[i]+x>=0&&mx[i]+x<9){
                str[my[i]+y][x+mx[i]]='0';
                moving[mo]=i;
                serch(mo+1,y+my[i],x+mx[i]);
            }

    }
}
int main()
{
    int co=0;
    while(cin>>str[0]){
        for(int i=1;i<8;i++)cin>>str[i];
        for(int i=0;i<8;i++){
            for(int j=0;j<8;j++){
                if(str[i][j]=='1'&&co==0){
                    str[i][j]='0';
                    serch(0,i,j);
                    co=1;
                    break;
                }
                else if(str[i][j]=='1'&&co==1){
                    co++;
                    cout<<"G"<<endl;
                }
            }
        }
        if(moving[0]==0&&co!=2){
            if(moving[1]==1){
                if(moving[2]==2)cout<<"A"<<endl;
                else cout<<"E"<<endl;
            }
            else cout<<"C"<<endl;
        }
        else if(moving[0]==2&&co!=2){
            if(moving[1]==0)cout<<"F"<<endl;
            else if(moving[1]==2)cout<<"B"<<endl;
            else cout<<"D"<<endl;
        }
        co=0;
    }
}

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

string M[8];

bool inF(int y, int x) {
  return 0<=x && x<8 && 0<=y && y<8;
}

int main() {

  while(cin>>M[0]) {
    for(int i=1; i<8; i++) cin >> M[i];
    
    char res = '#';
    
    for(int i=0; i<8; i++) {
      for(int j=0; j<8; j++) {
	if(M[i][j]-'0') {
	  
	  if(inF(i+1, j+1) && M[i+1][j+1]-'0') {
	    if(inF(i+2, j+1) && M[i+2][j+1]-'0') {
	      res = 'F'; goto end;
	    } else if(inF(i+1, j+2) && M[i+1][j+2]-'0') {
	      res = 'E'; goto end;
	    } else {
	      res = 'A'; goto end;
	    }
	  }
	  
	  if(inF(i+3, j) && M[i+3][j]-'0') {
	    res = 'B'; goto end;
	  }

	  if(inF(i, j+3) && M[i][j+3]-'0') {
	    res = 'C'; goto end;
	  }

	  if(inF(i-1, j+2) && M[i-1][j+2]-'0') {
	    res = 'D'; goto end;
	  }

	  if(inF(i+1, j-1) && M[i+1][j-1]-'0') {
	    res = 'G'; goto end;
	  }
	  
	}
      }
    }
    end:
    cout << res << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{

	while(1){
	
	char ret;
	string s;
	
	for(int i=0;i<8;i++){
		string s_tmp;
		if(scanf("%s", s) == EOF) return;
		s += s_tmp;
	}
	// 2次元配列を1次元的に処理
	for(int i=0;i<8*8;i++){
		if(s[i]=='1'){
			// Aかどうか
			if(s[i+1]=='1' && s[i+8]=='1' && s[i+9]=='1'){
				ret = 'A';
				break;
			}else if(s[i+8]=='1' && s[i+16]=='1' && s[i+24]=='1'){
				ret = 'B';
				break;
			}else if(s[i+1]=='1' && s[i+2]=='1' && s[i+3]=='1'){
				ret = 'C';
				break;
			}else if(s[i+7]=='1' && s[i+8]=='1' && s[i+15]=='1'){
				ret = 'D';
				break;
			}else if(s[i+1]=='1' && s[i+9]=='1' && s[i+10]=='1'){
				ret = 'E';
				break;
			}else if(s[i+8]=='1' && s[i+9]=='1' && s[i+17]=='1'){
				ret = 'F';
				break;
			}else if(s[i+1]=='1' && s[i+7]=='1' && s[i+8]=='1'){
				ret = 'G';
				break;
			}
		}
	}
	}
	cout<<ret<<endl;
	return 0;
}