Design Movie Rental System
<p>You have a movie renting company consisting of <code>n</code> shops. You want to implement a renting system that supports searching for, booking, and returning movies. The system should also support generating a report of the currently rented movies.</p>

<p>Each movie is given as a 2D integer array <code>entries</code> where <code>entries[i] = [shop<sub>i</sub>, movie<sub>i</sub>, price<sub>i</sub>]</code> indicates that there is a copy of movie <code>movie<sub>i</sub></code> at shop <code>shop<sub>i</sub></code> with a rental price of <code>price<sub>i</sub></code>. Each shop carries <strong>at most one</strong> copy of a movie <code>movie<sub>i</sub></code>.</p>

<p>The system should support the following functions:</p>

<ul>
	<li><strong>Search</strong>: Finds the <strong>cheapest 5 shops</strong> that have an <strong>unrented copy</strong> of a given movie. The shops should be sorted by <strong>price</strong> in ascending order, and in case of a tie, the one with the <strong>smaller </strong><code>shop<sub>i</sub></code> should appear first. If there are less than 5 matching shops, then all of them should be returned. If no shop has an unrented copy, then an empty list should be returned.</li>
	<li><strong>Rent</strong>: Rents an <strong>unrented copy</strong> of a given movie from a given shop.</li>
	<li><strong>Drop</strong>: Drops off a <strong>previously rented copy</strong> of a given movie at a given shop.</li>
	<li><strong>Report</strong>: Returns the <strong>cheapest 5 rented movies</strong> (possibly of the same movie ID) as a 2D list <code>res</code> where <code>res[j] = [shop<sub>j</sub>, movie<sub>j</sub>]</code> describes that the <code>j<sup>th</sup></code> cheapest rented movie <code>movie<sub>j</sub></code> was rented from the shop <code>shop<sub>j</sub></code>. The movies in <code>res</code> should be sorted by <strong>price </strong>in ascending order, and in case of a tie, the one with the <strong>smaller </strong><code>shop<sub>j</sub></code> should appear first, and if there is still tie, the one with the <strong>smaller </strong><code>movie<sub>j</sub></code> should appear first. If there are fewer than 5 rented movies, then all of them should be returned. If no movies are currently being rented, then an empty list should be returned.</li>
</ul>

<p>Implement the <code>MovieRentingSystem</code> class:</p>

<ul>
	<li><code>MovieRentingSystem(int n, int[][] entries)</code> Initializes the <code>MovieRentingSystem</code> object with <code>n</code> shops and the movies in <code>entries</code>.</li>
	<li><code>List&lt;Integer&gt; search(int movie)</code> Returns a list of shops that have an <strong>unrented copy</strong> of the given <code>movie</code> as described above.</li>
	<li><code>void rent(int shop, int movie)</code> Rents the given <code>movie</code> from the given <code>shop</code>.</li>
	<li><code>void drop(int shop, int movie)</code> Drops off a previously rented <code>movie</code> at the given <code>shop</code>.</li>
	<li><code>List&lt;List&lt;Integer&gt;&gt; report()</code> Returns a list of cheapest <strong>rented</strong> movies as described above.</li>
</ul>

<p><strong>Note:</strong> The test cases will be generated such that <code>rent</code> will only be called if the shop has an <strong>unrented</strong> copy of the movie, and <code>drop</code> will only be called if the shop had <strong>previously rented</strong> out the movie.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input</strong>
[&quot;MovieRentingSystem&quot;, &quot;search&quot;, &quot;rent&quot;, &quot;rent&quot;, &quot;report&quot;, &quot;drop&quot;, &quot;search&quot;]
[[3, [[0, 1, 5], [0, 2, 6], [0, 3, 7], [1, 1, 4], [1, 2, 7], [2, 1, 5]]], [1], [0, 1], [1, 2], [], [1, 2], [2]]
<strong>Output</strong>
[null, [1, 0, 2], null, null, [[0, 1], [1, 2]], null, [0, 1]]

