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>
using namespace std;

int main()
{
	int n,g=0;
	cin >> n;
	while(n--)
	{
		if(g) cout << endl; g=1;

		int f[9][9],k[9][9]={0};

		for(int i=0; i<81; i++)
			cin >> f[i/9][i%9];

		for(int y=0; y<9; y++)
		{
			int c[10]={0};
			for(int x=0; x<9; x++) c[f[y][x]]++;
			for(int x=0; x<9; x++) if(c[f[y][x]]!=1) k[y][x]=1;
		}
		for(int x=0; x<9; x++)
		{
			int c[10]={0};
			for(int y=0; y<9; y++) c[f[y][x]]++;
			for(int y=0; y<9; y++) if(c[f[y][x]]!=1) k[y][x]=1;
		}

		for(int y1=0; y1<3; y1++)
		for(int x1=0; x1<3; x1++)
		{
			int c[10]={0};
			for(int y2=0; y2<3; y2++)
			for(int x2=0; x2<3; x2++)
			{
				int x=x1*3+x2;
				int y=y1*3+y2;
				c[f[y][x]]++;
			}

			for(int y2=0; y2<3; y2++)
			for(int x2=0; x2<3; x2++)
			{
				int x=x1*3+x2;
				int y=y1*3+y2;
				if(c[f[y][x]]!=1) k[y][x]=1;
			}
		}

		for(int y=0; y<9; y++)
		{
			for(int x=0; x<9; x++)
			{
				cout << (k[y][x]?'*':' ') << f[y][x];
			}
			cout << endl;
		}
	}
}

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

int main() {
	int n;
	cin >> n;
	bool flag = false;

	for(int i = 0; i < n; i++) {
		int board[16][16];
		char mark[16][16];
		memset(mark, ' ', sizeof(mark));
		for(int j = 0; j < 9; j++)
			for(int k = 0; k < 9; k++)
				cin >> board[j][k];

		// row & comlumn
		for(int j = 0; j < 9; j++) {
			for(int k = 0; k < 9; k++) {
				for(int l = k + 1; l < 9; l++) {
					if(board[j][k] == board[j][l])
						mark[j][k] = mark[j][l] = '*';
					if(board[k][j] == board[l][j])
						mark[k][j] = mark[l][j] = '*';
				}
			}
		}

		// block
		for(int j = 0; j < 3; j++) {
			for(int k = 0; k < 3; k++) {
				for(int l = 0; l < 3; l++) {
					for(int m = 0; m < 3; m++) {
						for(int n = l + 1; n < 3; n++) {
							for(int o = m + 1; o < 3; o++) {
								if(board[j * 3 + l][k * 3 + m] == board[j * 3 + n][k * 3 + o])
									mark[j * 3 + l][k * 3 + m] = mark[j * 3 + n][k * 3 + o] = '*';
							}
						}
					}
				}
			}
		}

		if(flag)
			cout << endl;

		for(int j = 0; j < 9; j++) {
			for(int k = 0; k < 9; k++) {
				cout << mark[j][k] << board[j][k];
			}
			cout << endl;
		}

		flag = true;
	}

	return 0;
}

C++: #include <cstdio>
using namespace std;

int main(){
    int N;
    for(scanf("%d", &N); N--;){
        char pz[9][12] = {};
        char res[9][12] = {};
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                scanf(" %c", &pz[i][j]);
            }
        }
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                bool flg = true;
                for(int k = 0; k < 9; k++){
                    if(i == k) continue;
                    if(pz[i][j] == pz[k][j]) flg = 0;
                }
                for(int k = 0; k < 9; k++){
                    if(j == k) continue;
                    if(pz[i][j] == pz[i][k]) flg = 0;
                }
                if(flg){
                    res[i][j] = ' ';
                }else{
                    res[i][j] = '*';
                }
            }
        }
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                printf("%c", res[i][j]);
                printf("%c", pz[i][j]);
            }
            puts("");
        }
        if(N>=1) puts("");
    }
    return 0;
}

C++: #include<iostream>
#include<set>
#include<cstring>

void input(int mat[9][9]);
void checkrow(const int mat[9][9],std::set<std::pair<int,int> >& wrong,int r);
void checkcolumn(const int mat[9][9],std::set<std::pair<int,int> >& wrong,int c);
void checksquare(const int mat[9][9],std::set<std::pair<int,int> >& wrong,int n);
void output(const int mat[9][9],const std::set<std::pair<int,int> >& wrong);

int main()
{
	int n;
	std::cin>>n;
	for(int k=0;k<n;k++)
	{
		int mat[9][9];
		std::set<std::pair<int,int> > wrong;
		input(mat);
		
		for(int i=0;i<9;i++)
		{
			checkrow(mat,wrong,i);
			checkcolumn(mat,wrong,i);
			checksquare(mat,wrong,i);
		}
		if(k>0)std::cout<<std::endl;
		output(mat,wrong);
	}
	return 0;
}

void input(int mat[9][9])
{
	for(int i=0;i<9;i++)
	{
		for(int j=0;j<9;j++)
		{
			std::cin>>mat[i][j];
		}
	}
}

void checkrow(const int mat[9][9],std::set<std::pair<int,int> >& wrong,int r)
{
	int already[9];
	memset(already,-1,sizeof(already));
	for(int j=0;j<9;j++)
	{
		if(already[mat[r][j]-1]!=-1)
		{
			wrong.insert(std::pair<int,int>(r,j));
			wrong.insert(std::pair<int,int>(r,already[mat[r][j]-1]));
		}
		already[mat[r][j]-1]=j;
	}
}

void checkcolumn(const int mat[9][9],std::set<std::pair<int,int> >& wrong,int c)
{
	int already[9];
	memset(already,-1,sizeof(already));
	for(int i=0;i<9;i++)
	{
		if(already[mat[i][c]-1]!=-1)
		{
			wrong.insert(std::pair<int,int>(i,c));
			wrong.insert(std::pair<int,int>(already[mat[i][c]-1],c));
		}
		already[mat[i][c]-1]=i;
	}
}

void checksquare(const int mat[9][9],std::set<std::pair<int,int> >& wrong,int n)
{
	int already[9];
	memset(already,-1,sizeof(already));
	for(int i=n/3*3;i<n/3*3+3;i++)
	{
		for(int j=n%3*3;j<n%3*3+3;j++)
		{
			if(already[mat[i][j]-1]!=-1)
			{
				wrong.insert(std::pair<int,int>(i,j));
				wrong.insert(std::pair<int,int>(already[mat[i][j]-1],j));
			}
			already[mat[i][j]-1]=i;
		}
	}
}

void output(const int mat[9][9],const std::set<std::pair<int,int> >& wrong)
{
	for(int i=0;i<9;i++)
	{
		for(int j=0;j<9;j++)
		{
			if(wrong.find(std::pair<int,int>(i,j))==wrong.end())
			{
				std::cout<<' ';
			}
			else
			{
				std::cout<<'*';
			}
			std::cout<<mat[i][j];
		}
		std::cout<<std::endl;
	}
}