Repository: microsoft/pybryt (language: python)

Issue:
Add an annotation that checks the time complexity of a submission
As titled.


Discussion / hints:

Fix patch:
diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..ff6415d
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,7 @@
+[report]
+exclude_lines =
+    # Have to re-enable the standard pragma
+    pragma: no cover
+
+    # Don't complain if tests don't hit defensive assertion code:
+    raise NotImplementedError
diff --git a/.gitignore b/.gitignore
index 84a5d37..e2a5c87 100644
--- a/.gitignore
+++ b/.gitignore
@@ -130,4 +130,5 @@ dmypy.json
 
 .vscode/settings.json
 .doctrees/
-.OTTER_LOG
\ No newline at end of file
+.OTTER_LOG
+/notebooks
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bef13f9..3cf892a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file, and this pr
 
 ## Unreleased
 
+* Added time complexity annotations and checking
 * Changed tracing function to only increment step counter when tracing student code
 * Added relative tolerance to value annotations
 
diff --git a/docs/annotations/complexity_annotations.rst b/docs/annotations/complexity_annotations.rst
new file mode 100644
index 0000000..76607a5
--- /dev/null
+++ b/docs/annotations/complexity_annotations.rst
@@ -0,0 +1,86 @@
+.. _complexity:
+
+Complexity Annotations
+======================
+
+Complexity annotations define an expectation of the complexity of a block of student code. Currently,
+PyBryt supports one kind of complexity annotation: time complexity. All complexity annotations are
+subclasses of the abstract 
+:py:class:`ComplexityAnnotation<pybryt.annotations.complexty.ComplexityAnnotation>` class, which
+defines some helpful defaults for working with these annotations.
+
+
+Creating Complexity Annotations
+-------------------------------
+
+Complexity annotations can be created just like value annotations: by calling their constructor. The
+constructor takes one positional argument which corresponds to a class asserting the expected 
+complexity of the code. These complexity classes can be found in the 
+:py:mod:`pybryt.complexities<pybryt.annotations.complexity.complexities>` module. All complexity
+classes are subclasses of the abstract base class 
+:py:class:`pybryt.complexities.complexity<pybryt.annotations.complexity.complexities.complexity>`.
+
+The constructor also takes one required keyword argument, ``name``. This should be set to a string
+that corresponds to named time complexity context in the student's code (more on this below). The name
+should be unique across all annotations.
+
+For example, to check the time complexity of a block named ``"sort"`` with :math:`\mathcal{O}(n \log n)`:
+
+.. code-block:: python
+
+    import pybryt
+    import pybryt.complexities as cplx
+
+    pybryt.TimeComplexity(cplx.linearithmic, name="sort")
+
+A full list of the available complexity classes can be found :ref:`here<complexities>`.
+
+
+Tracking Code Complexity
+------------------------
+
+To track the time complexity of students' code, PyBryt provides the 
+:py:obj:`check_time_complexity<pybryt.execution.check_time_complexity>` context manager. This
+context manager takes two arguments, the name of the block (which should match the ``name`` of a
+time complexity annotation in the reference implementation) and length of the input (or, for simplicity,
+the input itself if it has a ``__len__`` method).
+
+The context manager uses PyBryt's tracing function to determine the runtime of the student's code by
+counting the number of steps taken while the code executes (the number of times the trace function is
+called). It then adds an object that tracks this information to the student's memory footprint when
+the block exits.
+
+An important note: any code placed inside this context manager will **not** have its objects in-memory
+traced. PyBryt's trace function will only be used to track the number of steps taken during execution,
+but no values will be added to the student's memory footprint. This means that any code needed to
+satisfy value annotations, relational annotations, etc. must be placed outside this context manager.
+
+For example, to satisfy the time complexity annotation above, the code block below checks the time
+complexity of a student-implemented ``sort`` function on a series of inputs of increasing sizes.
+
+.. code-block:: python
+
+    import numpy as np
+    for exp in np.arange(8):
+        n = np.random.uniform(size=10**exp)
+        with pybryt.check_time_complexity("sort", n):
+            sort(n)
+
+
+Evaluating Code Complexity
+--------------------------
+
+When evaluating whether a time complexity annotation has been satisfied, PyBryt uses the method of
+the |big_O|_ Python package. The annotation is evaluated by
+collecting all of the time complexity result objects found in the student's memory footprint that
+match the ``name`` of the annotation. 
+
+The data from these results is collected and sent through
+each complexity class, which uses ``np.linalg.lstsq`` to fit the input length data to
+the time data (incorporating the transformations needed for each complexity) and returns the 
+residuals of this fit. The complexity with the smallest residuals (incorporating a slight preference 
+for simpler complexities) is determined to be the best match, and is used to determine whether or not 
+the annotation was satisfied.
+
+.. |big_O| replace:: ``big_O``
+.. _big_O: https://github.com/pberkes/big_O
diff --git a/docs/annotations/index.rst b/docs/annotations/index.rst
index 775df58..e487e3a 100644
--- a/docs/annotations/index.rst
+++ b/docs/annotations/index.rst
@@ -8,6 +8,7 @@ Annotations
    :hidden:
 
    relational_annotations
+   complexity_annotations
    invariants
 
 Annotations are the building blocks out of which reference implementations are constructed. They 
diff --git a/docs/api_reference.rst b/docs/api_reference.rst
index c45022b..240ff03 100644
--- a/docs/api_reference.rst
+++ b/docs/api_reference.rst
@@ -28,6 +28,24 @@ Relational Annotations
    :undoc-members:
 
 
+Complexity Annotations
+++++++++++++++++++++++
+
+.. automodule:: pybryt.annotations.complexity.annotation
+   :members:
+   :undoc-members:
+
+
+.. _complexities:
+
+Complexity Classes
+??????????????????
+
+.. automodule:: pybryt.annotations.complexity.complexities
+   :members:
+   :undoc-members:
+
+
 Invariants
 ++++++++++
 
diff --git a/docs/html/_sources/annotations/complexity_annotations.rst.txt b/docs/html/_sources/annotations/complexity_annotations.rst.txt
new file mode 100644
index 0000000..76607a5
--- /dev/null
+++ b/docs/html/_sources/annotations/complexity_annotations.rst.txt
@@ -0,0 +1,86 @@
+.. _complexity:
+
+Complexity Annotations
+======================
+
+Complexity annotations define an expectation of the complexity of a block of student code. Currently,
+PyBryt supports one kind of complexity annotation: time complexity. All complexity annotations are
+subclasses of the abstract 
+:py:class:`ComplexityAnnotation<pybryt.annotations.complexty.ComplexityAnnotation>` class, which
+defines some helpful defaults for working with these annotations.
+
+
+Creating Complexity Annotations
+-------------------------------
+
+Complexity annotations can be created just like value annotations: by calling their constructor. The
+constructor takes one positional argument which corresponds to a class asserting the expected 
+complexity of the code. These complexity classes can be found in the 
+:py:mod:`pybryt.complexities<pybryt.annotations.complexity.complexities>` module. All complexity
+classes are subclasses of the abstract base class 
+:py:class:`pybryt.complexities.complexity<pybryt.annotations.complexity.complexities.complexity>`.
+
+The constructor also takes one required keyword argument, ``name``. This should be set to a string
+that corresponds to named time complexity context in the student's code (more on this below). The name
+should be unique across all annotations.
+
+For example, to check the time complexity of a block named ``"sort"`` with :math:`\mathcal{O}(n \log n)`:
+
+.. code-block:: python
+
+    import pybryt
+    import pybryt.complexities as cplx
+
+    pybryt.TimeComplexity(cplx.linearithmic, name="sort")
+
+A full list of the available complexity classes can be found :ref:`here<complexities>`.
+
+
+Tracking Code Complexity
+------------------------
+
+To track the time complexity of students' code, PyBryt provides the 
+:py:obj:`check_time_complexity<pybryt.execution.check_time_complexity>` context manager. This
+context manager takes two arguments, the name of the block (which should match the ``name`` of a
+time complexity annotation in the reference implementation) and length of the input (or, for simplicity,
+the input itself if it has a ``__len__`` method).
+
+The context manager uses PyBryt's tracing function to determine the runtime of the student's code by
+counting the number of steps taken while the code executes (the number of times the trace function is
+called). It then adds an object that tracks this information to the student's memory footprint when
+the block exits.
+
+An important note: any code placed inside this context manager will **not** have its objects in-memory
+traced. PyBryt's trace function will only be used to track the number of steps taken during execution,
+but no values will be added to the student's memory footprint. This means that any code needed to
+satisfy value annotations, relational annotations, etc. must be placed outside this context manager.
+
+For example, to satisfy the time complexity annotation above, the code block below checks the time
+complexity of a student-implemented ``sort`` function on a series of inputs of increasing sizes.
+
+.. code-block:: python
+
+    import numpy as np
+    for exp in np.arange(8):
+        n = np.random.uniform(size=10**exp)
+        with pybryt.check_time_complexity("sort", n):
+            sort(n)
+
+
+Evaluating Code Complexity
+--------------------------
+
+When evaluating whether a time complexity annotation has been satisfied, PyBryt uses the method of
+the |big_O|_ Python package. The annotation is evaluated by
+collecting all of the time complexity result objects found in the student's memory footprint that
+match the ``name`` of the annotation. 
+
+The data from these results is collected and sent through
+each complexity class, which uses ``np.linalg.lstsq`` to fit the input length data to
+the time data (incorporating the transformations needed for each complexity) and returns the 
+residuals of this fit. The complexity with the smallest residuals (incorporating a slight preference 
+for simpler complexities) is determined to be the best match, and is used to determine whether or not 
+the annotation was satisfied.
+
+.. |big_O| replace:: ``big_O``
+.. _big_O: https://github.com/pberkes/big_O
diff --git a/docs/html/_sources/annotations/index.rst.txt b/docs/html/_sources/annotations/index.rst.txt
index 775df58..e487e3a 100644
--- a/docs/html/_sources/annotations/index.rst.txt
+++ b/docs/html/_sources/annotations/index.rst.txt
@@ -8,6 +8,7 @@ Annotations
    :hidden:
 
    relational_annotations
+   complexity_annotations
    invariants
 
 Annotations are the building blocks out of which reference implementations are constructed. They 
diff --git a/docs/html/_sources/api_reference.rst.txt b/docs/html/_sources/api_reference.rst.txt
index c45022b..240ff03 100644
--- a/docs/html/_sources/api_reference.rst.txt
+++ b/docs/html/_sources/api_reference.rst.txt
@@ -28,6 +28,24 @@ Relational Annotations
    :undoc-members:
 
 
+Complexity Annotations
+++++++++++++++++++++++
+
+.. automodule:: pybryt.annotations.complexity.annotation
+   :members:
+   :undoc-members:
+
+
+.. _complexities:
+
+Complexity Classes
+??????????????????
+
+.. automodule:: pybryt.annotations.complexity.complexities
+   :members:
+   :undoc-members:
+
+
 Invariants
 ++++++++++
 
