Language: C

#include <stdio.h>
#include <string.h>
#include <math.h>

#define N 4
#define N2 16
#define LIM 100

static const int dx[N] = {0, -1, 0, 1};
static const int dy[N] = {1, 0, -1, 0};
static const char dir[N] = {'r', 'u', 'l', 'd'};
int MDT[N2][N2];

typedef struct{
  int f[N2];
  int space;
  int md;
}Puzzle;

Puzzle state;
int lim;
int path[LIM];

int max(int a, int b){
  if(a>=b) return a;
  return b;
}

int min(int a, int b){
  if(a<=b) return a;
  return b;
}

int getALLMD(Puzzle pz){
  int i, sum=0;
  for(i=0; i<N2; i++){
    if(pz.f[i] == N2) continue;
    sum += MDT[i][pz.f[i]-1];
  }
  return sum;
}

int isSolved(){
  int i;

  for(i=0; i<N2; i++){
    if(state.f[i] != i+1) return 0;
  }
  return 1;
}

int dfs(int d, int prev){
  int r, temp;

  if(state.md == 0) return 1;
  if(d+state.md > lim) return 0;

  int sx = state.space/N;
  int sy = state.space%N;
  Puzzle tmp;

  for(r=0; r<4; r++){
    int tx = sx+dx[r];
    int ty = sy+dy[r];
    if(tx<0 || ty<0 || tx>=N || ty>=N) continue;
    if(max(prev, r)-min(prev, r) == 2) continue;
    tmp = state;
    state.md -= MDT[tx*N+ty][state.f[tx*N+ty]-1];
    state.md += MDT[sx*N+sy][state.f[tx*N+ty]-1];

    temp = state.f[tx*N+ty];
    state.f[tx*N+ty] = state.f[sx*N+sy];
    state.f[sx*N+sy] = temp;

    state.space = tx*N+ty;
    if(dfs(d+1, r)){
      path[d] = r;
      return 1;
    }
    state = tmp;
  }
  return 0;
}

char* iterative_deepening(Puzzle in){
  int i;

  in.md = getAllMD(in);

  for(lim=in.md; lim<=LIM; lim++){
    state = in;
    if(0, -100){
      char ans[12] = "";
      for(i=0; i< lim; i++) ans += dir[path[i]];
      return ans;
    }
  }
  return "unsolvable";
}

int main(){
  int i, j;
  Puzzle in;
  char ans[12];

  for(i=0; i<N2; i++)
    for(j=0; j<N2; j++)
      MDT[i][j] = abs(i/N - j/N) + abs(i%N - j%N);

  for(i=0; i<N2; i++){
    scanf("%d", &in.f[i]);
    if(in.f[i] == 0){
      in.f[i] = N2;
      in.space = i;
    }
  }

  ans = interative_deepening(in);
  printf("%d\n", strlen(ans));

  return 0;
}

Compiler output:
main.c: In function 'iterative_deepening':
main.c:88:11: error: implicit declaration of function 'getAllMD'; did you mean 'getALLMD'? [-Wimplicit-function-declaration]
   88 |   in.md = getAllMD(in);
      |           ^~~~~~~~
      |           getALLMD
main.c:94:33: error: assignment to expression with array type
   94 |       for(i=0; i< lim; i++) ans += dir[path[i]];
      |                                 ^~
main.c:95:14: warning: function returns address of local variable [-Wreturn-local-addr]
   95 |       return ans;
      |              ^~~
main.c: In function 'main':
main.c:108:19: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
  108 |       MDT[i][j] = abs(i/N - j/N) + abs(i%N - j%N);
      |                   ^~~
main.c:4:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    3 | #include <math.h>
  +++ |+#include <stdlib.h>
    4 | 
main.c:118:9: error: implicit declaration of function 'interative_deepening'; did you mean 'iterative_deepening'? [-Wimplicit-function-declaration]
  118 |   ans = interative_deepening(in);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         iterative_deepening
main.c:118:7: error: assignment to expression with array type
  118 |   ans = interative_deepening(in);
      |       ^