<strong>Explanation</strong>
MovieRentingSystem movieRentingSystem = new MovieRentingSystem(3, [[0, 1, 5], [0, 2, 6], [0, 3, 7], [1, 1, 4], [1, 2, 7], [2, 1, 5]]);
movieRentingSystem.search(1);  // return [1, 0, 2], Movies of ID 1 are unrented at shops 1, 0, and 2. Shop 1 is cheapest; shop 0 and 2 are the same price, so order by shop number.
movieRentingSystem.rent(0, 1); // Rent movie 1 from shop 0. Unrented movies at shop 0 are now [2,3].
movieRentingSystem.rent(1, 2); // Rent movie 2 from shop 1. Unrented movies at shop 1 are now [1].
movieRentingSystem.report();   // return [[0, 1], [1, 2]]. Movie 1 from shop 0 is cheapest, followed by movie 2 from shop 1.
movieRentingSystem.drop(1, 2); // Drop off movie 2 at shop 1. Unrented movies at shop 1 are now [1,2].
movieRentingSystem.search(2);  // return [0, 1]. Movies of ID 2 are unrented at shops 0 and 1. Shop 0 is cheapest, followed by shop 1.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= n &lt;= 3 * 10<sup>5</sup></code></li>
	<li><code>1 &lt;= entries.length &lt;= 10<sup>5</sup></code></li>
	<li><code>0 &lt;= shop<sub>i</sub> &lt; n</code></li>
	<li><code>1 &lt;= movie<sub>i</sub>, price<sub>i</sub> &lt;= 10<sup>4</sup></code></li>
	<li>Each shop carries <strong>at most one</strong> copy of a movie <code>movie<sub>i</sub></code>.</li>
	<li>At most <code>10<sup>5</sup></code> calls <strong>in total</strong> will be made to <code>search</code>, <code>rent</code>, <code>drop</code> and <code>report</code>.</li>
</ul>

