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<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>

using namespace std;

int board[9][9];

bool Solution(int x, int y)
{
    int count = 0;
    
    for (int i = 0; i < 9; i++)
    {
        if (board[x][i] == board[x][y])
        {
            count++;
        }
        
        if (board[i][y] == board[x][y])
        {
            count++;
        }
    }
    
    int devideX = x / 3;
    int devideY = y / 3;
    
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            if (board[devideX * 3 + i][devideY * 3 + j] == board[x][y])
            {
                count++;
            }
        }
    }
    
    return count == 3;
}

int main()
{
    int n;
 
    bool flag = true;
    
    cin>>n;
    
    while(n--)
    {
        if (flag)
        {
            flag = false;
        }
        else
        {
            cout << endl;
        }
        
        for (int j = 0; j < 9; j++)
        {
            for (int k = 0; k < 9; k++)
            {
                cin>>board[j][k];
            }
        }
        
        for (int j = 0; j < 9; j++)
        {
            for (int k = 0; k < 9; k++)
            {
                char c = ' ';
                
                if (!Solution(j, k))
                {
                    c = '*';
                }
                
                cout << c << board[j][k];
            }
            
            cout << endl;
        }
    }
    
    return 0;
}

C++: #include<stdio.h>
#include <string.h>

int main(void){
	int n,i,j,k=0;
	int joudan[5],gedan[5];
	int data[7][5];

	while(1){
		
		if(scanf("%d",&n)==EOF)break;
		for(i=0;i<7;i++)
			for(j=0;j<5;j++)
				data[i][j]=1;

		for(i=4;i>=0;i--){
			joudan[i]=(n%10)/5;
			gedan[i]=(n%10)%5;
			n/=10;
		}
		  for(i=0;i<5;i++){//上段の判定
			  if(joudan[i]==1)
				  data[0][i]=0;
			  else 
				  data[1][i]=0;
		  }

		 for(i=0;i<5;i++){//下段の判定
			  if(gedan[i]==0)
				 data[2][i]=0;
			  else if(gedan[i]==1)
				  data[3][i]=0;
			  else if(gedan[i]==2)
				  data[4][i]=0;
			  else if(gedan[i]==3)
				  data[5][i]=0;
			  else if(gedan[i]==4)
				  data[6][i]=0;
		  }
		for(i=0;i<2;i++)
			for(j=0;j<5;j++){
				if(data[i][j]==1)
					printf("*");
				else
					printf(" ");
				if(j==4) printf("\n");
			}

		for(i=0;i<5;i++){
			printf("=");
			if(i==4) printf("\n");
		}

		for(i=2;i<7;i++)
			for(j=0;j<5;j++){
				if(data[i][j]==1)
					printf("*");
				else
					printf(" ");
				if(j==4&&i!=6) printf("\n");
			}
			puts("");
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <map>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n;
	cin >> n;

	int f[9][9];
	bool flag[9][9];
	map<int,int> ma;
	
	while(n--)
	{
		memset(f,0,sizeof(f));

		rep(i,9)
		{
			rep(j,9)
			{
				flag[i][j] = false;
			}
		}

		rep(i,9)
		{
			rep(j,9)
			{
				cin >> f[i][j];
			}
		}

		/*
		rep(i,9)
		{
			rep(j,9)
			{
				cout << fixed;
				cout.width(2);
				cout<< f[i][j]-1;
			}
			cout << endl;
		}
		*/

		rep(i,9)
		{
			ma.clear();
			rep(j,9)
			{
				ma[f[i][j]-1]++;
			}

			rep(j,9)
			{
				if(ma[f[i][j]-1] > 1)
				{
					flag[i][j] = true;
				}
			}
		}
		
		
		rep(i,9)
		{
			ma.clear();
			
			rep(j,9)
			{
				ma[f[j][i]-1]++;
			}

			rep(j,9)
			{
				if(ma[f[j][i]-1] > 1)
				{
					flag[j][i] = true;
				}
			}
		}

		int count = 0;
		int x = 0,y = 0;
		while(count != 9)
		{
			ma.clear();
			REP(i,x,x+3)
			{
				REP(j,y,y+3)
				{
					ma[f[i][j]-1]++;
				}
			}

			REP(i,x,x+3)
			{
				REP(j,y,y+3)
				{
					if(ma[f[i][j]-1] > 1)
					{
						flag[i][j] = true;
					}
				}
			}

			if(x+2 == 8)
			{
				if(y+2 == 8)
				{
					break;
				}
				x = 0;
				y += 3;
			}
			else
			{
				x += 3;
			}
		}

		rep(i,9)
		{
			rep(j,9)
			{
				if(flag[i][j])
				{
					cout << "*" << f[i][j];
				}
				else
				{
					cout << " " << f[i][j];
				}
			}
			cout << endl;
		}
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
void solve() {
	int a[10][10];
	bool b[10][10];
	for0(i, 9)for0(j, 9) { cin >> a[i][j]; b[i][j] = 1; }
	int cnt[11];
	for0(i, 9) {
		for1(j, 9)cnt[j] = 0;
		for0(j, 9)cnt[a[i][j]]++;
		for0(j, 9)if (cnt[a[i][j]] > 1)b[i][j] = 0;
	}
	for0(j, 9) {
		for1(i, 9)cnt[i] = 0;
		for0(i, 9)cnt[a[i][j]]++;
		for0(i, 9)if (cnt[a[i][j]] > 1)b[i][j] = 0;
	}
	for0(x, 9) {
		for1(i, 9)cnt[i] = 0;
		for0(y, 9)cnt[a[x / 3 * 3 + y / 3][x % 3 * 3 + y % 3]]++;
		for0(y, 9)if (cnt[a[x / 3 * 3 + y / 3][x % 3 * 3 + y % 3]] > 1)b[x / 3 * 3 + y / 3][x % 3 * 3 + y % 3] = 0;
	}
	for0(i, 9) {
		for0(j, 9)cout << (b[i][j] ? ' ' : '*') << a[i][j];
		cout << endl;
	}
}
signed main() {
	int q; cin >> q; while (q--) { solve(); if (q >= 1)cout << endl; }
}

C++: #include <iostream>
using namespace std;
#define REP(i,b,c) for(int i=0;i<b;i+=c)

int main(){
	char p[9][9];
	int n;
	cin >> n;
	while(n--){
		char a[9][9];
		REP(i,9,1)REP(j,9,1)a[j][i]=' ';
		REP(i,9,1)REP(j,9,1)cin >> p[j][i];
		
		REP(j,9,3){
			REP(i,9,3){			
				int c[9]={0};
				REP(x,3,1){
					REP(y,3,1){
						c[p[i+x][j+y]-'0'-1]++;
						if(c[p[i+x][j+y]-'0'-1]>1){
							REP(t,3,1){
								REP(l,3,1){
									if(p[i+x][j+y]==p[i+t][j+l]){
										a[i+t][j+l]='*';
									}
								}
							}
						}
					}
				}	
			}
		}
		REP(i,9,1){
			int c[9]={0},c2[9]={0};
			REP(j,9,1){
				c[p[j][i]-'0'-1]++;
				if(c[p[j][i]-'0'-1]>1){
					REP(t,9,1){
						if(p[j][i]==p[t][i]){
							a[t][i]='*';
						}
					}
				}
				c2[p[i][j]-'0'-1]++;
				if(c2[p[i][j]-'0'-1]>1){
					REP(t,9,1){
						if(p[i][j]==p[i][t]){
							a[i][t]='*';
						}
					}
				}
			}
		}
		REP(i,9,1){
			REP(j,9,1)cout << a[j][i] << p[j][i];
			cout << endl;
		}
		cout << endl;
	}
}