nodes: 0, module; 1, function_definition; 2, function_name:searchsorted; 3, parameters; 4, block; 5, identifier:arr; 6, identifier:N; 7, identifier:x; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, while_statement; 14, return_statement; 15, comment:"""N is length of arr
      """; 16, assignment; 17, assignment; 18, assignment; 19, assignment; 20, not_operator; 21, block; 22, identifier:L; 23, identifier:L; 24, integer:0; 25, identifier:R; 26, binary_operator:N-1; 27, identifier:done; 28, False; 29, identifier:m; 30, binary_operator:(L+R)//2; 31, identifier:done; 32, if_statement; 33, expression_statement; 34, if_statement; 35, identifier:N; 36, integer:1; 37, parenthesized_expression; 38, integer:2; 39, comparison_operator:arr[m] < x; 40, block; 41, elif_clause; 42, elif_clause; 43, assignment; 44, comparison_operator:L>R; 45, block; 46, binary_operator:L+R; 47, subscript; 48, identifier:x; 49, expression_statement; 50, comparison_operator:arr[m] > x; 51, block; 52, comparison_operator:arr[m] == x; 53, block; 54, identifier:m; 55, binary_operator:(L+R)//2; 56, identifier:L; 57, identifier:R; 58, expression_statement; 59, identifier:L; 60, identifier:R; 61, identifier:arr; 62, identifier:m; 63, assignment; 64, subscript; 65, identifier:x; 66, expression_statement; 67, subscript; 68, identifier:x; 69, expression_statement; 70, parenthesized_expression; 71, integer:2; 72, assignment; 73, identifier:L; 74, binary_operator:m + 1; 75, identifier:arr; 76, identifier:m; 77, assignment; 78, identifier:arr; 79, identifier:m; 80, assignment; 81, binary_operator:L+R; 82, identifier:done; 83, True; 84, identifier:m; 85, integer:1; 86, identifier:R; 87, binary_operator:m - 1; 88, identifier:done; 89, True; 90, identifier:L; 91, identifier:R; 92, identifier:m; 93, integer:1
code: def searchsorted(arr, N, x):
      """N is length of arr
      """
      L = 0
      R = N-1
      done = False
      m = (L+R)//2
      while not done:
          if arr[m] < x:
              L = m + 1
          elif arr[m] > x:
              R = m - 1
          elif arr[m] == x:
              done = True
          m = (L+R)//2
          if L>R:
              done = True
      return L