[]
[]
[{"value": "cpp", "text": "C++", "defaultCode": "class MovieRentingSystem {\npublic:\n    MovieRentingSystem(int n, vector<vector<int>>& entries) {\n        \n    }\n    \n    vector<int> search(int movie) {\n        \n    }\n    \n    void rent(int shop, int movie) {\n        \n    }\n    \n    void drop(int shop, int movie) {\n        \n    }\n    \n    vector<vector<int>> report() {\n        \n    }\n};\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * MovieRentingSystem* obj = new MovieRentingSystem(n, entries);\n * vector<int> param_1 = obj->search(movie);\n * obj->rent(shop,movie);\n * obj->drop(shop,movie);\n * vector<vector<int>> param_4 = obj->report();\n */"}, {"value": "java", "text": "Java", "defaultCode": "class MovieRentingSystem {\n\n    public MovieRentingSystem(int n, int[][] entries) {\n        \n    }\n    \n    public List<Integer> search(int movie) {\n        \n    }\n    \n    public void rent(int shop, int movie) {\n        \n    }\n    \n    public void drop(int shop, int movie) {\n        \n    }\n    \n    public List<List<Integer>> report() {\n        \n    }\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * MovieRentingSystem obj = new MovieRentingSystem(n, entries);\n * List<Integer> param_1 = obj.search(movie);\n * obj.rent(shop,movie);\n * obj.drop(shop,movie);\n * List<List<Integer>> param_4 = obj.report();\n */"}, {"value": "python", "text": "Python", "defaultCode": "class MovieRentingSystem(object):\n\n    def __init__(self, n, entries):\n        \"\"\"\n        :type n: int\n        :type entries: List[List[int]]\n        \"\"\"\n        \n\n    def search(self, movie):\n        \"\"\"\n        :type movie: int\n        :rtype: List[int]\n        \"\"\"\n        \n\n    def rent(self, shop, movie):\n        \"\"\"\n        :type shop: int\n        :type movie: int\n        :rtype: None\n        \"\"\"\n        \n\n    def drop(self, shop, movie):\n        \"\"\"\n        :type shop: int\n        :type movie: int\n        :rtype: None\n        \"\"\"\n        \n\n    def report(self):\n        \"\"\"\n        :rtype: List[List[int]]\n        \"\"\"\n        \n\n\n# Your MovieRentingSystem object will be instantiated and called as such:\n# obj = MovieRentingSystem(n, entries)\n# param_1 = obj.search(movie)\n# obj.rent(shop,movie)\n# obj.drop(shop,movie)\n# param_4 = obj.report()"}, {"value": "python3", "text": "Python3", "defaultCode": "class MovieRentingSystem:\n\n    def __init__(self, n: int, entries: List[List[int]]):\n        \n\n    def search(self, movie: int) -> List[int]:\n        \n\n    def rent(self, shop: int, movie: int) -> None:\n        \n\n    def drop(self, shop: int, movie: int) -> None:\n        \n\n    def report(self) -> List[List[int]]:\n        \n\n\n# Your MovieRentingSystem object will be instantiated and called as such:\n# obj = MovieRentingSystem(n, entries)\n# param_1 = obj.search(movie)\n# obj.rent(shop,movie)\n# obj.drop(shop,movie)\n# param_4 = obj.report()"}, {"value": "c", "text": "C", "defaultCode": "\n\n\ntypedef struct {\n    \n} MovieRentingSystem;\n\n\nMovieRentingSystem* movieRentingSystemCreate(int n, int** entries, int entriesSize, int* entriesColSize) {\n    \n}\n\nint* movieRentingSystemSearch(MovieRentingSystem* obj, int movie, int* retSize) {\n    \n}\n\nvoid movieRentingSystemRent(MovieRentingSystem* obj, int shop, int movie) {\n    \n}\n\nvoid movieRentingSystemDrop(MovieRentingSystem* obj, int shop, int movie) {\n    \n}\n\nint** movieRentingSystemReport(MovieRentingSystem* obj, int* retSize, int** retColSize) {\n    \n}\n\nvoid movieRentingSystemFree(MovieRentingSystem* obj) {\n    \n}\n\n/**\n * Your MovieRentingSystem struct will be instantiated and called as such:\n * MovieRentingSystem* obj = movieRentingSystemCreate(n, entries, entriesSize, entriesColSize);\n * int* param_1 = movieRentingSystemSearch(obj, movie, retSize);\n \n * movieRentingSystemRent(obj, shop, movie);\n \n * movieRentingSystemDrop(obj, shop, movie);\n \n * int** param_4 = movieRentingSystemReport(obj, retSize, retColSize);\n \n * movieRentingSystemFree(obj);\n*/"}, {"value": "csharp", "text": "C#", "defaultCode": "public class MovieRentingSystem {\n\n    public MovieRentingSystem(int n, int[][] entries) {\n        \n    }\n    \n    public IList<int> Search(int movie) {\n        \n    }\n    \n    public void Rent(int shop, int movie) {\n        \n    }\n    \n    public void Drop(int shop, int movie) {\n        \n    }\n    \n    public IList<IList<int>> Report() {\n        \n    }\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * MovieRentingSystem obj = new MovieRentingSystem(n, entries);\n * IList<int> param_1 = obj.Search(movie);\n * obj.Rent(shop,movie);\n * obj.Drop(shop,movie);\n * IList<IList<int>> param_4 = obj.Report();\n */"}, {"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number} n\n * @param {number[][]} entries\n */\nvar MovieRentingSystem = function(n, entries) {\n    \n};\n\n/** \n * @param {number} movie\n * @return {number[]}\n */\nMovieRentingSystem.prototype.search = function(movie) {\n    \n};\n\n/** \n * @param {number} shop \n * @param {number} movie\n * @return {void}\n */\nMovieRentingSystem.prototype.rent = function(shop, movie) {\n    \n};\n\n/** \n * @param {number} shop \n * @param {number} movie\n * @return {void}\n */\nMovieRentingSystem.prototype.drop = function(shop, movie) {\n    \n};\n\n/**\n * @return {number[][]}\n */\nMovieRentingSystem.prototype.report = function() {\n    \n};\n\n/** \n * Your MovieRentingSystem object will be instantiated and called as such:\n * var obj = new MovieRentingSystem(n, entries)\n * var param_1 = obj.search(movie)\n * obj.rent(shop,movie)\n * obj.drop(shop,movie)\n * var param_4 = obj.report()\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "class MovieRentingSystem {\n    constructor(n: number, entries: number[][]) {\n        \n    }\n\n    search(movie: number): number[] {\n        \n    }\n\n    rent(shop: number, movie: number): void {\n        \n    }\n\n    drop(shop: number, movie: number): void {\n        \n    }\n\n    report(): number[][] {\n        \n    }\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * var obj = new MovieRentingSystem(n, entries)\n * var param_1 = obj.search(movie)\n * obj.rent(shop,movie)\n * obj.drop(shop,movie)\n * var param_4 = obj.report()\n */"}, {"value": "php", "text": "PHP", "defaultCode": "class MovieRentingSystem {\n    /**\n     * @param Integer $n\n     * @param Integer[][] $entries\n     */\n    function __construct($n, $entries) {\n        \n    }\n  \n    /**\n     * @param Integer $movie\n     * @return Integer[]\n     */\n    function search($movie) {\n        \n    }\n  \n    /**\n     * @param Integer $shop\n     * @param Integer $movie\n     * @return NULL\n     */\n    function rent($shop, $movie) {\n        \n    }\n  \n    /**\n     * @param Integer $shop\n     * @param Integer $movie\n     * @return NULL\n     */\n    function drop($shop, $movie) {\n        \n    }\n  \n    /**\n     * @return Integer[][]\n     */\n    function report() {\n        \n    }\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * $obj = MovieRentingSystem($n, $entries);\n * $ret_1 = $obj->search($movie);\n * $obj->rent($shop, $movie);\n * $obj->drop($shop, $movie);\n * $ret_4 = $obj->report();\n */"}, {"value": "swift", "text": "Swift", "defaultCode": "\nclass MovieRentingSystem {\n\n    init(_ n: Int, _ entries: [[Int]]) {\n        \n    }\n    \n    func search(_ movie: Int) -> [Int] {\n        \n    }\n    \n    func rent(_ shop: Int, _ movie: Int) {\n        \n    }\n    \n    func drop(_ shop: Int, _ movie: Int) {\n        \n    }\n    \n    func report() -> [[Int]] {\n        \n    }\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * let obj = MovieRentingSystem(n, entries)\n * let ret_1: [Int] = obj.search(movie)\n * obj.rent(shop, movie)\n * obj.drop(shop, movie)\n * let ret_4: [[Int]] = obj.report()\n */"}, {"value": "kotlin", "text": "Kotlin", "defaultCode": "class MovieRentingSystem(n: Int, entries: Array<IntArray>) {\n\n    fun search(movie: Int): List<Int> {\n        \n    }\n\n    fun rent(shop: Int, movie: Int) {\n        \n    }\n\n    fun drop(shop: Int, movie: Int) {\n        \n    }\n\n    fun report(): List<List<Int>> {\n        \n    }\n\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * var obj = MovieRentingSystem(n, entries)\n * var param_1 = obj.search(movie)\n * obj.rent(shop,movie)\n * obj.drop(shop,movie)\n * var param_4 = obj.report()\n */"}, {"value": "dart", "text": "Dart", "defaultCode": "class MovieRentingSystem {\n\n  MovieRentingSystem(int n, List<List<int>> entries) {\n    \n  }\n  \n  List<int> search(int movie) {\n    \n  }\n  \n  void rent(int shop, int movie) {\n    \n  }\n  \n  void drop(int shop, int movie) {\n    \n  }\n  \n  List<List<int>> report() {\n    \n  }\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * MovieRentingSystem obj = MovieRentingSystem(n, entries);\n * List<int> param1 = obj.search(movie);\n * obj.rent(shop,movie);\n * obj.drop(shop,movie);\n * List<List<int>> param4 = obj.report();\n */"}, {"value": "golang", "text": "Go", "defaultCode": "type MovieRentingSystem struct {\n    \n}\n\n\nfunc Constructor(n int, entries [][]int) MovieRentingSystem {\n    \n}\n\n\nfunc (this *MovieRentingSystem) Search(movie int) []int {\n    \n}\n\n\nfunc (this *MovieRentingSystem) Rent(shop int, movie int)  {\n    \n}\n\n\nfunc (this *MovieRentingSystem) Drop(shop int, movie int)  {\n    \n}\n\n\nfunc (this *MovieRentingSystem) Report() [][]int {\n    \n}\n\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * obj := Constructor(n, entries);\n * param_1 := obj.Search(movie);\n * obj.Rent(shop,movie);\n * obj.Drop(shop,movie);\n * param_4 := obj.Report();\n */"}, {"value": "ruby", "text": "Ruby", "defaultCode": "class MovieRentingSystem\n\n=begin\n    :type n: Integer\n    :type entries: Integer[][]\n=end\n    def initialize(n, entries)\n        \n    end\n\n\n=begin\n    :type movie: Integer\n    :rtype: Integer[]\n=end\n    def search(movie)\n        \n    end\n\n\n=begin\n    :type shop: Integer\n    :type movie: Integer\n    :rtype: Void\n=end\n    def rent(shop, movie)\n        \n    end\n\n\n=begin\n    :type shop: Integer\n    :type movie: Integer\n    :rtype: Void\n=end\n    def drop(shop, movie)\n        \n    end\n\n\n=begin\n    :rtype: Integer[][]\n=end\n    def report()\n        \n    end\n\n\nend\n\n# Your MovieRentingSystem object will be instantiated and called as such:\n# obj = MovieRentingSystem.new(n, entries)\n# param_1 = obj.search(movie)\n# obj.rent(shop, movie)\n# obj.drop(shop, movie)\n# param_4 = obj.report()"}, {"value": "scala", "text": "Scala", "defaultCode": "class MovieRentingSystem(_n: Int, _entries: Array[Array[Int]]) {\n\n    def search(movie: Int): List[Int] = {\n        \n    }\n\n    def rent(shop: Int, movie: Int): Unit = {\n        \n    }\n\n    def drop(shop: Int, movie: Int): Unit = {\n        \n    }\n\n    def report(): List[List[Int]] = {\n        \n    }\n\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * val obj = new MovieRentingSystem(n, entries)\n * val param_1 = obj.search(movie)\n * obj.rent(shop,movie)\n * obj.drop(shop,movie)\n * val param_4 = obj.report()\n */"}, {"value": "rust", "text": "Rust", "defaultCode": "struct MovieRentingSystem {\n\n}\n\n\n/** \n * `&self` means the method takes an immutable reference.\n * If you need a mutable reference, change it to `&mut self` instead.\n */\nimpl MovieRentingSystem {\n\n    fn new(n: i32, entries: Vec<Vec<i32>>) -> Self {\n        \n    }\n    \n    fn search(&self, movie: i32) -> Vec<i32> {\n        \n    }\n    \n    fn rent(&self, shop: i32, movie: i32) {\n        \n    }\n    \n    fn drop(&self, shop: i32, movie: i32) {\n        \n    }\n    \n    fn report(&self) -> Vec<Vec<i32>> {\n        \n    }\n}\n\n/**\n * Your MovieRentingSystem object will be instantiated and called as such:\n * let obj = MovieRentingSystem::new(n, entries);\n * let ret_1: Vec<i32> = obj.search(movie);\n * obj.rent(shop, movie);\n * obj.drop(shop, movie);\n * let ret_4: Vec<Vec<i32>> = obj.report();\n */"}, {"value": "racket", "text": "Racket", "defaultCode": "(define movie-renting-system%\n  (class object%\n    (super-new)\n    \n    ; n : exact-integer?\n    ; entries : (listof (listof exact-integer?))\n    (init-field\n      n\n      entries)\n    \n    ; search : exact-integer? -> (listof exact-integer?)\n    (define/public (search movie)\n      )\n    ; rent : exact-integer? exact-integer? -> void?\n    (define/public (rent shop movie)\n      )\n    ; drop : exact-integer? exact-integer? -> void?\n    (define/public (drop shop movie)\n      )\n    ; report : -> (listof (listof exact-integer?))\n    (define/public (report)\n      )))\n\n;; Your movie-renting-system% object will be instantiated and called as such:\n;; (define obj (new movie-renting-system% [n n] [entries entries]))\n;; (define param_1 (send obj search movie))\n;; (send obj rent shop movie)\n;; (send obj drop shop movie)\n;; (define param_4 (send obj report))"}, {"value": "erlang", "text": "Erlang", "defaultCode": "-spec movie_renting_system_init_(N :: integer(), Entries :: [[integer()]]) -> any().\nmovie_renting_system_init_(N, Entries) ->\n  .\n\n-spec movie_renting_system_search(Movie :: integer()) -> [integer()].\nmovie_renting_system_search(Movie) ->\n  .\n\n-spec movie_renting_system_rent(Shop :: integer(), Movie :: integer()) -> any().\nmovie_renting_system_rent(Shop, Movie) ->\n  .\n\n-spec movie_renting_system_drop(Shop :: integer(), Movie :: integer()) -> any().\nmovie_renting_system_drop(Shop, Movie) ->\n  .\n\n-spec movie_renting_system_report() -> [[integer()]].\nmovie_renting_system_report() ->\n  .\n\n\n%% Your functions will be called as such:\n%% movie_renting_system_init_(N, Entries),\n%% Param_1 = movie_renting_system_search(Movie),\n%% movie_renting_system_rent(Shop, Movie),\n%% movie_renting_system_drop(Shop, Movie),\n%% Param_4 = movie_renting_system_report(),\n\n%% movie_renting_system_init_ will be called before every test case, in which you can do some necessary initializations."}, {"value": "elixir", "text": "Elixir", "defaultCode": "defmodule MovieRentingSystem do\n  @spec init_(n :: integer, entries :: [[integer]]) :: any\n  def init_(n, entries) do\n    \n  end\n\n  @spec search(movie :: integer) :: [integer]\n  def search(movie) do\n    \n  end\n\n  @spec rent(shop :: integer, movie :: integer) :: any\n  def rent(shop, movie) do\n    \n  end\n\n  @spec drop(shop :: integer, movie :: integer) :: any\n  def drop(shop, movie) do\n    \n  end\n\n  @spec report() :: [[integer]]\n  def report() do\n    \n  end\nend\n\n# Your functions will be called as such:\n# MovieRentingSystem.init_(n, entries)\n# param_1 = MovieRentingSystem.search(movie)\n# MovieRentingSystem.rent(shop, movie)\n# MovieRentingSystem.drop(shop, movie)\n# param_4 = MovieRentingSystem.report()\n\n# MovieRentingSystem.init_ will be called before every test case, in which you can do some necessary initializations."}]
{
  "classname": "MovieRentingSystem",
  "constructor": {
    "params": [
      {
        "type": "integer",
        "name": "n"
      },
      {
        "name": "entries",
        "type": "integer[][]"
      }
    ]
  },
  "methods": [
    {
      "params": [
        {
          "type": "integer",
          "name": "movie"
        }
      ],
      "name": "search",
      "return": {
        "type": "list<integer>"
      }
    },
    {
      "params": [
        {
          "type": "integer",
          "name": "shop"
        },
        {
          "type": "integer",
          "name": "movie"
        }
      ],
      "name": "rent",
      "return": {
        "type": "void"
      }
    },
    {
      "params": [
        {
          "type": "integer",
          "name": "shop"
        },
        {
          "type": "integer",
          "name": "movie"
        }
      ],
      "name": "drop",
      "return": {
        "type": "void"
      }
    },
    {
      "params": [],
      "name": "report",
      "return": {
        "type": "list<list<integer>>"
      }
    }
  ],
  "return": {
    "type": "boolean"
  },
  "systemdesign": true,
  "manual": false
}
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressSanitizer</a> is also enabled to help detect out-of-bounds and use-after-free bugs.</p>\r\n\r\n<p>Most standard library headers are already included automatically for your convenience.</p>"], "java": ["Java", "<p><code>OpenJDK 21</code>. Using compile arguments: <code>--enable-preview --release 21</code></p>\r\n\r\n<p>Most standard library headers are already included automatically for your convenience.</p>\r\n<p>Includes <code>Pair</code> class from https://docs.oracle.com/javase/8/javafx/api/javafx/util/Pair.html.</p>"], "python": ["Python", "<p><code>Python 2.7.18</code>.</p>\r\n\r\n<p>Most libraries are already imported automatically for your convenience, such as <a href=\"https://docs.python.org/2/library/array.html\" target=\"_blank\">array</a>, <a href=\"https://docs.python.org/2/library/bisect.html\" target=\"_blank\">bisect</a>, <a href=\"https://docs.python.org/2/library/collections.html\" target=\"_blank\">collections</a>. If you need more libraries, you can import it yourself.</p>\r\n\r\n<p>For Map/TreeMap data structure, you may use <a href=\"http://www.grantjenks.com/docs/sortedcontainers/\" target=\"_blank\">sortedcontainers</a> library.</p>\r\n\r\n<p>Note that Python 2.7 <a href=\"https://www.python.org/dev/peps/pep-0373/\" target=\"_blank\">is not maintained anymore</a>. For the latest Python, please choose Python3 instead.</p>"], "c": ["C", "<p>Compiled with <code>gcc 14</code> using the gnu11 standard.</p>\r\n\r\n<p>Your code is compiled with level one optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressSanitizer</a> is also enabled to help detect out-of-bounds and use-after-free bugs.</p>\r\n\r\n<p>Most standard library headers are already included automatically for your convenience.</p>\r\n\r\n<p>For hash table operations, you may use <a href=\"https://troydhanson.github.io/uthash/\" target=\"_blank\">uthash</a>. \"uthash.h\" is included by default. Below are some examples:</p>\r\n\r\n<p><b>1. Adding an item to a hash.</b>\r\n<pre>\r\nstruct hash_entry {\r\n    int id;            /* we'll use this field as the key */\r\n    char name[10];\r\n    UT_hash_handle hh; /* makes this structure hashable */\r\n};\r\n\r\nstruct hash_entry *users = NULL;\r\n\r\nvoid add_user(struct hash_entry *s) {\r\n    HASH_ADD_INT(users, id, s);\r\n}\r\n</pre>\r\n</p>\r\n\r\n<p><b>2. Looking up an item in a hash:</b>\r\n<pre>\r\nstruct hash_entry *find_user(int user_id) {\r\n    struct hash_entry *s;\r\n    HASH_FIND_INT(users, &user_id, s);\r\n    return s;\r\n}\r\n</pre>\r\n</p>\r\n\r\n<p><b>3. Deleting an item in a hash:</b>\r\n<pre>\r\nvoid delete_user(struct hash_entry *user) {\r\n    HASH_DEL(users, user);  \r\n}\r\n</pre>\r\n</p>"], "csharp": ["C#", "<p><a href=\"https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-13\" target=\"_blank\">C# 13</a> with .NET 9 runtime</p>"], "javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p>\r\n\r\n<p>For Priority Queue / Queue data structures, you may use 6.3.2 version of <a href=\"https://github.com/datastructures-js/priority-queue/tree/v6.3.2\" target=\"_blank\">datastructures-js/priority-queue</a> and 4.2.3 version of <a href=\"https://github.com/datastructures-js/queue/tree/v4.2.3\" target=\"_blank\">datastructures-js/queue</a> and 1.0.4 version of <a href=\"https://github.com/datastructures-js/deque/tree/v1.0.4\" target=\"_blank\">datastructures-js/deque</a>.</p>"], "ruby": ["Ruby", "<p><code>Ruby 3.2</code></p>\r\n\r\n<p>Some common data structure implementations are provided in the Algorithms module: https://www.rubydoc.info/github/kanwei/algorithms/Algorithms</p>"], "swift": ["Swift", "<p><code>Swift 6.0</code>.</p>\r\n\r\n<p>You may use the following packages:<br/>\r\n<a href=\"https://github.com/apple/swift-algorithms/tree/1.2.0\" target=\"_blank\">swift-algorithms 1.2.0</a><br/>\r\n<a href=\"https://github.com/apple/swift-collections/tree/1.1.4\" target=\"_blank\">swift-collections 1.1.4</a><br/>\r\n<a href=\"https://github.com/apple/swift-numerics/tree/1.0.2\" target=\"_blank\">swift-numerics 1.0.2</a></p>"], "golang": ["Go", "<p><code>Go 1.23</code></p>\r\n<p>Support <a href=\"https://pkg.go.dev/github.com/emirpasic/gods@v1.18.1\" target=\"_blank\">https://pkg.go.dev/github.com/emirpasic/gods@v1.18.1</a> and <a href=\"https://pkg.go.dev/github.com/emirpasic/gods/v2@v2.0.0-alpha\" target=\"_blank\">https://pkg.go.dev/github.com/emirpasic/gods/v2@v2.0.0-alpha</a> library.</p>"], "python3": ["Python3", "<p><code>Python 3.11</code>.</p>\r\n\r\n<p>Most libraries are already imported automatically for your convenience, such as <a href=\"https://docs.python.org/3/library/array.html\" target=\"_blank\">array</a>, <a href=\"https://docs.python.org/3/library/bisect.html\" target=\"_blank\">bisect</a>, <a href=\"https://docs.python.org/3/library/collections.html\" target=\"_blank\">collections</a>. If you need more libraries, you can import it yourself.</p>\r\n\r\n<p>For Map/TreeMap data structure, you may use <a href=\"http://www.grantjenks.com/docs/sortedcontainers/\" target=\"_blank\">sortedcontainers</a> library.</p>"], "scala": ["Scala", "<p><code>Scala 3.3.1</code>.</p>"], "kotlin": ["Kotlin", "<p><code>Kotlin 2.1.10</code>.</p>"], "rust": ["Rust", "<p><code>Rust 1.85.0</code>. Your code will be compiled with <code>opt-level</code> 2.</p>\r\n\r\n<p>Supports <a href=\"https://crates.io/crates/rand\" target=\"_blank\">rand v0.8</a> and <a href=\"https://crates.io/crates/regex\" target=\"_blank\">regex\u00a0v1</a> and <a href=\"https://crates.io/crates/itertools\" target=\"_blank\">itertools\u00a0v0.14</a> from crates.io</p>"], "php": ["PHP", "<p><code>PHP 8.2</code>.</p>\r\n<p>With bcmath module</p>"], "typescript": ["Typescript", "<p><code>TypeScript 5.7.3, Node.js 22.14.0</code>.</p>\r\n\r\n<p>Compile Options: <code>--alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2024</code></p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p>\r\n\r\n<p>For Priority Queue / Queue data structures, you may use 6.3.2 version of <a href=\"https://github.com/datastructures-js/priority-queue/tree/v6.3.2\" target=\"_blank\">datastructures-js/priority-queue</a> and 4.2.3 version of <a href=\"https://github.com/datastructures-js/queue/tree/v4.2.3\" target=\"_blank\">datastructures-js/queue</a> and 1.0.4 version of <a href=\"https://github.com/datastructures-js/deque/tree/v1.0.4\" target=\"_blank\">datastructures-js/deque</a>.</p>"], "racket": ["Racket", "<p><a href=\"https://docs.racket-lang.org/guide/performance.html#%28tech._c%29\" target=\"_blank\">Racket CS</a> v8.15</p>\r\n\r\n<p>Using <code>#lang racket</code></p>\r\n\r\n<p>Required <code>data/gvector data/queue data/order data/heap</code> automatically for your convenience</p>"], "erlang": ["Erlang", "Erlang/OTP 26"], "elixir": ["Elixir", "Elixir 1.17 with Erlang/OTP 26"], "dart": ["Dart", "<p>Dart 3.2. You may use package <a href=\"https://pub.dev/packages/collection/versions/1.18.0\" target=\"_blank\">collection</a></p>\r\n\r\n<p>Your code will be run directly without compiling</p>"]}
['Array', 'Hash Table', 'Design', 'Heap (Priority Queue)', 'Ordered Set']