Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	for scanner.Scan() {
		table := [9][9]int{}
		check := [9][9]bool{}
		n, _ := strconv.Atoi(scanner.Text())
		for n > 0 {
			n--
			for i := 0; i < 9; i++ {
				for j := 0; j < 9; j++ {
					table[i][j] = nextInt()
				}
			}
			for i := 0; i < 9; i++ {
				for j := 0; j < 9; j++ {
					ok := true
					for k := 0; k < 9; k++ {
						if table[i][j] == table[i][k] && j != k {
							ok = false
						}
					}
					for k := 0; k < 9; k++ {
						if table[i][j] == table[k][j] && i != k {
							ok = false
						}
					}
					seci := i/3
					secj := j/3
					for k := 0; k < 3; k++ {
						for l := 0; l > 3; l++ {
							if table[seci*3+k][secj*3+l]==table[i][j]&&seci*3+k!=i&&secj*3+l!=j {
								ok = false
							}
						}
					}
					if !ok {
						check[i][j] = true
					}
				}
			}
			for i := 0; i < 9; i++ {
				for j := 0; j < 9; j++ {
					if check[i][j] {
						fmt.Print("*")
					} else {
						fmt.Print(" ")
					}
					fmt.Print(table[i][j])
				}
				fmt.Println()
			}
			if n != 0 {
				fmt.Println()
			}
		}
	}
}

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

C++: #include <iostream>

#include <cstdio>
#include <cstring>
#include <ctime>

using namespace std;

int main(){

  int n;

  cin >> n;

  int puzzle[n][9][9];
  bool cpuzzle[n][9][9];
  
  // Init flag
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 9; j++){
      for(int k = 0; k < 9; k++){
	cpuzzle[i][j][k] = false;
      }
    }
  }    

  // Loop
  for(int i = 0; i < n; i++){
    // Input
    for(int j = 0; j < 9; j++){
      for(int k = 0; k < 9; k++){
	cin >> puzzle[i][j][k];
      }
    }
    // Check
    for(int j = 0; j < 9; j++){
      for(int k = 0; k < 9; k++){
	// Check line1
	for(int l1 = 0; l1 < 9; l1++){
	  if(l1 != k){
	    if(puzzle[i][j][k] == puzzle[i][j][l1]){
	      cpuzzle[i][j][k] = true;
	    }
	  }
	}
	// Check line2
	for(int l2 = 0; l2 < 9; l2++){
	  if(l2 != j){
	    if(puzzle[i][j][k] == puzzle[i][l2][k]){
	      cpuzzle[i][j][k] = true;
	    }
	  }
	}
	// Check area
	for(int a1 = 0; a1 < 3; a1++){
	  for(int a2 = 0; a2 < 3; a2++){
	    // Area1
	    if(j >= 0 && j <= 2 && k >= 0 && k <= 2){
	      if(a1 != j && a2 != k){
		if(puzzle[i][j][k] == puzzle[i][a1][a2]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	    // Area2
	    if(j >= 3 && j <= 5 && k >= 0 && k <= 2){
	      if(a1+3 != j && a2 != k){
		if(puzzle[i][j][k] == puzzle[i][a1+3][a2]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	    // Area3
	    if(j >= 6 && j <= 8 && k >= 0 && k <= 2){
	      if(a1+6 != j && a2 != k){
		if(puzzle[i][j][k] == puzzle[i][a1+6][a2]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	    // Area4
	    if(j >= 0 && j <= 2 && k >= 3 && k <= 5){
	      if(a1 != j && a2+3 != k){
		if(puzzle[i][j][k] == puzzle[i][a1][a2+3]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	    // Area5
	    if(j >= 3 && j <= 5 && k >= 3 && k <= 5){
	      if(a1+3 != j && a2+3 != k){
		if(puzzle[i][j][k] == puzzle[i][a1+3][a2+3]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	    // Area6
	    if(j >= 6 && j <= 8 && k >= 3 && k <= 5 ){
	      if(a1+6 != j && a2+3 != k){
		if(puzzle[i][j][k] == puzzle[i][a1+6][a2+3]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	    // Area7
	    if(j >= 0 && j <= 2 && k >= 6 && k <= 8){
	      if(a1 != j && a2+6 != k){
		if(puzzle[i][j][k] == puzzle[i][a1][a2+6]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	    // Area8
	    if(j >= 3 && j <= 5 && k >= 6 && k <= 8){
	      if(a1+3 != j && a2+6 != k){
		if(puzzle[i][j][k] == puzzle[i][a1+3][a2+6]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	    // Area9
	    if(j >= 6 && j <= 8 && k >= 6 && k <= 8){
	      if(a1+6 != j && a2+6 != k){
		if(puzzle[i][j][k] == puzzle[i][a1+6][a2+6]){
		  cpuzzle[i][j][k] = true;
		}
	      }
	    }
	  }
	}
      }
    }
    // Output
    for(int j = 0; j < 9; j++){
      for(int k = 0; k < 9; k++){
	if(cpuzzle[i][j][k]){
	  cout << "*";
	} else {
	  cout << " ";
	}
	cout << puzzle[i][j][k];
      }
      cout << endl;
    }
    if(i < n-1)cout << endl;
  }
  
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	
	int n;
	
	cin >> n;
	
	int map[10][10];
	
	bool check[10][10];
	
	int chec[10];
	
	for(int loop = 0; loop < n; loop++){
		
		if(loop != 0){
			cout << endl;
		}
		
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				cin >> map[i][j];
				check[i][j] = false;
			}
		}
		
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				chec[j] = 0;
			}
			
			for(int j = 0; j < 9; j++){
				chec[map[j][i]]++;
			}
			
			for(int j = 0; j < 9; j++){
				if(chec[j] > 1){
					for(int k = 0; k < 9; k++){
						if(map[k][i] == j){
							check[k][i] = true;
						}
					}
				}
			}
		}
		
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				chec[j] = 0;
			}
			
			for(int j = 0; j < 9; j++){
				chec[map[i][j]]++;
			}
			
			for(int j = 0; j < 9; j++){
				if(chec[j] > 1){
					for(int k = 0; k < 9; k++){
						if(map[i][k] == j){
							check[i][k] = true;
						}
					}
				}
			}
		}
		
		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				for(int k = 0; k < 3; k++){
					for(int l = 0; l < 3; l++){
						chec[k * 3 + l] = 0;
					}
				}
				
				for(int k = 0; k < 3; k++){
					for(int l = 0; l < 3; l++){
						chec[map[i * 3 + k][j * 3 + l]]++;
					}
				}
				
				for(int k = 0; k < 9; k++){
					if(chec[k] > 1){
						for(int m = 0; m < 3; m++){
							for(int l = 0; l < 3; l++){
								if(map[i * 3 + m][j * 3 + l] == k){
									check[i * 3 + m][j * 3 + l] = true;
								}
							}
						}
					}
				}
				
			}
		}
		
		
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				if(check[i][j]){
					cout << "*";
				}else{
					cout << " ";
				}
				cout << map[i][j];
			}
			cout << endl;
		}
	}
	
	return 0;
}