comefrom: <doocs>0636.Exclusive Time of Functions_1.py
code: def exclusiveTime( n: int, logs: List[str]) -> List[int]:
      ans = [0] * n
      stk = []
      curr = -1
      for log in logs:
          t = log.split(':')
          fid = int(t[0])
          ts = int(t[2])
          if t[1] == 'start':
              if stk:
                  ans[stk[-1]] += ts - curr
              stk.append(fid)
              curr = ts
          else:
              fid = stk.pop()
              ans[fid] += ts - curr + 1
              curr = ts + 1
      return ans
masked: def sample_funcname ( var_0 : int , var_2 : List [ str ] ) -> List [ int ] :
      var_6 = [ 0 ] * var_0
      var_7 = [ ]
      var_9 = - 1
      for var_10 in var_2 :
          var_13 = var_10.split ( ':' )
          var_14 = int ( var_13 [ 0 ] )
          var_16 = int ( var_13 [ 2 ] )
          if var_13 [ 1 ] == 'start' :
              if var_7 :
                  var_6 [ var_7 [ - 1 ] ] += var_16 - var_9
              var_7.append ( var_14 )
              var_9 = var_16
          else :
              var_14 = var_7.pop ( )
              var_6 [ var_14 ] += var_16 - var_9 + 1
              var_9 = var_16 + 1
      return var_6
  