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 <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;
        }
        if(roop!=n-1)cout<<endl;
        
    }
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int field[10][10], used[10];
	bool judge[10][10];

	int num;
	cin >> num;
	while(num--)
	{
		memset(judge, false, sizeof(judge));

		for(int i = 0; i < 9; i++)
		{
			for(int j = 0; j< 9; j++)
			{
				cin >> field[i][j];
			}
		}
		for(int i = 0; i < 9; i++)
		{
			memset(used, 0, sizeof(used));
			for(int j = 0; j < 9; j++)
			{
				used[field[i][j]]++;
			}
			for(int j = 1; j <=9; j++)
			{
				if(used[j] >= 2)
				{
					for(int k = 0; k < 9; k++)
					{
						if(field[i][k] == j)
						{
							judge[i][k] = true;
						}
					}
				}
			}
			memset(used, 0, sizeof(used));
			for(int j = 0; j < 9; j++)
			{
				used[field[j][i]]++;
			}
			for(int j = 1; j<= 9; j++)
			{
				//printf("%d%s",used[j] ,(j == 9)?"\n":" ");
				if(used[j] >= 2)
				{
					for(int k = 0; k < 9; k++)
					{
						if(field[k][i] == j)
						{
							judge[k][i] = true;
						}
					}
				}
			}
		}
		/*
		puts("run");
		memset(used, 0, sizeof(used));
		for(int i = 0; i < 9; i++)
		{
			used[field[i][i]]++;
		}
		for(int i = 1; i <= 9; i++)
		{
			if(used[i] >= 2)
			{
				for(int j = 0; j < 9; j++)
				{
					if(field[j][j] == i)
					{
						judge[j][j] = true;
					}
				}
			}
		}

		memset(used, 0, sizeof(used));
		for(int i = 0; i < 9; i++)
		{
			used[field[8-i][i]]++;
		}  
		for(int i = 1; i <= 9; i++)
		{
			printf("%d%s",used[i] ,(i == 9)?"\n":" ");

			if(used[i] >= 2)
			{
				for(int j = 0; j < 9; j++)
				{
					if(field[8-j][j] == i)
					{
						judge[8-j][j] = true;
					}
				}
			}
		}
		*/

		for(int l = 3; l < 9; l+=3)
		{
			for(int m = 3; m < 9; m+=3)
			{
				memset(used, false, sizeof(used));
				for(int i = 0; i < 3; i++)
				{
					for(int j = 0; j < 3; j++)
					{
						used[field[i+l][j+m]]++;
					}
				}

				for(int n = 1; n <=9; n++)
				{
					if(used[n] >= 2)
					{
						for(int i = 0; i < 3; i++)
						{
							for(int j = 0; j < 3; j++)
							{
								judge[i+l][j+m] = true;
							}
						}
					}
				}
			}
		}

		for(int i = 0; i < 9; i++)
		{
			for(int j = 0; j < 9; j++)
			{
				printf("%s%d",(judge[i][j])?"*":" " ,field[i][j]);
			}
			puts("");
		}
		puts("");
	}
}

C++: #include<iostream>
using namespace std;
main(){
  int n;
  int num[10][10]={0};
  int yoko=0;
  int tate=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int mondai[10][10]={0};
    for(int j=1;j<=9;j++){
      for(int k=1;k<=9;k++){
	cin>>num[j][k];
      }
    }
    for(int j=1;j<=9;j++){
      for(int k=1;k<=9;k++){
	if(mondai[j][k]!=1){
	  for(int a=1;a<=9;a++){
	    if(a!=k&&num[j][a]==num[j][k]){
	      mondai[j][a]=1;
	      mondai[j][k]=1;
	    }
	    if(a!=j&&num[a][k]==num[j][k]){
	      mondai[a][k]=1;
	      mondai[j][k]=1;
	    }
	  }
	  if(j<=3){
	    tate=0;
	  }
	  else if(j<=6){
	    tate=3;
	  }
	  else{
	    tate=6;
	  }
	  if(k<=3){
	    yoko=0;
	  }
	  else if(k<=6){
	    yoko=3;
	  }
	  else{
	    yoko=6;
	  }
	  for(int a=1;a<=3;a++){
	    for(int b=1;b<=3;b++){
	      if(num[tate+a][yoko+b]==num[j][k]&&(tate+a!=j||yoko+b!=k)){
		mondai[j][k]==1;
		mondai[tate+a][yoko+b]==1;
	      }
	    }
	  }
	}
      }
    }
    for(int j=1;j<=9;j++){
      for(int k=1;k<=9;k++){
	if(mondai[j][k]==1){
	 cout<<"*"<<num[j][k];
	}
	else{
	  cout<<" "<<num[j][k];
	}
      }
      cout<<endl;
    }
  }
}