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

C++: #include <iostream>

#include <vector>

#include <algorithm>

#include <sstream>

#include <string>

#include <cmath>

#include <list>

#include <set>
using namespace std;

int in() {int x; cin >> x; return x;}

template <typename T> class SegTree

{

public:

	int n;

	T T_max;

	vector<T> dat;

	SegTree(int n_, T t_max)

	{

		int n = 1;

		T_max = t_max;

		while (n < n_)n *= 2;

		for (int i = 0; i < 2 * n - 1; i++)dat.push_back(t_max);

	}

	void update(int k, T a)

	{

		k += n - 1;

		dat[k] = a;

		while (k > 0)

		{

			k = (k - 1) / 2;

			dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);

		}

	}



	//[a,b)

	T query(int a, int b)

	{

		return _query(a, b, 0, 0, n);

	}



private:

	T _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l)return T_max;

		if (a <= l && r <= b)return dat[k];

		else

		{

			T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);

			T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);

			return min(vr, vl);

		}

	}

};

int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int a[9][9];
		char b[10][10];
		for (int i = 0; i < 9; i++)
		{
			for (int l = 0; l < 9; l++)
			{
				cin >> a[i][l];
				b[i][l] = ' ';
			}
		}

		for (int i = 0; i < 9; i++)
		{
			int h[10] = {};
			for (int l = 0; l < 9; l++)
			{
				h[a[i][l]]++;
			}
			for (int l = 0; l < 9; l++)
			{
				if (h[a[i][l]] != 1)
				{
					b[i][l] = '*';
				}
			}


			int k[10] = {};
			for (int l = 0; l < 9; l++)
			{
				k[a[l][i]]++;
			}
			for (int l = 0; l < 9; l++)
			{
				if (k[a[l][i]] != 1)
				{
					b[l][i] = '*';
				}
			}
		}

		for (int i = 0; i < 9; i += 3)
		{
			for (int l = 0; l < 9; l += 3)
			{
				int h[10] = {};
				for (int j = 0; j < 3; j++)
				{
					for (int u = 0; u < 3; u++)
					{
						h[a[i + j][l + u]]++;
					}
				}

				for (int j = 0; j < 3; j++)
				{
					for (int u = 0; u < 3; u++)
					{
						if (h[a[i + j][l + u]] != 1)
						{
							b[i + j][l + u] = '*';
						}
					}
				}
			}

		}



		for (int i = 0; i < 9; i++)
		{
			for (int l = 0; l < 9; l++)
			{
				cout << b[i][l] << a[i][l];
			}
			cout << endl;
		}
		cout << endl;

	}
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    int n; cin>>n;
    rep(p,n){
    vector<vector<bool>>flag(10,vb(10,true));
    vvi v(10,vi(10,0));
    rep(i,9)rep(j,9)cin>>v[i][j];
    for(int i=0;i<9;i++){
        vb used(10,false);
        for(int j=0; j<9;j++){
            if(!used[v[i][j]]){used[v[i][j]]=true;}
            else {
                flag[i][j]=false;
                rep(k,9)if(v[i][k]==v[i][j])flag[i][k]=false;
            }
        }
    }
    for(int j=0;j<9;j++){
        vb used(10,false);
        for(int i=0; i<9;i++){
            if(!used[v[i][j]]){used[v[i][j]]=true;}
            else {
                flag[i][j]=false;
                rep(k,9)if(v[k][j]==v[i][j])flag[k][j]=false;
            }
        }
    }
   
    for(int h=0; h<=8;h+=3){
        for(int w=0; w<=8;w+=3){
            vb used(10,false);
            for(int i=h; i<h+3;i++){
                for(int j=w; j<w+3;j++){
                    if(!used[v[i][j]])used[v[i][j]]=true;
                    else for(int k=h; k<h+3;k++){
                            for(int m=w; m<w+3;m++){
                                if(v[k][m]==v[i][j])flag[k][m]=false;
                        }
                    }
                }
            }
        }
    }
    rep(i,9){
        rep(j,9){
            if(flag[i][j])cout<<" ";
            else cout<<"*";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
};