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 {
		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>
#include <sstream>


using namespace std;
/*
 入力1までの日数　−　入力2までの日数
*/


int main(){
    int n;
    cin>>n;
    for(int roop=0; roop<n; roop++){
        
        int puzzle[9][9];
        for(int i=0; i<9; i++){
            for(int j=0; j<9; j++){
                cin>>puzzle[i][j];
            }
        }
        /*横*/
        char ans[9][9];        
        for(int i=0; i<9; i++){
            bool checker[10]={0};
            for(int j=0; j<9; j++){
                if(checker[puzzle[i][j]]==0){
                    checker[puzzle[i][j]]=true;
                    ans[i][j]=' ';
                }else{
                    for(int k=0; k<j; k++){
                        if(puzzle[i][j]==puzzle[i][k])ans[i][k]='*';
                    }
                    ans[i][j]='*';
                }
            }
        }
        
        /*縦*/
        for(int i=0; i<9; i++){
            bool checker[10]={0};
            for(int j=0; j<9; j++){
                if(checker[puzzle[j][i]]==0){
                    checker[puzzle[j][i]]=true;
                }else{
                    for(int k=0; k<j; k++){
                        if(puzzle[j][i]==puzzle[k][i]){
                            ans[k][i]='*';
                        }
                    }
                    ans[j][i]='*';
                }
            }
        }
        
        /*四角*/
        for(int i=0; i<3; i++){
            for(int j=0; j<3; j++){
                int i2 = i*3;
                int j2 = j*3;
                bool checker[10]={0};
                for(int k=0; k<9; k++){
                    if(checker[puzzle[i2+k/3][j2+k%3]]==0){
                        checker[puzzle[i2+k/3][j2+k%3]]=true;
                    }else{
                        for(int l=0; l<k; l++){
                            if(puzzle[i2+k/3][j2+k%3]==puzzle[i2+l/3][j2+l%3])ans[i2+l/3][j2+l%3]='*';
                        }
                        ans[i2+k/3][j2+k%3]='*';
                    }
                }
            }
        }
        
        
        
        
        for(int i=0; i<9; i++){
            for(int j=0; j<9; j++){
                cout<<ans[i][j]<<puzzle[i][j];
            }
            cout<<endl;
        }
        
    }
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  int mapp[9][9];
  int koteiyoko,koteitate;
  cin>>n;
  for(int mawa=0;mawa<n;mawa++){
    if(mawa!=0){
      cout << endl;
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cin>>mapp[i][j];
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	koteiyoko=mapp[i][j];
	for(int k=0;k<9;k++){
	  if(koteiyoko==mapp[i][k]%10 && k!=j){
	    mapp[i][k]+=10;
	    mapp[i][j]+=10;
	  }
	}
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	koteitate=mapp[i][j];
	for(int k=0;k<9;k++){
	  if(koteitate==mapp[k][j]%10 && k!=i){
	    mapp[i][j]+=10;
	    mapp[k][j]+=10;
	  }
	}
      }
    }
    int block[3][3][10]={0};
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	block[i/3][j/3][mapp[i][j]%10]++;
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	if(block[i/3][j/3][mapp[i][j]%10]>1){
	  mapp[i][j]+=10;
	}
      }
    }
    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	if(mapp[i][j]>=10){
	  cout<<'*'<<mapp[i][j]%10;
	}else{
	  cout<<' '<<mapp[i][j];
	}
      }
      cout<<endl;
    }
  }
}

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