diff --git a/docs/html/_static/underscore-1.12.0.js b/docs/html/_static/underscore-1.12.0.js
new file mode 100644
index 0000000..3af6352
--- /dev/null
+++ b/docs/html/_static/underscore-1.12.0.js
@@ -0,0 +1,2027 @@
+(function (global, factory) {
+  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+  typeof define === 'function' && define.amd ? define('underscore', factory) :
+  (global = global || self, (function () {
+    var current = global._;
+    var exports = global._ = factory();
+    exports.noConflict = function () { global._ = current; return exports; };
+  }()));
+}(this, (function () {
+  //     Underscore.js 1.12.0
+  //     https://underscorejs.org
+  //     (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+  //     Underscore may be freely distributed under the MIT license.
+
+  // Current version.
+  var VERSION = '1.12.0';
+
+  // Establish the root object, `window` (`self`) in the browser, `global`
+  // on the server, or `this` in some virtual machines. We use `self`
+  // instead of `window` for `WebWorker` support.
+  var root = typeof self == 'object' && self.self === self && self ||
+            typeof global == 'object' && global.global === global && global ||
+            Function('return this')() ||
+            {};
+
+  // Save bytes in the minified (but not gzipped) version:
+  var ArrayProto = Array.prototype, ObjProto = Object.prototype;
+  var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
+
+  // Create quick reference variables for speed access to core prototypes.
+  var push = ArrayProto.push,
+      slice = ArrayProto.slice,
+      toString = ObjProto.toString,
+      hasOwnProperty = ObjProto.hasOwnProperty;
+
+  // Modern feature detection.
+  var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
+      supportsDataView = typeof DataView !== 'undefined';
+
+  // All **ECMAScript 5+** native function implementations that we hope to use
+  // are declared here.
+  var nativeIsArray = Array.isArray,
+      nativeKeys = Object.keys,
+      nativeCreate = Object.create,
+      nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
+
+  // Create references to these builtin functions because we override them.
+  var _isNaN = isNaN,
+      _isFinite = isFinite;
+
+  // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
+  var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
+  var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
+    'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
+
+  // The largest integer that can be represented exactly.
+  var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
+
+  // Some functions take a variable number of arguments, or a few expected
+  // arguments at the beginning and then a variable number of values to operate
+  // on. This helper accumulates all remaining arguments past the function’s
+  // argument length (or an explicit `startIndex`), into an array that becomes
+  // the last argument. Similar to ES6’s "rest parameter".
+  function restArguments(func, startIndex) {
+    startIndex = startIndex == null ? func.length - 1 : +startIndex;
+    return function() {
+      var length = Math.max(arguments.length - startIndex, 0),
+          rest = Array(length),
+          index = 0;
+      for (; index < length; index++) {
+        rest[index] = arguments[index + startIndex];
+      }
+      switch (startIndex) {
+        case 0: return func.call(this, rest);
+        case 1: return func.call(this, arguments[0], rest);
+        case 2: return func.call(this, arguments[0], arguments[1], rest);
+      }
+      var args = Array(startIndex + 1);
+      for (index = 0; index < startIndex; index++) {
+        args[index] = arguments[index];
+      }
+      args[startIndex] = rest;
+      return func.apply(this, args);
+    };
+  }
+
+  // Is a given variable an object?
+  function isObject(obj) {
+    var type = typeof obj;
+    return type === 'function' || type === 'object' && !!obj;
+  }
+
+  // Is a given value equal to null?
+  function isNull(obj) {
+    return obj === null;
+  }
+
+  // Is a given variable undefined?
+  function isUndefined(obj) {
+    return obj === void 0;
+  }
+
+  // Is a given value a boolean?
+  function isBoolean(obj) {
+    return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
+  }
+
+  // Is a given value a DOM element?
+  function isElement(obj) {
+    return !!(obj && obj.nodeType === 1);
+  }
+
+  // Internal function for creating a `toString`-based type tester.
+  function tagTester(name) {
+    var tag = '[object ' + name + ']';
+    return function(obj) {
+      return toString.call(obj) === tag;
+    };
+  }
+
+  var isString = tagTester('String');
+
+  var isNumber = tagTester('Number');
+
+  var isDate = tagTester('Date');
+
+  var isRegExp = tagTester('RegExp');
+
+  var isError = tagTester('Error');
+
+  var isSymbol = tagTester('Symbol');
+
+  var isArrayBuffer = tagTester('ArrayBuffer');
+
+  var isFunction = tagTester('Function');
+
+  // Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
+  // v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
+  var nodelist = root.document && root.document.childNodes;
+  if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
+    isFunction = function(obj) {
+      return typeof obj == 'function' || false;
+    };
+  }
+
+  var isFunction$1 = isFunction;
+
+  var hasObjectTag = tagTester('Object');
+
+  // In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
+  // In IE 11, the most common among them, this problem also applies to
+  // `Map`, `WeakMap` and `Set`.
+  var hasStringTagBug = (
+        supportsDataView && hasObjectTag(new DataView(new ArrayBuffer(8)))
+      ),
+      isIE11 = (typeof Map !== 'undefined' && hasObjectTag(new Map));
+
+  var isDataView = tagTester('DataView');
+
+  // In IE 10 - Edge 13, we need a different heuristic
+  // to determine whether an object is a `DataView`.
+  function ie10IsDataView(obj) {
+    return obj != null && isFunction$1(obj.getInt8) && isArrayBuffer(obj.buffer);
+  }
+
+  var isDataView$1 = (hasStringTagBug ? ie10IsDataView : isDataView);
+
+  // Is a given value an array?
+  // Delegates to ECMA5's native `Array.isArray`.
+  var isArray = nativeIsArray || tagTester('Array');
+
+  // Internal function to check whether `key` is an own property name of `obj`.
+  function has(obj, key) {
+    return obj != null && hasOwnProperty.call(obj, key);
+  }
+
+  var isArguments = tagTester('Arguments');
+
+  // Define a fallback version of the method in browsers (ahem, IE < 9), where
+  // there isn't any inspectable "Arguments" type.
+  (function() {
+    if (!isArguments(arguments)) {
+      isArguments = function(obj) {
+        return has(obj, 'callee');
+      };
+    }
+  }());
+
+  var isArguments$1 = isArguments;
+
+  // Is a given object a finite number?
+  function isFinite$1(obj) {
+    return !isSymbol(obj) && _isFinite(obj) && !isNaN(parseFloat(obj));
+  }
+
+  // Is the given value `NaN`?
+  function isNaN$1(obj) {
+    return isNumber(obj) && _isNaN(obj);
+  }
+
+  // Predicate-generating function. Often useful outside of Underscore.
+  function constant(value) {
+    return function() {
+      return value;
+    };
+  }
+
+  // Common internal logic for `isArrayLike` and `isBufferLike`.
+  function createSizePropertyCheck(getSizeProperty) {
+    return function(collection) {
+      var sizeProperty = getSizeProperty(collection);
+      return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= MAX_ARRAY_INDEX;
+    }
+  }
+
+  // Internal helper to generate a function to obtain property `key` from `obj`.
+  function shallowProperty(key) {
+    return function(obj) {
+      return obj == null ? void 0 : obj[key];
+    };
+  }
+
+  // Internal helper to obtain the `byteLength` property of an object.
+  var getByteLength = shallowProperty('byteLength');
+
+  // Internal helper to determine whether we should spend extensive checks against
+  // `ArrayBuffer` et al.
+  var isBufferLike = createSizePropertyCheck(getByteLength);
+
+  // Is a given value a typed array?
+  var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
+  function isTypedArray(obj) {
+    // `ArrayBuffer.isView` is the most future-proof, so use it when available.
+    // Otherwise, fall back on the above regular expression.
+    return nativeIsView ? (nativeIsView(obj) && !isDataView$1(obj)) :
+                  isBufferLike(obj) && typedArrayPattern.test(toString.call(obj));
+  }
+
+  var isTypedArray$1 = supportsArrayBuffer ? isTypedArray : constant(false);
+
+  // Internal helper to obtain the `length` property of an object.
+  var getLength = shallowProperty('length');
+
+  // Internal helper to create a simple lookup structure.
+  // `collectNonEnumProps` used to depend on `_.contains`, but this led to
+  // circular imports. `emulatedSet` is a one-off solution that only works for
+  // arrays of strings.
+  function emulatedSet(keys) {
+    var hash = {};
+    for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
+    return {
+      contains: function(key) { return hash[key]; },
+      push: function(key) {
+        hash[key] = true;
+        return keys.push(key);
+      }
+    };
+  }
+
+  // Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
+  // be iterated by `for key in ...` and thus missed. Extends `keys` in place if
+  // needed.
+  function collectNonEnumProps(obj, keys) {
+    keys = emulatedSet(keys);
+    var nonEnumIdx = nonEnumerableProps.length;
+    var constructor = obj.constructor;
+    var proto = isFunction$1(constructor) && constructor.prototype || ObjProto;
+
+    // Constructor is a special case.
+    var prop = 'constructor';
+    if (has(obj, prop) && !keys.contains(prop)) keys.push(prop);
+
+    while (nonEnumIdx--) {
+      prop = nonEnumerableProps[nonEnumIdx];
+      if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
+        keys.push(prop);
+      }
+    }
+  }
+
+  // Retrieve the names of an object's own properties.
+  // Delegates to **ECMAScript 5**'s native `Object.keys`.
+  function keys(obj) {
+    if (!isObject(obj)) return [];
+    if (nativeKeys) return nativeKeys(obj);
+    var keys = [];
+    for (var key in obj) if (has(obj, key)) keys.push(key);
+    // Ahem, IE < 9.
+    if (hasEnumBug) collectNonEnumProps(obj, keys);
+    return keys;
+  }
+
+  // Is a given array, string, or object empty?
+  // An "empty" object has no enumerable own-properties.
+  function isEmpty(obj) {
+    if (obj == null) return true;
+    // Skip the more expensive `toString`-based type checks if `obj` has no
+    // `.length`.
+    var length = getLength(obj);
+    if (typeof length == 'number' && (
+      isArray(obj) || isString(obj) || isArguments$1(obj)
+    )) return length === 0;
+    return getLength(keys(obj)) === 0;
+  }
+
+  // Returns whether an object has a given set of `key:value` pairs.
+  function isMatch(object, attrs) {
+    var _keys = keys(attrs), length = _keys.length;
+    if (object == null) return !length;
+    var obj = Object(object);
+    for (var i = 0; i < length; i++) {
+      var key = _keys[i];
+      if (attrs[key] !== obj[key] || !(key in obj)) return false;
+    }
+    return true;
+  }
+
+  // If Underscore is called as a function, it returns a wrapped object that can
+  // be used OO-style. This wrapper holds altered versions of all functions added
+  // through `_.mixin`. Wrapped objects may be chained.
+  function _(obj) {
+    if (obj instanceof _) return obj;
+    if (!(this instanceof _)) return new _(obj);
+    this._wrapped = obj;
+  }
+
+  _.VERSION = VERSION;
+
+  // Extracts the result from a wrapped and chained object.
+  _.prototype.value = function() {
+    return this._wrapped;
+  };
+
+  // Provide unwrapping proxies for some methods used in engine operations
+  // such as arithmetic and JSON stringification.
+  _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
+
+  _.prototype.toString = function() {
+    return String(this._wrapped);
+  };
+
+  // Internal function to wrap or shallow-copy an ArrayBuffer,
+  // typed array or DataView to a new view, reusing the buffer.
+  function toBufferView(bufferSource) {
+    return new Uint8Array(
+      bufferSource.buffer || bufferSource,
+      bufferSource.byteOffset || 0,
+      getByteLength(bufferSource)
+    );
+  }
+
+  // We use this string twice, so give it a name for minification.
+  var tagDataView = '[object DataView]';
+
+  // Internal recursive comparison function for `_.isEqual`.
+  function eq(a, b, aStack, bStack) {
+    // Identical objects are equal. `0 === -0`, but they aren't identical.
+    // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
+    if (a === b) return a !== 0 || 1 / a === 1 / b;
+    // `null` or `undefined` only equal to itself (strict comparison).
+    if (a == null || b == null) return false;
+    // `NaN`s are equivalent, but non-reflexive.
+    if (a !== a) return b !== b;
+    // Exhaust primitive checks
+    var type = typeof a;
+    if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
+    return deepEq(a, b, aStack, bStack);
+  }
+
+  // Internal recursive comparison function for `_.isEqual`.
+  function deepEq(a, b, aStack, bStack) {
+    // Unwrap any wrapped objects.
+    if (a instanceof _) a = a._wrapped;
+    if (b instanceof _) b = b._wrapped;
+    // Compare `[[Class]]` names.
+    var className = toString.call(a);
+    if (className !== toString.call(b)) return false;
+    // Work around a bug in IE 10 - Edge 13.
+    if (hasStringTagBug && className == '[object Object]' && isDataView$1(a)) {
+      if (!isDataView$1(b)) return false;
+      className = tagDataView;
+    }
+    switch (className) {
+      // These types are compared by value.
+      case '[object RegExp]':
+        // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
+      case '[object String]':
+        // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+        // equivalent to `new String("5")`.
+        return '' + a === '' + b;
+      case '[object Number]':
+        // `NaN`s are equivalent, but non-reflexive.
+        // Object(NaN) is equivalent to NaN.
+        if (+a !== +a) return +b !== +b;
+        // An `egal` comparison is performed for other numeric values.
+        return +a === 0 ? 1 / +a === 1 / b : +a === +b;
+      case '[object Date]':
+      case '[object Boolean]':
+        // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+        // millisecond representations. Note that invalid dates with millisecond representations
+        // of `NaN` are not equivalent.
+        return +a === +b;
+      case '[object Symbol]':
+        return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b);
+      case '[object ArrayBuffer]':
+      case tagDataView:
+        // Coerce to typed array so we can fall through.
+        return deepEq(toBufferView(a), toBufferView(b), aStack, bStack);
+    }
+
+    var areArrays = className === '[object Array]';
+    if (!areArrays && isTypedArray$1(a)) {
+        var byteLength = getByteLength(a);
+        if (byteLength !== getByteLength(b)) return false;
+        if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
+        areArrays = true;
+    }
+    if (!areArrays) {
+      if (typeof a != 'object' || typeof b != 'object') return false;
+
+      // Objects with different constructors are not equivalent, but `Object`s or `Array`s
+      // from different frames are.
+      var aCtor = a.constructor, bCtor = b.constructor;
+      if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor &&
+                               isFunction$1(bCtor) && bCtor instanceof bCtor)
+                          && ('constructor' in a && 'constructor' in b)) {
+        return false;
+      }
+    }
+    // Assume equality for cyclic structures. The algorithm for detecting cyclic
+    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+
+    // Initializing stack of traversed objects.
+    // It's done here since we only need them for objects and arrays comparison.
+    aStack = aStack || [];
+    bStack = bStack || [];
+    var length = aStack.length;
+    while (length--) {
+      // Linear search. Performance is inversely proportional to the number of
+      // unique nested structures.
+      if (aStack[length] === a) return bStack[length] === b;
+    }
+
+    // Add the first object to the stack of traversed objects.
+    aStack.push(a);
+    bStack.push(b);
+
+    // Recursively compare objects and arrays.
+    if (areArrays) {
+      // Compare array lengths to determine if a deep comparison is necessary.
+      length = a.length;
+      if (length !== b.length) return false;
+      // Deep compare the contents, ignoring non-numeric properties.
+      while (length--) {
+        if (!eq(a[length], b[length], aStack, bStack)) return false;
+      }
+    } else {
+      // Deep compare objects.
+      var _keys = keys(a), key;
+      length = _keys.length;
+      // Ensure that both objects contain the same number of properties before comparing deep equality.
+      if (keys(b).length !== length) return false;
+      while (length--) {
+        // Deep compare each member
+        key = _keys[length];
+        if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
+      }
+    }
+    // Remove the first object from the stack of traversed objects.
+    aStack.pop();
+    bStack.pop();
+    return true;
+  }
+
+  // Perform a deep comparison to check if two objects are equal.
+  function isEqual(a, b) {
+    return eq(a, b);
+  }
+
+  // Retrieve all the enumerable property names of an object.
+  function allKeys(obj) {
+    if (!isObject(obj)) return [];
+    var keys = [];
+    for (var key in obj) keys.push(key);
+    // Ahem, IE < 9.
+    if (hasEnumBug) collectNonEnumProps(obj, keys);
+    return keys;
+  }
+
+  // Since the regular `Object.prototype.toString` type tests don't work for
+  // some types in IE 11, we use a fingerprinting heuristic instead, based
+  // on the methods. It's not great, but it's the best we got.
+  // The fingerprint method lists are defined below.
+  function ie11fingerprint(methods) {
+    var length = getLength(methods);
+    return function(obj) {
+      if (obj == null) return false;
+      // `Map`, `WeakMap` and `Set` have no enumerable keys.
+      var keys = allKeys(obj);
+      if (getLength(keys)) return false;
+      for (var i = 0; i < length; i++) {
+        if (!isFunction$1(obj[methods[i]])) return false;
+      }
+      // If we are testing against `WeakMap`, we need to ensure that
+      // `obj` doesn't have a `forEach` method in order to distinguish
+      // it from a regular `Map`.
+      return methods !== weakMapMethods || !isFunction$1(obj[forEachName]);
+    };
+  }
+
+  // In the interest of compact minification, we write
+  // each string in the fingerprints only once.
+  var forEachName = 'forEach',
+      hasName = 'has',
+      commonInit = ['clear', 'delete'],
+      mapTail = ['get', hasName, 'set'];
+
+  // `Map`, `WeakMap` and `Set` each have slightly different
+  // combinations of the above sublists.
+  var mapMethods = commonInit.concat(forEachName, mapTail),
+      weakMapMethods = commonInit.concat(mapTail),
+      setMethods = ['add'].concat(commonInit, forEachName, hasName);
+
+  var isMap = isIE11 ? ie11fingerprint(mapMethods) : tagTester('Map');
+
+  var isWeakMap = isIE11 ? ie11fingerprint(weakMapMethods) : tagTester('WeakMap');
+
+  var isSet = isIE11 ? ie11fingerprint(setMethods) : tagTester('Set');
+
+  var isWeakSet = tagTester('WeakSet');
+
+  // Retrieve the values of an object's properties.
+  function values(obj) {
+    var _keys = keys(obj);
+    var length = _keys.length;
+    var values = Array(length);
+    for (var i = 0; i < length; i++) {
+      values[i] = obj[_keys[i]];
+    }
+    return values;
+  }
+
+  // Convert an object into a list of `[key, value]` pairs.
+  // The opposite of `_.object` with one argument.
+  function pairs(obj) {
+    var _keys = keys(obj);
+    var length = _keys.length;
+    var pairs = Array(length);
+    for (var i = 0; i < length; i++) {
+      pairs[i] = [_keys[i], obj[_keys[i]]];
+    }
+    return pairs;
+  }
+
+  // Invert the keys and values of an object. The values must be serializable.
+  function invert(obj) {
+    var result = {};
+    var _keys = keys(obj);
+    for (var i = 0, length = _keys.length; i < length; i++) {
+      result[obj[_keys[i]]] = _keys[i];
+    }
+    return result;
+  }
+
+  // Return a sorted list of the function names available on the object.
+  function functions(obj) {
+    var names = [];
+    for (var key in obj) {
+      if (isFunction$1(obj[key])) names.push(key);
+    }
+    return names.sort();
+  }
+
+  // An internal function for creating assigner functions.
+  function createAssigner(keysFunc, defaults) {
+    return function(obj) {
+      var length = arguments.length;
+      if (defaults) obj = Object(obj);
+      if (length < 2 || obj == null) return obj;
+      for (var index = 1; index < length; index++) {
+        var source = arguments[index],
+            keys = keysFunc(source),
+            l = keys.length;
+        for (var i = 0; i < l; i++) {
+          var key = keys[i];
+          if (!defaults || obj[key] === void 0) obj[key] = source[key];
+        }
+      }
+      return obj;
+    };
+  }
+
+  // Extend a given object with all the properties in passed-in object(s).
+  var extend = createAssigner(allKeys);
+
+  // Assigns a given object with all the own properties in the passed-in
+  // object(s).
+  // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
+  var extendOwn = createAssigner(keys);
+
+  // Fill in a given object with default properties.
+  var defaults = createAssigner(allKeys, true);
+
+  // Create a naked function reference for surrogate-prototype-swapping.
+  function ctor() {
+    return function(){};
+  }
+
+  // An internal function for creating a new object that inherits from another.
+  function baseCreate(prototype) {
+    if (!isObject(prototype)) return {};
+    if (nativeCreate) return nativeCreate(prototype);
+    var Ctor = ctor();
+    Ctor.prototype = prototype;
+    var result = new Ctor;
+    Ctor.prototype = null;
+    return result;
+  }
+
+  // Creates an object that inherits from the given prototype object.
+  // If additional properties are provided then they will be added to the
+  // created object.
+  function create(prototype, props) {
+    var result = baseCreate(prototype);
+    if (props) extendOwn(result, props);
+    return result;
+  }
+
+  // Create a (shallow-cloned) duplicate of an object.
+  function clone(obj) {
+    if (!isObject(obj)) return obj;
+    return isArray(obj) ? obj.slice() : extend({}, obj);
+  }
+
+  // Invokes `interceptor` with the `obj` and then returns `obj`.
+  // The primary purpose of this method is to "tap into" a method chain, in
+  // order to perform operations on intermediate results within the chain.
+  function tap(obj, interceptor) {
+    interceptor(obj);
+    return obj;
+  }
+
+  // Normalize a (deep) property `path` to array.
+  // Like `_.iteratee`, this function can be customized.
+  function toPath(path) {
+    return isArray(path) ? path : [path];
+  }
+  _.toPath = toPath;
+
+  // Internal wrapper for `_.toPath` to enable minification.
+  // Similar to `cb` for `_.iteratee`.
+  function toPath$1(path) {
+    return _.toPath(path);
+  }
+
+  // Internal function to obtain a nested property in `obj` along `path`.
+  function deepGet(obj, path) {
+    var length = path.length;
+    for (var i = 0; i < length; i++) {
+      if (obj == null) return void 0;
+      obj = obj[path[i]];
+    }
+    return length ? obj : void 0;
+  }
+
+  // Get the value of the (deep) property on `path` from `object`.
+  // If any property in `path` does not exist or if the value is
+  // `undefined`, return `defaultValue` instead.
+  // The `path` is normalized through `_.toPath`.
+  function get(object, path, defaultValue) {
+    var value = deepGet(object, toPath$1(path));
+    return isUndefined(value) ? defaultValue : value;
+  }
+
+  // Shortcut function for checking if an object has a given property directly on
+  // itself (in other words, not on a prototype). Unlike the internal `has`
+  // function, this public version can also traverse nested properties.
+  function has$1(obj, path) {
+    path = toPath$1(path);
+    var length = path.length;
+    for (var i = 0; i < length; i++) {
+      var key = path[i];
+      if (!has(obj, key)) return false;
+      obj = obj[key];
+    }
+    return !!length;
+  }
+
+  // Keep the identity function around for default iteratees.
+  function identity(value) {
+    return value;
+  }
+
+  // Returns a predicate for checking whether an object has a given set of
+  // `key:value` pairs.
+  function matcher(attrs) {
+    attrs = extendOwn({}, attrs);
+    return function(obj) {
+      return isMatch(obj, attrs);
+    };
+  }
+
+  // Creates a function that, when passed an object, will traverse that object’s
+  // properties down the given `path`, specified as an array of keys or indices.
+  function property(path) {
+    path = toPath$1(path);
+    return function(obj) {
+      return deepGet(obj, path);
+    };
+  }
+
+  // Internal function that returns an efficient (for current engines) version
+  // of the passed-in callback, to be repeatedly applied in other Underscore
+  // functions.
+  function optimizeCb(func, context, argCount) {
+    if (context === void 0) return func;
+    switch (argCount == null ? 3 : argCount) {
+      case 1: return function(value) {
+        return func.call(context, value);
+      };
+      // The 2-argument case is omitted because we’re not using it.
+      case 3: return function(value, index, collection) {
+        return func.call(context, value, index, collection);
+      };
+      case 4: return function(accumulator, value, index, collection) {
+        return func.call(context, accumulator, value, index, collection);
+      };
+    }
+    return function() {
+      return func.apply(context, arguments);
+    };
+  }
+
+  // An internal function to generate callbacks that can be applied to each
+  // element in a collection, returning the desired result — either `_.identity`,
+  // an arbitrary callback, a property matcher, or a property accessor.
+  function baseIteratee(value, context, argCount) {
+    if (value == null) return identity;
+    if (isFunction$1(value)) return optimizeCb(value, context, argCount);
+    if (isObject(value) && !isArray(value)) return matcher(value);
+    return property(value);
+  }
+
+  // External wrapper for our callback generator. Users may customize
+  // `_.iteratee` if they want additional predicate/iteratee shorthand styles.
+  // This abstraction hides the internal-only `argCount` argument.
+  function iteratee(value, context) {
+    return baseIteratee(value, context, Infinity);
+  }
+  _.iteratee = iteratee;
+
+  // The function we call internally to generate a callback. It invokes
+  // `_.iteratee` if overridden, otherwise `baseIteratee`.
+  function cb(value, context, argCount) {
+    if (_.iteratee !== iteratee) return _.iteratee(value, context);
+    return baseIteratee(value, context, argCount);
+  }
+
+  // Returns the results of applying the `iteratee` to each element of `obj`.
+  // In contrast to `_.map` it returns an object.
+  function mapObject(obj, iteratee, context) {
+    iteratee = cb(iteratee, context);
+    var _keys = keys(obj),
+        length = _keys.length,
+        results = {};
+    for (var index = 0; index < length; index++) {
+      var currentKey = _keys[index];
+      results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
+    }
+    return results;
+  }
+
+  // Predicate-generating function. Often useful outside of Underscore.
+  function noop(){}
+
+  // Generates a function for a given object that returns a given property.
+  function propertyOf(obj) {
+    if (obj == null) return noop;
+    return function(path) {
+      return get(obj, path);
+    };
+  }
+
+  // Run a function **n** times.
+  function times(n, iteratee, context) {
+    var accum = Array(Math.max(0, n));
+    iteratee = optimizeCb(iteratee, context, 1);
+    for (var i = 0; i < n; i++) accum[i] = iteratee(i);
+    return accum;
+  }
+
+  // Return a random integer between `min` and `max` (inclusive).
+  function random(min, max) {
+    if (max == null) {
+      max = min;
+      min = 0;
+    }
+    return min + Math.floor(Math.random() * (max - min + 1));
+  }
+
+  // A (possibly faster) way to get the current timestamp as an integer.
+  var now = Date.now || function() {
+    return new Date().getTime();
+  };
+
+  // Internal helper to generate functions for escaping and unescaping strings
+  // to/from HTML interpolation.
+  function createEscaper(map) {
+    var escaper = function(match) {
+      return map[match];
+    };
+    // Regexes for identifying a key that needs to be escaped.
+    var source = '(?:' + keys(map).join('|') + ')';
+    var testRegexp = RegExp(source);
+    var replaceRegexp = RegExp(source, 'g');
+    return function(string) {
+      string = string == null ? '' : '' + string;
+      return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
+    };
+  }
+
+  // Internal list of HTML entities for escaping.
+  var escapeMap = {
+    '&': '&amp;',
+    '<': '&lt;',
+    '>': '&gt;',
+    '"': '&quot;',
+    "'": '&#x27;',
+    '`': '&#x60;'
+  };
+
+  // Function for escaping strings to HTML interpolation.
+  var _escape = createEscaper(escapeMap);
+
+  // Internal list of HTML entities for unescaping.
+  var unescapeMap = invert(escapeMap);
+
+  // Function for unescaping strings from HTML interpolation.
+  var _unescape = createEscaper(unescapeMap);
+
+  // By default, Underscore uses ERB-style template delimiters. Change the
+  // following template settings to use alternative delimiters.
+  var templateSettings = _.templateSettings = {
+    evaluate: /<%([\s\S]+?)%>/g,
+    interpolate: /<%=([\s\S]+?)%>/g,
+    escape: /<%-([\s\S]+?)%>/g
+  };
+
+  // When customizing `_.templateSettings`, if you don't want to define an
+  // interpolation, evaluation or escaping regex, we need one that is
+  // guaranteed not to match.
+  var noMatch = /(.)^/;
+
+  // Certain characters need to be escaped so that they can be put into a
+  // string literal.
+  var escapes = {
+    "'": "'",
+    '\\': '\\',
+    '\r': 'r',
+    '\n': 'n',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
+
+  function escapeChar(match) {
+    return '\\' + escapes[match];
+  }
+
+  // JavaScript micro-templating, similar to John Resig's implementation.
+  // Underscore templating handles arbitrary delimiters, preserves whitespace,
+  // and correctly escapes quotes within interpolated code.
+  // NB: `oldSettings` only exists for backwards compatibility.
+  function template(text, settings, oldSettings) {
+    if (!settings && oldSettings) settings = oldSettings;
+    settings = defaults({}, settings, _.templateSettings);
+
+    // Combine delimiters into one regular expression via alternation.
+    var matcher = RegExp([
+      (settings.escape || noMatch).source,
+      (settings.interpolate || noMatch).source,
+      (settings.evaluate || noMatch).source
+    ].join('|') + '|$', 'g');
+
+    // Compile the template source, escaping string literals appropriately.
+    var index = 0;
+    var source = "__p+='";
+    text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
+      source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
+      index = offset + match.length;
+
+      if (escape) {
+        source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
+      } else if (interpolate) {
+        source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
+      } else if (evaluate) {
+        source += "';\n" + evaluate + "\n__p+='";
+      }
+
+      // Adobe VMs need the match returned to produce the correct offset.
+      return match;
+    });
+    source += "';\n";
+
+    // If a variable is not specified, place data values in local scope.
+    if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
+
+    source = "var __t,__p='',__j=Array.prototype.join," +
+      "print=function(){__p+=__j.call(arguments,'');};\n" +
+      source + 'return __p;\n';
+
+    var render;
+    try {
+      render = new Function(settings.variable || 'obj', '_', source);
+    } catch (e) {
+      e.source = source;
+      throw e;
+    }
+
+    var template = function(data) {
+      return render.call(this, data, _);
+    };
+
+    // Provide the compiled source as a convenience for precompilation.
+    var argument = settings.variable || 'obj';
+    template.source = 'function(' + argument + '){\n' + source + '}';
+
+    return template;
+  }
+
+  // Traverses the children of `obj` along `path`. If a child is a function, it
+  // is invoked with its parent as context. Returns the value of the final
+  // child, or `fallback` if any child is undefined.
+  function result(obj, path, fallback) {
+    path = toPath$1(path);
+    var length = path.length;
+    if (!length) {
+      return isFunction$1(fallback) ? fallback.call(obj) : fallback;
+    }
+    for (var i = 0; i < length; i++) {
+      var prop = obj == null ? void 0 : obj[path[i]];
+      if (prop === void 0) {
+        prop = fallback;
+        i = length; // Ensure we don't continue iterating.
+      }
+      obj = isFunction$1(prop) ? prop.call(obj) : prop;
+    }
+    return obj;
+  }
+
+  // Generate a unique integer id (unique within the entire client session).
+  // Useful for temporary DOM ids.
+  var idCounter = 0;
+  function uniqueId(prefix) {
+    var id = ++idCounter + '';
+    return prefix ? prefix + id : id;
+  }
+
+  // Start chaining a wrapped Underscore object.
+  function chain(obj) {
+    var instance = _(obj);
+    instance._chain = true;
+    return instance;
+  }
+
+  // Internal function to execute `sourceFunc` bound to `context` with optional
+  // `args`. Determines whether to execute a function as a constructor or as a
+  // normal function.
+  function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
+    if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
+    var self = baseCreate(sourceFunc.prototype);
+    var result = sourceFunc.apply(self, args);
+    if (isObject(result)) return result;
+    return self;
+  }
+
+  // Partially apply a function by creating a version that has had some of its
+  // arguments pre-filled, without changing its dynamic `this` context. `_` acts
+  // as a placeholder by default, allowing any combination of arguments to be
+  // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
+  var partial = restArguments(function(func, boundArgs) {
+    var placeholder = partial.placeholder;
+    var bound = function() {
+      var position = 0, length = boundArgs.length;
+      var args = Array(length);
+      for (var i = 0; i < length; i++) {
+        args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
+      }
+      while (position < arguments.length) args.push(arguments[position++]);
+      return executeBound(func, bound, this, this, args);
+    };
+    return bound;
+  });
+
+  partial.placeholder = _;
+
+  // Create a function bound to a given object (assigning `this`, and arguments,
+  // optionally).
+  var bind = restArguments(function(func, context, args) {
+    if (!isFunction$1(func)) throw new TypeError('Bind must be called on a function');
+    var bound = restArguments(function(callArgs) {
+      return executeBound(func, bound, context, this, args.concat(callArgs));
+    });
+    return bound;
+  });
+
+  // Internal helper for collection methods to determine whether a collection
+  // should be iterated as an array or as an object.
+  // Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
+  // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
+  var isArrayLike = createSizePropertyCheck(getLength);
+
+  // Internal implementation of a recursive `flatten` function.
+  function flatten(input, depth, strict, output) {
+    output = output || [];
+    if (!depth && depth !== 0) {
+      depth = Infinity;
+    } else if (depth <= 0) {
+      return output.concat(input);
+    }
+    var idx = output.length;
+    for (var i = 0, length = getLength(input); i < length; i++) {
+      var value = input[i];
+      if (isArrayLike(value) && (isArray(value) || isArguments$1(value))) {
+        // Flatten current level of array or arguments object.
+        if (depth > 1) {
+          flatten(value, depth - 1, strict, output);
+          idx = output.length;
+        } else {
+          var j = 0, len = value.length;
+          while (j < len) output[idx++] = value[j++];
+        }
+      } else if (!strict) {
+        output[idx++] = value;
+      }
+    }
+    return output;
+  }
+
+  // Bind a number of an object's methods to that object. Remaining arguments
+  // are the method names to be bound. Useful for ensuring that all callbacks
+  // defined on an object belong to it.
+  var bindAll = restArguments(function(obj, keys) {
+    keys = flatten(keys, false, false);
+    var index = keys.length;
+    if (index < 1) throw new Error('bindAll must be passed function names');
+    while (index--) {
+      var key = keys[index];
+      obj[key] = bind(obj[key], obj);
+    }
+    return obj;
+  });
+
+  // Memoize an expensive function by storing its results.
+  function memoize(func, hasher) {
+    var memoize = function(key) {
+      var cache = memoize.cache;
+      var address = '' + (hasher ? hasher.apply(this, arguments) : key);
+      if (!has(cache, address)) cache[address] = func.apply(this, arguments);
+      return cache[address];
+    };
+    memoize.cache = {};
+    return memoize;
+  }
+
+  // Delays a function for the given number of milliseconds, and then calls
+  // it with the arguments supplied.
+  var delay = restArguments(function(func, wait, args) {
+    return setTimeout(function() {
+      return func.apply(null, args);
+    }, wait);
+  });
+
+  // Defers a function, scheduling it to run after the current call stack has
+  // cleared.
+  var defer = partial(delay, _, 1);
+
+  // Returns a function, that, when invoked, will only be triggered at most once
+  // during a given window of time. Normally, the throttled function will run
+  // as much as it can, without ever going more than once per `wait` duration;
+  // but if you'd like to disable the execution on the leading edge, pass
+  // `{leading: false}`. To disable execution on the trailing edge, ditto.
+  function throttle(func, wait, options) {
+    var timeout, context, args, result;
+    var previous = 0;
+    if (!options) options = {};
+
+    var later = function() {
+      previous = options.leading === false ? 0 : now();
+      timeout = null;
+      result = func.apply(context, args);
+      if (!timeout) context = args = null;
+    };
+
+    var throttled = function() {
+      var _now = now();
+      if (!previous && options.leading === false) previous = _now;
+      var remaining = wait - (_now - previous);
+      context = this;
+      args = arguments;
+      if (remaining <= 0 || remaining > wait) {
+        if (timeout) {
+          clearTimeout(timeout);
+          timeout = null;
+        }
+        previous = _now;
+        result = func.apply(context, args);
+        if (!timeout) context = args = null;
+      } else if (!timeout && options.trailing !== false) {
+        timeout = setTimeout(later, remaining);
+      }
+      return result;
+    };
+
+    throttled.cancel = function() {
+      clearTimeout(timeout);
+      previous = 0;
+      timeout = context = args = null;
+    };
+
+    return throttled;
+  }
+
+  // When a sequence of calls of the returned function ends, the argument
+  // function is triggered. The end of a sequence is defined by the `wait`
+  // parameter. If `immediate` is passed, the argument function will be
+  // triggered at the beginning of the sequence instead of at the end.
+  function debounce(func, wait, immediate) {
+    var timeout, previous, args, result, context;
+
+    var later = function() {
+      var passed = now() - previous;
+      if (wait > passed) {
+        timeout = setTimeout(later, wait - passed);
+      } else {
+        timeout = null;
+        if (!immediate) result = func.apply(context, args);
+        // This check is needed because `func` can recursively invoke `debounced`.
+        if (!timeout) args = context = null;
+      }
+    };
+
+    var debounced = restArguments(function(_args) {
+      context = this;
+      args = _args;
+      previous = now();
+      if (!timeout) {
+        timeout = setTimeout(later, wait);
+        if (immediate) result = func.apply(context, args);
+      }
+      return result;
+    });
+
+    debounced.cancel = function() {
+      clearTimeout(timeout);
+      timeout = args = context = null;
+    };
+
+    return debounced;
+  }
+
+  // Returns the first function passed as an argument to the second,
+  // allowing you to adjust arguments, run code before and after, and
+  // conditionally execute the original function.
+  function wrap(func, wrapper) {
+    return partial(wrapper, func);
+  }
+
+  // Returns a negated version of the passed-in predicate.
+  function negate(predicate) {
+    return function() {
+      return !predicate.apply(this, arguments);
+    };
+  }
+
+  // Returns a function that is the composition of a list of functions, each
+  // consuming the return value of the function that follows.
+  function compose() {
+    var args = arguments;
+    var start = args.length - 1;
+    return function() {
+      var i = start;
+      var result = args[start].apply(this, arguments);
+      while (i--) result = args[i].call(this, result);
+      return result;
+    };
+  }
+
+  // Returns a function that will only be executed on and after the Nth call.
+  function after(times, func) {
+    return function() {
+      if (--times < 1) {
+        return func.apply(this, arguments);
+      }
+    };
+  }
+
+  // Returns a function that will only be executed up to (but not including) the
+  // Nth call.
+  function before(times, func) {
+    var memo;
+    return function() {
+      if (--times > 0) {
+        memo = func.apply(this, arguments);
+      }
+      if (times <= 1) func = null;
+      return memo;
+    };
+  }
+
+  // Returns a function that will be executed at most one time, no matter how
+  // often you call it. Useful for lazy initialization.
+  var once = partial(before, 2);
+
+  // Returns the first key on an object that passes a truth test.
+  function findKey(obj, predicate, context) {
+    predicate = cb(predicate, context);
+    var _keys = keys(obj), key;
+    for (var i = 0, length = _keys.length; i < length; i++) {
+      key = _keys[i];
+      if (predicate(obj[key], key, obj)) return key;
+    }
+  }
+
+  // Internal function to generate `_.findIndex` and `_.findLastIndex`.
+  function createPredicateIndexFinder(dir) {
+    return function(array, predicate, context) {
+      predicate = cb(predicate, context);
+      var length = getLength(array);
+      var index = dir > 0 ? 0 : length - 1;
+      for (; index >= 0 && index < length; index += dir) {
+        if (predicate(array[index], index, array)) return index;
+      }
+      return -1;
+    };
+  }
+
+  // Returns the first index on an array-like that passes a truth test.
+  var findIndex = createPredicateIndexFinder(1);
+
+  // Returns the last index on an array-like that passes a truth test.
+  var findLastIndex = createPredicateIndexFinder(-1);
+
+  // Use a comparator function to figure out the smallest index at which
+  // an object should be inserted so as to maintain order. Uses binary search.
+  function sortedIndex(array, obj, iteratee, context) {
+    iteratee = cb(iteratee, context, 1);
+    var value = iteratee(obj);
+    var low = 0, high = getLength(array);
+    while (low < high) {
+      var mid = Math.floor((low + high) / 2);
+      if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
+    }
+    return low;
+  }
+
+  // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
+  function createIndexFinder(dir, predicateFind, sortedIndex) {
+    return function(array, item, idx) {
+      var i = 0, length = getLength(array);
+      if (typeof idx == 'number') {
+        if (dir > 0) {
+          i = idx >= 0 ? idx : Math.max(idx + length, i);
+        } else {
+          length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
+        }
+      } else if (sortedIndex && idx && length) {
+        idx = sortedIndex(array, item);
+        return array[idx] === item ? idx : -1;
+      }
+      if (item !== item) {
+        idx = predicateFind(slice.call(array, i, length), isNaN$1);
+        return idx >= 0 ? idx + i : -1;
+      }
+      for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
+        if (array[idx] === item) return idx;
+      }
+      return -1;
+    };
+  }
+
+  // Return the position of the first occurrence of an item in an array,
+  // or -1 if the item is not included in the array.
+  // If the array is large and already in sort order, pass `true`
+  // for **isSorted** to use binary search.
+  var indexOf = createIndexFinder(1, findIndex, sortedIndex);
+
+  // Return the position of the last occurrence of an item in an array,
+  // or -1 if the item is not included in the array.
+  var lastIndexOf = createIndexFinder(-1, findLastIndex);
+
+  // Return the first value which passes a truth test.
+  function find(obj, predicate, context) {
+    var keyFinder = isArrayLike(obj) ? findIndex : findKey;
+    var key = keyFinder(obj, predicate, context);
+    if (key !== void 0 && key !== -1) return obj[key];
+  }
+
+  // Convenience version of a common use case of `_.find`: getting the first
+  // object containing specific `key:value` pairs.
+  function findWhere(obj, attrs) {
+    return find(obj, matcher(attrs));
+  }
+
+  // The cornerstone for collection functions, an `each`
+  // implementation, aka `forEach`.
+  // Handles raw objects in addition to array-likes. Treats all
+  // sparse array-likes as if they were dense.
+  function each(obj, iteratee, context) {
+    iteratee = optimizeCb(iteratee, context);
+    var i, length;
+    if (isArrayLike(obj)) {
+      for (i = 0, length = obj.length; i < length; i++) {
+        iteratee(obj[i], i, obj);
+      }
+    } else {
+      var _keys = keys(obj);
+      for (i = 0, length = _keys.length; i < length; i++) {
+        iteratee(obj[_keys[i]], _keys[i], obj);
+      }
+    }
+    return obj;
+  }
+
+  // Return the results of applying the iteratee to each element.
+  function map(obj, iteratee, context) {
+    iteratee = cb(iteratee, context);
+    var _keys = !isArrayLike(obj) && keys(obj),
+        length = (_keys || obj).length,
+        results = Array(length);
+    for (var index = 0; index < length; index++) {
+      var currentKey = _keys ? _keys[index] : index;
+      results[index] = iteratee(obj[currentKey], currentKey, obj);
+    }
+    return results;
+  }
+
+  // Internal helper to create a reducing function, iterating left or right.
+  function createReduce(dir) {
+    // Wrap code that reassigns argument variables in a separate function than
+    // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
+    var reducer = function(obj, iteratee, memo, initial) {
+      var _keys = !isArrayLike(obj) && keys(obj),
+          length = (_keys || obj).length,
+          index = dir > 0 ? 0 : length - 1;
+      if (!initial) {
+        memo = obj[_keys ? _keys[index] : index];
+        index += dir;
+      }
+      for (; index >= 0 && index < length; index += dir) {
+        var currentKey = _keys ? _keys[index] : index;
+        memo = iteratee(memo, obj[currentKey], currentKey, obj);
+      }
+      return memo;
+    };
+
+    return function(obj, iteratee, memo, context) {
+      var initial = arguments.length >= 3;
+      return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial);
+    };
+  }
+
+  // **Reduce** builds up a single result from a list of values, aka `inject`,
+  // or `foldl`.
+  var reduce = createReduce(1);
+
+  // The right-associative version of reduce, also known as `foldr`.
+  var reduceRight = createReduce(-1);
+
+  // Return all the elements that pass a truth test.
+  function filter(obj, predicate, context) {
+    var results = [];
+    predicate = cb(predicate, context);
+    each(obj, function(value, index, list) {
+      if (predicate(value, index, list)) results.push(value);
+    });
+    return results;
+  }
+
+  // Return all the elements for which a truth test fails.
+  function reject(obj, predicate, context) {
+    return filter(obj, negate(cb(predicate)), context);
+  }
+
+  // Determine whether all of the elements pass a truth test.
+  function every(obj, predicate, context) {
+    predicate = cb(predicate, context);
+    var _keys = !isArrayLike(obj) && keys(obj),
+        length = (_keys || obj).length;
+    for (var index = 0; index < length; index++) {
+      var currentKey = _keys ? _keys[index] : index;
+      if (!predicate(obj[currentKey], currentKey, obj)) return false;
+    }
+    return true;
+  }
+
+  // Determine if at least one element in the object passes a truth test.
+  function some(obj, predicate, context) {
+    predicate = cb(predicate, context);
+    var _keys = !isArrayLike(obj) && keys(obj),
+        length = (_keys || obj).length;
+    for (var index = 0; index < length; index++) {
+      var currentKey = _keys ? _keys[index] : index;
+      if (predicate(obj[currentKey], currentKey, obj)) return true;
+    }
+    return false;
+  }
+
+  // Determine if the array or object contains a given item (using `===`).
+  function contains(obj, item, fromIndex, guard) {
+    if (!isArrayLike(obj)) obj = values(obj);
+    if (typeof fromIndex != 'number' || guard) fromIndex = 0;
+    return indexOf(obj, item, fromIndex) >= 0;
+  }
+
+  // Invoke a method (with arguments) on every item in a collection.
+  var invoke = restArguments(function(obj, path, args) {
+    var contextPath, func;
+    if (isFunction$1(path)) {
+      func = path;
+    } else {
+      path = toPath$1(path);
+      contextPath = path.slice(0, -1);
+      path = path[path.length - 1];
+    }
+    return map(obj, function(context) {
+      var method = func;
+      if (!method) {
+        if (contextPath && contextPath.length) {
+          context = deepGet(context, contextPath);
+        }
+        if (context == null) return void 0;
+        method = context[path];
+      }
+      return method == null ? method : method.apply(context, args);
+    });
+  });
+
+  // Convenience version of a common use case of `_.map`: fetching a property.
+  function pluck(obj, key) {
+    return map(obj, property(key));
+  }
+
+  // Convenience version of a common use case of `_.filter`: selecting only
+  // objects containing specific `key:value` pairs.
+  function where(obj, attrs) {
+    return filter(obj, matcher(attrs));
+  }
+
+  // Return the maximum element (or element-based computation).
+  function max(obj, iteratee, context) {
+    var result = -Infinity, lastComputed = -Infinity,
+        value, computed;
+    if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
+      obj = isArrayLike(obj) ? obj : values(obj);
+      for (var i = 0, length = obj.length; i < length; i++) {
+        value = obj[i];
+        if (value != null && value > result) {
+          result = value;
+        }
+      }
+    } else {
+      iteratee = cb(iteratee, context);
+      each(obj, function(v, index, list) {
+        computed = iteratee(v, index, list);
+        if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
+          result = v;
+          lastComputed = computed;
+        }
+      });
+    }
+    return result;
+  }
+
+  // Return the minimum element (or element-based computation).
+  function min(obj, iteratee, context) {
+    var result = Infinity, lastComputed = Infinity,
+        value, computed;
+    if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
+      obj = isArrayLike(obj) ? obj : values(obj);
+      for (var i = 0, length = obj.length; i < length; i++) {
+        value = obj[i];
+        if (value != null && value < result) {
+          result = value;
+        }
+      }
+    } else {
+      iteratee = cb(iteratee, context);
+      each(obj, function(v, index, list) {
+        computed = iteratee(v, index, list);
+        if (computed < lastComputed || computed === Infinity && result === Infinity) {
+          result = v;
+          lastComputed = computed;
+        }
+      });
+    }
+    return result;
+  }
+
+  // Sample **n** random values from a collection using the modern version of the
+  // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
+  // If **n** is not specified, returns a single random element.
+  // The internal `guard` argument allows it to work with `_.map`.
+  function sample(obj, n, guard) {
+    if (n == null || guard) {
+      if (!isArrayLike(obj)) obj = values(obj);
+      return obj[random(obj.length - 1)];
+    }
+    var sample = isArrayLike(obj) ? clone(obj) : values(obj);
+    var length = getLength(sample);
+    n = Math.max(Math.min(n, length), 0);
+    var last = length - 1;
+    for (var index = 0; index < n; index++) {
+      var rand = random(index, last);
+      var temp = sample[index];
+      sample[index] = sample[rand];
+      sample[rand] = temp;
+    }
+    return sample.slice(0, n);
+  }
+
+  // Shuffle a collection.
+  function shuffle(obj) {
+    return sample(obj, Infinity);
+  }
+
+  // Sort the object's values by a criterion produced by an iteratee.
+  function sortBy(obj, iteratee, context) {
+    var index = 0;
+    iteratee = cb(iteratee, context);
+    return pluck(map(obj, function(value, key, list) {
+      return {
+        value: value,
+        index: index++,
+        criteria: iteratee(value, key, list)
+      };
+    }).sort(function(left, right) {
+      var a = left.criteria;
+      var b = right.criteria;
+      if (a !== b) {
+        if (a > b || a === void 0) return 1;
+        if (a < b || b === void 0) return -1;
+      }
+      return left.index - right.index;
+    }), 'value');
+  }
+
+  // An internal function used for aggregate "group by" operations.
+  function group(behavior, partition) {
+    return function(obj, iteratee, context) {
+      var result = partition ? [[], []] : {};
+      iteratee = cb(iteratee, context);
+      each(obj, function(value, index) {
+        var key = iteratee(value, index, obj);
+        behavior(result, value, key);
+      });
+      return result;
+    };
+  }
+
+  // Groups the object's values by a criterion. Pass either a string attribute
+  // to group by, or a function that returns the criterion.
+  var groupBy = group(function(result, value, key) {
+    if (has(result, key)) result[key].push(value); else result[key] = [value];
+  });
+
+  // Indexes the object's values by a criterion, similar to `_.groupBy`, but for
+  // when you know that your index values will be unique.
+  var indexBy = group(function(result, value, key) {
+    result[key] = value;
+  });
+
+  // Counts instances of an object that group by a certain criterion. Pass
+  // either a string attribute to count by, or a function that returns the
+  // criterion.
+  var countBy = group(function(result, value, key) {
+    if (has(result, key)) result[key]++; else result[key] = 1;
+  });
+
+  // Split a collection into two arrays: one whose elements all pass the given
+  // truth test, and one whose elements all do not pass the truth test.
+  var partition = group(function(result, value, pass) {
+    result[pass ? 0 : 1].push(value);
+  }, true);
+
+  // Safely create a real, live array from anything iterable.
+  var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
+  function toArray(obj) {
+    if (!obj) return [];
+    if (isArray(obj)) return slice.call(obj);
+    if (isString(obj)) {
+      // Keep surrogate pair characters together.
+      return obj.match(reStrSymbol);
+    }
+    if (isArrayLike(obj)) return map(obj, identity);
+    return values(obj);
+  }
+
+  // Return the number of elements in a collection.
+  function size(obj) {
+    if (obj == null) return 0;
+    return isArrayLike(obj) ? obj.length : keys(obj).length;
+  }
+
+  // Internal `_.pick` helper function to determine whether `key` is an enumerable
+  // property name of `obj`.
+  function keyInObj(value, key, obj) {
+    return key in obj;
+  }
+
+  // Return a copy of the object only containing the allowed properties.
+  var pick = restArguments(function(obj, keys) {
+    var result = {}, iteratee = keys[0];
+    if (obj == null) return result;
+    if (isFunction$1(iteratee)) {
+      if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]);
+      keys = allKeys(obj);
+    } else {
+      iteratee = keyInObj;
+      keys = flatten(keys, false, false);
+      obj = Object(obj);
+    }
+    for (var i = 0, length = keys.length; i < length; i++) {
+      var key = keys[i];
+      var value = obj[key];
+      if (iteratee(value, key, obj)) result[key] = value;
+    }
+    return result;
+  });
+
+  // Return a copy of the object without the disallowed properties.
+  var omit = restArguments(function(obj, keys) {
+    var iteratee = keys[0], context;
+    if (isFunction$1(iteratee)) {
+      iteratee = negate(iteratee);
+      if (keys.length > 1) context = keys[1];
+    } else {
+      keys = map(flatten(keys, false, false), String);
+      iteratee = function(value, key) {
+        return !contains(keys, key);
+      };
+    }
+    return pick(obj, iteratee, context);
+  });
+
+  // Returns everything but the last entry of the array. Especially useful on
+  // the arguments object. Passing **n** will return all the values in
+  // the array, excluding the last N.
+  function initial(array, n, guard) {
+    return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
+  }
+
+  // Get the first element of an array. Passing **n** will return the first N
+  // values in the array. The **guard** check allows it to work with `_.map`.
+  function first(array, n, guard) {
+    if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
+    if (n == null || guard) return array[0];
+    return initial(array, array.length - n);
+  }
+
+  // Returns everything but the first entry of the `array`. Especially useful on
+  // the `arguments` object. Passing an **n** will return the rest N values in the
+  // `array`.
+  function rest(array, n, guard) {
+    return slice.call(array, n == null || guard ? 1 : n);
+  }
+
+  // Get the last element of an array. Passing **n** will return the last N
+  // values in the array.
+  function last(array, n, guard) {
+    if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
+    if (n == null || guard) return array[array.length - 1];
+    return rest(array, Math.max(0, array.length - n));
+  }
+
+  // Trim out all falsy values from an array.
+  function compact(array) {
+    return filter(array, Boolean);
+  }
+
+  // Flatten out an array, either recursively (by default), or up to `depth`.
+  // Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
+  function flatten$1(array, depth) {
+    return flatten(array, depth, false);
+  }
+
+  // Take the difference between one array and a number of other arrays.
+  // Only the elements present in just the first array will remain.
+  var difference = restArguments(function(array, rest) {
+    rest = flatten(rest, true, true);
+    return filter(array, function(value){
+      return !contains(rest, value);
+    });
+  });
+
+  // Return a version of the array that does not contain the specified value(s).
+  var without = restArguments(function(array, otherArrays) {
+    return difference(array, otherArrays);
+  });
+
+  // Produce a duplicate-free version of the array. If the array has already
+  // been sorted, you have the option of using a faster algorithm.
+  // The faster algorithm will not work with an iteratee if the iteratee
+  // is not a one-to-one function, so providing an iteratee will disable
+  // the faster algorithm.
+  function uniq(array, isSorted, iteratee, context) {
+    if (!isBoolean(isSorted)) {
+      context = iteratee;
+      iteratee = isSorted;
+      isSorted = false;
+    }
+    if (iteratee != null) iteratee = cb(iteratee, context);
+    var result = [];
+    var seen = [];
+    for (var i = 0, length = getLength(array); i < length; i++) {
+      var value = array[i],
+          computed = iteratee ? iteratee(value, i, array) : value;
+      if (isSorted && !iteratee) {
+        if (!i || seen !== computed) result.push(value);
+        seen = computed;
+      } else if (iteratee) {
+        if (!contains(seen, computed)) {
+          seen.push(computed);
+          result.push(value);
+        }
+      } else if (!contains(result, value)) {
+        result.push(value);
+      }
+    }
+    return result;
+  }
+
+  // Produce an array that contains the union: each distinct element from all of
+  // the passed-in arrays.
+  var union = restArguments(function(arrays) {
+    return uniq(flatten(arrays, true, true));
+  });
+
+  // Produce an array that contains every item shared between all the
+  // passed-in arrays.
+  function intersection(array) {
+    var result = [];
+    var argsLength = arguments.length;
+    for (var i = 0, length = getLength(array); i < length; i++) {
+      var item = array[i];
+      if (contains(result, item)) continue;
+      var j;
+      for (j = 1; j < argsLength; j++) {
+        if (!contains(arguments[j], item)) break;
+      }
+      if (j === argsLength) result.push(item);
+    }
+    return result;
+  }
+
+  // Complement of zip. Unzip accepts an array of arrays and groups
+  // each array's elements on shared indices.
+  function unzip(array) {
+    var length = array && max(array, getLength).length || 0;
+    var result = Array(length);
+
+    for (var index = 0; index < length; index++) {
+      result[index] = pluck(array, index);
+    }
+    return result;
+  }
+
+  // Zip together multiple lists into a single array -- elements that share
+  // an index go together.
+  var zip = restArguments(unzip);
+
+  // Converts lists into objects. Pass either a single array of `[key, value]`
+  // pairs, or two parallel arrays of the same length -- one of keys, and one of
+  // the corresponding values. Passing by pairs is the reverse of `_.pairs`.
+  function object(list, values) {
+    var result = {};
+    for (var i = 0, length = getLength(list); i < length; i++) {
+      if (values) {
+        result[list[i]] = values[i];
+      } else {
+        result[list[i][0]] = list[i][1];
+      }
+    }
+    return result;
+  }
+
+  // Generate an integer Array containing an arithmetic progression. A port of
+  // the native Python `range()` function. See
+  // [the Python documentation](https://docs.python.org/library/functions.html#range).
+  function range(start, stop, step) {
+    if (stop == null) {
+      stop = start || 0;
+      start = 0;
+    }
+    if (!step) {
+      step = stop < start ? -1 : 1;
+    }
+
+    var length = Math.max(Math.ceil((stop - start) / step), 0);
+    var range = Array(length);
+
+    for (var idx = 0; idx < length; idx++, start += step) {
+      range[idx] = start;
+    }
+
+    return range;
+  }
+
+  // Chunk a single array into multiple arrays, each containing `count` or fewer
+  // items.
+  function chunk(array, count) {
+    if (count == null || count < 1) return [];
+    var result = [];
+    var i = 0, length = array.length;
+    while (i < length) {
+      result.push(slice.call(array, i, i += count));
+    }
+    return result;
+  }
+
+  // Helper function to continue chaining intermediate results.
+  function chainResult(instance, obj) {
+    return instance._chain ? _(obj).chain() : obj;
+  }
+
+  // Add your own custom functions to the Underscore object.
+  function mixin(obj) {
+    each(functions(obj), function(name) {
+      var func = _[name] = obj[name];
+      _.prototype[name] = function() {
+        var args = [this._wrapped];
+        push.apply(args, arguments);
+        return chainResult(this, func.apply(_, args));
+      };
+    });
+    return _;
+  }
+
+  // Add all mutator `Array` functions to the wrapper.
+  each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
+    var method = ArrayProto[name];
+    _.prototype[name] = function() {
+      var obj = this._wrapped;
+      if (obj != null) {
+        method.apply(obj, arguments);
+        if ((name === 'shift' || name === 'splice') && obj.length === 0) {
+          delete obj[0];
+        }
+      }
+      return chainResult(this, obj);
+    };
+  });
+
+  // Add all accessor `Array` functions to the wrapper.
+  each(['concat', 'join', 'slice'], function(name) {
+    var method = ArrayProto[name];
+    _.prototype[name] = function() {
+      var obj = this._wrapped;
+      if (obj != null) obj = method.apply(obj, arguments);
+      return chainResult(this, obj);
+    };
+  });
+
+  // Named Exports
+
+  var allExports = {
+    __proto__: null,
+    VERSION: VERSION,
+    restArguments: restArguments,
+    isObject: isObject,
+    isNull: isNull,
+    isUndefined: isUndefined,
+    isBoolean: isBoolean,
+    isElement: isElement,
+    isString: isString,
+    isNumber: isNumber,
+    isDate: isDate,
+    isRegExp: isRegExp,
+    isError: isError,
+    isSymbol: isSymbol,
+    isArrayBuffer: isArrayBuffer,
+    isDataView: isDataView$1,
+    isArray: isArray,
+    isFunction: isFunction$1,
+    isArguments: isArguments$1,
+    isFinite: isFinite$1,
+    isNaN: isNaN$1,
+    isTypedArray: isTypedArray$1,
+    isEmpty: isEmpty,
+    isMatch: isMatch,
+    isEqual: isEqual,
+    isMap: isMap,
+    isWeakMap: isWeakMap,
+    isSet: isSet,
+    isWeakSet: isWeakSet,
+    keys: keys,
+    allKeys: allKeys,
+    values: values,
+    pairs: pairs,
+    invert: invert,
+    functions: functions,
+    methods: functions,
+    extend: extend,
+    extendOwn: extendOwn,
+    assign: extendOwn,
+    defaults: defaults,
+    create: create,
+    clone: clone,
+    tap: tap,
+    get: get,
+    has: has$1,
+    mapObject: mapObject,
+    identity: identity,
+    constant: constant,
+    noop: noop,
+    toPath: toPath,
+    property: property,
+    propertyOf: propertyOf,
+    matcher: matcher,
+    matches: matcher,
+    times: times,
+    random: random,
+    now: now,
+    escape: _escape,
+    unescape: _unescape,
+    templateSettings: templateSettings,
+    template: template,
+    result: result,
+    uniqueId: uniqueId,
+    chain: chain,
+    iteratee: iteratee,
+    partial: partial,
+    bind: bind,
+    bindAll: bindAll,
+    memoize: memoize,
+    delay: delay,
+    defer: defer,
+    throttle: throttle,
+    debounce: debounce,
+    wrap: wrap,
+    negate: negate,
+    compose: compose,
+    after: after,
+    before: before,
+    once: once,
+    findKey: findKey,
+    findIndex: findIndex,
+    findLastIndex: findLastIndex,
+    sortedIndex: sortedIndex,
+    indexOf: indexOf,
+    lastIndexOf: lastIndexOf,
+    find: find,
+    detect: find,
+    findWhere: findWhere,
+    each: each,
+    forEach: each,
+    map: map,
+    collect: map,
+    reduce: reduce,
+    foldl: reduce,
+    inject: reduce,
+    reduceRight: reduceRight,
+    foldr: reduceRight,
+    filter: filter,
+    select: filter,
+    reject: reject,
+    every: every,
+    all: every,
+    some: some,
+    any: some,
+    contains: contains,
+    includes: contains,
+    include: contains,
+    invoke: invoke,
+    pluck: pluck,
+    where: where,
+    max: max,
+    min: min,
+    shuffle: shuffle,
+    sample: sample,
+    sortBy: sortBy,
+    groupBy: groupBy,
+    indexBy: indexBy,
+    countBy: countBy,
+    partition: partition,
+    toArray: toArray,
+    size: size,
+    pick: pick,
+    omit: omit,
+    first: first,
+    head: first,
+    take: first,
+    initial: initial,
+    last: last,
+    rest: rest,
+    tail: rest,
+    drop: rest,
+    compact: compact,
+    flatten: flatten$1,
+    without: without,
+    uniq: uniq,
+    unique: uniq,
+    union: union,
+    intersection: intersection,
+    difference: difference,
+    unzip: unzip,
+    transpose: unzip,
+    zip: zip,
+    object: object,
+    range: range,
+    chunk: chunk,
+    mixin: mixin,
+    'default': _
+  };
+
+  // Default Export
+
+  // Add all of the Underscore functions to the wrapper object.
+  var _$1 = mixin(allExports);
+  // Legacy Node.js API.
+  _$1._ = _$1;
+
+  return _$1;
+
+})));
+//# sourceMappingURL=underscore.js.map
diff --git a/docs/html/annotations/complexity_annotations.html b/docs/html/annotations/complexity_annotations.html
new file mode 100644
index 0000000..19513ce
--- /dev/null
+++ b/docs/html/annotations/complexity_annotations.html
@@ -0,0 +1,278 @@
+<!doctype html>
+<html class="no-js">
+  <head><meta charset="utf-8"/>
+    <meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Invariants" href="invariants.html" /><link rel="prev" title="Relational Annotations" href="relational_annotations.html" />
+
+    <meta name="generator" content="sphinx-3.5.1, furo 2021.02.21.beta25"/>
+        <title>Complexity Annotations - PyBryt documentation</title>
+      <link rel="stylesheet" href="../_static/styles/furo.css?digest=33d2fc4f3f180ec1ffc6524e273e21d7d58cbe49">
+    <link rel="stylesheet" href="../_static/pygments.css">
+    <link media="(prefers-color-scheme: dark)" rel="stylesheet" href="../_static/pygments_dark.css">
+    
+
+
+<style>
+  :root {
+    --color-code-background: #eeffcc;
+  --color-code-foreground: black;
+  
+  }
+  @media (prefers-color-scheme: dark) {
+    :root {
+      --color-code-background: #202020;
+  --color-code-foreground: #d0d0d0;
+  
+    }
+  }
+
+  /* For allowing end-user-specific overrides */
+  .override-light {
+    --color-code-background: #eeffcc;
+  --color-code-foreground: black;
+  
+  }
+  .override-dark {
+    --color-code-background: #202020;
+  --color-code-foreground: #d0d0d0;
+  
+  }
+</style><link rel="stylesheet" href="../_static/styles/furo-extensions.css?digest=d391b54134226e4196576da3bdb6dddb7e05ba2b"></head>
+  <body dir="">
+    
+<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
+  <symbol id="svg-toc" viewBox="0 0 24 24">
+    <title>Contents</title>
+    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+      stroke-width="1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round">
+      <path stroke="none" d="M0 0h24v24H0z"/>
+      <line x1="4" y1="6" x2="20" y2="6" />
+      <line x1="10" y1="12" x2="20" y2="12" />
+      <line x1="6" y1="18" x2="20" y2="18" />
+    </svg>
+  </symbol>
+  <symbol id="svg-menu" viewBox="0 0 24 24">
+    <title>Menu</title>
+    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+      stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+      class="feather feather-menu">
+      <line x1="3" y1="12" x2="21" y2="12"></line>
+      <line x1="3" y1="6" x2="21" y2="6"></line>
+      <line x1="3" y1="18" x2="21" y2="18"></line>
+    </svg>
+  </symbol>
+  <symbol id="svg-arrow-right" viewBox="0 0 24 24">
+    <title>Expand</title>
+    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
+      stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
+      class="feather feather-chevron-right">
+      <polyline points="9 18 15 12 9 6"></polyline>
+    </svg>
+  </symbol>
+</svg>
+
+<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
+<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
+<label class="overlay sidebar-overlay" for="__navigation"></label>
+<label class="overlay toc-overlay" for="__toc"></label>
+
+
+
+<div class="page">
+  <header class="mobile-header">
+    <div class="header-left">
+      <label class="nav-overlay-icon" for="__navigation">
+        <i class="icon"><svg><use href="#svg-menu"></use></svg></i>
+      </label>
+    </div>
+    <div class="header-center">
+      <a href="../index.html"><div class="brand">PyBryt  documentation</div></a>
+    </div>
+    <div class="header-right">
+      <label class="toc-overlay-icon toc-header-icon" for="__toc">
+        <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
+      </label>
+    </div>
+  </header>
+  <aside class="sidebar-drawer">
+    <div class="sidebar-container">
+      
+      <div class="sidebar-sticky"><a class="sidebar-brand" href="../index.html">
+  
+  
+  <span class="sidebar-brand-text">PyBryt  documentation</span>
+  
+</a><form class="sidebar-search-container" method="get" action="../search.html">
+  <input class="sidebar-search" placeholder=Search name="q">
+  <input type="hidden" name="check_keywords" value="yes">
+  <input type="hidden" name="area" value="default">
+</form><div class="sidebar-scroll"><div class="sidebar-tree">
+  <ul class="current">
+<li class="toctree-l1"><a class="reference internal" href="../getting_started.html">Getting Started</a></li>
+<li class="toctree-l1 current has-children"><a class="reference internal" href="index.html">Annotations</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current">
+<li class="toctree-l2"><a class="reference internal" href="relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2 current current-page"><a class="current reference internal" href="#">Complexity Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="invariants.html">Invariants</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="../reference_implementations.html">Reference Implementations</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../student_implementations.html">Student Implementations</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../api_reference.html">API Reference</a></li>
+<li class="toctree-l1"><a class="reference external" href="https://github.com/microsoft/pybryt/tree/main/CHANGELOG.md">Changelog</a></li>
+</ul>
+
+</div>
+</div>
+      </div>
+      
+    </div>
+  </aside>
+  <main class="main">
+    <div class="content">
+      <article role="main">
+        <label class="toc-overlay-icon toc-content-icon" for="__toc">
+          <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
+        </label>
+        <div class="section" id="complexity-annotations">
+<span id="complexity"></span><h1>Complexity Annotations<a class="headerlink" href="#complexity-annotations" title="Permalink to this headline">¶</a></h1>
+<p>Complexity annotations define an expectation of the complexity of a block of student code. Currently,
+PyBryt supports one kind of complexity annotation: time complexity. All complexity annotations are
+subclasses of the abstract
+<code class="xref py py-class docutils literal notranslate"><span class="pre">ComplexityAnnotation</span></code> class, which
+defines some helpful defaults for working with these annotations.</p>
+<div class="section" id="creating-complexity-annotations">
+<h2>Creating Complexity Annotations<a class="headerlink" href="#creating-complexity-annotations" title="Permalink to this headline">¶</a></h2>
+<p>Complexity annotations can be created just like value annotations: by calling their constructor. The
+constructor takes one positional argument which corresponds to a class asserting the expected
+complexity of the code. These complexity classes can be found in the
+<a class="reference internal" href="../api_reference.html#module-pybryt.annotations.complexity.complexities" title="pybryt.annotations.complexity.complexities"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pybryt.complexities</span></code></a> module. All complexity
+classes are subclasses of the abstract base class
+<a class="reference internal" href="../api_reference.html#pybryt.annotations.complexity.complexities.complexity" title="pybryt.annotations.complexity.complexities.complexity"><code class="xref py py-class docutils literal notranslate"><span class="pre">pybryt.complexities.complexity</span></code></a>.</p>
+<p>The constructor also takes one required keyword argument, <code class="docutils literal notranslate"><span class="pre">name</span></code>. This should be set to a string
+that corresponds to named time complexity context in the student’s code (more on this below). The name
+should be unique across all annotations.</p>
+<p>For example, to check the time complexity of a block named <code class="docutils literal notranslate"><span class="pre">"sort"</span></code> with <span class="math notranslate nohighlight">\(\mathcal{O}(n \log n)\)</span>:</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">pybryt</span>
+<span class="kn">import</span> <span class="nn">pybryt.complexities</span> <span class="k">as</span> <span class="nn">cplx</span>
+
+<span class="n">pybryt</span><span class="o">.</span><span class="n">TimeComplexity</span><span class="p">(</span><span class="n">cplx</span><span class="o">.</span><span class="n">linearithmic</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s2">"sort"</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>A full list of the available complexity classes can be found <a class="reference internal" href="../api_reference.html#complexities"><span class="std std-ref">here</span></a>.</p>
+</div>
+<div class="section" id="tracking-code-complexity">
+<h2>Tracking Code Complexity<a class="headerlink" href="#tracking-code-complexity" title="Permalink to this headline">¶</a></h2>
+<p>To track the time complexity of students’ code, PyBryt provides the
+<a class="reference internal" href="../api_reference.html#pybryt.execution.check_time_complexity" title="pybryt.execution.check_time_complexity"><code class="xref py py-obj docutils literal notranslate"><span class="pre">check_time_complexity</span></code></a> context manager. This
+context manager takes two arguments, the name of the block (which should match the <code class="docutils literal notranslate"><span class="pre">name</span></code> of a
+time complexity annotation in the reference implementation) and length of the input (or, for simplicity,
+the input itself if it has a <code class="docutils literal notranslate"><span class="pre">__len__</span></code> method).</p>
+<p>The context manager uses PyBryt’s tracing function to determine the runtime of the student’s code by
+counting the number of steps taken while the code executes (the number of times the trace function is
+called). It then adds an object that tracks this information to the student’s memory footprint when
+the block exits.</p>
+<p>An important note: any code placed inside this context manager will <strong>not</strong> have its objects in-memory
+traced. PyBryt’s trace function will only be used to track the number of steps taken during execution,
+but no values will be added to the student’s memory footprint. This means that any code needed to
+satisfy value annotations, relational annotations, etc. must be placed outside this context manager.</p>
+<p>For example, to satisfy the time complexity annotation above, the code block below checks the time
+complexity of a student-implemented <code class="docutils literal notranslate"><span class="pre">sort</span></code> function on a series of inputs of increasing sizes.</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
+<span class="k">for</span> <span class="n">exp</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">8</span><span class="p">):</span>
+    <span class="n">n</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">size</span><span class="o">=</span><span class="mi">10</span><span class="o">**</span><span class="n">exp</span><span class="p">)</span>
+    <span class="k">with</span> <span class="n">pybryt</span><span class="o">.</span><span class="n">check_time_complexity</span><span class="p">(</span><span class="s2">"sort"</span><span class="p">,</span> <span class="n">n</span><span class="p">):</span>
+        <span class="n">sort</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="evaluating-code-complexity">
+<h2>Evaluating Code Complexity<a class="headerlink" href="#evaluating-code-complexity" title="Permalink to this headline">¶</a></h2>
+<p>When evaluating whether a time complexity annotation has been satisfied, PyBryt uses the method of
+the <a class="reference external" href="https://github.com/pberkes/big_O"><code class="docutils literal notranslate"><span class="pre">big_O</span></code></a> Python package. The annotation is evaluated by
+collecting all of the time complexity result objects found in the student’s memory footprint that
+match the <code class="docutils literal notranslate"><span class="pre">name</span></code> of the annotation.</p>
+<p>The data from these results is collected and sent through
+each complexity class, which uses <code class="docutils literal notranslate"><span class="pre">np.linalg.lstsq</span></code> to fit the input length data to
+the time data (incorporating the transformations needed for each complexity) and returns the
+residuals of this fit. The complexity with the smallest residuals (incorporating a slight preference
+for simpler complexities) is determined to be the best match, and is used to determine whether or not
+the annotation was satisfied.</p>
+</div>
+</div>
+
+      </article>
+      <footer>
+        
+        <div class="related-pages">
+          <a class="next-page" href="invariants.html">
+              <div class="page-info">
+                <div class="context">
+                  <span>Next</span>
+                </div>
+                <div class="title">Invariants</div>
+              </div>
+              <svg><use href="#svg-arrow-right"></use></svg>
+            </a>
+          <a class="prev-page" href="relational_annotations.html">
+              <svg><use href="#svg-arrow-right"></use></svg>
+              <div class="page-info">
+                <div class="context">
+                  <span>Previous</span>
+                </div>
+                
+                <div class="title">Relational Annotations</div>
+                
+              </div>
+            </a>
+        </div>
+
+        <div class="related-information">
+              Copyright &#169; 2021, Microsoft
+            |
+            Built with <a href="https://www.sphinx-doc.org/">Sphinx</a>
+              and
+              <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
+              <a href="https://github.com/pradyunsg/furo">Furo theme</a>.
+            |
+            <a class="muted-link" href="../_sources/annotations/complexity_annotations.rst.txt"
+               rel="nofollow">
+              Show Source
+            </a>
+        </div>
+        
+      </footer>
+    </div>
+    <aside class="toc-drawer">
+      
+      
+      <div class="toc-sticky toc-scroll">
+        <div class="toc-title-container">
+          <span class="toc-title">
+            Contents
+          </span>
+        </div>
+        <div class="toc-tree-container">
+          <div class="toc-tree">
+            <ul>
+<li><a class="reference internal" href="#">Complexity Annotations</a><ul>
+<li><a class="reference internal" href="#creating-complexity-annotations">Creating Complexity Annotations</a></li>
+<li><a class="reference internal" href="#tracking-code-complexity">Tracking Code Complexity</a></li>
+<li><a class="reference internal" href="#evaluating-code-complexity">Evaluating Code Complexity</a></li>
+</ul>
+</li>
+</ul>
+
+          </div>
+        </div>
+      </div>
+      
+      
+    </aside>
+  </main>
+</div>
+    <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
+    <script src="../_static/jquery.js"></script>
+    <script src="../_static/underscore.js"></script>
+    <script src="../_static/doctools.js"></script>
+    <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <script src="../_static/scripts/main.js?digest=e931d09b2a40c1bb82b542effe772014573baf67"></script></body>
+</html>
\ No newline at end of file
diff --git a/docs/html/annotations/index.html b/docs/html/annotations/index.html
index 049e0a6..8c4c36e 100644
--- a/docs/html/annotations/index.html
+++ b/docs/html/annotations/index.html
@@ -110,6 +110,7 @@
 <li class="toctree-l1"><a class="reference internal" href="../getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 current has-children current-page"><a class="current reference internal" href="#">Annotations</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
 <li class="toctree-l2"><a class="reference internal" href="relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="invariants.html">Invariants</a></li>
 </ul>
 </li>
diff --git a/docs/html/annotations/invariants.html b/docs/html/annotations/invariants.html
index 643c5ac..df7425e 100644
--- a/docs/html/annotations/invariants.html
+++ b/docs/html/annotations/invariants.html
@@ -1,7 +1,7 @@
 <!doctype html>
 <html class="no-js">
   <head><meta charset="utf-8"/>
-    <meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Reference Implementations" href="../reference_implementations.html" /><link rel="prev" title="Relational Annotations" href="relational_annotations.html" />
+    <meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Reference Implementations" href="../reference_implementations.html" /><link rel="prev" title="Complexity Annotations" href="complexity_annotations.html" />
 
     <meta name="generator" content="sphinx-3.5.1, furo 2021.02.21.beta25"/>
         <title>Invariants - PyBryt documentation</title>
@@ -110,6 +110,7 @@
 <li class="toctree-l1"><a class="reference internal" href="../getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 current has-children"><a class="reference internal" href="index.html">Annotations</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current">
 <li class="toctree-l2"><a class="reference internal" href="relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2 current current-page"><a class="current reference internal" href="#">Invariants</a></li>
 </ul>
 </li>
@@ -149,14 +150,14 @@
               </div>
               <svg><use href="#svg-arrow-right"></use></svg>
             </a>
-          <a class="prev-page" href="relational_annotations.html">
+          <a class="prev-page" href="complexity_annotations.html">
               <svg><use href="#svg-arrow-right"></use></svg>
               <div class="page-info">
                 <div class="context">
                   <span>Previous</span>
                 </div>
                 
-                <div class="title">Relational Annotations</div>
+                <div class="title">Complexity Annotations</div>
                 
               </div>
             </a>
diff --git a/docs/html/annotations/relational_annotations.html b/docs/html/annotations/relational_annotations.html
index f662ee9..4684ac3 100644
--- a/docs/html/annotations/relational_annotations.html
+++ b/docs/html/annotations/relational_annotations.html
@@ -1,7 +1,7 @@
 <!doctype html>
 <html class="no-js">
   <head><meta charset="utf-8"/>
-    <meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Invariants" href="invariants.html" /><link rel="prev" title="Annotations" href="index.html" />
+    <meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Complexity Annotations" href="complexity_annotations.html" /><link rel="prev" title="Annotations" href="index.html" />
 
     <meta name="generator" content="sphinx-3.5.1, furo 2021.02.21.beta25"/>
         <title>Relational Annotations - PyBryt documentation</title>
@@ -110,6 +110,7 @@
 <li class="toctree-l1"><a class="reference internal" href="../getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 current has-children"><a class="reference internal" href="index.html">Annotations</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current">
 <li class="toctree-l2 current current-page"><a class="current reference internal" href="#">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="invariants.html">Invariants</a></li>
 </ul>
 </li>
@@ -222,12 +223,12 @@ <h2>Boolean Annotations<a class="headerlink" href="#boolean-annotations" title="
       <footer>
         
         <div class="related-pages">
-          <a class="next-page" href="invariants.html">
+          <a class="next-page" href="complexity_annotations.html">
               <div class="page-info">
                 <div class="context">
                   <span>Next</span>
                 </div>
-                <div class="title">Invariants</div>
+                <div class="title">Complexity Annotations</div>
               </div>
               <svg><use href="#svg-arrow-right"></use></svg>
             </a>
diff --git a/docs/html/api_reference.html b/docs/html/api_reference.html
index 2aeff3a..d01b910 100644
--- a/docs/html/api_reference.html
+++ b/docs/html/api_reference.html
@@ -110,6 +110,7 @@
 <li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 has-children"><a class="reference internal" href="annotations/index.html">Annotations</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
 <li class="toctree-l2"><a class="reference internal" href="annotations/relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="annotations/complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="annotations/invariants.html">Invariants</a></li>
 </ul>
 </li>
@@ -684,6 +685,351 @@ <h2>Annotations<a class="headerlink" href="#annotations" title="Permalink to thi
 </dd></dl>
 </dd></dl>
 </div>
+<div class="section" id="module-pybryt.annotations.complexity.annotation">
+<span id="complexity-annotations"></span><h3>Complexity Annotations<a class="headerlink" href="#module-pybryt.annotations.complexity.annotation" title="Permalink to this headline">¶</a></h3>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.annotation.ComplexityAnnotation">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">ComplexityAnnotation</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pybryt.annotations.complexity.complexities.complexity" title="pybryt.annotations.complexity.complexities.complexity"><span class="pre">pybryt.annotations.complexity.complexities.complexity</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.annotation.ComplexityAnnotation" title="Permalink to this definition">¶</a></dt>
+<dd><p>Abstract base class for annotations that assert a condition on the complexity of a student’s code.</p>
+<p>All complexity annotations should inherit from this class, which defines a constructor that
+takes in a complexity class and any necessary keyword arguments. Note that all compelxity
+annotations require a <code class="docutils literal notranslate"><span class="pre">name</span></code> keyword argument so that they can be matched with their results
+from the student’s memory footprint.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><ul class="simple">
+<li><p><strong>complexity</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">complexity</span></code>) – the complexity class
+being asserted</p></li>
+<li><p><strong>**kwargs</strong> – additional keyword arguments passed to the
+<a class="reference internal" href="#pybryt.Annotation" title="pybryt.Annotation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Annotation</span></code></a> constructor</p></li>
+</ul>
+</dd>
+</dl>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.annotation.ComplexityAnnotation.children">
+<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">children</span></code><a class="headerlink" href="#pybryt.annotations.complexity.annotation.ComplexityAnnotation.children" title="Permalink to this definition">¶</a></dt>
+<dd><p>the child annotations of this annotation. If this annotation has no
+children, an empty list.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">list[Annotation]</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.ComplexityAnnotation.failure_message">
+<code class="sig-name descname"><span class="pre">failure_message</span></code><em class="property"><span class="pre">:</span> <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.ComplexityAnnotation.failure_message" title="Permalink to this definition">¶</a></dt>
+<dd><p>a message to relay to the student if not satisfied</p>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.ComplexityAnnotation.group">
+<code class="sig-name descname"><span class="pre">group</span></code><em class="property"><span class="pre">:</span> <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.ComplexityAnnotation.group" title="Permalink to this definition">¶</a></dt>
+<dd><p>the name of the group that this annotation belongs to</p>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.ComplexityAnnotation.limit">
+<code class="sig-name descname"><span class="pre">limit</span></code><em class="property"><span class="pre">:</span> <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.ComplexityAnnotation.limit" title="Permalink to this definition">¶</a></dt>
+<dd><p>the maximum number of annotations with this name to track in <code class="xref py py-obj docutils literal notranslate"><span class="pre">_TRACKED_ANNOTATIONS</span></code></p>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.ComplexityAnnotation.name">
+<code class="sig-name descname"><span class="pre">name</span></code><em class="property"><span class="pre">:</span> <span class="pre">str</span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.ComplexityAnnotation.name" title="Permalink to this definition">¶</a></dt>
+<dd><p>the name of the annotation</p>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.ComplexityAnnotation.success_message">
+<code class="sig-name descname"><span class="pre">success_message</span></code><em class="property"><span class="pre">:</span> <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.ComplexityAnnotation.success_message" title="Permalink to this definition">¶</a></dt>
+<dd><p>a message to relay to the student if satisfied</p>
+</dd></dl>
+</dd></dl>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.annotation.TimeComplexity">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">TimeComplexity</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="#pybryt.annotations.complexity.complexities.complexity" title="pybryt.annotations.complexity.complexities.complexity"><span class="pre">pybryt.annotations.complexity.complexities.complexity</span></a></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.annotation.TimeComplexity" title="Permalink to this definition">¶</a></dt>
+<dd><p>Annotation for asserting the time complexity of a block of student code.</p>
+<p>Time complexity here is defined as the number of execution steps taken while executing the
+code block, which is determined using the number of calls to PyBryt’s trace function. Use the
+<code class="xref py py-obj docutils literal notranslate"><span class="pre">check_time_complexity</span></code> context manager to check time
+complexity in student’s code. The <code class="docutils literal notranslate"><span class="pre">name</span></code> of this annotation should be the same as the <code class="docutils literal notranslate"><span class="pre">name</span></code>
+passed to the context manager or this annotation will not be able to find the results of the
+check.</p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.annotation.TimeComplexity.check">
+<code class="sig-name descname"><span class="pre">check</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">observed_values</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> → <span class="pre">pybryt.annotations.annotation.AnnotationResult</span><a class="headerlink" href="#pybryt.annotations.complexity.annotation.TimeComplexity.check" title="Permalink to this definition">¶</a></dt>
+<dd><p>Checks the time complexity of a block of student code and returns a results object.</p>
+<p>Finds all instances of the <code class="xref py py-class docutils literal notranslate"><span class="pre">TimeComplexityResult</span></code>
+class in the student’s memory footprint and selects all those with matching names. Collects
+the timing data from each into a dictionary and runs each complexity class in
+<code class="xref py py-obj docutils literal notranslate"><span class="pre">complexities.complexity_classes</span></code> against
+this data. Returns a result indicating whether the closest-matched complexity class was the
+one asserted in this annotation’s <code class="docutils literal notranslate"><span class="pre">complexity</span></code> field. The <code class="docutils literal notranslate"><span class="pre">value</span></code> of the result object
+is set to the matching complexity class.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>observed_values</strong> (<code class="docutils literal notranslate"><span class="pre">list[tuple[object,</span> <span class="pre">int]]</span></code>) – a list of tuples of values observed
+during execution and the timestamps of those values</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the results of this annotation based on
+<code class="docutils literal notranslate"><span class="pre">observed_values</span></code></p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">AnnotationResult</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.TimeComplexity.failure_message">
+<code class="sig-name descname"><span class="pre">failure_message</span></code><em class="property"><span class="pre">:</span> <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.TimeComplexity.failure_message" title="Permalink to this definition">¶</a></dt>
+<dd><p>a message to relay to the student if not satisfied</p>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.TimeComplexity.group">
+<code class="sig-name descname"><span class="pre">group</span></code><em class="property"><span class="pre">:</span> <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.TimeComplexity.group" title="Permalink to this definition">¶</a></dt>
+<dd><p>the name of the group that this annotation belongs to</p>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.TimeComplexity.limit">
+<code class="sig-name descname"><span class="pre">limit</span></code><em class="property"><span class="pre">:</span> <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.TimeComplexity.limit" title="Permalink to this definition">¶</a></dt>
+<dd><p>the maximum number of annotations with this name to track in <code class="xref py py-obj docutils literal notranslate"><span class="pre">_TRACKED_ANNOTATIONS</span></code></p>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.TimeComplexity.name">
+<code class="sig-name descname"><span class="pre">name</span></code><em class="property"><span class="pre">:</span> <span class="pre">str</span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.TimeComplexity.name" title="Permalink to this definition">¶</a></dt>
+<dd><p>the name of the annotation</p>
+</dd></dl>
+<dl class="py attribute">
+<dt id="pybryt.annotations.complexity.annotation.TimeComplexity.success_message">
+<code class="sig-name descname"><span class="pre">success_message</span></code><em class="property"><span class="pre">:</span> <span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#pybryt.annotations.complexity.annotation.TimeComplexity.success_message" title="Permalink to this definition">¶</a></dt>
+<dd><p>a message to relay to the student if satisfied</p>
+</dd></dl>
+</dd></dl>
+<div class="section" id="module-pybryt.annotations.complexity.complexities">
+<span id="complexity-classes"></span><span id="complexities"></span><h4>Complexity Classes<a class="headerlink" href="#module-pybryt.annotations.complexity.complexities" title="Permalink to this headline">¶</a></h4>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.complexities.complexity">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">complexity</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.complexity" title="Permalink to this definition">¶</a></dt>
+<dd><p>Abstract base class for a complexity. Subclassses should implement the <code class="docutils literal notranslate"><span class="pre">transform_n</span></code> method,
+which transforms the input lengths array so that least squares can be used. If needed, the
+<code class="docutils literal notranslate"><span class="pre">transform_t</span></code> method can also be overwritten to transform the step counter values.</p>
+<p>The architecture for these and the algorithm for determining the optimal complexity is borrowed
+from <a class="reference external" href="https://github.com/pberkes/big_O">https://github.com/pberkes/big_O</a>.</p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.complexity.run">
+<em class="property"><span class="pre">classmethod</span> </em><code class="sig-name descname"><span class="pre">run</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> → <span class="pre">float</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.complexity.run" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns the sum of residuals by performing least squares on the input length data and timings.</p>
+<p>Uses <code class="docutils literal notranslate"><span class="pre">transform_n</span></code> and <code class="docutils literal notranslate"><span class="pre">transform_t</span></code> to transform the data from <code class="docutils literal notranslate"><span class="pre">complexity_data</span></code>, which
+is a dictionary mapping input lengths to step counts. Performs least squares on the resulting
+arrays and returns the sum of residuals.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>complexity_data</strong> (<code class="docutils literal notranslate"><span class="pre">dict[int,</span> <span class="pre">int]</span></code>) – the complexity information</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the sum of residuals from least squares</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.complexity.transform_n">
+<em class="property"><span class="pre">abstract</span> <span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_n</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.complexity.transform_n" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of input lengths for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of input lengths</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of input lengths</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.complexity.transform_t">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_t</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.complexity.transform_t" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of timings for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of timings</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of timings</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+</dd></dl>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.complexities.constant">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">constant</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.constant" title="Permalink to this definition">¶</a></dt>
+<dd><p>Complexity class for constant time: <span class="math notranslate nohighlight">\(\mathcal{O}(1)\)</span></p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.constant.transform_n">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_n</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.constant.transform_n" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of input lengths for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of input lengths</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of input lengths</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+</dd></dl>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.complexities.cubic">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">cubic</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.cubic" title="Permalink to this definition">¶</a></dt>
+<dd><p>Complexity class for cubic time: <span class="math notranslate nohighlight">\(\mathcal{O}(n^3)\)</span></p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.cubic.transform_n">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_n</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.cubic.transform_n" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of input lengths for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of input lengths</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of input lengths</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+</dd></dl>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.complexities.exponential">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">exponential</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.exponential" title="Permalink to this definition">¶</a></dt>
+<dd><p>Complexity class for exponential time: <span class="math notranslate nohighlight">\(\mathcal{O}(2^n)\)</span></p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.exponential.transform_n">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_n</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.exponential.transform_n" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of input lengths for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of input lengths</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of input lengths</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.exponential.transform_t">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_t</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.exponential.transform_t" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of timings for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of timings</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of timings</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+</dd></dl>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.complexities.linear">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">linear</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.linear" title="Permalink to this definition">¶</a></dt>
+<dd><p>Complexity class for linear time: <span class="math notranslate nohighlight">\(\mathcal{O}(n)\)</span></p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.linear.transform_n">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_n</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.linear.transform_n" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of input lengths for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of input lengths</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of input lengths</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+</dd></dl>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.complexities.linearithmic">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">linearithmic</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.linearithmic" title="Permalink to this definition">¶</a></dt>
+<dd><p>Complexity class for linearithmic time: <span class="math notranslate nohighlight">\(\mathcal{O}(n \log n)\)</span></p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.linearithmic.transform_n">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_n</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.linearithmic.transform_n" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of input lengths for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of input lengths</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of input lengths</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+</dd></dl>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.complexities.logarithmic">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">logarithmic</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.logarithmic" title="Permalink to this definition">¶</a></dt>
+<dd><p>Complexity class for logarithmic time: <span class="math notranslate nohighlight">\(\mathcal{O}(\log n)\)</span></p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.logarithmic.transform_n">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_n</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.logarithmic.transform_n" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of input lengths for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of input lengths</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of input lengths</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+</dd></dl>
+<dl class="py class">
+<dt id="pybryt.annotations.complexity.complexities.quadratic">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">quadratic</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">complexity_data</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.quadratic" title="Permalink to this definition">¶</a></dt>
+<dd><p>Complexity class for quadratic time: <span class="math notranslate nohighlight">\(\mathcal{O}(n^2)\)</span></p>
+<dl class="py method">
+<dt id="pybryt.annotations.complexity.complexities.quadratic.transform_n">
+<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">transform_n</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">numpy.ndarray</span></span></em><span class="sig-paren">)</span> → <span class="pre">numpy.ndarray</span><a class="headerlink" href="#pybryt.annotations.complexity.complexities.quadratic.transform_n" title="Permalink to this definition">¶</a></dt>
+<dd><p>Transforms the array of input lengths for performing least squares.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>n</strong> (<code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code>) – the array of input lengths</p>
+</dd>
+<dt class="field-even">Returns</dt>
+<dd class="field-even"><p>the transformed array of input lengths</p>
+</dd>
+<dt class="field-odd">Return type</dt>
+<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">np.ndarray</span></code></p>
+</dd>
+</dl>
+</dd></dl>
+</dd></dl>
+</div>
+</div>
 <div class="section" id="module-pybryt.annotations.invariants">
 <span id="invariants"></span><h3>Invariants<a class="headerlink" href="#module-pybryt.annotations.invariants" title="Permalink to this headline">¶</a></h3>
 <p>Invariants for value annotations (available as <code class="xref py py-mod docutils literal notranslate"><span class="pre">pybryt.invariants</span></code>)</p>
