




'''simple docstring'''







def 	_A			(   UpperCAmelCase	):






   '''simple docstring'''







   A__         =    [list(UpperCAmelCase	) for row in matrix]
   if matrix and isinstance(UpperCAmelCase			,UpperCAmelCase	):
      if isinstance(matrix[0]			,UpperCAmelCase	):
         A__         =    0
         for row in matrix:
            if prev_len == 0:
               A__         =    len(UpperCAmelCase	)
               A__         =    True
            else:
               A__         =    prev_len == len(UpperCAmelCase	)
      else:
         A__         =    True
   else:
      A__         =    False

   return result







def 	_A			(   UpperCAmelCase	):






   '''simple docstring'''







   if check_matrix(UpperCAmelCase	) and len(UpperCAmelCase	) > 0:
      A__         =    [list(UpperCAmelCase	) for row in a]
      A__         =    len(UpperCAmelCase	)
      if isinstance(a[0]			,UpperCAmelCase	):
         A__         =    len(a[0]	)
      else:
         for dat in a:
            print(UpperCAmelCase	)
         return

      # horizotal printing increasing
      for i in range(0			,UpperCAmelCase	):
         print(a[0][i]	)
      # vertical printing down
      for i in range(1			,UpperCAmelCase	):
         print(a[i][mat_col - 1]	)
      # horizotal printing decreasing
      if mat_row > 1:
         for i in range(mat_col - 2			,-1			,-1	):
            print(a[mat_row - 1][i]	)
        # vertical printing up
      for i in range(mat_row - 2			,0			,-1	):
         print(a[i][0]	)
      A__         =    [row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
      if len(UpperCAmelCase	) > 0:
         spiral_print_clockwise(UpperCAmelCase	)
      else:
         return
   else:
      print('Not a valid matrix'	)
      return







def 	_A			(   UpperCAmelCase	):






   '''simple docstring'''







   if matrix:
      return list(matrix.pop(0	)	) + spiral_traversal(list(zip(*UpperCAmelCase	)	)[::-1]	)
   else:
      return []


# driver code
if __name__ == "__main__":
    import doctest

    doctest.testmod()

    lowerCAmelCase_    	=							[[1, 2, 3, 4], [5, 6, 7, 8], [9, 1_0, 1_1, 1_2]]
    spiral_print_clockwise(a)








'''simple docstring'''







def 	_A			(   UpperCAmelCase	):






   '''simple docstring'''







   if not isinstance(UpperCAmelCase			,UpperCAmelCase	) or not all(
       isinstance(UpperCAmelCase			,UpperCAmelCase	) and item >= 0 for item in citations	):
      raise ValueError('The citations should be a list of non negative integers.'	)

   citations.sort()
   A__         =    len(UpperCAmelCase	)

   for i in range(UpperCAmelCase	):
      if citations[len_citations - 1 - i] <= i:
         return i

   return len_citations


if __name__ == "__main__":
    import doctest

    doctest.testmod()


