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<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int n;
int board[10][10];
int main(){
	cin>>n;
	for(int k = 0;k< n;k++){
		bool flag[10][10];
		rep(i,10){
			rep(j,10){
				flag[i][j] = true;
			}
		}
		for(int y = 1;y <=9;y++){
			for(int x = 1;x <=9;x++){
				cin>>board[y][x];
			}
		}
		for(int y = 1; y<=9;y+=3){//3×3ブロックごとの判定
			for(int x = 1;x <=9;x+=3){
				int cnt[10]={0};
				rep(i,3){
					rep(j,3){
						cnt[board[y+i][x+j]]+=1;
					}
				}
				rep(i,3){
					rep(j,3){
						if(cnt[board[y+i][x+j]]!=1){
							flag[y+i][x+j] =false;
						}
					}
				}
			}
		}
		for(int y = 1;y <=9;y++){//横の判定
			int cnt[10]={0};
			for(int x = 1;x <=9;x++){
				cnt[board[y][x]]+=1;
			}
			for(int x = 1; x<=9;x++){
				if(cnt[board[y][x]]!=1){
					flag[y][x] =false;
				}
			}
		}
		for(int x = 1;x <=9;x++){
			int cnt[10]={0};
			for(int y =1;y <=9;y++){
				cnt[board[y][x]]++;
			}
			for(int y = 1;y <=9;y++){
				if(cnt[board[y][x]]!=1){
					flag[y][x] = false;
				}
			}
		}
		for(int i = 1;i <=9;i++){
			for(int j = 1;j <=9;j++){
				printf("%c%d",(flag[i][j]?' ':'*'),board[i][j]);
			}
			puts("");
		}
	}
	return 0;
}

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

using namespace std;

int main(void)
{
	int n, table[9][9];
	bool ok[9][9];
	cin >> n;
	for (int cnt = 0; cnt < n; cnt++){
		for (int i = 0; i < 9; i++){
			for (int j = 0; j < 9; j++){
				cin >> table[i][j];
				ok[i][j] = true;
			}
		}
		
		cout << "input ok" << endl;
		// れつ
		for (int i = 0; i < 9; i++){
			bool done[10] = {false};
			for (int j = 0; j < 9; j++){
				if (done[table[i][j]]){
					ok[i][j] = false;
					for (int k = 0; k < j; k++){
						if (table[i][j] == table[i][k]){
							ok[i][k] = false;
						}
					}
				}
				done[table[i][j]] = true;
			}
		}
		
		// ぎょう
		for (int i = 0; i < 9; i++){
			bool done[10] = {false};
			for (int j = 0; j < 9; j++){
				if (done[table[j][i]]){
					ok[j][i] = false;
					for (int k = 0; k < j; k++){
						if (table[j][i] == table[k][i]){
							ok[k][i] = false;
						}
					}
				}
				done[table[j][i]] = true;
			}
		}
		
		for (int y = 0; y < 9; y += 3){
			for (int x = 0; x < 9; x += 3){
				bool done[10] = {false};
				for (int i = 0; i < 3; i++){
					for (int j = 0; j < 3; j++){
						int ny = y + i, nx = x + j;
						printf("%d ", table[ny][nx]);
						if (done[table[ny][nx]]){
							ok[ny][nx] = false;
							for (int k = 0; k < 3; k++){
								for (int l = 0; l < 3; l++){
									if (table[ny][nx] == table[y + k][x + l]){
										ok[y + k][x + l] = false;
									}
								}
							}
						}
						done[table[ny][nx]] = true;
					}
					cout << endl;
				}
				cout << endl;
			}
		}
		
		for (int i = 0; i < 9; i++){
			for (int j = 0; j < 9; j++){
				printf("%c%d", ok[i][j] ? ' ' : '*', table[i][j]);
			}
			cout << endl;
		}
		
		if (cnt + 1 < n) cout << endl;
	}
	
	return 0;
}

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

bool ok[9][9];
int m[9][9];

void reset(int *r){
	for(int i = 0; i < 10; ++i)
		*(r + i) = 0;
}

void func(int x, int y){
	int cn[10] = {};
	for(int i = x; i < x + 3; ++i)
		for(int j = y; j < y + 3; ++j)
			cn[m[i][j]]++;
			
	for(int i = x; i < x + 3; ++i){
		for(int j = y; j < y + 3; ++j){
			if(cn[m[i][j]] >= 2)
				ok[i][j] = true;
		}
	}
}
int main() {
	int n;
	cin >> n;
	for(int c = 0; c < n; ++c){
		for(int i = 0; i < 9; ++i)
			for(int j = 0; j < 9; ++j)
				ok[i][j] = false;
			
		for(int i = 0; i < 9; ++i)
			for(int j = 0; j < 9; ++j)
				cin >> m[i][j];
		
		int cnt[10] = {0};
		for(int i = 0; i < 9; ++i){
			for(int j = 0; j < 9; ++j)
				cnt[m[j][i]]++;
				
			for(int j = 0; j < 9; ++j){
			if(cnt[m[j][i]] >= 2)
				ok[j][i] = true;
			}
			reset(cnt);
		}
	
		for(int i = 0; i < 9; ++i){
			for(int j = 0; j < 9; ++j)
				cnt[m[i][j]]++;
				
			for(int j = 0; j < 9; ++j){
				if(cnt[m[i][j]] >= 2)
					ok[i][j] = true;
			}
			reset(cnt);
		}
		
		for(int i = 0; i < 9; i += 3)
			for(int j = 0; j < 9; j += 3)
				func(i, j);
				
		for(int i = 0; i < 9; ++i){
			for(int j = 0; j < 9; ++j){
				if(ok[i][j])
					cout << "#";
				else
					cout << " ";
				cout << m[i][j];
			}
			cout << endl;
		}
		if(c != n - 1)
			cout << endl;
	}
	return 0;
}