@@ -1192,6 +1538,10 @@ <h2>Student Implementations<a class="headerlink" href="#student-implementations"
 <div class="section" id="module-pybryt.execution">
 <span id="execution"></span><h3>Execution<a class="headerlink" href="#module-pybryt.execution" title="Permalink to this headline">¶</a></h3>
 <p>Submission execution internals for PyBryt</p>
+<dl class="py class">
+<dt id="pybryt.execution.check_time_complexity">
+<em class="property"><span class="pre">class</span> </em><code class="sig-name descname"><span class="pre">check_time_complexity</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span> </span><span class="pre">float</span><span class="p"><span class="pre">,</span> </span><span class="pre">collections.abc.Sized</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.execution.check_time_complexity" title="Permalink to this definition">¶</a></dt>
+<dd></dd></dl>
 <dl class="py function">
 <dt id="pybryt.execution.tracing_off">
 <code class="sig-name descname"><span class="pre">tracing_off</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pybryt.execution.tracing_off" title="Permalink to this definition">¶</a></dt>
@@ -1285,6 +1635,10 @@ <h2>Student Implementations<a class="headerlink" href="#student-implementations"
 <li><a class="reference internal" href="#annotations">Annotations</a><ul>
 <li><a class="reference internal" href="#module-pybryt.annotations.value">Value Annotations</a></li>
 <li><a class="reference internal" href="#module-pybryt.annotations.relation">Relational Annotations</a></li>
