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>
#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;
        }
        cout<<endl;
        
    }
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {

  int n;
  int map[100];

  int wrong[100];
  int check[10];

  int index;

  cin >> n;

  for(int num=0;num<n;num++) {

    //wrongÌú»
    for(int i=0;i<81;i++) {

      wrong[i]=0;

    }

    //pYÌÇÝÝ
    for(int i=0;i<81;i++) {

      cin >> map[i];

    }

    //^eÌñð`FbN
    for(int i=0;i<9;i++) {

      for(int j=0;j<9;j++) check[j]=0;

      for(int j=0;j<9;j++) {

	check[map[9*j+i]-1]++;

      }

      for(int j=0;j<9;j++) {

	if(check[j]>1) {

	  for(int k=0;k<9;k++) {

	    if(map[9*k+i]==j+1) wrong[9*k+i]=1;

	  }

	}

      }
    
    }

    //RÌñð`FbN
    for(int j=0;j<9;j++) {

      for(int i=0;i<9;i++) check[i]=0;

      for(int i=0;i<9;i++) {

	check[map[9*j+i]-1]++;

      }

      for(int i=0;i<9;i++) {

	if(check[i]>1) {

	  for(int k=0;k<9;k++) {

	    if(map[9*j+k]==i+1) wrong[9*j+k]=1;

	  }

	}

      }

    }

    //gÌð`FbN
    for(int i=0;i<3;i++) {

      for(int j=0;j<3;j++) {

	index=27*j+3*i;

	for(int k=0;k<9;k++) check[k]=0;

	for(int k=0;k<3;k++) {

	  for(int l=0;l<3;l++) {

	    check[map[index+9*l+k]-1]++;

	  }

	}

	for(int k=0;k<9;k++) {

	  if(check[k]>1) {

	    for(int l=0;l<3;l++) {

	      for(int m=0;m<3;m++) {

		if(map[index+9*m+l]==k+1) wrong[index+9*m+l]=1;

	      }

	    }

	  }

	}

      }

    }

    for(int j=0;j<9;j++) {

      for(int i=0;i<9;i++) {

	if(wrong[9*j+i]==1) cout << "*";
      
	else cout << " ";

	cout << map[9*j+i];

      }

      cout << endl;

    }

    cout << endl;

  }

  return 0;

}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int math[9][9], jud[10] = {};
char mmath[9][9];
void jj(int x, int y){
	int jud2[10][2];
	for(int i = 0; i < 10; i++){
		fill(jud2[i], jud2[i] + 2, -1);
	}
	for(int i = x; i < x + 3; i++){
		for(int j = y; j < y + 3; j++){
			if(jud2[math[i][j]][0] >= 0){
				mmath[i][j] = '*';
				mmath[jud2[math[i][j]][0]][jud2[math[i][j]][1]] = '*';
			}
			jud2[math[i][j]][0] = i;
			jud2[math[i][j]][1] = j;
		}
	}
}
int main(){
	int n;
	cin >> n;
	for(int k = 0; k < n; k++){
		for(int i = 0; i < 9; i++)
			fill(mmath[i], mmath[i] + 9, 0);
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				cin >> math[i][j];
			}
		}
		for(int i = 0; i < 9; i++){
			fill(jud, jud + 10, -1);
			for(int j = 0; j < 9; j++){
				if(jud[math[i][j]] >= 0){
					mmath[i][j] = '*';
					mmath[i][jud[math[i][j]]] = '*';
				}
				jud[math[i][j]] = j;
			}
		}
		for(int i = 0; i < 9; i++){
			fill(jud, jud + 10, -1);
			for(int j = 0; j < 9; j++){
				if(jud[math[j][i]] >= 0){
					mmath[j][i] = '*';
					mmath[jud[math[j][i]]][i] = '*';
				}
				jud[math[j][i]] = j;
			}
		}
		jj(0, 0);	jj(3, 0);	jj(6, 0);
		jj(0, 3);	jj(3, 3);	jj(6, 3);
		jj(0, 6);	jj(3, 6);	jj(6, 6);
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				if(!mmath[i][j])
					cout << " ";
				cout<< mmath[i][j] << math[i][j];
			}
			cout << endl;
		}
		cout << endl;
	}
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<cstdio>
#include<cmath>
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
	int n;
	cin>>n;
	bool h=false;
	rep(w,n){
	if(h)cout<<endl;
		int in[9][9]={0};
		rep(j,9)rep(k,9)cin>>in[j][k];
		int out[9][9]={0};
		rep(i,9){
			rep(j,9){
				int co=0;
				rep(k,9)if(in[i][k]==j+1)co++;
				if(co>1)rep(k,9)if(in[i][k]==j+1)out[i][k]=1;
			}
		}
		rep(i,9){
			rep(j,9){
				int co=0;
				rep(k,9)if(in[k][i]==j+1)co++;
				if(co>1)rep(k,9)if(in[k][i]==j+1)out[k][i]=1;
			}
		}
		rep(i,3)rep(j,3){
			map<int,int>m;
			rep(a,3)rep(b,3)m[in[3*i+a][3*j+b]]++;
			rep(k,9)if(m[k+1]>=2)rep(a,3)rep(b,3)if(in[3*i+a][3*j+b]==k+1)out[3*i+a][3*j+b]=1;
		}
		rep(i,9){
			rep(j,9)
				if(out[i][j]==0)cout<<" "<<in[i][j];
				else cout<<"*"<<in[i][j];
			cout<<endl;
		}
		h=true;
	}
}