Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	table := [9][9]int{}
	check := [9][9]bool{}
	n, _ := strconv.Atoi(scanner.Text())
	for n > 0 {
		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()
		}
		n--
	}
}

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main() {
	bool bf = false;
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		if (bf) cout << endl;

		int m[9][9];
		for (int y = 0; y < 9; ++y)
			for (int x = 0; x < 9; ++x) {
				cin >> m[y][x];
				--m[y][x];
			}

		bool wa[9][9] = {0};
		for (int y = 0; y < 9; ++y) {
			bool f[9] = {0}, w[9] = {0};
			for (int x = 0; x < 9; ++x)
				if (f[m[y][x]]) w[m[y][x]] = true;
				else f[m[y][x]] = true;

			for (int x = 0; x < 9; ++x)
				if (w[m[y][x]]) wa[y][x] = true;
		}
		for (int x = 0; x < 9; ++x) {
			bool f[9] = {0}, w[9] = {0};
			for (int y = 0; y < 9; ++y)
				if (f[m[y][x]]) w[m[y][x]] = true;
				else f[m[y][x]] = true;

			for (int y = 0; y < 9; ++y)
				if (w[m[y][x]]) wa[y][x] = true;
		}
		for (int y = 0; y < 3; ++y)
			for (int x = 0; x < 3; ++x) {
				bool f[9] = {0}, w[9] = {0};
				for (int dx = 0; dx < 3; ++dx)
					for (int dy = 0; dy < 3; ++dy) {
						int nx = x * 3 + dx;
						int ny = y * 3 + dy;

						if (f[m[ny][nx]]) w[m[ny][nx]] = true;
						else f[m[ny][nx]] = true;
					}

				for (int dx = 0; dx < 3; ++dx)
					for (int dy = 0; dy < 3; ++dy) {
						int nx = x * 3 + dx;
						int ny = y * 3 + dy;

						if (w[m[ny][nx]]) wa[ny][nx] = true;
					}
			}

		for (int y = 0; y < 9; ++y) {
			for (int x = 0; x < 9; ++x) {
				if (wa[y][x]) cout << "*";
				else cout << " ";

				cout << (m[y][x] + 1);
			}
			cout << endl;
		}

		bf = true;
	}
}

C++: #include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char **argv)
{
	int *array, *array2, *array3, n; 
	
	cin >> n;
	for(int l = 0; l < n; l++){
		array = (int *)calloc(100, sizeof(int));
		array2 = (int *)calloc(100, sizeof(int));
		
		for(int i = 1; i <= 9; i++){
			array3 = (int *)calloc(10, sizeof(int));
			for(int j = 1, tmp = i*10; j <= 9; j++){
				cin >> array[tmp+j];
				array3[array[tmp+j]]++;
			}
			
			for(int j = 1, tmp = i*10; j <= 9; j++){
				if(array3[j] > 1){
					for(int k = 1; k <= 9; k++){
						if(j == array[tmp+k]){
							array2[tmp+k] = 1;
						}
					}
				}
			}
			free(array3);
		}
		
		for(int i = 1; i <= 9; i++){
			array3 = (int *)calloc(10, sizeof(int));
			for(int j = 1; j <= 9; j++){
				array3[array[i+j*10]]++;
			}
			
			for(int j = 1; j <= 9; j++){
				if(array3[j] > 1){
					for(int k = 1; k <= 9; k++){
						if(j == array[i+10*k]){
							array2[10*k+i] = 1;
						}
					}
				}
			}
			free(array3);
		}
		
		for(int i = 1; i <= 9; i++){
			for(int j = 1, tmp = i*10; j <= 9; j++){
				if(array2[tmp+j] == 0){
					cout << " " << array[tmp+j];
				} else {
					cout << "*" << array[tmp+j];
				}
			}
			cout << endl;
		}
		cout << endl;
		
		free(array);
		free(array2);
	}
	
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


const int SIZE = 9;
int T[SIZE][SIZE];
bool F[SIZE][SIZE];

void input() {
    for ( int i = 0; i < SIZE; ++ i ) {
        for ( int j = 0; j < SIZE; ++ j ) {
            cin >> T[i][j];
        }
    }
}

bool check( int r, int c ) {
    int sr = r - r % 3;
    int sc = c - c % 3;
    for ( int i = 0; i < SIZE; ++ i ) {
        if ( i != c && T[r][c] == T[r][i] ) return true;
        if ( i != r && T[r][c] == T[i][c] ) return true;
    }
    for ( int i = 0; i < 3; ++ i ) {
        for ( int j = 0; j < 3; ++ j ) {
            if ( sr + i == r && sc + j == c ) continue;
            if ( T[r][c] == T[sr+i][sc+j] ) return true;
        }
    }
    return false;
}

void solve() {
    fill( (bool*)F, (bool*)F+SIZE*SIZE, false );
    for ( int i = 0; i < SIZE; ++ i ) {
        for ( int j = 0; j < SIZE; ++ j ) {
            F[i][j] = check( i, j );
        }
    }
    for ( int i = 0; i < SIZE; ++ i ) {
        for ( int j = 0; j < SIZE; ++ j ) {
            cout << ( F[i][j] ? '*' : ' ' ) << T[i][j];
        }
        cout << endl;
    }
}

int main() {
    int n;
    while ( cin >> n ) {
        for ( int i = 0; i < n; ++ i ) {
            input();
            solve();
            if ( i + 1 < n ) cout << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char **argv)
{
	int *array, *array2, *array3, n; 
	
	cin >> n;
	for(int l = 0; l < n; l++){
		array = (int *)calloc(100, sizeof(int));
		array2 = (int *)calloc(100, sizeof(int));
		
		for(int i = 1; i <= 9; i++){
			array3 = (int *)calloc(10, sizeof(int));
			for(int j = 1, tmp = i*10; j <= 9; j++){
				cin >> array[tmp+j];
				array3[array[tmp+j]]++;
			}
			
			for(int j = 1, tmp = i*10; j <= 9; j++){
				if(array3[j] > 1){
					for(int k = 1; k <= 9; k++){
						if(j == array[tmp+k]){
							array2[tmp+k] = 1;
						}
					}
				}
			}
			free(array3);
		}
		
		for(int i = 1; i <= 9; i++){
			array3 = (int *)calloc(10, sizeof(int));
			for(int j = 1; j <= 9; j++){
				array3[array[i+j*10]]++;
			}
			
			for(int j = 1; j <= 9; j++){
				if(array3[j] > 1){
					for(int k = 1; k <= 9; k++){
						if(j == array[i+10*k]){
							array2[10*k+i] = 1;
						}
					}
				}
			}
			free(array3);
		}
		
		for(int i = 1; i <= 9; i++){
			for(int j = 1, tmp = i*10; j <= 9; j++){
				if(array2[tmp+j] == 0){
					cout << " " << array[tmp+j];
				} else {
					cout << "*" << array[tmp+j];
				}
			}
			cout << endl;
		}
		
		free(array);
		free(array2);
	}
	
	return 0;
}