+<li><a class="reference internal" href="#module-pybryt.annotations.complexity.annotation">Complexity Annotations</a><ul>
+<li><a class="reference internal" href="#module-pybryt.annotations.complexity.complexities">Complexity Classes</a></li>
+</ul>
+</li>
 <li><a class="reference internal" href="#module-pybryt.annotations.invariants">Invariants</a></li>
 <li><a class="reference internal" href="#annotation-results">Annotation Results</a></li>
 </ul>
diff --git a/docs/html/genindex.html b/docs/html/genindex.html
index b0703d7..0366ae8 100644
--- a/docs/html/genindex.html
+++ b/docs/html/genindex.html
@@ -109,6 +109,7 @@
 <li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 has-children"><a class="reference internal" href="annotations/index.html">Annotations</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
 <li class="toctree-l2"><a class="reference internal" href="annotations/relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="annotations/complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="annotations/invariants.html">Invariants</a></li>
 </ul>
 </li>
@@ -134,7 +135,7 @@
 <section class="genindex-section">
   <h1 id="index">Index</h1>
   <div class="genindex-jumpbox">
-  <a href="#A"><strong>A</strong></a> | <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#M"><strong>M</strong></a> | <a href="#N"><strong>N</strong></a> | <a href="#O"><strong>O</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a> | <a href="#V"><strong>V</strong></a> | <a href="#X"><strong>X</strong></a>
+  <a href="#A"><strong>A</strong></a> | <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#E"><strong>E</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#M"><strong>M</strong></a> | <a href="#N"><strong>N</strong></a> | <a href="#O"><strong>O</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#Q"><strong>Q</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a> | <a href="#V"><strong>V</strong></a> | <a href="#X"><strong>X</strong></a>
   </div>
 </section>
 <section id="A" class="genindex-section">
