comefrom: <doocs>0873.Length of Longest Fibonacci Subsequence_1.py
code: def lenLongestFibSubseq( arr: List[int]) -> int:
      mp = {v: i for i, v in enumerate(arr)}
      n = len(arr)
      dp = [[0] * n for _ in range(n)]
      for i in range(n):
          for j in range(i):
              dp[j][i] = 2
      ans = 0
      for i in range(n):
          for j in range(i):
              d = arr[i] - arr[j]
              if d in mp and (k := mp[d]) < j:
                  dp[j][i] = max(dp[j][i], dp[k][j] + 1)
                  ans = max(ans, dp[j][i])
      return ans
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_6 = { var_3 : var_4 for var_4 , var_3 in enumerate ( var_0 ) }
      var_8 = len ( var_0 )
      var_12 = [ [ 0 ] * var_8 for var_10 in range ( var_8 ) ]
      for var_4 in range ( var_8 ) :
          for var_13 in range ( var_4 ) :
              var_12 [ var_13 ] [ var_4 ] = 2
      var_15 = 0
      for var_4 in range ( var_8 ) :
          for var_13 in range ( var_4 ) :
              var_16 = var_0 [ var_4 ] - var_0 [ var_13 ]
              if var_16 in var_6 and ( var_17 := var_6 [ var_16 ] ) < var_13 :
                  var_12 [ var_13 ] [ var_4 ] = max ( var_12 [ var_13 ] [ var_4 ] , var_12 [ var_17 ] [ var_13 ] + 1 )
                  var_15 = max ( var_15 , var_12 [ var_13 ] [ var_4 ] )
      return var_15
  