#include using namespace std; int main() { int m[3][3]; int i,j; for(i=0;i<3;i++) for(j=0;j<3;j++) cin>>m[i][j]; int min[8] = {1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000}; int k=0; int sum = 0; int a1[3][3] = {{8, 1, 6},{3, 5, 7},{4, 9, 2}}; int a2[3][3] = {{4, 3, 8},{9, 5, 1},{2, 7, 6}}; int a3[3][3] = {{2, 9, 4},{7, 5, 3},{6, 1, 8}}; int a4[3][3] = {{6, 7, 2},{1, 5, 9},{8, 3, 4}}; int a5[3][3] = {{6, 1, 8},{7, 5, 3},{2, 9, 4}}; int a6[3][3] = {{8, 3, 4},{1, 5, 9},{6, 7, 2}}; int a7[3][3] = {{4, 9, 2},{3, 5, 7},{8, 1, 6}}; int a8[3][3] = {{2, 7, 6},{9, 5, 1},{4, 3, 8}}; for(i=0;i<3;i++) { for(j=0;j<3;j++) { sum+=(abs(m[i][j]-a1[i][j])); } } if(sum