@@ -197,16 +198,20 @@ <h2>C</h2>
           <li><a href="api_reference.html#pybryt.annotations.relation.RelationalAnnotation.check">(RelationalAnnotation method)</a>
 </li>
           <li><a href="api_reference.html#pybryt.StudentImplementation.check">(StudentImplementation method)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.TimeComplexity.check">(TimeComplexity method)</a>
 </li>
           <li><a href="api_reference.html#pybryt.annotations.value.Value.check">(Value method)</a>
 </li>
           <li><a href="api_reference.html#pybryt.annotations.relation.XorAnnotation.check">(XorAnnotation method)</a>
 </li>
         </ul></li>
-    </ul></td>
-    <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.StudentImplementation.check_plagiarism">check_plagiarism() (StudentImplementation method)</a>
 </li>
+        <li><a href="api_reference.html#pybryt.execution.check_time_complexity">check_time_complexity (class in pybryt.execution)</a>
+</li>
+    </ul></td>
+    <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.annotations.value.Value.check_values_equal">check_values_equal() (Value static method)</a>
 </li>
         <li><a href="api_reference.html#pybryt.AnnotationResult.children">children (AnnotationResult attribute)</a>
@@ -215,6 +220,8 @@ <h2>C</h2>
 
         <ul>
           <li><a href="api_reference.html#pybryt.annotations.value.Attribute.children">(Attribute property)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.ComplexityAnnotation.children">(ComplexityAnnotation property)</a>
 </li>
           <li><a href="api_reference.html#pybryt.annotations.relation.RelationalAnnotation.children">(RelationalAnnotation property)</a>
 </li>
@@ -222,8 +229,16 @@ <h2>C</h2>
 </li>
         </ul></li>
         <li><a href="api_reference.html#pybryt.ReferenceImplementation.compile">compile() (ReferenceImplementation class method)</a>
+</li>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.complexity">complexity (class in pybryt.annotations.complexity.complexities)</a>
+</li>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.ComplexityAnnotation">ComplexityAnnotation (class in pybryt.annotations.complexity.annotation)</a>
+</li>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.constant">constant (class in pybryt.annotations.complexity.complexities)</a>
 </li>
         <li><a href="api_reference.html#pybryt.ReferenceResult.correct">correct() (ReferenceResult property)</a>
+</li>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.cubic">cubic (class in pybryt.annotations.complexity.complexities)</a>
 </li>
     </ul></td>
   </tr></table>
@@ -247,12 +262,28 @@ <h2>D</h2>
   </tr></table>
 </section>
 
+<section id="E" class="genindex-section">
+  <h2>E</h2>
+  <table style="width: 100%" class="indextable genindextable"><tr>
+    <td style="width: 33%; vertical-align: top;"><ul>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.exponential">exponential (class in pybryt.annotations.complexity.complexities)</a>
+</li>
+    </ul></td>
+  </tr></table>
+</section>
+
 <section id="F" class="genindex-section">
   <h2>F</h2>
   <table style="width: 100%" class="indextable genindextable"><tr>
     <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.Annotation.failure_message">failure_message (Annotation attribute)</a>
+
+        <ul>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.ComplexityAnnotation.failure_message">(ComplexityAnnotation attribute)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.TimeComplexity.failure_message">(TimeComplexity attribute)</a>
 </li>
+        </ul></li>
     </ul></td>
   </tr></table>
 </section>
@@ -266,7 +297,11 @@ <h2>G</h2>
         <li><a href="api_reference.html#pybryt.Annotation.group">group (Annotation attribute)</a>
 
         <ul>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.ComplexityAnnotation.group">(ComplexityAnnotation attribute)</a>
+</li>
           <li><a href="api_reference.html#pybryt.ReferenceResult.group">(ReferenceResult attribute)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.TimeComplexity.group">(TimeComplexity attribute)</a>
 </li>
         </ul></li>
     </ul></td>
@@ -298,6 +333,18 @@ <h2>L</h2>
   <table style="width: 100%" class="indextable genindextable"><tr>
     <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.Annotation.limit">limit (Annotation attribute)</a>
+
+        <ul>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.ComplexityAnnotation.limit">(ComplexityAnnotation attribute)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.TimeComplexity.limit">(TimeComplexity attribute)</a>
+</li>
+        </ul></li>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.linear">linear (class in pybryt.annotations.complexity.complexities)</a>
+</li>
+    </ul></td>
+    <td style="width: 33%; vertical-align: top;"><ul>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.linearithmic">linearithmic (class in pybryt.annotations.complexity.complexities)</a>
 </li>
         <li><a href="api_reference.html#pybryt.ReferenceImplementation.load">load() (ReferenceImplementation static method)</a>
 
@@ -305,9 +352,9 @@ <h2>L</h2>
           <li><a href="api_reference.html#pybryt.StudentImplementation.load">(StudentImplementation static method)</a>
 </li>
         </ul></li>
-    </ul></td>
-    <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.StudentImplementation.loads">loads() (StudentImplementation class method)</a>
+</li>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.logarithmic">logarithmic (class in pybryt.annotations.complexity.complexities)</a>
 </li>
     </ul></td>
   </tr></table>
@@ -327,6 +374,10 @@ <h2>M</h2>
     module
 
         <ul>
+          <li><a href="api_reference.html#module-pybryt.annotations.complexity.annotation">pybryt.annotations.complexity.annotation</a>
+</li>
+          <li><a href="api_reference.html#module-pybryt.annotations.complexity.complexities">pybryt.annotations.complexity.complexities</a>
+</li>
           <li><a href="api_reference.html#module-pybryt.annotations.invariants">pybryt.annotations.invariants</a>
 </li>
           <li><a href="api_reference.html#module-pybryt.annotations.relation">pybryt.annotations.relation</a>
@@ -345,11 +396,17 @@ <h2>N</h2>
   <table style="width: 100%" class="indextable genindextable"><tr>
     <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.Annotation.name">name (Annotation attribute)</a>
+
+        <ul>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.ComplexityAnnotation.name">(ComplexityAnnotation attribute)</a>
 </li>
-        <li><a href="api_reference.html#pybryt.AnnotationResult.name">name() (AnnotationResult property)</a>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.TimeComplexity.name">(TimeComplexity attribute)</a>
 </li>
+        </ul></li>
     </ul></td>
     <td style="width: 33%; vertical-align: top;"><ul>
+        <li><a href="api_reference.html#pybryt.AnnotationResult.name">name() (AnnotationResult property)</a>
+</li>
         <li><a href="api_reference.html#pybryt.StudentImplementation.nb">nb (StudentImplementation attribute)</a>
 </li>
         <li><a href="api_reference.html#pybryt.StudentImplementation.nb_path">nb_path (StudentImplementation attribute)</a>
@@ -375,12 +432,28 @@ <h2>P</h2>
   <table style="width: 100%" class="indextable genindextable"><tr>
     <td style="width: 33%; vertical-align: top;"><ul>
         <li>
+    pybryt.annotations.complexity.annotation
+
+        <ul>
+          <li><a href="api_reference.html#module-pybryt.annotations.complexity.annotation">module</a>
+</li>
+        </ul></li>
+        <li>
+    pybryt.annotations.complexity.complexities
+
+        <ul>
+          <li><a href="api_reference.html#module-pybryt.annotations.complexity.complexities">module</a>
+</li>
+        </ul></li>
+        <li>
     pybryt.annotations.invariants
 
         <ul>
           <li><a href="api_reference.html#module-pybryt.annotations.invariants">module</a>
 </li>
         </ul></li>
+    </ul></td>
+    <td style="width: 33%; vertical-align: top;"><ul>
         <li>
     pybryt.annotations.relation
 
@@ -388,8 +461,6 @@ <h2>P</h2>
           <li><a href="api_reference.html#module-pybryt.annotations.relation">module</a>
 </li>
         </ul></li>
-    </ul></td>
-    <td style="width: 33%; vertical-align: top;"><ul>
         <li>
     pybryt.annotations.value
 
@@ -408,6 +479,16 @@ <h2>P</h2>
   </tr></table>
 </section>
 
+<section id="Q" class="genindex-section">
+  <h2>Q</h2>
+  <table style="width: 100%" class="indextable genindextable"><tr>
+    <td style="width: 33%; vertical-align: top;"><ul>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.quadratic">quadratic (class in pybryt.annotations.complexity.complexities)</a>
+</li>
+    </ul></td>
+  </tr></table>
+</section>
+
 <section id="R" class="genindex-section">
   <h2>R</h2>
   <table style="width: 100%" class="indextable genindextable"><tr>
@@ -428,9 +509,11 @@ <h2>R</h2>
 </li>
         <li><a href="api_reference.html#pybryt.annotations.value.Value.rtol">rtol (Value attribute)</a>
 </li>
-        <li><a href="api_reference.html#pybryt.annotations.invariants.invariant.run">run() (invariant static method)</a>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.complexity.run">run() (complexity class method)</a>
 
         <ul>
+          <li><a href="api_reference.html#pybryt.annotations.invariants.invariant.run">(invariant static method)</a>
+</li>
           <li><a href="api_reference.html#pybryt.ReferenceImplementation.run">(ReferenceImplementation method)</a>
 </li>
           <li><a href="api_reference.html#pybryt.annotations.invariants.string_capitalization.run">(string_capitalization static method)</a>
@@ -450,14 +533,20 @@ <h2>S</h2>
 </li>
         <li><a href="api_reference.html#pybryt.StudentImplementation.steps">steps (StudentImplementation attribute)</a>
 </li>
-    </ul></td>
-    <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.annotations.invariants.string_capitalization">string_capitalization (class in pybryt.annotations.invariants)</a>
 </li>
+    </ul></td>
+    <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.StudentImplementation">StudentImplementation (class in pybryt)</a>
 </li>
         <li><a href="api_reference.html#pybryt.Annotation.success_message">success_message (Annotation attribute)</a>
+
+        <ul>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.ComplexityAnnotation.success_message">(ComplexityAnnotation attribute)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.TimeComplexity.success_message">(TimeComplexity attribute)</a>
 </li>
+        </ul></li>
     </ul></td>
   </tr></table>
 </section>
@@ -466,6 +555,8 @@ <h2>S</h2>
   <h2>T</h2>
   <table style="width: 100%" class="indextable genindextable"><tr>
     <td style="width: 33%; vertical-align: top;"><ul>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.annotation.TimeComplexity">TimeComplexity (class in pybryt.annotations.complexity.annotation)</a>
+</li>
         <li><a href="api_reference.html#pybryt.AnnotationResult.timestamp">timestamp (AnnotationResult attribute)</a>
 </li>
         <li><a href="api_reference.html#pybryt.ReferenceResult.to_array">to_array() (ReferenceResult method)</a>
@@ -482,13 +573,37 @@ <h2>T</h2>
           <li><a href="api_reference.html#pybryt.annotations.value.Value.to_dict">(Value method)</a>
 </li>
         </ul></li>
-    </ul></td>
-    <td style="width: 33%; vertical-align: top;"><ul>
         <li><a href="api_reference.html#pybryt.execution.tracing_off">tracing_off() (in module pybryt.execution)</a>
 </li>
         <li><a href="api_reference.html#pybryt.execution.tracing_on">tracing_on() (in module pybryt.execution)</a>
 </li>
     </ul></td>
+    <td style="width: 33%; vertical-align: top;"><ul>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.complexity.transform_n">transform_n() (complexity static method)</a>
+
+        <ul>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.constant.transform_n">(constant static method)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.cubic.transform_n">(cubic static method)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.exponential.transform_n">(exponential static method)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.linear.transform_n">(linear static method)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.linearithmic.transform_n">(linearithmic static method)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.logarithmic.transform_n">(logarithmic static method)</a>
+</li>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.quadratic.transform_n">(quadratic static method)</a>
+</li>
+        </ul></li>
+        <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.complexity.transform_t">transform_t() (complexity static method)</a>
+
+        <ul>
+          <li><a href="api_reference.html#pybryt.annotations.complexity.complexities.exponential.transform_t">(exponential static method)</a>
+</li>
+        </ul></li>
+    </ul></td>
   </tr></table>
 </section>
 
diff --git a/docs/html/getting_started.html b/docs/html/getting_started.html
index 7254575..a1b6138 100644
--- a/docs/html/getting_started.html
+++ b/docs/html/getting_started.html
@@ -110,6 +110,7 @@
 <li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Getting Started</a></li>
 <li class="toctree-l1 has-children"><a class="reference internal" href="annotations/index.html">Annotations</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
 <li class="toctree-l2"><a class="reference internal" href="annotations/relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="annotations/complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="annotations/invariants.html">Invariants</a></li>
 </ul>
 </li>
diff --git a/docs/html/index.html b/docs/html/index.html
index 8c9c6db..34e158f 100644
--- a/docs/html/index.html
+++ b/docs/html/index.html
@@ -110,6 +110,7 @@
 <li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 has-children"><a class="reference internal" href="annotations/index.html">Annotations</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
 <li class="toctree-l2"><a class="reference internal" href="annotations/relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="annotations/complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="annotations/invariants.html">Invariants</a></li>
 </ul>
 </li>
diff --git a/docs/html/objects.inv b/docs/html/objects.inv
index 735a078..ba910c1 100644
Binary files a/docs/html/objects.inv and b/docs/html/objects.inv differ
diff --git a/docs/html/reference_implementations.html b/docs/html/reference_implementations.html
index 9092f50..516e323 100644
--- a/docs/html/reference_implementations.html
+++ b/docs/html/reference_implementations.html
@@ -110,6 +110,7 @@
 <li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 has-children"><a class="reference internal" href="annotations/index.html">Annotations</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
 <li class="toctree-l2"><a class="reference internal" href="annotations/relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="annotations/complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="annotations/invariants.html">Invariants</a></li>
 </ul>
 </li>
diff --git a/docs/html/search.html b/docs/html/search.html
index 04e8e40..fda51c8 100644
--- a/docs/html/search.html
+++ b/docs/html/search.html
@@ -108,6 +108,7 @@
 <li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 has-children"><a class="reference internal" href="annotations/index.html">Annotations</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
 <li class="toctree-l2"><a class="reference internal" href="annotations/relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="annotations/complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="annotations/invariants.html">Invariants</a></li>
 </ul>
 </li>
diff --git a/docs/html/searchindex.js b/docs/html/searchindex.js
index cb214bd..e55e6b3 100644
--- a/docs/html/searchindex.js
+++ b/docs/html/searchindex.js
@@ -1,1 +1,1 @@
-Search.setIndex({docnames:["annotations/index","annotations/invariants","annotations/relational_annotations","api_reference","getting_started","index","reference_implementations","student_implementations"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["annotations/index.rst","annotations/invariants.rst","annotations/relational_annotations.rst","api_reference.rst","getting_started.rst","index.rst","reference_implementations.rst","student_implementations.rst"],objects:{"pybryt.Annotation":{after:[3,1,1,""],before:[3,1,1,""],check:[3,1,1,""],children:[3,1,1,""],failure_message:[3,2,1,""],get_tracked_annotations:[3,1,1,""],group:[3,2,1,""],limit:[3,2,1,""],name:[3,2,1,""],reset_tracked_annotations:[3,1,1,""],success_message:[3,2,1,""],to_dict:[3,1,1,""]},"pybryt.AnnotationResult":{annotation:[3,2,1,""],children:[3,2,1,""],group:[3,1,1,""],messages:[3,1,1,""],name:[3,1,1,""],satisfied:[3,1,1,""],satisfied_at:[3,1,1,""],timestamp:[3,2,1,""],to_dict:[3,1,1,""],value:[3,1,1,""]},"pybryt.ReferenceImplementation":{annotations:[3,2,1,""],compile:[3,1,1,""],dump:[3,1,1,""],load:[3,1,1,""],run:[3,1,1,""]},"pybryt.ReferenceResult":{correct:[3,1,1,""],group:[3,2,1,""],messages:[3,1,1,""],reference:[3,2,1,""],results:[3,2,1,""],to_array:[3,1,1,""],to_dict:[3,1,1,""]},"pybryt.StudentImplementation":{check:[3,1,1,""],check_plagiarism:[3,1,1,""],dump:[3,1,1,""],dumps:[3,1,1,""],load:[3,1,1,""],loads:[3,1,1,""],nb:[3,2,1,""],nb_path:[3,2,1,""],steps:[3,2,1,""],values:[3,2,1,""]},"pybryt.annotations":{invariants:[3,3,0,"-"],relation:[3,3,0,"-"],value:[3,3,0,"-"]},"pybryt.annotations.invariants":{invariant:[3,0,1,""],string_capitalization:[3,0,1,""]},"pybryt.annotations.invariants.invariant":{run:[3,1,1,""]},"pybryt.annotations.invariants.string_capitalization":{run:[3,1,1,""]},"pybryt.annotations.relation":{AndAnnotation:[3,0,1,""],BeforeAnnotation:[3,0,1,""],NotAnnotation:[3,0,1,""],OrAnnotation:[3,0,1,""],RelationalAnnotation:[3,0,1,""],XorAnnotation:[3,0,1,""]},"pybryt.annotations.relation.AndAnnotation":{check:[3,1,1,""]},"pybryt.annotations.relation.BeforeAnnotation":{check:[3,1,1,""]},"pybryt.annotations.relation.NotAnnotation":{check:[3,1,1,""]},"pybryt.annotations.relation.OrAnnotation":{check:[3,1,1,""]},"pybryt.annotations.relation.RelationalAnnotation":{check:[3,1,1,""],children:[3,1,1,""]},"pybryt.annotations.relation.XorAnnotation":{check:[3,1,1,""]},"pybryt.annotations.value":{Attribute:[3,0,1,""],Value:[3,0,1,""]},"pybryt.annotations.value.Attribute":{check:[3,1,1,""],children:[3,1,1,""],to_dict:[3,1,1,""]},"pybryt.annotations.value.Value":{atol:[3,2,1,""],check:[3,1,1,""],check_values_equal:[3,1,1,""],children:[3,1,1,""],intial_value:[3,2,1,""],invariants:[3,2,1,""],rtol:[3,2,1,""],to_dict:[3,1,1,""]},"pybryt.execution":{tracing_off:[3,4,1,""],tracing_on:[3,4,1,""]},pybryt:{Annotation:[3,0,1,""],AnnotationResult:[3,0,1,""],ReferenceImplementation:[3,0,1,""],ReferenceResult:[3,0,1,""],StudentImplementation:[3,0,1,""],execution:[3,3,0,"-"]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"],"2":["py","attribute","Python attribute"],"3":["py","module","Python module"],"4":["py","function","Python function"]},objtypes:{"0":"py:class","1":"py:method","2":"py:attribute","3":"py:module","4":"py:function"},terms:{"100":0,"abstract":[0,2,3,5,6,7],"boolean":[0,3],"case":[0,7],"class":[0,2,3,4,5,6,7],"default":[0,2,6,7],"float":3,"function":[3,4,6,7],"import":4,"int":[2,3,4,6],"new":6,"null":[],"return":[2,3,4,6,7],"static":[3,6],"switch":2,"true":[],"while":[0,3,7],For:[0,2,3,7],The:[0,2,3,4,6,7],There:[0,6],These:6,Use:[],Uses:3,__init__:6,__len__:[],__new__:3,_collector_ret:[],_tracked_annot:3,abc:[],abl:2,about:[0,4,5],abov:2,absolut:[0,3,7],accept:[0,3],access:7,across:7,act:[],action:3,activ:4,actual:7,add:[4,6],added:3,addit:3,addl_filenam:[3,7],advanc:6,affect:0,after:[2,3,4,6],against:3,aim:5,algorithm:2,all:[0,2,3,6],allcos:3,allow:[0,2,3,7],also:[0,2,4,7],analysi:5,andannot:3,ani:[3,4,6],annot:[5,6,7],annotation_result:3,annotationresult:3,anoth:[2,3],ans:6,api:[4,6],appear:[0,2,3],append:6,applic:3,arang:[],architectur:[],arg:[2,3],argument:[0,3,7],arithemt:3,arr:0,arrai:[2,3],assert:[2,3,4],assess:[4,5],assign:6,atol:3,attr:3,attribut:3,auto:5,autograd:5,autolab:5,autom:4,automat:4,avail:3,awai:[6,7],back:3,bad:4,base:[3,7],basic:0,becaus:[3,6,7],been:[2,3,6],befor:[2,3,4,6],beforeannot:[2,3],begin:6,behavior:[0,5],being:[0,3,6,7],belong:3,below:[0,3,6],best:[],between:2,beyond:4,big_o:[],bin:4,bitwis:[2,3],black:4,block:0,bool:3,both:4,box:4,build:0,built:6,builtin:4,call:[0,2,3,6,7],callabl:3,can:[2,3,4,5,6,7],capit:3,captur:[],cdot:3,check:[2,3,4,6],check_plagiar:3,check_time_complex:[],check_values_equ:3,child:[2,3],children:3,classmethod:3,closest:[],code:[0,2,3,5,6,7],collect:[3,6],com:[],combin:0,come:2,compar:[3,5],compelx:[],compil:[3,6],complet:4,complex:[0,5],complexity_class:[],complexity_data:[],complexityannot:[],compris:3,comput:[2,3],computation:7,conda:4,condit:[0,2,3,5,6],configur:3,consid:[0,2,3,6],constant:[],constraint:2,construct:[0,1,6,7],constructor:[0,2,3,4,6,7],consum:7,contain:[2,3,7],content:5,context:[],convert:3,copi:[0,3],core:[5,6],correct:[2,3],correct_answ:0,correctli:6,correspond:[2,7],could:4,count:4,count_word:4,counter:3,cplx:[],creat:[0,2,3,4,5,7],create_collector:[],create_refer:3,creation:3,cubic:[],curr_val:[2,6],current:[1,2],custom:[3,7],data:3,deactiv:3,debug:7,decreas:3,def:[2,3,4,6],defin:[0,2,3,5,6],demo:[3,4],describ:[0,2],design:5,dest:3,detail:[3,4],detect:[4,5],determin:[3,6],dict:3,dictionari:3,differ:[0,2,7],dill:[3,6],directli:2,doe:3,doesn:6,don:0,down:6,dtype:[2,6],dump:[3,6,7],dunder:2,dure:3,dynam:[2,6],each:[2,3,7],easi:5,easier:7,educ:5,either:[2,3,7],element:3,emploi:7,empow:5,empti:[3,4],encod:[3,6,7],enforc:[2,5],enough:3,ensur:[2,3],environ:[4,6],equal:[0,2,3],error:[],etc:[],evalu:3,everi:7,exact:7,exampl:[2,3,6,7],execut:[0,5,6],executepreprocessor:7,exist:[3,5],exit:[],exp:[],expect:[0,3,6],expens:7,exponenti:[],fail:0,failur:3,failure_messag:3,feedback:5,fib:[2,6],fib_map:6,fiber:[],fibonacci:[2,6],field:3,file:[3,6,7],filenam:[3,6],final_answ:6,find:6,first:[2,3,4,6],first_ref:6,fit:[],five:4,folder:4,follow:[2,4],footprint:[3,7],form:0,format:3,found:[5,6],fragment:4,frame:[],friendli:3,from:[0,2,3,4,6],from_footprint:[],full:[],fun:5,further:6,gener:[3,6,7],get_impl_result:3,get_tracked_annot:3,github:[],given:4,global:[3,6],goal:5,grade:5,grader:5,greater:[2,3],group:[3,6,7],guid:5,hand:5,handl:[3,7],har:7,has:[2,3,6],hash:6,have:[2,3,4,5,6],help:2,here:[],http:[],ignor:3,implemen:6,implement:[0,4,5],implenet:6,includ:[0,3],incorpor:[],increas:[],indic:3,inform:[],infrastructur:5,inherit:3,initi:3,input:4,insensit:0,insert:7,insid:[3,7],instanc:[0,2,3,4,5,6],instani:0,instanti:2,institut:5,instructor:5,integ:3,integr:5,interact:3,intern:3,intial_valu:3,ipynb:[6,7],item:4,iter:[0,2],its:[3,4],itself:2,jig:4,json:3,judg:4,jupyt:[3,6,7],just:[],kei:[3,4],keyword:3,kind:[0,2,3],kwarg:3,lab:5,lack:0,later:6,launch:[],learn:[4,5],learner:5,leav:3,len:4,length:[3,4],less:3,leverag:5,librari:[5,6],like:[],limit:3,linalg:[],line:6,linear:[],linearithm:[],list:[0,3,4,6,7],load:[3,6,7],log:[],logarithm:[],logic:[0,2,3],look:[4,5],loop:2,lowercas:3,lstsq:[],made:6,magic:4,mai:2,main:0,maintain:[3,6],make:[3,4,7],manag:[3,7],mang:3,map:[3,6],mark:[3,6],match:3,math:0,mathcal:[],matrix:3,maximum:3,mean:6,meaning:5,meet:0,memori:[2,3,7],messag:3,met:3,method:[2,3,4,6,7],might:7,model:[4,5],modul:[],more:[2,3,4,6],most:0,much:4,multipl:[6,7],must:[3,6],mutabl:0,n_fib:6,name:[3,7],nb_path:3,nbformat:[3,7],ndarrai:[2,3],necessari:[3,6],need:[0,3],next:2,njump:4,non:3,none:3,noreturn:3,normal:0,notannot:3,note:[0,2],notebook:[3,6],notebooknod:3,number:[2,3,4],numbr:2,numer:3,numpi:3,nymph:4,obj:3,object:[0,3,5,6,7],observ:[3,4,7],observed_valu:3,occur:[2,3,7],off:3,okpi:5,one:[2,3,6],onli:[0,2,3,6],open:5,oper:[2,3,5],operand:2,option:3,orannot:3,order:3,organiz:5,origin:3,other:3,other_annot:3,other_valu:3,otherwis:3,otter:5,our:5,out:[0,4],output:[3,7],outsid:[],overrid:2,own:[3,4],packag:[],page:1,paramet:3,part:3,pass:[0,3,4,6,7],passag:3,path:[2,3,6,7],path_or_nb:3,pattern:[5,7],pberk:[],pedagog:5,perspect:0,pickl:3,picklabl:3,piec:4,pip:4,pkl:[3,6],place:[],plagiar:[3,4,5],pointer:2,popul:3,posit:[],possibl:[0,2],pow:3,practic:5,prefer:[],preprocessor:7,presenc:[0,2],present:[2,3],print:7,problem:[2,5],proce:7,process:5,program:[2,5,6],project:4,properti:3,provid:[0,2,3,5,7],ps1:4,pybryt:[0,2,3,6,7],pybyrt:4,python3:4,python:[2,3,4,5,7],quadrat:[],quartz:4,question:[3,7],quick:4,quickli:4,rais:3,random:0,randomli:3,rang:[2,6],rather:[],read:[4,7],recent:4,recommend:2,reconcil:[6,7],ref1:6,ref2:6,ref:[3,6,7],refer:[0,4,5,7],referenceimplement:[3,5,6,7],referenceresult:[3,7],rel:[2,3],relai:3,relat:0,relationalannot:[2,3],relationship:[0,2],remov:4,report:[],report_on_error:[],repres:0,represent:3,requir:[3,4],reset:3,reset_tracked_annot:3,residu:[],respond:0,result:[4,6],rtol:3,run:[3,6,7],runtim:[],same:[2,3,7],sampl:4,satisfi:[2,3],satisfied_at:3,satisifi:[],save:6,save_func:[],script:[3,4,7],search:6,second:[2,3,6],second_ref:6,see:[0,3,7],seed:0,select:[],self:3,send:4,sent:[],sequenc:[2,6],seri:[3,5,6],serial:[6,7],session:7,set:[0,3,6,7],should:[0,2,3,7],shouldn:3,show:7,show_onli:[],signatur:4,similar:[],simpl:[3,4],simpler:[],simpli:[2,7],simplic:[],singl:[0,3,6,7],singleton:[3,6],size:0,slight:[],smallest:[],solut:[2,5],some:[2,3,4,5,6],sort:[],sourc:[4,5],space:4,special:7,specif:[0,2,3,5,7],specifi:3,sphinx:4,split:4,stack:3,stage:7,statement:7,step:3,still:6,stolen:[],store:3,str:[3,4],string:[0,3,4,7],string_capit:[0,3],structur:[0,5],stu:7,student:[0,2,4,5,6],student_impl:3,studentimplement:[3,6,7],studi:3,subclass:[0,2,3,5],subm:7,submiss:[3,7],success:3,success_messag:3,support:[0,2,3,5],sure:4,surround:0,tak:3,take:[0,2,3,4,6,7],taken:3,task:4,teach:5,technolog:5,tempor:[0,3],test:[4,7],text:[3,4],texttt:3,than:[2,3],thei:[0,3,6],them:[3,4,6,7],thereof:0,thi:[1,2,3,4,5,6,7],third:3,those:[0,3,5,6,7],through:[3,5],thrown:[],time:7,timecomplex:[],timecomplexityresult:[],timestamp:[2,3,7],to_arrai:3,to_dict:3,tol:0,toler:3,trace:[3,7],tracing_func:[],tracing_off:3,tracing_on:3,track:[3,6,7],train:4,transform:[],transform_n:[],transform_t:[],transpos:3,transposit:3,tupl:[3,6,7],turn:[3,6],two:[0,2,3,4,6],type:[0,3,4,7],typecontextmanag:[],unchang:3,under:[1,3],ungrad:3,uniform:[],union:3,uniqu:[],unit:6,unless:6,unnecessari:6,unpickl:3,unsatisfi:3,unspecifi:[],updat:[2,4],upon:[],use:[0,2,4,6,7],used:[2,3,4,7],useful:7,uses:6,using:[0,2,3,4,7],valu:[2,4,5,6,7],valueerror:3,variabl:[2,4,6],variou:7,vector:0,venv:4,version:[4,7],vex:4,virtual:4,vow:4,wai:6,waltz:4,want:4,well:3,were:[3,4,7],what:4,when:[0,2,3,6],where:3,whether:[3,6],which:[0,2,3,4,6,7],within:[3,4,5],wizard:4,word:4,work:[2,3,5,6],workflow:5,worri:0,would:[3,4,7],wrangl:3,write:[2,3,4,7],written:[5,7],xor:2,xorannot:[2,3],you:[0,4],your:4,zero:[0,2,6]},titles:["Annotations","Invariants","Relational Annotations","API Reference","Getting Started","PyBryt Documentation","Reference Implementations","Student Implementations"],titleterms:{"boolean":2,"class":[],annot:[0,2,3,4],api:3,automat:6,check:7,code:[],command:4,complex:[],creat:6,creation:6,document:5,evalu:[],exampl:4,execut:[3,7],exist:4,get:4,implement:[3,6,7],insid:4,instal:4,interact:6,invari:[0,1,3],jupyt:4,line:4,linux:4,maco:4,manual:6,next:4,notebook:[4,7],numer:0,powershel:4,pybryt:[4,5],refer:[3,6],relat:[2,3],result:3,start:4,step:4,store:[6,7],student:[3,7],tempor:2,toler:0,track:[],valu:[0,3],window:4,work:4}})
\ No newline at end of file
+Search.setIndex({docnames:["annotations/complexity_annotations","annotations/index","annotations/invariants","annotations/relational_annotations","api_reference","getting_started","index","reference_implementations","student_implementations"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":2,sphinx:56},filenames:["annotations/complexity_annotations.rst","annotations/index.rst","annotations/invariants.rst","annotations/relational_annotations.rst","api_reference.rst","getting_started.rst","index.rst","reference_implementations.rst","student_implementations.rst"],objects:{"pybryt.Annotation":{after:[4,1,1,""],before:[4,1,1,""],check:[4,1,1,""],children:[4,1,1,""],failure_message:[4,2,1,""],get_tracked_annotations:[4,1,1,""],group:[4,2,1,""],limit:[4,2,1,""],name:[4,2,1,""],reset_tracked_annotations:[4,1,1,""],success_message:[4,2,1,""],to_dict:[4,1,1,""]},"pybryt.AnnotationResult":{annotation:[4,2,1,""],children:[4,2,1,""],group:[4,1,1,""],messages:[4,1,1,""],name:[4,1,1,""],satisfied:[4,1,1,""],satisfied_at:[4,1,1,""],timestamp:[4,2,1,""],to_dict:[4,1,1,""],value:[4,1,1,""]},"pybryt.ReferenceImplementation":{annotations:[4,2,1,""],compile:[4,1,1,""],dump:[4,1,1,""],load:[4,1,1,""],run:[4,1,1,""]},"pybryt.ReferenceResult":{correct:[4,1,1,""],group:[4,2,1,""],messages:[4,1,1,""],reference:[4,2,1,""],results:[4,2,1,""],to_array:[4,1,1,""],to_dict:[4,1,1,""]},"pybryt.StudentImplementation":{check:[4,1,1,""],check_plagiarism:[4,1,1,""],dump:[4,1,1,""],dumps:[4,1,1,""],load:[4,1,1,""],loads:[4,1,1,""],nb:[4,2,1,""],nb_path:[4,2,1,""],steps:[4,2,1,""],values:[4,2,1,""]},"pybryt.annotations":{invariants:[4,3,0,"-"],relation:[4,3,0,"-"],value:[4,3,0,"-"]},"pybryt.annotations.complexity":{annotation:[4,3,0,"-"],complexities:[4,3,0,"-"]},"pybryt.annotations.complexity.annotation":{ComplexityAnnotation:[4,0,1,""],TimeComplexity:[4,0,1,""]},"pybryt.annotations.complexity.annotation.ComplexityAnnotation":{children:[4,1,1,""],failure_message:[4,2,1,""],group:[4,2,1,""],limit:[4,2,1,""],name:[4,2,1,""],success_message:[4,2,1,""]},"pybryt.annotations.complexity.annotation.TimeComplexity":{check:[4,1,1,""],failure_message:[4,2,1,""],group:[4,2,1,""],limit:[4,2,1,""],name:[4,2,1,""],success_message:[4,2,1,""]},"pybryt.annotations.complexity.complexities":{complexity:[4,0,1,""],constant:[4,0,1,""],cubic:[4,0,1,""],exponential:[4,0,1,""],linear:[4,0,1,""],linearithmic:[4,0,1,""],logarithmic:[4,0,1,""],quadratic:[4,0,1,""]},"pybryt.annotations.complexity.complexities.complexity":{run:[4,1,1,""],transform_n:[4,1,1,""],transform_t:[4,1,1,""]},"pybryt.annotations.complexity.complexities.constant":{transform_n:[4,1,1,""]},"pybryt.annotations.complexity.complexities.cubic":{transform_n:[4,1,1,""]},"pybryt.annotations.complexity.complexities.exponential":{transform_n:[4,1,1,""],transform_t:[4,1,1,""]},"pybryt.annotations.complexity.complexities.linear":{transform_n:[4,1,1,""]},"pybryt.annotations.complexity.complexities.linearithmic":{transform_n:[4,1,1,""]},"pybryt.annotations.complexity.complexities.logarithmic":{transform_n:[4,1,1,""]},"pybryt.annotations.complexity.complexities.quadratic":{transform_n:[4,1,1,""]},"pybryt.annotations.invariants":{invariant:[4,0,1,""],string_capitalization:[4,0,1,""]},"pybryt.annotations.invariants.invariant":{run:[4,1,1,""]},"pybryt.annotations.invariants.string_capitalization":{run:[4,1,1,""]},"pybryt.annotations.relation":{AndAnnotation:[4,0,1,""],BeforeAnnotation:[4,0,1,""],NotAnnotation:[4,0,1,""],OrAnnotation:[4,0,1,""],RelationalAnnotation:[4,0,1,""],XorAnnotation:[4,0,1,""]},"pybryt.annotations.relation.AndAnnotation":{check:[4,1,1,""]},"pybryt.annotations.relation.BeforeAnnotation":{check:[4,1,1,""]},"pybryt.annotations.relation.NotAnnotation":{check:[4,1,1,""]},"pybryt.annotations.relation.OrAnnotation":{check:[4,1,1,""]},"pybryt.annotations.relation.RelationalAnnotation":{check:[4,1,1,""],children:[4,1,1,""]},"pybryt.annotations.relation.XorAnnotation":{check:[4,1,1,""]},"pybryt.annotations.value":{Attribute:[4,0,1,""],Value:[4,0,1,""]},"pybryt.annotations.value.Attribute":{check:[4,1,1,""],children:[4,1,1,""],to_dict:[4,1,1,""]},"pybryt.annotations.value.Value":{atol:[4,2,1,""],check:[4,1,1,""],check_values_equal:[4,1,1,""],children:[4,1,1,""],intial_value:[4,2,1,""],invariants:[4,2,1,""],rtol:[4,2,1,""],to_dict:[4,1,1,""]},"pybryt.execution":{check_time_complexity:[4,0,1,""],tracing_off:[4,4,1,""],tracing_on:[4,4,1,""]},pybryt:{Annotation:[4,0,1,""],AnnotationResult:[4,0,1,""],ReferenceImplementation:[4,0,1,""],ReferenceResult:[4,0,1,""],StudentImplementation:[4,0,1,""],execution:[4,3,0,"-"]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"],"2":["py","attribute","Python attribute"],"3":["py","module","Python module"],"4":["py","function","Python function"]},objtypes:{"0":"py:class","1":"py:method","2":"py:attribute","3":"py:module","4":"py:function"},terms:{"100":1,"abstract":[0,1,3,4,6,7,8],"boolean":[1,4],"case":[1,8],"class":[0,1,3,5,6,7,8],"default":[0,1,3,7,8],"float":4,"function":[0,4,5,7,8],"import":[0,5],"int":[3,4,5,7],"new":7,"null":[],"return":[0,3,4,5,7,8],"static":[4,7],"switch":3,"true":[],"while":[0,1,4,8],For:[0,1,3,4,8],The:[0,1,3,4,5,7,8],There:[1,7],These:[0,7],Use:4,Uses:4,__init__:7,__len__:0,__new__:4,_collector_ret:[],_tracked_annot:4,abc:4,abl:[3,4],about:[1,5,6],abov:[0,3],absolut:[1,4,8],accept:[1,4],access:8,across:[0,8],act:[],action:4,activ:5,actual:8,add:[0,5,7],added:[0,4],addit:4,addl_filenam:[4,8],advanc:7,affect:1,after:[3,4,5,7],against:4,aim:6,algorithm:[3,4],all:[0,1,3,4,7],allcos:4,allow:[1,3,4,8],also:[0,1,3,4,5,8],analysi:6,andannot:4,ani:[0,4,5,7],annot:[6,7,8],annotation_result:4,annotationresult:4,anoth:[3,4],ans:7,api:[5,7],appear:[1,3,4],append:7,applic:4,arang:0,architectur:4,arg:[3,4],argument:[0,1,4,8],arithemt:4,arr:1,arrai:[3,4],assert:[0,3,4,5],assess:[5,6],assign:7,atol:4,attr:4,attribut:4,auto:6,autograd:6,autolab:6,autom:5,automat:5,avail:[0,4],awai:[7,8],back:4,bad:5,base:[0,4,8],basic:1,becaus:[4,7,8],been:[0,3,4,7],befor:[3,4,5,7],beforeannot:[3,4],begin:7,behavior:[1,6],being:[1,4,7,8],belong:4,below:[0,1,4,7],best:0,between:3,beyond:5,big_o:[0,4],bin:5,bitwis:[3,4],black:5,block:[0,1,4],bool:4,borrow:4,both:5,box:5,build:1,built:7,builtin:5,call:[0,1,3,4,7,8],callabl:4,can:[0,3,4,5,6,7,8],capit:4,captur:[],cdot:4,check:[0,3,4,5,7],check_plagiar:4,check_time_complex:[0,4],check_values_equ:4,child:[3,4],children:4,classmethod:4,closest:4,code:[1,3,4,6,7,8],collect:[0,4,7],com:4,combin:1,come:3,compar:[4,6],compelx:4,compil:[4,7],complet:5,complex:[1,6],complexity_class:4,complexity_data:4,complexityannot:[0,4],compris:4,comput:[3,4],computation:8,conda:5,condit:[1,3,4,6,7],configur:4,consid:[1,3,4,7],constant:4,constraint:3,construct:[1,2,7,8],constructor:[0,1,3,4,5,7,8],consum:8,contain:[3,4,8],content:6,context:[0,4],convert:4,copi:[1,4],core:[6,7],correct:[3,4],correct_answ:1,correctli:7,correspond:[0,3,8],could:5,count:[0,4,5],count_word:5,counter:4,cplx:0,creat:[1,3,4,5,6,8],create_collector:[],create_refer:4,creation:4,cubic:4,curr_val:[3,7],current:[0,2,3],custom:[4,8],data:[0,4],deactiv:4,debug:8,decreas:4,def:[3,4,5,7],defin:[0,1,3,4,6,7],demo:[4,5],describ:[1,3],design:6,dest:4,detail:[4,5],detect:[5,6],determin:[0,4,7],dict:4,dictionari:4,differ:[1,3,8],dill:[4,7],directli:3,doe:4,doesn:7,don:1,down:7,dtype:[3,7],dump:[4,7,8],dunder:3,dure:[0,4],dynam:[3,7],each:[0,3,4,8],easi:6,easier:8,educ:6,either:[3,4,8],element:4,emploi:8,empow:6,empti:[4,5],encod:[4,7,8],enforc:[3,6],enough:4,ensur:[3,4],environ:[5,7],equal:[1,3,4],error:[],etc:0,evalu:4,everi:8,exact:8,exampl:[0,3,4,7,8],exclud:[],execut:[0,1,6,7],executepreprocessor:8,exist:[4,6],exit:0,exp:0,expect:[0,1,4,7],expens:8,exponenti:4,fail:1,failur:4,failure_messag:4,feedback:6,fib:[3,7],fib_map:7,fiber:[],fibonacci:[3,7],field:4,file:[4,7,8],filenam:[4,7],fill:[],fill_empti:[],final_answ:7,find:[4,7],first:[3,4,5,7],first_ref:7,fit:0,five:5,folder:5,follow:[3,5],footprint:[0,4,8],form:1,format:4,found:[0,6,7],fragment:5,frame:[],friendli:4,from:[0,1,3,4,5,7],from_footprint:[],full:0,fun:6,further:7,gener:[4,7,8],generate_report:[],get_impl_result:4,get_tracked_annot:4,github:4,given:5,global:[4,7],goal:6,grade:6,grader:6,greater:[3,4],group:[4,7,8],guid:6,hand:6,handl:[4,8],har:8,has:[0,3,4,7],hash:7,have:[0,3,4,5,6,7],help:[0,3],here:[0,4],http:4,ignor:4,implemen:7,implement:[0,1,5,6],implenet:7,includ:[1,4],incorpor:0,increas:0,indic:4,inform:[0,4],infrastructur:6,inherit:4,initi:4,input:[0,4,5],insensit:1,insert:8,insid:[0,4,8],instanc:[1,3,4,5,6,7],instani:1,instanti:3,institut:6,instructor:6,integ:4,integr:6,interact:4,intern:4,intial_valu:4,ipynb:[7,8],item:5,iter:[1,3],its:[0,4,5],itself:[0,3],jig:5,json:4,judg:5,jupyt:[4,7,8],just:0,kei:[4,5],keyword:[0,4],kind:[0,1,3,4],kwarg:4,lab:6,lack:1,later:7,launch:[],learn:[5,6],learner:6,least:4,leav:4,len:5,length:[0,4,5],less:4,leverag:6,librari:[6,7],like:0,limit:4,linalg:0,line:7,linear:4,linearithm:[0,4],list:[0,1,4,5,7,8],load:[4,7,8],log:[0,4],logarithm:4,logic:[1,3,4],look:[5,6],loop:3,lowercas:4,lstsq:0,made:7,magic:5,mai:3,main:1,maintain:[4,7],make:[4,5,8],manag:[0,4,8],mang:4,map:[4,7],mark:[4,7],match:[0,4],math:1,mathcal:[0,4],matrix:4,maximum:4,mean:[0,7],meaning:6,meet:1,member:[],memori:[0,3,4,8],messag:4,met:4,method:[0,3,4,5,7,8],might:8,model:[5,6],modul:0,more:[0,3,4,5,7],most:1,much:5,multipl:[7,8],must:[0,4,7],mutabl:1,n_fib:7,name:[0,4,8],nb_path:4,nbformat:[4,8],ndarrai:[3,4],necessari:[4,7],need:[0,1,4],next:3,njump:5,non:4,none:4,noreturn:4,normal:1,notannot:4,note:[0,1,3,4],notebook:[4,7],notebooknod:4,number:[0,3,4,5],numbr:3,numer:4,numpi:[0,4],nymph:5,obj:4,object:[0,1,4,6,7,8],observ:[4,5,8],observed_valu:4,occur:[3,4,8],off:4,okpi:6,one:[0,3,4,7],onli:[0,1,3,4,7],open:6,oper:[3,4,6],operand:3,optim:4,option:4,orannot:4,order:4,organiz:6,origin:4,other:4,other_annot:4,other_valu:4,otherwis:4,otter:6,our:6,out:[1,5],output:[4,8],outsid:0,overrid:3,overwritten:4,own:[4,5],packag:0,page:2,paramet:4,part:4,pass:[1,4,5,7,8],passag:4,path:[3,4,7,8],path_or_nb:4,pattern:[6,8],pberk:4,pedagog:6,perform:4,perspect:1,pickl:4,picklabl:4,piec:5,pip:5,pkl:[4,7],place:0,plagiar:[4,5,6],pointer:3,popul:4,posit:0,possibl:[1,3],pow:4,practic:6,prefer:0,preprocessor:8,presenc:[1,3],present:[3,4],print:8,problem:[3,6],proce:8,process:6,program:[3,6,7],project:5,properti:4,provid:[0,1,3,4,6,8],ps1:5,pybryt:[0,1,3,4,7,8],pybyrt:5,python3:5,python:[0,3,4,5,6,8],quadrat:4,quartz:5,question:[4,8],quick:5,quickli:5,rais:4,random:[0,1],randomli:4,rang:[3,7],rather:[],read:[5,8],recent:5,recommend:3,reconcil:[7,8],ref1:7,ref2:7,ref:[4,7,8],refer:[0,1,5,6,8],referenceimplement:[4,6,7,8],referenceresult:[4,8],rel:[3,4],relai:4,relat:[0,1],relationalannot:[3,4],relationship:[1,3],remov:5,report:[],report_on_error:[],repres:1,represent:4,requir:[0,4,5],reset:4,reset_tracked_annot:4,residu:[0,4],respond:1,result:[0,5,7],rtol:4,run:[4,7,8],runtim:0,same:[3,4,8],sampl:5,satisfi:[0,3,4],satisfied_at:4,satisifi:[],save:7,save_func:[],script:[4,5,8],search:7,second:[3,4,7],second_ref:7,see:[1,4,8],seed:1,select:4,self:4,send:5,sent:0,sequenc:[3,7],seri:[0,4,6,7],serial:[7,8],session:8,set:[0,1,4,7,8],should:[0,1,3,4,8],shouldn:4,show:8,show_onli:[],signatur:5,similar:[],simpl:[4,5],simpler:0,simpli:[3,8],simplic:0,singl:[1,4,7,8],singleton:[4,7],size:[0,1,4],slight:0,smallest:0,solut:[3,6],some:[0,3,4,5,6,7],sort:0,sourc:[5,6],space:5,special:8,specif:[1,3,4,6,8],specifi:4,sphinx:5,split:5,squar:4,stack:4,stage:8,statement:8,step:[0,4],still:7,stolen:[],store:4,str:[4,5],string:[0,1,4,5,8],string_capit:[1,4],structur:[1,6],stu:8,student:[0,1,3,5,6,7],student_impl:4,studentimplement:[4,7,8],studi:4,subclass:[0,1,3,4,6],subclasss:4,subm:8,submiss:[4,8],success:4,success_messag:4,sum:4,summari:[],support:[0,1,3,4,6],sure:5,surround:1,tak:4,take:[0,1,3,4,5,7,8],taken:[0,4],task:5,teach:6,technolog:6,tempor:[1,4],test:[5,8],text:[4,5],texttt:4,than:[3,4],thei:[1,4,7],them:[4,5,7,8],thereof:1,thi:[0,2,3,4,5,6,7,8],third:4,those:[1,4,6,7,8],through:[0,4,6],thrown:[],time:[0,4,8],timecomplex:[0,4],timecomplexityresult:4,timestamp:[3,4,8],to_arrai:4,to_dict:4,tol:1,toler:4,trace:[0,4,8],tracing_func:[],tracing_off:4,tracing_on:4,track:[4,7,8],train:5,transform:[0,4],transform_n:4,transform_t:4,transpos:4,transposit:4,tupl:[4,7,8],turn:[4,7],two:[0,1,3,4,5,7],type:[1,4,5,8],typecontextmanag:[],unchang:4,under:[2,4],underli:[],undoc:[],ungrad:4,uniform:0,union:4,uniqu:0,unit:7,unless:7,unnecessari:7,unpickl:4,unsatisfi:4,unspecifi:[],updat:[3,5],upon:[],use:[1,3,5,7,8],used:[0,3,4,5,8],useful:8,uses:[0,7],using:[1,3,4,5,8],valu:[0,3,5,6,7,8],valueerror:4,variabl:[3,5,7],variou:8,vector:1,venv:5,version:[5,8],vex:5,virtual:5,vow:5,wai:7,waltz:5,want:5,well:4,were:[4,5,8],what:5,when:[0,1,3,4,7],where:4,whether:[0,4,7],which:[0,1,3,4,5,7,8],within:[4,5,6],wizard:5,word:5,work:[0,3,4,6,7],workflow:6,worri:1,would:[4,5,8],wrangl:4,write:[3,4,5,8],written:[6,8],xor:3,xorannot:[3,4],you:[1,5],your:5,zero:[1,3,7]},titles:["Complexity Annotations","Annotations","Invariants","Relational Annotations","API Reference","Getting Started","PyBryt Documentation","Reference Implementations","Student Implementations"],titleterms:{"boolean":3,"class":4,annot:[0,1,3,4,5],api:4,automat:7,check:8,code:0,command:5,complex:[0,4],creat:[0,7],creation:7,document:6,evalu:0,exampl:5,execut:[4,8],exist:5,get:5,implement:[4,7,8],insid:5,instal:5,interact:7,invari:[1,2,4],jupyt:5,line:5,linux:5,maco:5,manual:7,next:5,notebook:[5,8],numer:1,powershel:5,pybryt:[5,6],refer:[4,7],relat:[3,4],result:4,start:5,step:5,store:[7,8],student:[4,8],tempor:3,toler:1,track:0,valu:[1,4],window:5,work:5}})
\ No newline at end of file
diff --git a/docs/html/student_implementations.html b/docs/html/student_implementations.html
index e3f81c4..4976be8 100644
--- a/docs/html/student_implementations.html
+++ b/docs/html/student_implementations.html
@@ -110,6 +110,7 @@
 <li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
 <li class="toctree-l1 has-children"><a class="reference internal" href="annotations/index.html">Annotations</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
 <li class="toctree-l2"><a class="reference internal" href="annotations/relational_annotations.html">Relational Annotations</a></li>
+<li class="toctree-l2"><a class="reference internal" href="annotations/complexity_annotations.html">Complexity Annotations</a></li>
 <li class="toctree-l2"><a class="reference internal" href="annotations/invariants.html">Invariants</a></li>
 </ul>
 </li>
diff --git a/pybryt/annotations/__init__.py b/pybryt/annotations/__init__.py
index be02f91..01b7140 100644
--- a/pybryt/annotations/__init__.py
+++ b/pybryt/annotations/__init__.py
@@ -2,5 +2,6 @@
 
 from . import invariants
 from .annotation import Annotation, AnnotationResult
+from .complexity import *
 from .relation import *
 from .value import *
diff --git a/pybryt/annotations/annotation.py b/pybryt/annotations/annotation.py
index 8084a4f..2f8cf6e 100644
--- a/pybryt/annotations/annotation.py
+++ b/pybryt/annotations/annotation.py
@@ -74,17 +74,13 @@ def _track(self) -> NoReturn:
         global _GROUP_INDICES, _TRACKED_ANNOTATIONS
 
         idx = len(_TRACKED_ANNOTATIONS)
-        if self.name is None:
-            if self.limit is not None:
-                raise TypeError("'limit' passed without 'name'") 
+        if self.name not in _GROUP_INDICES:
+            _GROUP_INDICES[self.name] = []
+        if self.limit is not None and len(_GROUP_INDICES[self.name]) >= self.limit:
+            return
         else:
-            if self.name not in _GROUP_INDICES:
-                _GROUP_INDICES[self.name] = []
-            if self.limit is not None and len(_GROUP_INDICES[self.name]) >= self.limit:
-                return
-            else:
-                _GROUP_INDICES[self.name].append(idx)
-        
+            _GROUP_INDICES[self.name].append(idx)
+    
         for child in self.children:
             try:
                 _TRACKED_ANNOTATIONS.remove(child)
@@ -121,7 +117,7 @@ def children(self) -> List["Annotation"]:
         ``list[Annotation]``: the child annotations of this annotation. If this annotation has no 
         children, an empty list.
         """
-        ...
+        ... # pragma: no cover
 
     @abstractmethod
     def check(self, observed_values: List[Tuple[Any, int]]) -> "AnnotationResult":
@@ -140,7 +136,7 @@ def check(self, observed_values: List[Tuple[Any, int]]) -> "AnnotationResult":
             :py:class:`AnnotationResult`: the results of this annotation based on 
             ``observed_values``
         """
-        ...
+        ... # pragma: no cover
 
     @abstractmethod
     def __eq__(self, other: Any) -> bool:
@@ -153,7 +149,7 @@ def __eq__(self, other: Any) -> bool:
         Returns:
             ``bool``: whether the objects are equal
         """
-        return self is other
+        ... # pragma: no cover
 
     def before(self, other_annotation: "Annotation", **kwargs) -> "BeforeAnnotation":
         """
@@ -329,8 +325,8 @@ def satisfied(self) -> bool:
             return self._satisfied
         elif self.children:
             return all(c.satisfied for c in self.children)
-        else:
-            return bool(self._satisfied)
+        else: # pragma: no cover
+            return False
 
     @property
     def satisfied_at(self) -> int:
diff --git a/pybryt/annotations/complexity/__init__.py b/pybryt/annotations/complexity/__init__.py
new file mode 100644
index 0000000..6c8ef64
--- /dev/null
+++ b/pybryt/annotations/complexity/__init__.py
@@ -0,0 +1,4 @@
+""""""
+
+from . import complexities
+from .annotation import *
diff --git a/pybryt/annotations/complexity/annotation.py b/pybryt/annotations/complexity/annotation.py
new file mode 100644
index 0000000..17b968a
--- /dev/null
+++ b/pybryt/annotations/complexity/annotation.py
@@ -0,0 +1,109 @@
+""""""
+
+__all__ = ["ComplexityAnnotation", "TimeComplexity"]
+
+from typing import Any, List, Tuple
+
+from . import complexities
+from ..annotation import Annotation, AnnotationResult
+from ...execution import TimeComplexityResult
+
+
+EPS = 1e-6 # a value to set a slight preference for simpler methods
+
+
+class ComplexityAnnotation(Annotation):
+    """
+    Abstract base class for annotations that assert a condition on the complexity of a student's code.
+
+    All complexity annotations should inherit from this class, which defines a constructor that
+    takes in a complexity class and any necessary keyword arguments. Note that all compelxity
+    annotations require a ``name`` keyword argument so that they can be matched with their results
+    from the student's memory footprint.
+
+    Args:
+        complexity (:py:class:`complexity<pybryt.complexities.complexity>`): the complexity class
+            being asserted
+        **kwargs: additional keyword arguments passed to the 
+            :py:class:`Annotation<pybryt.Annotation>` constructor
+    """
+
+    def __init__(self, complexity: complexities.complexity, **kwargs):
+        if "name" not in kwargs:
+            raise ValueError("Complexity annotations require a 'name' kwarg")
+        if complexity not in complexities.complexity_classes:
+            raise ValueError(f"Invalid valid for argument 'complexity': {complexity}")
+        self.complexity = complexity
+        super().__init__(**kwargs)
+
+    @property
+    def children(self) -> List[Annotation]:
+        """
+        ``list[Annotation]``: the child annotations of this annotation. If this annotation has no 
+        children, an empty list.
+        """
+        return []
+    
+    def __eq__(self, other: Any) -> bool:
+        """
+        Checks whether this annotation is equal to another object.
+
+        A complexity annotation equals another object if it is also a complexity annotation of the
+        same type, has the same name, and has the same complexity assertion.
+
+        Args:
+            other (``object``): the object to compare to
+
+        Returns:
+            ``bool``: whether the objects are equal
+        """
+        return type(self) is type(other) and self.name == other.name and self.complexity is other.complexity
+
+
+class TimeComplexity(ComplexityAnnotation):
+    """
+    Annotation for asserting the time complexity of a block of student code.
+
+    Time complexity here is defined as the number of execution steps taken while executing the
+    code block, which is determined using the number of calls to PyBryt's trace function. Use the
+    :py:obj:`check_time_complexity<pybryt.check_time_complexity>` context manager to check time
+    complexity in student's code. The ``name`` of this annotation should be the same as the ``name``
+    passed to the context manager or this annotation will not be able to find the results of the 
+    check.
+    """
+
+    def check(self, observed_values: List[Tuple[Any, int]]) -> AnnotationResult:
+        """
+        Checks the time complexity of a block of student code and returns a results object.
+
+        Finds all instances of the :py:class:`TimeComplexityResult<pybryt.execution.TimeComplexityResult>` 
+        class in the student's memory footprint and selects all those with matching names. Collects
+        the timing data from each into a dictionary and runs each complexity class in
+        :py:obj:`complexities.complexity_classes<pybryt.complexities.complexity_classes>` against
+        this data. Returns a result indicating whether the closest-matched complexity class was the
+        one asserted in this annotation's ``complexity`` field. The ``value`` of the result object
+        is set to the matching complexity class.
+
+        Args:
+            observed_values (``list[tuple[object, int]]``): a list of tuples of values observed
+                during execution and the timestamps of those values
+        
+        Returns:
+            :py:class:`AnnotationResult`: the results of this annotation based on 
+            ``observed_values``
+        """
+        complexity_data = {}
+        for v, ts in observed_values:
+            if not isinstance(v, TimeComplexityResult) or v.name != self.name:
+                continue
+
+            complexity_data[v.n] = v.stop - v.start
+
+        best_cls, best_res = None, None
+        for cplx in complexities.complexity_classes:
+            res = cplx(complexity_data)
+
+            if best_res is None or res < best_res - EPS:
+                best_cls, best_res = cplx, res
+
+        return AnnotationResult(best_cls is self.complexity, self, value=best_cls)
diff --git a/pybryt/annotations/complexity/complexities.py b/pybryt/annotations/complexity/complexities.py
new file mode 100644
index 0000000..e7da0a0
--- /dev/null
+++ b/pybryt/annotations/complexity/complexities.py
@@ -0,0 +1,156 @@
+""""""
+
+import numpy as np
+
+from abc import ABC, abstractmethod
+from typing import Dict
+
+
+class complexity(ABC):
+    """
+    Abstract base class for a complexity. Subclassses should implement the ``transform_n`` method,
+    which transforms the input lengths array so that least squares can be used. If needed, the
+    ``transform_t`` method can also be overwritten to transform the step counter values.
+
+    The architecture for these and the algorithm for determining the optimal complexity is borrowed
+    from https://github.com/pberkes/big_O.
+    """
+
+    @staticmethod
+    def __new__(cls, complexity_data: Dict[int, int]) -> float:
+        return cls.run(complexity_data)
+
+    @staticmethod
+    @abstractmethod
+    def transform_n(n: np.ndarray) -> np.ndarray:
+        """
+        Transforms the array of input lengths for performing least squares.
+
+        Args:
+            n (``np.ndarray``): the array of input lengths
+        
+        Returns:
+            ``np.ndarray``: the transformed array of input lengths
+        """
+        ... # pragma: no cover
+
+    @staticmethod
+    def transform_t(t: np.ndarray) -> np.ndarray:
+        """
+        Transforms the array of timings for performing least squares.
+
+        Args:
+            n (``np.ndarray``): the array of timings
+        
+        Returns:
+            ``np.ndarray``: the transformed array of timings
+        """
+        return t
+
+    @classmethod
+    def run(cls, complexity_data: Dict[int, int]) -> float:
+        """
+        Returns the sum of residuals by performing least squares on the input length data and timings.
+
+        Uses ``transform_n`` and ``transform_t`` to transform the data from ``complexity_data``, which
+        is a dictionary mapping input lengths to step counts. Performs least squares on the resulting
+        arrays and returns the sum of residuals.
+
+        Args:
+            complexity_data (``dict[int, int]``): the complexity information
+
+        Returns:
+            ``float``: the sum of residuals from least squares
+        """
+        ns, ts = [], []
+        for n, t in complexity_data.items():
+            ns.append(n)
+            ts.append(t)
+        
+        n = np.array(ns, dtype=int)
+        t = np.array(ts, dtype=int)
+
+        n = cls.transform_n(n)
+        t = cls.transform_t(t)
+
+        _, resid, _, _ = np.linalg.lstsq(n, t, rcond=-1)
+        if len(resid) == 0:
+            return np.inf
+        return resid[0]
+
+
+class constant(complexity):
+    """
+    Complexity class for constant time: :math:`\mathcal{O}(1)`
+    """
+
+    @staticmethod
+    def transform_n(n: np.ndarray) -> np.ndarray:
+        return np.ones((len(n), 1))
+
+
+class logarithmic(complexity):
+    """
+    Complexity class for logarithmic time: :math:`\mathcal{O}(\log n)`
+    """
+
+    @staticmethod
+    def transform_n(n: np.ndarray) -> np.ndarray:
+        return np.vstack((np.ones(len(n)), np.log2(n))).T
+
+
+class linear(complexity):
+    """
+    Complexity class for linear time: :math:`\mathcal{O}(n)`
+    """
+
+    @staticmethod
+    def transform_n(n: np.ndarray) -> np.ndarray:
+        return np.vstack((np.ones(len(n)), n)).T
+
+
+class linearithmic(complexity):
+    """
+    Complexity class for linearithmic time: :math:`\mathcal{O}(n \log n)`
+    """
+
+    @staticmethod
+    def transform_n(n: np.ndarray) -> np.ndarray:
+        return np.vstack((np.ones(len(n)), n * np.log2(n))).T
+
+
+class quadratic(complexity):
+    """
+    Complexity class for quadratic time: :math:`\mathcal{O}(n^2)`
+    """
+
+    @staticmethod
+    def transform_n(n: np.ndarray) -> np.ndarray:
+        return np.vstack((np.ones(len(n)), n * n)).T
+
+
+class cubic(complexity):
+    """
+    Complexity class for cubic time: :math:`\mathcal{O}(n^3)`
+    """
+
+    @staticmethod
+    def transform_n(n: np.ndarray) -> np.ndarray:
+        return np.vstack((np.ones(len(n)), n * n * n)).T
+
+
+class exponential(complexity):
+    """
+    Complexity class for exponential time: :math:`\mathcal{O}(2^n)`
+    """
+
+    @staticmethod
+    def transform_n(n: np.ndarray) -> np.ndarray:
+        return np.vstack((np.ones(len(n)), n)).T
+
+    @staticmethod
+    def transform_t(t: np.ndarray) -> np.ndarray:
+        return np.log2(t)
+
+
+complexity_classes = [constant, logarithmic, linear, linearithmic, quadratic, cubic, exponential]
diff --git a/pybryt/annotations/invariants.py b/pybryt/annotations/invariants.py
index 4388f3f..001feb1 100644
--- a/pybryt/annotations/invariants.py
+++ b/pybryt/annotations/invariants.py
@@ -47,7 +47,7 @@ def run(values: List[Any], **kwargs) -> List[Any]:
             ``list[object]``: the values that would evaluate as "the same" under the conditions 
             of this invariant
         """
-        ...
+        ... # pragma: no cover
 
 
 # TODO: if hashing, for all strings collect actual string and lowercased version (marked as such), 
diff --git a/pybryt/annotations/relation.py b/pybryt/annotations/relation.py
index a527c2e..0149e30 100644
--- a/pybryt/annotations/relation.py
+++ b/pybryt/annotations/relation.py
@@ -62,7 +62,7 @@ def __eq__(self, other: Any) -> bool:
 
     @abstractmethod
     def check(self, observed_values: List[Tuple[Any, int]]) -> "AnnotationResult":
-        ...
+        ... # pragma: no cover
 
 
 class BeforeAnnotation(RelationalAnnotation):
diff --git a/pybryt/complexities.py b/pybryt/complexities.py
new file mode 100644
index 0000000..72e605a
--- /dev/null
+++ b/pybryt/complexities.py
@@ -0,0 +1,3 @@
+"""Alias for pybryt.annotations.complexity.complexities"""
+
+from .annotations.complexity.complexities import *
diff --git a/pybryt/execution/__init__.py b/pybryt/execution/__init__.py
new file mode 100644
index 0000000..fb4c658
--- /dev/null
+++ b/pybryt/execution/__init__.py
@@ -0,0 +1,89 @@
+"""Submission execution internals for PyBryt"""
+
+__all__ = ["check_time_complexity", "tracing_off", "tracing_on"]
+
+import os
+import dill
+import nbformat
+
+from nbconvert.preprocessors import ExecutePreprocessor
+from copy import deepcopy
+from tempfile import mkstemp
+from typing import Any, List, Tuple, Optional
+from textwrap import dedent
+
+from .complexity import check_time_complexity, TimeComplexityResult
+from .tracing import create_collector, TRACING_VARNAME, tracing_off, tracing_on
+from ..preprocessors import IntermediateVariablePreprocessor
+from ..utils import make_secret
+
+
+NBFORMAT_VERSION = 4
+
+
+def execute_notebook(nb: nbformat.NotebookNode, nb_path: str, addl_filenames: List[str] = [], 
+        output: Optional[str] = None) -> Tuple[int, List[Tuple[Any, int]]]:
+    """
+    Executes a submission using ``nbconvert`` and returns the memory footprint.
+
+    Takes in a notebook object and preprocesses it before running it through the 
+    ``nbconvert.ExecutePreprocessor`` to execute it. The notebook writes the memory footprint, a 
+    list of observed values and their timestamps, to a file, which is loaded using ``dill`` by this
+    function. Errors during execution are ignored, and the executed notebook can be written to a 
+    file using the ``output`` argument.
+
+    Args:
+        nb (``nbformat.NotebookNode``): the notebook to be executed
+        nb_path (``str``): path to the notebook ``nb``
+        addl_filenames (``list[str]``, optional): a list of additional files to trace inside
+        output (``str``, optional): a file path at which to write the executed notebook
+
+    Returns:
+        ``tuple[int, list[tuple[object, int]]]``: the number of execution steps and the memory 
+        footprint
+    """
+    nb = deepcopy(nb)
+    preprocessor = IntermediateVariablePreprocessor()
+    nb = preprocessor.preprocess(nb)
+
+    secret = make_secret()
+    _, observed_fp = mkstemp()
+    nb_dir = os.path.abspath(os.path.split(nb_path)[0])
+
+    first_cell = nbformat.v4.new_code_cell(dedent(f"""\
+        import sys
+        from pybryt.execution import create_collector
+        observed_{secret}, cir = create_collector(addl_filenames={addl_filenames})
+        sys.settrace(cir)
+        {TRACING_VARNAME} = True
+        %cd {nb_dir}
+    """))
+
+    last_cell = nbformat.v4.new_code_cell(dedent(f"""\
+        sys.settrace(None)
+        import dill
+        from pybryt.utils import filter_picklable_list
+        filter_picklable_list(observed_{secret})
+        with open("{observed_fp}", "wb+") as f:
+            dill.dump(observed_{secret}, f)
+    """))
+
+    nb['cells'].insert(0, first_cell)
+    nb['cells'].append(last_cell)
+
+    ep = ExecutePreprocessor(timeout=1200, allow_errors=True)
+
+    ep.preprocess(nb)
+
+    if output:
+        with open(output, "w+") as f:
+            nbformat.write(nb, f)
+
+    with open(observed_fp, "rb") as f:
+        observed = dill.load(f)
+
+    os.remove(observed_fp)
+
+    n_steps = max([t[1] for t in observed])
+
+    return n_steps, observed
diff --git a/pybryt/execution/complexity.py b/pybryt/execution/complexity.py
new file mode 100644
index 0000000..7fc84d1
--- /dev/null
+++ b/pybryt/execution/complexity.py
@@ -0,0 +1,74 @@
+""""""
+
+from collections.abc import Sized
+from contextlib import contextmanager
+from typing import Union
+
+
+_TRACKING_DISABLED = False
+
+
+class TimeComplexityResult:
+
+    def __init__(self, name, n, start, stop):
+        self.name = name
+        self.n = n
+        self.start = start
+        self.stop = stop
+
+
+class check_time_complexity:
+    """
+    A context manager for checking the time complexity of student code.
+
+    Halts tracking of values in memory and sets the trace function to only increment the step
+    counter. When the block exits, the step counter is checked an a ``TimeComplexityResult`` object
+    is appended to the student's memory footprint.
+
+    If the current call stack is not being traced by PyBryt, no action is taken.
+
+    Args:
+        name (``str``): the name of the check; should match with the name of an annotation in the
+            reference implementation
+        n (``Union[int, float, Sized]``): the input length or the input itself if it supports ``len``
+    """
+
+    def __init__(self, name: str, n: Union[int, float, Sized]):
+        if isinstance(n, float):
+            n = int(n)
+        if isinstance(n, Sized):
+            n = len(n)
+        if not isinstance(n, int):
+            try:
+                n = int(n)
+            except:
+                raise TypeError(f"n has invalid type {type(n)}")
+  
+        self._name = name
+        self._n = n
+        self._curr_steps = None
+        self._observed, self._counter = None, None
+
+    def __enter__(self):
+        global _TRACKING_DISABLED
+
+        from .tracing import _COLLECTOR_RET
+        if _COLLECTOR_RET is not None:
+            self._observed, self._counter, _ = _COLLECTOR_RET
+            self._curr_steps = self._counter[0]
+
+        _TRACKING_DISABLED = True
+
+    def __exit__(self, exc_type, exc_value, traceback):
+        global _TRACKING_DISABLED
+
+        _TRACKING_DISABLED = False
+
+        if self._curr_steps is not None:
+            end_steps = self._counter[0]
+            self._observed.append((
+                TimeComplexityResult(self._name, self._n, self._curr_steps, end_steps), 
+                end_steps,
+            ))
+
+        return False
diff --git a/pybryt/execution.py b/pybryt/execution/tracing.py
similarity index 66%
rename from pybryt/execution.py
rename to pybryt/execution/tracing.py
index 3db27e5..15df2a8 100644
--- a/pybryt/execution.py
+++ b/pybryt/execution/tracing.py
@@ -1,26 +1,17 @@
-"""Submission execution internals for PyBryt"""
+""""""
 
-__all__ = ["tracing_off", "tracing_on"]
-
-import os
 import re
 import linecache
-import dill
 import inspect
-import nbformat
 
-from nbconvert.preprocessors import ExecutePreprocessor
-from copy import copy, deepcopy
-from tempfile import mkstemp
+from copy import copy
 from types import FrameType, FunctionType, ModuleType
-from typing import Any, List, Tuple, Callable, Optional
-from textwrap import dedent
+from typing import Any, List, Tuple, Callable
 
-from .preprocessors import IntermediateVariablePreprocessor
-from .utils import make_secret, pickle_and_hash
+from ..utils import make_secret, pickle_and_hash
 
 
-NBFORMAT_VERSION = 4
+_COLLECTOR_RET = None
 TRACING_VARNAME = "__PYBRYT_TRACING__"
 TRACING_FUNC = None
 
@@ -44,6 +35,7 @@ def create_collector(skip_types: List[type] = [type, type(len), ModuleType, Func
         ``tuple[list[tuple[object, int]], callable[[frame, str, object], callable]]``: the list
         of tuples of observed objects and their timestamps, and the trace function
     """
+    global _COLLECTOR_RET
     observed = []
     vars_not_found = {}
     hashes = set()
@@ -81,10 +73,17 @@ def collect_intermidiate_results(frame: FrameType, event: str, arg: Any):
         """
         Trace function for PyBryt.
         """
+        if frame.f_code.co_filename.startswith("<ipython") or frame.f_code.co_filename in addl_filenames:
+            counter[0] += 1 # increment student code step counter
+
+        # return if tracking is disabled by a compelxity check
+        from .complexity import _TRACKING_DISABLED
+        if _TRACKING_DISABLED:
+            return collect_intermidiate_results
+
         name = frame.f_code.co_filename + frame.f_code.co_name
 
         if frame.f_code.co_filename.startswith("<ipython") or frame.f_code.co_filename in addl_filenames:
-            counter[0] += 1 # increment student code step counter
             if event == "line" or event == "return":
 
                 line = linecache.getline(frame.f_code.co_filename, frame.f_lineno)
@@ -137,23 +136,19 @@ def collect_intermidiate_results(frame: FrameType, event: str, arg: Any):
 
         return collect_intermidiate_results
 
+    _COLLECTOR_RET = (observed, counter, collect_intermidiate_results)
     return observed, collect_intermidiate_results
 
 
-def _currently_tracing():
+def _get_tracing_frame():
     """
-    Determines whether PyBryt is actively tracing the current call stack by looking at the parent
-    frames and determining if ``__PYBRYT_TRACING__`` exists and is ``True`` in any of their globals.
-
-    Returns:
-        ``bool``: if PyBryt is currently tracing
     """
     frame = inspect.currentframe()
     while frame is not None:
         if TRACING_VARNAME in frame.f_globals and frame.f_globals[TRACING_VARNAME]:
-            return True
+            return frame
         frame = frame.f_back
-    return False
+    return None
 
 
 def tracing_off():
@@ -176,9 +171,9 @@ def pow(x, a):
         x3 = pow(x, 3)
     """
     global TRACING_FUNC
-    if not _currently_tracing():
+    frame = _get_tracing_frame()
+    if frame is None:
         return
-    frame = inspect.currentframe().f_back
     TRACING_FUNC = frame.f_trace
     vn = f"sys_{make_secret()}"
     exec(f"import sys as {vn}\n{vn}.settrace(None)", frame.f_globals, frame.f_locals)
@@ -207,78 +202,10 @@ def pow(x, a):
         x4 = pow(x, 4)
     """
     global TRACING_FUNC
-    if not _currently_tracing() or TRACING_FUNC is None:
+    frame = _get_tracing_frame()
+    if frame is None:
         return
-    frame = inspect.currentframe().f_back
     vn = f"cir_{make_secret()}"
     vn2 = f"sys_{make_secret()}"
     frame.f_globals[vn] = TRACING_FUNC
     exec(f"import sys as {vn2}\n{vn2}.settrace({vn})", frame.f_globals, frame.f_locals)
-
-
-def execute_notebook(nb: nbformat.NotebookNode, nb_path: str, addl_filenames: List[str] = [], 
-        output: Optional[str] = None) -> Tuple[int, List[Tuple[Any, int]]]:
-    """
-    Executes a submission using ``nbconvert`` and returns the memory footprint.
-
-    Takes in a notebook object and preprocesses it before running it through the 
-    ``nbconvert.ExecutePreprocessor`` to execute it. The notebook writes the memory footprint, a 
-    list of observed values and their timestamps, to a file, which is loaded using ``dill`` by this
-    function. Errors during execution are ignored, and the executed notebook can be written to a 
-    file using the ``output`` argument.
-
-    Args:
-        nb (``nbformat.NotebookNode``): the notebook to be executed
-        nb_path (``str``): path to the notebook ``nb``
-        addl_filenames (``list[str]``, optional): a list of additional files to trace inside
-        output (``str``, optional): a file path at which to write the executed notebook
-
-    Returns:
-        ``tuple[int, list[tuple[object, int]]]``: the number of execution steps and the memory 
-        footprint
-    """
-    nb = deepcopy(nb)
-    preprocessor = IntermediateVariablePreprocessor()
-    nb = preprocessor.preprocess(nb)
-
-    secret = make_secret()
-    _, observed_fp = mkstemp()
-    nb_dir = os.path.abspath(os.path.split(nb_path)[0])
-
-    first_cell = nbformat.v4.new_code_cell(dedent(f"""\
-        import sys
-        from pybryt.execution import create_collector
-        observed_{secret}, cir = create_collector(addl_filenames={addl_filenames})
-        sys.settrace(cir)
-        {TRACING_VARNAME} = True
-        %cd {nb_dir}
-    """))
-
-    last_cell = nbformat.v4.new_code_cell(dedent(f"""\
-        sys.settrace(None)
-        import dill
-        from pybryt.utils import filter_pickleable_list
-        filter_pickleable_list(observed_{secret})
-        with open("{observed_fp}", "wb+") as f:
-            dill.dump(observed_{secret}, f)
-    """))
-
-    nb['cells'].insert(0, first_cell)
-    nb['cells'].append(last_cell)
-
-    ep = ExecutePreprocessor(timeout=1200, allow_errors=True)
-
-    ep.preprocess(nb)
-
-    if output:
-        with open(output, "w+") as f:
-            nbformat.write(nb, f)
-
-    with open(observed_fp, "rb") as f:
-        observed = dill.load(f)
-
-    os.remove(observed_fp)
-
-    n_steps = max([t[1] for t in observed])
-
-    return n_steps, observed
diff --git a/pybryt/preprocessors/intermediate_variables.py b/pybryt/preprocessors/intermediate_variables.py
index b1f8a5d..4e76e6c 100644
--- a/pybryt/preprocessors/intermediate_variables.py
+++ b/pybryt/preprocessors/intermediate_variables.py
@@ -125,7 +125,7 @@ def transform_unassigned_node(self, node):
                 if isinstance(curr.parent, ast.If):
                     idx = curr.parent.orelse.index(curr)
                     is_else = True
-                else:
+                else: # pragma: no cover
                     raise
 
             curr = curr.parent
diff --git a/pybryt/reference.py b/pybryt/reference.py
index 6e4fb3c..33657ad 100644
--- a/pybryt/reference.py
+++ b/pybryt/reference.py
@@ -212,15 +212,12 @@ def messages(self):
         for r in self.results:
             m = r.messages
             for msg in m:
-                if msg[1] is None:
+                if msg[1] in message_names and not msg[2]:
+                    idx = message_names[msg[1]]
+                    messages[idx] = msg[0]
+                elif msg[1] not in message_names:
+                    message_names[msg[1]] = len(messages)
                     messages.append(msg[0])
-                else:
-                    if msg[1] in message_names and not msg[2]:
-                        idx = message_names[msg[1]]
-                        messages[idx] = msg[0]
-                    elif msg[1] not in message_names:
-                        message_names[msg[1]] = len(messages)
-                        messages.append(msg[0])
         return messages
 
     def to_dict(self) -> Dict[str, Any]:
diff --git a/pybryt/utils.py b/pybryt/utils.py
index 92279f5..faf0508 100644
--- a/pybryt/utils.py
+++ b/pybryt/utils.py
@@ -28,7 +28,7 @@ def pickle_and_hash(obj: Any) -> str:
     return hashlib.sha512(s).hexdigest()
 
 
-def filter_pickleable_list(lst: List[Any]) -> NoReturn:
+def filter_picklable_list(lst: List[Any]) -> NoReturn:
     """
     Removes all elements from a list that cannot be pickled with ``dill``.
 


Test patch:
diff --git a/tests/annotations/test_complexity.py b/tests/annotations/test_complexity.py
new file mode 100644
index 0000000..1d8ede1
--- /dev/null
+++ b/tests/annotations/test_complexity.py
@@ -0,0 +1,87 @@
+""""""
+
+import pytest
+import numpy as np
+
+from pybryt import *
+from pybryt import complexities as cplx
+from pybryt.execution.complexity import TimeComplexityResult
+
+from .utils import check_obj_attributes
+
+
+def generate_complexity_footprint(name, t_transform, max_exp=8):
+    footprint = []
+    for i, e in enumerate(range(1, max_exp + 1)):
+        n = 10 ** e
+        t = t_transform(n)
+        footprint.append((TimeComplexityResult(name, n, 0, t), i))
+    return footprint
+
+
+def test_complexity_abc():
+    """
+    """
+    Annotation.reset_tracked_annotations()
+
+    a = TimeComplexity(cplx.constant, name="foo")
+    check_obj_attributes(a, {
+        "name": "foo",
+        "complexity": cplx.constant,
+    })
+
+    b = TimeComplexity(cplx.constant, name="foo")
+    assert a == b
+
+    b.complexity = cplx.linear
+    assert a != b
+
+    b.name = "bar"
+    assert a != b
+
+    b.complexity = cplx.constant
+    assert a != b
+
+    # test constructor errors
+    with pytest.raises(ValueError, match="Complexity annotations require a 'name' kwarg"):
+        TimeComplexity(cplx.constant)
+
+    with pytest.raises(ValueError, match="Invalid valid for argument 'complexity': 1"):
+        TimeComplexity(1, name="foo")
+
+
+def test_time_complexity():
+    Annotation.reset_tracked_annotations()
+
+    a = TimeComplexity(cplx.constant, name="foo")
+
+    footprint = generate_complexity_footprint("foo", lambda v: 1012)
+    res = a.check(footprint)
+    assert res.satisfied
+    assert res.value == cplx.constant
+
+    footprint.append((np.random.uniform(size=100), 9))
+    footprint.append((TimeComplexityResult("bar", 10, 0, 10 ** 3), 10))
+    res = a.check(footprint)
+    assert res.satisfied
+    assert res.value == cplx.constant
+
+    footprint = generate_complexity_footprint("foo", np.log2)
+    res = a.check(footprint)
+    assert not res.satisfied
+    assert res.value == cplx.logarithmic
+
+    footprint = generate_complexity_footprint("foo", lambda v: v * np.log2(v))
+    res = a.check(footprint)
+    assert not res.satisfied
+    assert res.value == cplx.linearithmic
+
+    a.complexity = cplx.exponential
+    res = a.check(footprint)
+    assert not res.satisfied
+    assert res.value == cplx.linearithmic
+
+
+def test_alias():
+    import pybryt.complexities as cplx2
+    assert cplx.complexity_classes is cplx2.complexity_classes
diff --git a/tests/annotations/test_value.py b/tests/annotations/test_value.py
index 292ed73..e412609 100644
--- a/tests/annotations/test_value.py
+++ b/tests/annotations/test_value.py
@@ -44,7 +44,7 @@ def test_value_annotation():
     res = v.check(mfp)
 
     assert v.to_dict() == {
-        "name": "Annotation 10",
+        "name": "Annotation 11",
         "children": [],
         "success_message": None,
         "failure_message": None,
@@ -77,6 +77,12 @@ def test_value_annotation():
         with pytest.raises(ValueError):
             v = Value(-1)
 
+    # test with invariants
+    s = mfp[-1][0]
+    v = Value(s.upper(), invariants=[invariants.string_capitalization])
+    res = v.check(mfp)
+    assert res.satisfied
+
 
 def test_attribute_annotation():
     """
diff --git a/tests/annotations/utils.py b/tests/annotations/utils.py
index 8e90395..aff15f6 100644
--- a/tests/annotations/utils.py
+++ b/tests/annotations/utils.py
@@ -40,5 +40,6 @@ def generate_memory_footprint():
         None,
         np.random.normal(size=102),
         4.0,
+        "some CasE insenSITIve StrINg!",
     ]
     return [(o, i) for i, o in enumerate(objs)]
diff --git a/tests/execution/__init__.py b/tests/execution/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/execution/test_complexity.py b/tests/execution/test_complexity.py
new file mode 100644
index 0000000..90ab541
--- /dev/null
+++ b/tests/execution/test_complexity.py
@@ -0,0 +1,54 @@
+""""""
+
+import pytest
+import numpy as np
+
+from pybryt import check_time_complexity
+from pybryt.execution import create_collector, TimeComplexityResult
+
+from .utils import generate_mocked_frame
+
+
+def test_time_complexity():
+    def do_work(n, transform):
+        n = int(transform(n))
+        for _ in range(n):
+            2 * 2
+        return n
+
+    observed, cir = create_collector()
+
+    for e in range(1, 9):
+        n = 10 ** e
+        with check_time_complexity("foo", n):
+            do_work(n, lambda v: v)
+
+    assert len(observed) == 8
+    assert all(isinstance(t[0], TimeComplexityResult) for t in observed)
+
+    observed.clear()
+
+    for e in range(1, 9):
+        n = float(10 ** e)
+        with check_time_complexity("foo", n):
+            do_work(n, np.log2)
+
+        n = np.random.uniform(size=int(n))
+        with check_time_complexity("bar", n):
+            do_work(n, len)
+
+    assert len(observed) == 16
+    assert all(isinstance(t[0], TimeComplexityResult) for t in observed)
+    assert [t[0].name for t in observed] == ["foo", "bar"] * 8
+
+    # test error
+    n = lambda v: v
+    with pytest.raises(TypeError, match=f"n has invalid type {type(n)}"):
+        with check_time_complexity("foo", n):
+            pass
+
+    # check that tracking is disabled
+    frame = generate_mocked_frame("<ipython-abc-123>", "bar", 1)
+    with check_time_complexity("foo", 10):
+        cir(frame, "return", 10)
+        assert len(observed) == 16
diff --git a/tests/execution/test_notebook_execution.py b/tests/execution/test_notebook_execution.py
new file mode 100644
index 0000000..1f29a61
--- /dev/null
+++ b/tests/execution/test_notebook_execution.py
@@ -0,0 +1,47 @@
+"""Tests for PyBryt execution internals"""
+
+import re
+import dill
+import pathlib
+import random
+import tempfile
+import nbformat
+import numpy as np
+
+from unittest import mock
+
+from pybryt.execution import execute_notebook
+
+
+def generate_test_notebook():
+    """
+    """
+    nb = nbformat.v4.new_notebook()
+    nb.cells.append(nbformat.v4.new_code_cell(
+        "import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n%matplotlib inline"
+        ))
+    nb.cells.append(nbformat.v4.new_code_cell(
+        "np.random.seed(42)\nx = np.random.uniform(size=1000)\ny = np.random.normal(size=1000)"
+    ))
+    nb.cells.append(nbformat.v4.new_code_cell("df = pd.DataFrame({'x': x, 'y': y})"))
+    return nb
+
+
+def test_notebook_execution():
+    """
+    """
+    random.seed(42)
+    nb = generate_test_notebook()
+
+    observed_fn = str(pathlib.Path(__file__).parent.parent / 'files' / 'expected_observed.pkl')
+    with open(observed_fn, "rb") as f:
+        expected_observed = dill.load(f)
+
+    with tempfile.NamedTemporaryFile("w+") as ntf:
+        with tempfile.NamedTemporaryFile(delete=False) as observed_ntf:
+            with mock.patch("pybryt.execution.mkstemp") as mocked_tempfile:
+                mocked_tempfile.return_value = (None, observed_ntf.name)
+
+                n_steps, observed = execute_notebook(nb, "", output=ntf.name)
+                assert len(ntf.read()) > 0
+                assert n_steps == max(t[1] for t in observed)
diff --git a/tests/test_execution.py b/tests/execution/test_tracing.py
similarity index 66%
rename from tests/test_execution.py
rename to tests/execution/test_tracing.py
index ef98151..7ed9b90 100644
--- a/tests/test_execution.py
+++ b/tests/execution/test_tracing.py
@@ -1,51 +1,18 @@
-"""Tests for PyBryt execution internals"""
-
-import os
-import re
-import dill
-import random
-import tempfile
-import nbformat
+""""""
+
+import sys
+import inspect
 import numpy as np
-import pkg_resources
 
 from unittest import mock
 
-from pybryt.execution import create_collector, execute_notebook, NBFORMAT_VERSION
+from pybryt import *
+from pybryt.execution import create_collector, TRACING_VARNAME
 
-from .utils import AttrDict
+from .utils import generate_mocked_frame
 
 
-def generate_mocked_frame(co_filename, co_name, f_lineno, f_globals={}, f_locals={}, f_back=None):
-    """
-    Factory for generating objects with the instance variables of an ``inspect`` frame that are 
-    needed by PyBryt's trace function.
-    """
-    code = AttrDict({
-        "co_filename": co_filename,
-        "co_name": co_name,
-    })
-    return AttrDict({
-        "f_lineno": f_lineno,
-        "f_globals": f_globals,
-        "f_locals": f_locals,
-        "f_back": f_back,
-        "f_code": code,
-    })
-
-
-def generate_test_notebook():
-    """
-    """
-    nb = nbformat.v4.new_notebook()
-    nb.cells.append(nbformat.v4.new_code_cell(
-        "import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n%matplotlib inline"
-        ))
-    nb.cells.append(nbformat.v4.new_code_cell(
-        "np.random.seed(42)\nx = np.random.uniform(size=1000)\ny = np.random.normal(size=1000)"
-    ))
-    nb.cells.append(nbformat.v4.new_code_cell("df = pd.DataFrame({'x': x, 'y': y})"))
-    return nb
+__PYBRYT_TRACING__ = False
 
 
 def test_trace_function():
@@ -152,21 +119,28 @@ def test_trace_function():
     assert observed[7][1] == 12
 
 
-def test_notebook_execution():
+def test_tracing_control():
     """
     """
-    random.seed(42)
-    nb = generate_test_notebook()
+    global __PYBRYT_TRACING__
+    trace = lambda frame, event, arg: trace
+
+    __PYBRYT_TRACING__ = True
+    with mock.patch("sys.settrace") as mocked_settrace:
+        tracing_off()
+        mocked_settrace.assert_called()
+
+    with mock.patch("sys.settrace") as mocked_settrace:
+        tracing_on()
+        mocked_settrace.assert_called()
 
-    observed_fn = pkg_resources.resource_filename(__name__, os.path.join("files", "expected_observed.pkl"))
-    with open(observed_fn, "rb") as f:
-        expected_observed = dill.load(f)
+    __PYBRYT_TRACING__ = False
+    with mock.patch("sys.settrace") as mocked_settrace:
+        tracing_off()
+        mocked_settrace.assert_not_called()
 
-    with tempfile.NamedTemporaryFile("w+") as ntf:
-        with tempfile.NamedTemporaryFile(delete=False) as observed_ntf:
-            with mock.patch("pybryt.execution.mkstemp") as mocked_tempfile:
-                mocked_tempfile.return_value = (None, observed_ntf.name)
+    with mock.patch("sys.settrace") as mocked_settrace:
+        tracing_on()
+        mocked_settrace.assert_not_called()
 
-                n_steps, observed = execute_notebook(nb, "", output=ntf.name)
-                assert len(ntf.read()) > 0
-                assert n_steps == max(t[1] for t in observed)
+    # assert inspect.currentframe().f_trace is not trace
diff --git a/tests/execution/utils.py b/tests/execution/utils.py
new file mode 100644
index 0000000..29d212c
--- /dev/null
+++ b/tests/execution/utils.py
@@ -0,0 +1,24 @@
+""""""
+
+from ..utils import AttrDict
+
+
+def generate_mocked_frame(
+    co_filename, co_name, f_lineno, f_globals={}, f_locals={}, f_trace=None, f_back=None
+):
+    """
+    Factory for generating objects with the instance variables of an ``inspect`` frame that are 
+    needed by PyBryt's trace function.
+    """
+    code = AttrDict({
+        "co_filename": co_filename,
+        "co_name": co_name,
+    })
+    return AttrDict({
+        "f_lineno": f_lineno,
+        "f_globals": f_globals,
+        "f_locals": f_locals,
+        "f_trace": f_trace,
+        "f_back": f_back,
+        "f_code": code,
+    })
\ No newline at end of file
diff --git a/tests/integrations/test_otter.py b/tests/integrations/test_otter.py
index 9a20265..00f89e0 100644
--- a/tests/integrations/test_otter.py
+++ b/tests/integrations/test_otter.py
@@ -165,5 +165,3 @@ def test_from_notebook(capsys):
             NO REFERENCE SATISFIED
         """)
         assert captured.out == expected
-
-
diff --git a/tests/preprocessors/__init__.py b/tests/preprocessors/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/preprocessors/test_intermediate_variables.py b/tests/preprocessors/test_intermediate_variables.py
new file mode 100644
index 0000000..9c8a9ed
--- /dev/null
+++ b/tests/preprocessors/test_intermediate_variables.py
@@ -0,0 +1,80 @@
+""""""
+
+import random
+import nbformat
+
+from textwrap import dedent
+
+from pybryt.preprocessors import IntermediateVariablePreprocessor
+
+
+def test_preprocessor():
+    """
+    """
+    nb = nbformat.v4.new_notebook()
+    nb.cells.append(nbformat.v4.new_code_cell(dedent("""\
+        a = True
+        b = False
+        f = lambda x: not x
+
+        g = f(a) + f(b)
+
+        if f(a) and f(b):
+            print("hi")
+
+        if f(a) or f(b):
+            print("hi")
+        
+        if a or b:
+            print("bye")
+
+        l = [f(i) for i in [a, b]]
+
+        f = lambda x: [not i for i in l]
+        l = [a, b]
+        if all(f(l)):
+            print("ok")
+        else:
+            l = any(f(l))
+    """)))
+
+    ivp = IntermediateVariablePreprocessor()
+
+    random.seed(42)
+    nb = ivp.preprocess(nb)
+    print(nb.cells[0].source)
+    assert len(nb.cells) == 1
+    assert nb.cells[0].source.strip() == dedent("""\
+        a = True
+        b = False
+        f = (lambda x: (not x))
+        var_HBRPOI = f(a)
+        var_G8F1CB = f(b)
+        g = (var_HBRPOI + var_G8F1CB)
+        var_FNO6B9 = f(a)
+        if (var_FNO6B9):
+            var_M80O2R = f(b)
+        if (var_FNO6B9 and var_M80O2R):
+            var_AK1VRJ = print('hi')
+            var_AK1VRJ
+        var_NVGFYG = f(a)
+        if (not (var_NVGFYG)):
+            var_WWQC38 = f(b)
+        if (var_NVGFYG or var_WWQC38):
+            var_HYF9SX = print('hi')
+            var_HYF9SX
+        if (a or b):
+            var_MECOSF = print('bye')
+            var_MECOSF
+        l = [f(i) for i in [a, b]]
+        f = (lambda x: [(not i) for i in l])
+        l = [a, b]
+        var_KXWNRE = f(l)
+        var_K8PK3Y = all(var_KXWNRE)
+        if var_K8PK3Y:
+            var_R9OUDO = print('ok')
+            var_R9OUDO
+        else:
+            var_CUZREN = f(l)
+            l = any(var_CUZREN)
+    """).strip()
diff --git a/tests/test_utils.py b/tests/test_utils.py
new file mode 100644
index 0000000..8649d68
--- /dev/null
+++ b/tests/test_utils.py
@@ -0,0 +1,84 @@
+""""""
+
+import pytest
+import random
+import tempfile
+
+from textwrap import dedent
+from unittest import mock
+
+from pybryt.utils import *
+
+from .test_reference import generate_reference_notebook
+
+
+def test_filter_picklable_list():
+    """
+    """
+    l = [1, 2, 3]
+    filter_picklable_list(l)
+    assert len(l) == 3
+
+    with mock.patch("dill.dumps") as mocked_dill:
+        mocked_dill.side_effect = Exception()
+        filter_picklable_list(l)
+        assert len(l) == 0
+
+
+def test_notebook_to_string():
+    """
+    """
+    ref = generate_reference_notebook()
+    s = notebook_to_string(ref)
+    assert s.strip() == dedent("""\
+        import pybryt
+
+        def median(S):
+            sorted_S = sorted(S) 
+            pybryt.Value(sorted_S, name="sorted", group="median", limit=5, success_message="SUCCESS: Sorted the sample correctly", 
+                        failure_message="ERROR: The sample was not sorted")
+
+            size_of_set = len(S) 
+            pybryt.Value(size_of_set, name="size", group="median", success_message = "SUCCESS: Computed the size of the sample", 
+                        failure_message="ERROR: Did not capture the size of the set to determine if it is odd or even")
+
+            middle = size_of_set // 2
+            is_set_size_even = (size_of_set % 2) == 0
+
+            if is_set_size_even:
+                return (sorted_S[middle-1] + sorted_S[middle]) / 2
+            else:
+                return sorted_S[middle]
+
+        import numpy as np
+        np.random.seed(42)
+        for _ in range(10):
+            vals = [np.random.randint(-1000, 1000) for _ in range(np.random.randint(1, 1000))]
+            val = median(vals)
+            pybryt.Value(val, name="median", group="median", success_message="SUCCESS: computed the correct median", 
+                failure_message="ERROR: failed to compute the median")
+    """).strip()
+
+    with pytest.raises(TypeError, match="invalid notebook type"):
+        notebook_to_string(1)
+
+
+def test_make_secret():
+    """
+    """
+    random.seed(42)
+    s = make_secret()
+    print(s)
+    assert s == "HBRPOI"
+
+
+def test_save_notebook():
+    """
+    """
+    with mock.patch("pybryt.utils.get_ipython") as mocked_get:
+        with mock.patch("pybryt.utils.publish_display_data") as mocked_pub:
+            mocked_get.return_value = True
+            with tempfile.NamedTemporaryFile(suffix=".ipynb") as ntf:
+                v = save_notebook(ntf.name, timeout=1)
+                mocked_pub.assert_called()
+                assert not v