# migrations

dir: embeddings_queue
filename: 00001-embeddings.sqlite.sql
hash: d3755dfd232be8e8301f4d7fcfb3a486
sql:
CREATE TABLE embeddings_queue (
    seq_id INTEGER PRIMARY KEY,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    operation INTEGER NOT NULL,
    topic TEXT NOT NULL,
    id TEXT NOT NULL,
    vector BLOB,
    encoding TEXT,
    metadata TEXT
);


dir: sysdb
filename: 00001-collections.sqlite.sql
hash: 38352d725ad1c16074fac420b22b4633
sql:
CREATE TABLE collections (
    id TEXT PRIMARY KEY,
    name TEXT NOT NULL,
    topic TEXT NOT NULL,
    UNIQUE (name)
);

CREATE TABLE collection_metadata (
    collection_id TEXT REFERENCES collections(id) ON DELETE CASCADE,
    key TEXT NOT NULL,
    str_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (collection_id, key)
);


dir: sysdb
filename: 00002-segments.sqlite.sql
hash: 2913cb6a503055a95f625448037e8912
sql:
CREATE TABLE segments (
    id TEXT PRIMARY KEY,
    type TEXT NOT NULL,
    scope TEXT NOT NULL,
    topic TEXT,
    collection TEXT REFERENCES collection(id)
);

CREATE TABLE segment_metadata (
    segment_id TEXT  REFERENCES segments(id) ON DELETE CASCADE,
    key TEXT NOT NULL,
    str_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (segment_id, key)
);


dir: sysdb
filename: 00004-tenants-databases.sqlite.sql
hash: 048867ce8fcdefe4023c7110e4433591
sql:
CREATE TABLE IF NOT EXISTS tenants (
    id TEXT PRIMARY KEY,
    UNIQUE (id)
);

CREATE TABLE IF NOT EXISTS databases (
    id TEXT PRIMARY KEY, -- unique globally
    name TEXT NOT NULL, -- unique per tenant
    tenant_id TEXT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
    UNIQUE (tenant_id, name) -- Ensure that a tenant has only one database with a given name
);

CREATE TABLE IF NOT EXISTS collections_tmp (
    id TEXT PRIMARY KEY, -- unique globally
    name TEXT NOT NULL, -- unique per database
    topic TEXT NOT NULL,
    dimension INTEGER,
    database_id TEXT NOT NULL REFERENCES databases(id) ON DELETE CASCADE,
    UNIQUE (name, database_id)
);

-- Create default tenant and database
INSERT OR REPLACE INTO tenants (id) VALUES ('default_tenant'); -- The default tenant id is 'default_tenant' others are UUIDs
INSERT OR REPLACE INTO databases (id, name, tenant_id) VALUES ('00000000-0000-0000-0000-000000000000', 'default_database', 'default_tenant');

INSERT OR REPLACE INTO collections_tmp (id, name, topic, dimension, database_id)
    SELECT id, name, topic, dimension, '00000000-0000-0000-0000-000000000000' FROM collections;
DROP TABLE collections;
ALTER TABLE collections_tmp RENAME TO collections;


dir: sysdb
filename: 00005-remove-topic.sqlite.sql
hash: b1367c826b8fba5f96f27befdc1d42d2
sql:
-- Remove the topic column from the Collections and Segments tables

ALTER TABLE collections DROP COLUMN topic;
ALTER TABLE segments DROP COLUMN topic;


dir: sysdb
filename: 00006-collection-segment-metadata.sqlite.sql
hash: 4eea7468935bf25d4604a0fed2366116
sql:
-- SQLite does not support adding check with alter table, as a result, adding a check
-- involve creating a new table and copying the data over. It is over kill with adding
-- a boolean type column. The application write to the table needs to ensure the data
-- integrity.
ALTER TABLE collection_metadata ADD COLUMN bool_value INTEGER;
ALTER TABLE segment_metadata ADD COLUMN bool_value INTEGER;


dir: sysdb
filename: 00007-collection-config.sqlite.sql
hash: 1c7e63bba346a42a18b6ab7f1c989bed
sql:
-- Stores collection configuration dictionaries.
ALTER TABLE collections ADD COLUMN config_json_str TEXT;


dir: metadb
filename: 00001-embedding-metadata.sqlite.sql
hash: 2b4cf52c4bb2676e21d6860a4409f856
sql:
CREATE TABLE embeddings (
    id INTEGER PRIMARY KEY,
    segment_id TEXT NOT NULL,
    embedding_id TEXT NOT NULL,
    seq_id BLOB NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UNIQUE (segment_id, embedding_id)
);

CREATE TABLE embedding_metadata (
    id INTEGER REFERENCES embeddings(id),
    key TEXT NOT NULL,
    string_value TEXT,
    int_value INTEGER,
    float_value REAL,
    PRIMARY KEY (id, key)
);

CREATE TABLE max_seq_id (
    segment_id TEXT PRIMARY KEY,
    seq_id BLOB NOT NULL
);

CREATE VIRTUAL TABLE embedding_fulltext USING fts5(id, string_value);


dir: metadb
filename: 00002-embedding-metadata.sqlite.sql
hash: 12a570f7121b3a8ce750a2a7c36da20f
sql:
-- SQLite does not support adding check with alter table, as a result, adding a check
-- involve creating a new table and copying the data over. It is over kill with adding
-- a boolean type column. The application write to the table needs to ensure the data
-- integrity.
ALTER TABLE embedding_metadata ADD COLUMN bool_value INTEGER


dir: metadb
filename: 00003-full-text-tokenize.sqlite.sql
hash: f97ad6334aeaa8f419f01110b648b97a
sql:
CREATE VIRTUAL TABLE embedding_fulltext_search USING fts5(string_value, tokenize='trigram');
INSERT INTO embedding_fulltext_search (rowid, string_value) SELECT rowid, string_value FROM embedding_metadata;
DROP TABLE embedding_fulltext;


# embeddings_queue

created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 99e546f5-cb00-4618-a74e-2a206c9bc3ea
encoding: FLOAT32
metadata:
{"solution": "def sum_squares_of_even(nums:list):\n    return sum(map(lambda x: x**2, filter(lambda x: x%2==0, nums)))", "question_template": "def sum_squares_of_even(nums:list):\n    pass", "function_name": "sum_squares_of_even", "tags": "numeric,map,aggregation,filtering", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(sum_squares_of_even([1,2,3,4,5])))\", \"output\": \"20\"}, {\"input\": \"print(repr(sum_squares_of_even([2,4,6,8])))\", \"output\": \"120\"}, {\"input\": \"print(repr(sum_squares_of_even([1,3,5,7])))\", \"output\": \"0\"}, {\"input\": \"print(repr(sum_squares_of_even([10,20,30,40])))\", \"output\": \"3000\"}, {\"input\": \"print(repr(sum_squares_of_even([])))\", \"output\": \"0\"}]", "chroma:document": "Find the sum of the squares of the even numbers in a list"}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: ea4da0aa-b7f8-4fcc-9f9f-06d02008a2ca
encoding: FLOAT32
metadata:
{"solution": "def row_with_max_zeros(matrix:list[list[int]])->int:\n    return max(range(len(matrix)), key= lambda x: matrix[x].count(0))", "question_template": "def row_with_max_zeros(matrix:list[list[int]])->int:\n    pass", "function_name": "row_with_max_zeros", "tags": "matrix,count,max,index", "input_type": "code", "data_formats": "int,list[list]", "testcases": "[{\"input\": \"print(repr(row_with_max_zeros([[0, 0, 1], [1, 1, 1], [0, 0, 0]])))\", \"output\": \"2\"}, {\"input\": \"print(repr(row_with_max_zeros([[1, 1, 1], [0, 0, 0], [1, 1, 1]])))\", \"output\": \"1\"}, {\"input\": \"print(repr(row_with_max_zeros([[0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]])))\", \"output\": \"0\"}, {\"input\": \"print(repr(row_with_max_zeros([[1, 0, 1], [1, 0, 1], [1, 0, 1]])))\", \"output\": \"0\"}, {\"input\": \"print(repr(row_with_max_zeros([[0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0]])))\", \"output\": \"0\"}]", "chroma:document": "Find the index of the row with the maximum number of zeros in it."}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 2ac7819d-7a27-4e91-bd65-e40218d53f24
encoding: FLOAT32
metadata:
{"solution": "def filter_strings_with_vowels(strings:list[str])->list[str]:\n    return list(filter(lambda x: not any(c in 'aeiou' for c in x.lower()), strings))", "question_template": "def filter_strings_with_vowels(strings:list[str])->list[str]:\n    pass", "function_name": "filter_strings_with_vowels", "tags": "filter,vowels,strings", "input_type": "code", "data_formats": "str,list", "testcases": "[{\"input\": \"print(repr(filter_strings_with_vowels(['hello', 'world', 'bcd', 'aeiou'])))\", \"output\": \"['bcd']\"}, {\"input\": \"print(repr(filter_strings_with_vowels(['abc', 'xyz', 'pqr', 'mno'])))\", \"output\": \"['xyz', 'pqr']\"}, {\"input\": \"print(repr(filter_strings_with_vowels(['a', 'b', 'c', 'd', 'e'])))\", \"output\": \"['b', 'c', 'd']\"}, {\"input\": \"print(repr(filter_strings_with_vowels(['apple', 'boy', 'cat', 'dog', 'elephant'])))\", \"output\": \"[]\"}, {\"input\": \"print(repr(filter_strings_with_vowels(['x', 'y', 'z'])))\", \"output\": \"['x', 'y', 'z']\"}]", "chroma:document": "Given a list of strings, filter out the strings that contain vowels."}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 663e61ae-9a7f-4029-9bae-eb93c390bd2b
encoding: FLOAT32
metadata:
{"solution": "def max_sublist_sum(lst:list[int]):\n    return max(sum(lst[i: j]) for i in range(len(lst)) for j in range(i + 1, len(lst) + 1))", "question_template": "def max_sublist_sum(lst:list[int]):\n    pass", "function_name": "max_sublist_sum", "tags": "numeric,sublist,max", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(max_sublist_sum([-2, -3, 4, -1, -2, 1, 5, -3])))\", \"output\": \"7\"}, {\"input\": \"print(repr(max_sublist_sum([1, -2, 3, 10, -4, 7, 2, -5])))\", \"output\": \"18\"}, {\"input\": \"print(repr(max_sublist_sum([-1, -2, -3, -4, -5])))\", \"output\": \"-1\"}, {\"input\": \"print(repr(max_sublist_sum([1, 2, 3, 4, 5])))\", \"output\": \"15\"}, {\"input\": \"print(repr(max_sublist_sum([0, 0, 0, 0, 0])))\", \"output\": \"0\"}]", "chroma:document": "Find the maximum sum of a sub-list in a list."}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 908cafb1-c5cc-4765-8f4a-dbecc27e9203
encoding: FLOAT32
metadata:
{"solution": "def max_value_key(d:dict[str,int])->str:\n    return max(d, key=d.get)", "question_template": "def max_value_key(d:dict[str,int])->str:\n    pass", "function_name": "max_value_key", "tags": "dict,max", "input_type": "code", "data_formats": "dict,str,int", "testcases": "[{\"input\": \"print(repr(max_value_key({'a': 1, 'b': 2, 'c': 3})))\", \"output\": \"'c'\"}, {\"input\": \"print(repr(max_value_key({'x': 10, 'y': 20, 'z': 30})))\", \"output\": \"'z'\"}, {\"input\": \"print(repr(max_value_key({'p': 5, 'q': 10, 'r': 15})))\", \"output\": \"'r'\"}, {\"input\": \"print(repr(max_value_key({'one': 1, 'two': 2, 'three': 3})))\", \"output\": \"'three'\"}, {\"input\": \"print(repr(max_value_key({'apple': 10, 'banana': 20, 'cherry': 30})))\", \"output\": \"'cherry'\"}]", "chroma:document": "Given a dictionary, find the key with the maximum value."}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: fc49a5ce-5142-40fe-8785-3a48e530c79c
encoding: FLOAT32
metadata:
{"solution": "def count_words(sentence:str)->dict[str,int]:\n    return {word: sentence.count(word) for word in sentence.split()}", "question_template": "def count_words(sentence:str)->dict[str,int]:\n    pass", "function_name": "count_words", "tags": "string,count,dict", "input_type": "code", "data_formats": "str,dict", "testcases": "[{\"input\": \"print(repr(count_words('hello world hello'))) \", \"output\": \"{'hello': 2, 'world': 1}\"}, {\"input\": \"print(repr(count_words('apple apple apple'))) \", \"output\": \"{'apple': 3}\"}, {\"input\": \"print(repr(count_words('a b c d e f g'))) \", \"output\": \"{'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1}\"}, {\"input\": \"print(repr(count_words('hello world hello world'))) \", \"output\": \"{'hello': 2, 'world': 2}\"}, {\"input\": \"print(repr(count_words('a b c d e f g h i j k l m n o p q r s t u v w x y z'))) \", \"output\": \"{'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1, 'h': 1, 'i': 1, 'j': 1, 'k': 1, 'l': 1, 'm': 1, 'n': 1, 'o': 1, 'p': 1, 'q': 1, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 1, 'w': 1, 'x': 1, 'y': 1, 'z': 1}\"}]", "chroma:document": "Find the count of each word in a string."}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: bc6b581b-cde7-49ec-bfb5-135fc6aa888c
encoding: FLOAT32
metadata:
{"solution": "def sum_diagonal_elements(matrix:list[list[int]])->int:\n    return sum(matrix[i][i] for i in range(len(matrix)))", "question_template": "def sum_diagonal_elements(matrix:list[list[int]])->int:\n    pass", "function_name": "sum_diagonal_elements", "tags": "matrix,diagonal,sum", "input_type": "code", "data_formats": "int,list[list]", "testcases": "[{\"input\": \"print(repr(sum_diagonal_elements([[1, 2, 3], [4, 5, 6], [7, 8, 9]])))\", \"output\": \"15\"}, {\"input\": \"print(repr(sum_diagonal_elements([[5, 5, 5], [5, 5, 5], [5, 5, 5]])))\", \"output\": \"15\"}, {\"input\": \"print(repr(sum_diagonal_elements([[1, 1], [1, 1]])))\", \"output\": \"2\"}, {\"input\": \"print(repr(sum_diagonal_elements([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]])))\", \"output\": \"34\"}, {\"input\": \"print(repr(sum_diagonal_elements([[0, 0, 0], [0, 0, 0], [0, 0, 0]])))\", \"output\": \"0\"}]", "chroma:document": "Given a matrix, find the sum of its diagonal elements."}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: eee62530-c74d-4ccc-afe5-80e26801e1d5
encoding: FLOAT32
metadata:
{"solution": "def max_len_string(strings:list[str])->int:\n    return max(len(s) for s in strings)", "question_template": "def max_len_string(strings:list[str])->int:\n    pass", "function_name": "max_len_string", "tags": "string,max", "input_type": "code", "data_formats": "str,list", "testcases": "[{\"input\": \"print(repr(max_len_string(['apple', 'banana', 'cherry'])))\", \"output\": \"6\"}, {\"input\": \"print(repr(max_len_string(['hello', 'world'])))\", \"output\": \"5\"}, {\"input\": \"print(repr(max_len_string(['a', 'bb', 'ccc'])))\", \"output\": \"3\"}, {\"input\": \"print(repr(max_len_string(['python', 'is', 'fun'])))\", \"output\": \"6\"}, {\"input\": \"print(repr(max_len_string(['short', 'longer', 'longest'])))\", \"output\": \"7\"}]", "chroma:document": "Find the maximum length of a string in a list."}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 4b3a57fe-b245-4eb6-8f38-2a4175bee512
encoding: FLOAT32
metadata:
{"solution": "def filter_dict_values(d:dict[str,int], threshold:int)->dict[str,int]:\n    return {k: v for k, v in d.items() if v >= threshold}", "question_template": "def filter_dict_values(d:dict[str,int], threshold:int)->dict[str,int]:\n    pass", "function_name": "filter_dict_values", "tags": "dict,filter", "input_type": "code", "data_formats": "dict,str,int", "testcases": "[{\"input\": \"print(repr(filter_dict_values({'a': 1, 'b': 2, 'c': 3}, 2)))\", \"output\": \"{'b': 2, 'c': 3}\"}, {\"input\": \"print(repr(filter_dict_values({'x': 10, 'y': 20, 'z': 30}, 25)))\", \"output\": \"{'z': 30}\"}, {\"input\": \"print(repr(filter_dict_values({'p': 5, 'q': 5, 'r': 5}, 6)))\", \"output\": \"{}\"}, {\"input\": \"print(repr(filter_dict_values({'m': 10, 'n': 20, 'o': 30}, 15)))\", \"output\": \"{'n': 20, 'o': 30}\"}, {\"input\": \"print(repr(filter_dict_values({'k': 100, 'l': 200, 'm': 300}, 150)))\", \"output\": \"{'l': 200, 'm': 300}\"}]", "chroma:document": "Given a dictionary, filter out the keys with values less than a certain threshold."}


created_at: 2024-09-14 16:06:50
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: be0c7f50-5412-44bc-968c-bc23844112e7
encoding: FLOAT32
metadata:
{"solution": "def find_target_index(lst:list[int], target:int)->int:\n    return next((i for i, x in enumerate(lst) if x == target), None)", "question_template": "def find_target_index(lst:list[int], target:int)->int:\n    pass", "function_name": "find_target_index", "tags": "index,target", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(find_target_index([1, 2, 3, 4, 5], 3)))\", \"output\": \"2\"}, {\"input\": \"print(repr(find_target_index([10, 20, 30, 40, 50], 40)))\", \"output\": \"3\"}, {\"input\": \"print(repr(find_target_index([1, 2, 3, 4, 5], 6)))\", \"output\": \"None\"}, {\"input\": \"print(repr(find_target_index([5, 5, 5, 5, 5], 5)))\", \"output\": \"0\"}, {\"input\": \"print(repr(find_target_index([1, 2, 3, 4, 5], 1)))\", \"output\": \"0\"}]", "chroma:document": "Find the index of the first occurrence of a target element in a list."}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 66b47555-1fdc-4b98-9ea0-3ef506019a4b
encoding: FLOAT32
metadata:
{"solution": "def sum_squares_of_evens(nums:list):\n    return sum(i**2 for i in nums if i % 2 == 0)", "question_template": "def sum_squares_of_evens(nums:list):\n    pass", "function_name": "sum_squares_of_evens", "tags": "numeric,aggregation,filtering", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(sum_squares_of_evens([1,2,3,4,5,6])))\", \"output\": \"56\"}, {\"input\": \"print(repr(sum_squares_of_evens([2,4,6,8,10])))\", \"output\": \"220\"}, {\"input\": \"print(repr(sum_squares_of_evens([1,3,5,7,9])))\", \"output\": \"0\"}, {\"input\": \"print(repr(sum_squares_of_evens([])))\", \"output\": \"0\"}, {\"input\": \"print(repr(sum_squares_of_evens([2,4,6,8,10,12])))\", \"output\": \"364\"}]", "chroma:document": "Find the sum of the squares of all the even numbers in a list"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: aa526323-ded5-4373-b902-713ac41f1b43
encoding: FLOAT32
metadata:
{"solution": "def max_in_matrices(matrix:list[list[int]])->int:\n    return max(max(row) for row in matrix)", "question_template": "def max_in_matrices(matrix:list[list[int]])->int:\n    pass", "function_name": "max_in_matrices", "tags": "matrix,max", "input_type": "code", "data_formats": "int,list[list]", "testcases": "[{\"input\": \"print(repr(max_in_matrices([[1, 2, 3], [4, 5, 6]])))\", \"output\": \"6\"}, {\"input\": \"print(repr(max_in_matrices([[10, 20, 30], [40, 50, 60]])))\", \"output\": \"60\"}, {\"input\": \"print(repr(max_in_matrices([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]])))\", \"output\": \"12\"}, {\"input\": \"print(repr(max_in_matrices([[100, 200, 300], [400, 500, 600], [700, 800, 900]])))\", \"output\": \"900\"}, {\"input\": \"print(repr(max_in_matrices([[1, 1, 1], [1, 1, 1], [1, 1, 1]])))\", \"output\": \"1\"}]", "chroma:document": "Find the maximum value in a list of lists"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: b172cd4f-d1b1-47a5-952e-389a1aafcdc1
encoding: FLOAT32
metadata:
{"solution": "def max_count_a(strings:list[str])->str:\n    return max(strings, key=lambda x: x.count('a'))", "question_template": "def max_count_a(strings:list[str])->str:\n    pass", "function_name": "max_count_a", "tags": "count,max", "input_type": "code", "data_formats": "str,list", "testcases": "[{\"input\": \"print(repr(max_count_a(['apple', 'banana', 'apricot'])))\", \"output\": \"'banana'\"}, {\"input\": \"print(repr(max_count_a(['ant', 'aardvark', 'apple'])))\", \"output\": \"'aardvark'\"}, {\"input\": \"print(repr(max_count_a(['abc', 'def', 'ghi'])))\", \"output\": \"'abc'\"}, {\"input\": \"print(repr(max_count_a(['a', 'aa', 'aaa'])))\", \"output\": \"'aaa'\"}, {\"input\": \"print(repr(max_count_a(['b', 'c', 'd'])))\", \"output\": \"'b'\"}]", "chroma:document": "Given a list of strings, find the string with the maximum count of 'a'"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: b2bdc195-b74d-454a-b4ed-b0990c1a391a
encoding: FLOAT32
metadata:
{"solution": "def index_of_max(nums:list[int])->int:\n    return nums.index(max(nums))", "question_template": "def index_of_max(nums:list[int])->int:\n    pass", "function_name": "index_of_max", "tags": "index,max", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(index_of_max([1, 2, 3, 4, 5])))\", \"output\": \"4\"}, {\"input\": \"print(repr(index_of_max([5, 4, 3, 2, 1])))\", \"output\": \"0\"}, {\"input\": \"print(repr(index_of_max([10, 20, 30, 40, 50])))\", \"output\": \"4\"}, {\"input\": \"print(repr(index_of_max([1, 1, 1, 1, 1])))\", \"output\": \"0\"}, {\"input\": \"print(repr(index_of_max([-5, -4, -3, -2, -1])))\", \"output\": \"4\"}]", "chroma:document": "Find the index of the first occurrence of the maximum value in a list"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 3b6ef0fb-f67d-4945-8ef6-a62f9619bdcd
encoding: FLOAT32
metadata:
{"solution": "def count_words(sentence:str)->int:\n    return len(sentence.split())", "question_template": "def count_words(sentence:str)->int:\n    pass", "function_name": "count_words", "tags": "count,split", "input_type": "code", "data_formats": "str", "testcases": "[{\"input\": \"print(repr(count_words('Hello World')))\", \"output\": \"2\"}, {\"input\": \"print(repr(count_words('This is a test')))\", \"output\": \"4\"}, {\"input\": \"print(repr(count_words('Single word')))\", \"output\": \"2\"}, {\"input\": \"print(repr(count_words('')))\", \"output\": \"0\"}, {\"input\": \"print(repr(count_words('Multiple   spaces   between   words')))\", \"output\": \"4\"}]", "chroma:document": "Given a string, find the count of words"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: b2d8e090-f5b2-43e1-9c98-a3647316da81
encoding: FLOAT32
metadata:
{"solution": "def sum_of_digits(num:int)->int:\n    return sum(int(digit) for digit in str(num))", "question_template": "def sum_of_digits(num:int)->int:\n    pass", "function_name": "sum_of_digits", "tags": "numeric,aggregation", "input_type": "code", "data_formats": "int", "testcases": "[{\"input\": \"print(repr(sum_of_digits(123)))\", \"output\": \"6\"}, {\"input\": \"print(repr(sum_of_digits(456)))\", \"output\": \"15\"}, {\"input\": \"print(repr(sum_of_digits(789)))\", \"output\": \"24\"}, {\"input\": \"print(repr(sum_of_digits(100)))\", \"output\": \"1\"}, {\"input\": \"print(repr(sum_of_digits(111)))\", \"output\": \"3\"}]", "chroma:document": "Find the sum of the digits of a number"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 2b729013-b613-43b1-a71d-a2352d0e2c8e
encoding: FLOAT32
metadata:
{"solution": "def max_length_string(strings:list[str])->str:\n    return max(strings, key=len)", "question_template": "def max_length_string(strings:list[str])->str:\n    pass", "function_name": "max_length_string", "tags": "max,length", "input_type": "code", "data_formats": "str,list", "testcases": "[{\"input\": \"print(repr(max_length_string(['apple', 'banana', 'grape'])))\", \"output\": \"'banana'\"}, {\"input\": \"print(repr(max_length_string(['hello', 'world', 'python'])))\", \"output\": \"'python'\"}, {\"input\": \"print(repr(max_length_string(['a', 'bb', 'ccc'])))\", \"output\": \"'ccc'\"}, {\"input\": \"print(repr(max_length_string(['abc', 'abcd', 'abcde'])))\", \"output\": \"'abcde'\"}, {\"input\": \"print(repr(max_length_string(['xyz', 'abcd', 'abcdefg'])))\", \"output\": \"'abcdefg'\"}]", "chroma:document": "Given a list of strings, find the string with the maximum length"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 66ddd222-24ac-4552-966a-adb1988bc1e5
encoding: FLOAT32
metadata:
{"solution": "def sum_evens(nums:list[int])->int:\n    return sum(num for num in nums if num % 2 == 0)", "question_template": "def sum_evens(nums:list[int])->int:\n    pass", "function_name": "sum_evens", "tags": "numeric,aggregation,filtering", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(sum_evens([1, 2, 3, 4, 5, 6])))\", \"output\": \"12\"}, {\"input\": \"print(repr(sum_evens([2, 4, 6, 8, 10])))\", \"output\": \"30\"}, {\"input\": \"print(repr(sum_evens([1, 3, 5, 7, 9])))\", \"output\": \"0\"}, {\"input\": \"print(repr(sum_evens([10, 20, 30, 40, 50])))\", \"output\": \"150\"}, {\"input\": \"print(repr(sum_evens([2, 4, 6, 8, 10, 12, 14, 16, 18, 20])))\", \"output\": \"110\"}]", "chroma:document": "Find the sum of all the even numbers in a list"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 768faf1b-010b-403a-815e-0202c90b727e
encoding: FLOAT32
metadata:
{"solution": "def count_vowels(sentence:str)->int:\n    return sum(1 for char in sentence if char.lower() in 'aeiou')", "question_template": "def count_vowels(sentence:str)->int:\n    pass", "function_name": "count_vowels", "tags": "count,aggregation", "input_type": "code", "data_formats": "str", "testcases": "[{\"input\": \"print(repr(count_vowels('hello world')))\", \"output\": \"3\"}, {\"input\": \"print(repr(count_vowels('python is fun')))\", \"output\": \"3\"}, {\"input\": \"print(repr(count_vowels('AEIOU')))\", \"output\": \"5\"}, {\"input\": \"print(repr(count_vowels('bcdfghjklmnpqrstvwxyz')))\", \"output\": \"0\"}, {\"input\": \"print(repr(count_vowels('')))\", \"output\": \"0\"}]", "chroma:document": "Given a string, find the count of vowels"}


created_at: 2024-09-14 16:09:11
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: f7ffcc40-34c0-4b89-9376-089bbac80a65
encoding: FLOAT32
metadata:
{"solution": "def max_in_list(nums:list[int])->int:\n    return max(nums)", "question_template": "def max_in_list(nums:list[int])->int:\n    pass", "function_name": "max_in_list", "tags": "max", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(max_in_list([1, 2, 3, 4, 5])))\", \"output\": \"5\"}, {\"input\": \"print(repr(max_in_list([-1, -2, -3, -4, -5])))\", \"output\": \"-1\"}, {\"input\": \"print(repr(max_in_list([10, 20, 30, 40, 50])))\", \"output\": \"50\"}, {\"input\": \"print(repr(max_in_list([5, 5, 5, 5, 5])))\", \"output\": \"5\"}, {\"input\": \"print(repr(max_in_list([-10, -20, 0, 10, 20])))\", \"output\": \"20\"}]", "chroma:document": "Find the maximum value in a list"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 10037dcb-203c-464e-82dd-472bb85ddc1c
encoding: FLOAT32
metadata:
{"solution": "def sum_squares(nums:list):\n    return sum(map(lambda x: x**2, nums))", "question_template": "def sum_squares(nums:list):\n    pass", "function_name": "sum_squares", "tags": "numeric,map,aggregation", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(sum_squares([1, 2, 3])))\", \"output\": \"14\"}, {\"input\": \"print(repr(sum_squares([5, 4, 3])))\", \"output\": \"50\"}, {\"input\": \"print(repr(sum_squares([-1, 0, 1])))\", \"output\": \"2\"}, {\"input\": \"print(repr(sum_squares([10, 20, 30])))\", \"output\": \"1400\"}, {\"input\": \"print(repr(sum_squares([-5, 0, 5])))\", \"output\": \"50\"}]", "chroma:document": "Find the sum of squares of all integers in a list"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 6f5c2274-456c-48cd-ba2f-9ca229b73296
encoding: FLOAT32
metadata:
{"solution": "def max_word_length(sentence:str):\n    return max(map(len, sentence.split()))", "question_template": "def max_word_length(sentence:str):\n    pass", "function_name": "max_word_length", "tags": "string,max,split", "input_type": "code", "data_formats": "str", "testcases": "[{\"input\": \"print(repr(max_word_length('Hello world'))) \", \"output\": \"5\"}, {\"input\": \"print(repr(max_word_length('I am a coder'))) \", \"output\": \"5\"}, {\"input\": \"print(repr(max_word_length('This is a test'))) \", \"output\": \"4\"}, {\"input\": \"print(repr(max_word_length(''))) \", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(max_word_length('a b c'))) \", \"output\": \"1\"}]", "chroma:document": "Given a string, find the maximum length of its words"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: be376ace-2ac6-4703-9b2e-0c0234e7419b
encoding: FLOAT32
metadata:
{"solution": "def index_of_max(nums:list):\n    return nums.index(max(nums))", "question_template": "def index_of_max(nums:list):\n    pass", "function_name": "index_of_max", "tags": "numeric,max,index", "input_type": "code", "data_formats": "int,list", "testcases": "[{\"input\": \"print(repr(index_of_max([1, 2, 3, 4, 5])))\", \"output\": \"4\"}, {\"input\": \"print(repr(index_of_max([5, 4, 3, 2, 1])))\", \"output\": \"0\"}, {\"input\": \"print(repr(index_of_max([1, 1, 1, 1, 1])))\", \"output\": \"0\"}, {\"input\": \"print(repr(index_of_max([10, 20, 30, 40, 50])))\", \"output\": \"4\"}, {\"input\": \"print(repr(index_of_max([5, 10, 15, 20, 25])))\", \"output\": \"4\"}]", "chroma:document": "Find the index of the maximum element in a list"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 4e185d35-d0f1-4e95-8042-7d259dce3a8d
encoding: FLOAT32
metadata:
{"solution": "num_word = {\n    0: 'zero',1: 'one',2: 'two',3: 'three',\n    4: 'four',5: 'five',6: 'six',7: 'seven',\n    8: 'eight',9: 'nine'\n}\n\ndef num_to_hypen_string(num:int)->str:\n    return '-'.join(map(num_word.get, map(int, str(num))))", "question_template": "", "function_name": "", "tags": "mapping,split,concatenation,type-conversion", "input_type": "stdin", "data_formats": "int,str,dict", "testcases": "[{\"input\": \"123\", \"output\": \"Error: No output\"}, {\"input\": \"456\", \"output\": \"Error: No output\"}, {\"input\": \"789\", \"output\": \"Error: No output\"}, {\"input\": \"0\", \"output\": \"Error: No output\"}, {\"input\": \"98765\", \"output\": \"Error: No output\"}]", "chroma:document": "Given an integer, create a string with its digits as words separated by hyphens."}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 0347dd45-753b-4299-8006-9d236b639c39
encoding: FLOAT32
metadata:
{"solution": "def count_zero_rows(matrix:list[list[int]])->int:\n    return sum(map(lambda x: all(i == 0 for i in x), matrix)).count(True)", "question_template": "def count_zero_rows(matrix:list[list[int]])->int:\n    pass", "function_name": "count_zero_rows", "tags": "matrix,count,all", "input_type": "code", "data_formats": "int,list[list]", "testcases": "[{\"input\": \"print(repr(count_zero_rows([[0, 0, 0], [1, 2, 3], [0, 0, 0]])))\", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(count_zero_rows([[1, 2, 3], [0, 0, 0], [4, 5, 6]])))\", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(count_zero_rows([[0, 0, 0], [0, 0, 0], [0, 0, 0]])))\", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(count_zero_rows([[1, 2, 3], [4, 5, 6], [7, 8, 9]])))\", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(count_zero_rows([[0, 0, 0, 0], [0, 0, 0, 0], [1, 2, 3, 4]])))\", \"output\": \"Error: No output\"}]", "chroma:document": "Count the number of rows with all elements as zero in a matrix"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 132eafe8-87a2-43eb-99a2-ff304fb5e51f
encoding: FLOAT32
metadata:
{"solution": "def most_common_word(sentence:str)->str:\n    words = sentence.split()\n    return max(set(words), key=words.count)", "question_template": "def most_common_word(sentence:str)->str:\n    pass", "function_name": "most_common_word", "tags": "string,max,count", "input_type": "code", "data_formats": "str", "testcases": "[{\"input\": \"print(repr(most_common_word('apple apple banana orange')))\", \"output\": \"'apple'\"}, {\"input\": \"print(repr(most_common_word('this is a test test this test')))\", \"output\": \"'test'\"}, {\"input\": \"print(repr(most_common_word('hello world world world')))\", \"output\": \"'world'\"}, {\"input\": \"print(repr(most_common_word('a a a a b b c')))\", \"output\": \"'a'\"}, {\"input\": \"print(repr(most_common_word('x y z x y z x')))\", \"output\": \"'x'\"}]", "chroma:document": "Given a sentence, find the word that appears the most"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 61f70bfb-4bdf-449c-9b65-dcad3b7a54ef
encoding: FLOAT32
metadata:
{"solution": "def sum_matrix(matrix:list[list[int]])->int:\n    return sum(sum(row) for row in matrix)", "question_template": "def sum_matrix(matrix:list[list[int]])->int:\n    pass", "function_name": "sum_matrix", "tags": "matrix,sum,nested-loop", "input_type": "code", "data_formats": "int,list[list]", "testcases": "[{\"input\": \"print(repr(sum_matrix([[1, 2, 3], [4, 5, 6]])))\", \"output\": \"21\"}, {\"input\": \"print(repr(sum_matrix([[1, 2], [3, 4], [5, 6]])))\", \"output\": \"21\"}, {\"input\": \"print(repr(sum_matrix([[1], [2], [3]])))\", \"output\": \"6\"}, {\"input\": \"print(repr(sum_matrix([[10, 20, 30], [40, 50, 60]])))\", \"output\": \"210\"}, {\"input\": \"print(repr(sum_matrix([[1, 1], [1, 1], [1, 1]])))\", \"output\": \"6\"}]", "chroma:document": "Find the sum of all integers in a matrix"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: 4e1534af-d896-42f8-942c-13a2bb23638d
encoding: FLOAT32
metadata:
{"solution": "def count_rows_with_zero(matrix:list[list[int]])->int:\n    return sum(map(lambda x: any(i == 0 for i in x), matrix)).count(True)", "question_template": "def count_rows_with_zero(matrix:list[list[int]])->int:\n    pass", "function_name": "count_rows_with_zero", "tags": "matrix,count,any", "input_type": "code", "data_formats": "int,list[list]", "testcases": "[{\"input\": \"print(repr(count_rows_with_zero([[1, 2, 3], [4, 5, 6], [7, 8, 0]])))\", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(count_rows_with_zero([[1, 0, 3], [4, 5, 6], [7, 8, 9]])))\", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(count_rows_with_zero([[0, 0, 0], [0, 0, 0], [0, 0, 0]])))\", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(count_rows_with_zero([[1, 1, 1], [1, 1, 1], [1, 1, 1]])))\", \"output\": \"Error: No output\"}, {\"input\": \"print(repr(count_rows_with_zero([[0, 1, 0], [1, 0, 1], [0, 0, 0]])))\", \"output\": \"Error: No output\"}]", "chroma:document": "Find the number of rows with at least one zero in a matrix"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: b8084074-efc3-43a3-adff-4f85d5ce1357
encoding: FLOAT32
metadata:
{"solution": "def max_char_length(sentence:str):\n    return max(map(len, sentence.split()))", "question_template": "def max_char_length(sentence:str):\n    pass", "function_name": "max_char_length", "tags": "string,max,split", "input_type": "code", "data_formats": "str", "testcases": "[{\"input\": \"print(repr(max_char_length('Hello World'))) \", \"output\": \"5\"}, {\"input\": \"print(repr(max_char_length('I love coding'))) \", \"output\": \"6\"}, {\"input\": \"print(repr(max_char_length('Python is fun'))) \", \"output\": \"6\"}, {\"input\": \"print(repr(max_char_length('I am a programmer'))) \", \"output\": \"10\"}, {\"input\": \"print(repr(max_char_length('This is a test sentence'))) \", \"output\": \"8\"}]", "chroma:document": "Given a string, find the maximum length of its characters"}


created_at: 2024-09-14 16:10:33
topic: persistent://default/default/42b1885d-d7c1-4f71-a858-9a3243d9b814
id: b42109c7-60a2-486e-a74e-823779d9f7e5
encoding: FLOAT32
metadata:
{"solution": "def row_with_max_sum(matrix:list[list[int]])->int:\n    return max(range(len(matrix)), key= lambda x: sum(matrix[x]))", "question_template": "def row_with_max_sum(matrix:list[list[int]])->int:\n    pass", "function_name": "row_with_max_sum", "tags": "matrix,max,sum,index", "input_type": "code", "data_formats": "int,list[list]", "testcases": "[{\"input\": \"print(repr(row_with_max_sum([[1, 2, 3], [4, 5, 6], [7, 8, 9]])))\", \"output\": \"2\"}, {\"input\": \"print(repr(row_with_max_sum([[10, 20, 30], [40, 50, 60], [70, 80, 90]])))\", \"output\": \"2\"}, {\"input\": \"print(repr(row_with_max_sum([[1, 1, 1], [1, 1, 1], [1, 1, 1]])))\", \"output\": \"0\"}, {\"input\": \"print(repr(row_with_max_sum([[5, 5], [10, 10], [15, 15]])))\", \"output\": \"2\"}, {\"input\": \"print(repr(row_with_max_sum([[1, 2], [3, 4], [5, 6]])))\", \"output\": \"2\"}]", "chroma:document": "Find the index of the row with the maximum sum in a matrix"}


# collections

id: 42b1885d-d7c1-4f71-a858-9a3243d9b814
name: python-questions
database_id: 00000000-0000-0000-0000-000000000000
config_json_str:
{"hnsw_configuration": {"space": "l2", "ef_construction": 100, "ef_search": 10, "num_threads": 8, "M": 16, "resize_factor": 1.2, "batch_size": 100, "sync_threshold": 1000, "_type": "HNSWConfigurationInternal"}, "_type": "CollectionConfigurationInternal"}


# embedding_metadata

key: solution
string_value:
def sum_squares_of_even(nums:list):
    return sum(map(lambda x: x**2, filter(lambda x: x%2==0, nums)))


key: testcases
string_value:
[{"input": "print(repr(sum_squares_of_even([1,2,3,4,5])))", "output": "20"}, {"input": "print(repr(sum_squares_of_even([2,4,6,8])))", "output": "120"}, {"input": "print(repr(sum_squares_of_even([1,3,5,7])))", "output": "0"}, {"input": "print(repr(sum_squares_of_even([10,20,30,40])))", "output": "3000"}, {"input": "print(repr(sum_squares_of_even([])))", "output": "0"}]


key: solution
string_value:
def row_with_max_zeros(matrix:list[list[int]])->int:
    return max(range(len(matrix)), key= lambda x: matrix[x].count(0))


key: testcases
string_value:
[{"input": "print(repr(row_with_max_zeros([[0, 0, 1], [1, 1, 1], [0, 0, 0]])))", "output": "2"}, {"input": "print(repr(row_with_max_zeros([[1, 1, 1], [0, 0, 0], [1, 1, 1]])))", "output": "1"}, {"input": "print(repr(row_with_max_zeros([[0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]])))", "output": "0"}, {"input": "print(repr(row_with_max_zeros([[1, 0, 1], [1, 0, 1], [1, 0, 1]])))", "output": "0"}, {"input": "print(repr(row_with_max_zeros([[0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0]])))", "output": "0"}]


key: solution
string_value:
def filter_strings_with_vowels(strings:list[str])->list[str]:
    return list(filter(lambda x: not any(c in 'aeiou' for c in x.lower()), strings))


key: testcases
string_value:
[{"input": "print(repr(filter_strings_with_vowels(['hello', 'world', 'bcd', 'aeiou'])))", "output": "['bcd']"}, {"input": "print(repr(filter_strings_with_vowels(['abc', 'xyz', 'pqr', 'mno'])))", "output": "['xyz', 'pqr']"}, {"input": "print(repr(filter_strings_with_vowels(['a', 'b', 'c', 'd', 'e'])))", "output": "['b', 'c', 'd']"}, {"input": "print(repr(filter_strings_with_vowels(['apple', 'boy', 'cat', 'dog', 'elephant'])))", "output": "[]"}, {"input": "print(repr(filter_strings_with_vowels(['x', 'y', 'z'])))", "output": "['x', 'y', 'z']"}]


key: solution
string_value:
def max_sublist_sum(lst:list[int]):
    return max(sum(lst[i: j]) for i in range(len(lst)) for j in range(i + 1, len(lst) + 1))


key: testcases
string_value:
[{"input": "print(repr(max_sublist_sum([-2, -3, 4, -1, -2, 1, 5, -3])))", "output": "7"}, {"input": "print(repr(max_sublist_sum([1, -2, 3, 10, -4, 7, 2, -5])))", "output": "18"}, {"input": "print(repr(max_sublist_sum([-1, -2, -3, -4, -5])))", "output": "-1"}, {"input": "print(repr(max_sublist_sum([1, 2, 3, 4, 5])))", "output": "15"}, {"input": "print(repr(max_sublist_sum([0, 0, 0, 0, 0])))", "output": "0"}]


key: testcases
string_value:
[{"input": "print(repr(max_value_key({'a': 1, 'b': 2, 'c': 3})))", "output": "'c'"}, {"input": "print(repr(max_value_key({'x': 10, 'y': 20, 'z': 30})))", "output": "'z'"}, {"input": "print(repr(max_value_key({'p': 5, 'q': 10, 'r': 15})))", "output": "'r'"}, {"input": "print(repr(max_value_key({'one': 1, 'two': 2, 'three': 3})))", "output": "'three'"}, {"input": "print(repr(max_value_key({'apple': 10, 'banana': 20, 'cherry': 30})))", "output": "'cherry'"}]


key: solution
string_value:
def count_words(sentence:str)->dict[str,int]:
    return {word: sentence.count(word) for word in sentence.split()}


key: testcases
string_value:
[{"input": "print(repr(count_words('hello world hello'))) ", "output": "{'hello': 2, 'world': 1}"}, {"input": "print(repr(count_words('apple apple apple'))) ", "output": "{'apple': 3}"}, {"input": "print(repr(count_words('a b c d e f g'))) ", "output": "{'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1}"}, {"input": "print(repr(count_words('hello world hello world'))) ", "output": "{'hello': 2, 'world': 2}"}, {"input": "print(repr(count_words('a b c d e f g h i j k l m n o p q r s t u v w x y z'))) ", "output": "{'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1, 'h': 1, 'i': 1, 'j': 1, 'k': 1, 'l': 1, 'm': 1, 'n': 1, 'o': 1, 'p': 1, 'q': 1, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 1, 'w': 1, 'x': 1, 'y': 1, 'z': 1}"}]


key: solution
string_value:
def sum_diagonal_elements(matrix:list[list[int]])->int:
    return sum(matrix[i][i] for i in range(len(matrix)))


key: testcases
string_value:
[{"input": "print(repr(sum_diagonal_elements([[1, 2, 3], [4, 5, 6], [7, 8, 9]])))", "output": "15"}, {"input": "print(repr(sum_diagonal_elements([[5, 5, 5], [5, 5, 5], [5, 5, 5]])))", "output": "15"}, {"input": "print(repr(sum_diagonal_elements([[1, 1], [1, 1]])))", "output": "2"}, {"input": "print(repr(sum_diagonal_elements([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]])))", "output": "34"}, {"input": "print(repr(sum_diagonal_elements([[0, 0, 0], [0, 0, 0], [0, 0, 0]])))", "output": "0"}]


key: testcases
string_value:
[{"input": "print(repr(max_len_string(['apple', 'banana', 'cherry'])))", "output": "6"}, {"input": "print(repr(max_len_string(['hello', 'world'])))", "output": "5"}, {"input": "print(repr(max_len_string(['a', 'bb', 'ccc'])))", "output": "3"}, {"input": "print(repr(max_len_string(['python', 'is', 'fun'])))", "output": "6"}, {"input": "print(repr(max_len_string(['short', 'longer', 'longest'])))", "output": "7"}]


key: solution
string_value:
def filter_dict_values(d:dict[str,int], threshold:int)->dict[str,int]:
    return {k: v for k, v in d.items() if v >= threshold}


key: testcases
string_value:
[{"input": "print(repr(filter_dict_values({'a': 1, 'b': 2, 'c': 3}, 2)))", "output": "{'b': 2, 'c': 3}"}, {"input": "print(repr(filter_dict_values({'x': 10, 'y': 20, 'z': 30}, 25)))", "output": "{'z': 30}"}, {"input": "print(repr(filter_dict_values({'p': 5, 'q': 5, 'r': 5}, 6)))", "output": "{}"}, {"input": "print(repr(filter_dict_values({'m': 10, 'n': 20, 'o': 30}, 15)))", "output": "{'n': 20, 'o': 30}"}, {"input": "print(repr(filter_dict_values({'k': 100, 'l': 200, 'm': 300}, 150)))", "output": "{'l': 200, 'm': 300}"}]


key: solution
string_value:
def find_target_index(lst:list[int], target:int)->int:
    return next((i for i, x in enumerate(lst) if x == target), None)


key: testcases
string_value:
[{"input": "print(repr(find_target_index([1, 2, 3, 4, 5], 3)))", "output": "2"}, {"input": "print(repr(find_target_index([10, 20, 30, 40, 50], 40)))", "output": "3"}, {"input": "print(repr(find_target_index([1, 2, 3, 4, 5], 6)))", "output": "None"}, {"input": "print(repr(find_target_index([5, 5, 5, 5, 5], 5)))", "output": "0"}, {"input": "print(repr(find_target_index([1, 2, 3, 4, 5], 1)))", "output": "0"}]


key: testcases
string_value:
[{"input": "print(repr(sum_squares_of_evens([1,2,3,4,5,6])))", "output": "56"}, {"input": "print(repr(sum_squares_of_evens([2,4,6,8,10])))", "output": "220"}, {"input": "print(repr(sum_squares_of_evens([1,3,5,7,9])))", "output": "0"}, {"input": "print(repr(sum_squares_of_evens([])))", "output": "0"}, {"input": "print(repr(sum_squares_of_evens([2,4,6,8,10,12])))", "output": "364"}]


key: testcases
string_value:
[{"input": "print(repr(max_in_matrices([[1, 2, 3], [4, 5, 6]])))", "output": "6"}, {"input": "print(repr(max_in_matrices([[10, 20, 30], [40, 50, 60]])))", "output": "60"}, {"input": "print(repr(max_in_matrices([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]])))", "output": "12"}, {"input": "print(repr(max_in_matrices([[100, 200, 300], [400, 500, 600], [700, 800, 900]])))", "output": "900"}, {"input": "print(repr(max_in_matrices([[1, 1, 1], [1, 1, 1], [1, 1, 1]])))", "output": "1"}]


key: testcases
string_value:
[{"input": "print(repr(max_count_a(['apple', 'banana', 'apricot'])))", "output": "'banana'"}, {"input": "print(repr(max_count_a(['ant', 'aardvark', 'apple'])))", "output": "'aardvark'"}, {"input": "print(repr(max_count_a(['abc', 'def', 'ghi'])))", "output": "'abc'"}, {"input": "print(repr(max_count_a(['a', 'aa', 'aaa'])))", "output": "'aaa'"}, {"input": "print(repr(max_count_a(['b', 'c', 'd'])))", "output": "'b'"}]


key: testcases
string_value:
[{"input": "print(repr(index_of_max([1, 2, 3, 4, 5])))", "output": "4"}, {"input": "print(repr(index_of_max([5, 4, 3, 2, 1])))", "output": "0"}, {"input": "print(repr(index_of_max([10, 20, 30, 40, 50])))", "output": "4"}, {"input": "print(repr(index_of_max([1, 1, 1, 1, 1])))", "output": "0"}, {"input": "print(repr(index_of_max([-5, -4, -3, -2, -1])))", "output": "4"}]


key: testcases
string_value:
[{"input": "print(repr(count_words('Hello World')))", "output": "2"}, {"input": "print(repr(count_words('This is a test')))", "output": "4"}, {"input": "print(repr(count_words('Single word')))", "output": "2"}, {"input": "print(repr(count_words('')))", "output": "0"}, {"input": "print(repr(count_words('Multiple   spaces   between   words')))", "output": "4"}]


key: testcases
string_value:
[{"input": "print(repr(sum_of_digits(123)))", "output": "6"}, {"input": "print(repr(sum_of_digits(456)))", "output": "15"}, {"input": "print(repr(sum_of_digits(789)))", "output": "24"}, {"input": "print(repr(sum_of_digits(100)))", "output": "1"}, {"input": "print(repr(sum_of_digits(111)))", "output": "3"}]


key: testcases
string_value:
[{"input": "print(repr(max_length_string(['apple', 'banana', 'grape'])))", "output": "'banana'"}, {"input": "print(repr(max_length_string(['hello', 'world', 'python'])))", "output": "'python'"}, {"input": "print(repr(max_length_string(['a', 'bb', 'ccc'])))", "output": "'ccc'"}, {"input": "print(repr(max_length_string(['abc', 'abcd', 'abcde'])))", "output": "'abcde'"}, {"input": "print(repr(max_length_string(['xyz', 'abcd', 'abcdefg'])))", "output": "'abcdefg'"}]


key: testcases
string_value:
[{"input": "print(repr(sum_evens([1, 2, 3, 4, 5, 6])))", "output": "12"}, {"input": "print(repr(sum_evens([2, 4, 6, 8, 10])))", "output": "30"}, {"input": "print(repr(sum_evens([1, 3, 5, 7, 9])))", "output": "0"}, {"input": "print(repr(sum_evens([10, 20, 30, 40, 50])))", "output": "150"}, {"input": "print(repr(sum_evens([2, 4, 6, 8, 10, 12, 14, 16, 18, 20])))", "output": "110"}]


key: solution
string_value:
def count_vowels(sentence:str)->int:
    return sum(1 for char in sentence if char.lower() in 'aeiou')


key: testcases
string_value:
[{"input": "print(repr(count_vowels('hello world')))", "output": "3"}, {"input": "print(repr(count_vowels('python is fun')))", "output": "3"}, {"input": "print(repr(count_vowels('AEIOU')))", "output": "5"}, {"input": "print(repr(count_vowels('bcdfghjklmnpqrstvwxyz')))", "output": "0"}, {"input": "print(repr(count_vowels('')))", "output": "0"}]


key: testcases
string_value:
[{"input": "print(repr(max_in_list([1, 2, 3, 4, 5])))", "output": "5"}, {"input": "print(repr(max_in_list([-1, -2, -3, -4, -5])))", "output": "-1"}, {"input": "print(repr(max_in_list([10, 20, 30, 40, 50])))", "output": "50"}, {"input": "print(repr(max_in_list([5, 5, 5, 5, 5])))", "output": "5"}, {"input": "print(repr(max_in_list([-10, -20, 0, 10, 20])))", "output": "20"}]


key: testcases
string_value:
[{"input": "print(repr(sum_squares([1, 2, 3])))", "output": "14"}, {"input": "print(repr(sum_squares([5, 4, 3])))", "output": "50"}, {"input": "print(repr(sum_squares([-1, 0, 1])))", "output": "2"}, {"input": "print(repr(sum_squares([10, 20, 30])))", "output": "1400"}, {"input": "print(repr(sum_squares([-5, 0, 5])))", "output": "50"}]


key: testcases
string_value:
[{"input": "print(repr(max_word_length('Hello world'))) ", "output": "5"}, {"input": "print(repr(max_word_length('I am a coder'))) ", "output": "5"}, {"input": "print(repr(max_word_length('This is a test'))) ", "output": "4"}, {"input": "print(repr(max_word_length(''))) ", "output": "Error: No output"}, {"input": "print(repr(max_word_length('a b c'))) ", "output": "1"}]


key: testcases
string_value:
[{"input": "print(repr(index_of_max([1, 2, 3, 4, 5])))", "output": "4"}, {"input": "print(repr(index_of_max([5, 4, 3, 2, 1])))", "output": "0"}, {"input": "print(repr(index_of_max([1, 1, 1, 1, 1])))", "output": "0"}, {"input": "print(repr(index_of_max([10, 20, 30, 40, 50])))", "output": "4"}, {"input": "print(repr(index_of_max([5, 10, 15, 20, 25])))", "output": "4"}]


key: solution
string_value:
num_word = {
    0: 'zero',1: 'one',2: 'two',3: 'three',
    4: 'four',5: 'five',6: 'six',7: 'seven',
    8: 'eight',9: 'nine'
}

def num_to_hypen_string(num:int)->str:
    return '-'.join(map(num_word.get, map(int, str(num))))


key: testcases
string_value:
[{"input": "123", "output": "Error: No output"}, {"input": "456", "output": "Error: No output"}, {"input": "789", "output": "Error: No output"}, {"input": "0", "output": "Error: No output"}, {"input": "98765", "output": "Error: No output"}]


key: solution
string_value:
def count_zero_rows(matrix:list[list[int]])->int:
    return sum(map(lambda x: all(i == 0 for i in x), matrix)).count(True)


key: testcases
string_value:
[{"input": "print(repr(count_zero_rows([[0, 0, 0], [1, 2, 3], [0, 0, 0]])))", "output": "Error: No output"}, {"input": "print(repr(count_zero_rows([[1, 2, 3], [0, 0, 0], [4, 5, 6]])))", "output": "Error: No output"}, {"input": "print(repr(count_zero_rows([[0, 0, 0], [0, 0, 0], [0, 0, 0]])))", "output": "Error: No output"}, {"input": "print(repr(count_zero_rows([[1, 2, 3], [4, 5, 6], [7, 8, 9]])))", "output": "Error: No output"}, {"input": "print(repr(count_zero_rows([[0, 0, 0, 0], [0, 0, 0, 0], [1, 2, 3, 4]])))", "output": "Error: No output"}]


key: solution
string_value:
def most_common_word(sentence:str)->str:
    words = sentence.split()
    return max(set(words), key=words.count)


key: testcases
string_value:
[{"input": "print(repr(most_common_word('apple apple banana orange')))", "output": "'apple'"}, {"input": "print(repr(most_common_word('this is a test test this test')))", "output": "'test'"}, {"input": "print(repr(most_common_word('hello world world world')))", "output": "'world'"}, {"input": "print(repr(most_common_word('a a a a b b c')))", "output": "'a'"}, {"input": "print(repr(most_common_word('x y z x y z x')))", "output": "'x'"}]


key: testcases
string_value:
[{"input": "print(repr(sum_matrix([[1, 2, 3], [4, 5, 6]])))", "output": "21"}, {"input": "print(repr(sum_matrix([[1, 2], [3, 4], [5, 6]])))", "output": "21"}, {"input": "print(repr(sum_matrix([[1], [2], [3]])))", "output": "6"}, {"input": "print(repr(sum_matrix([[10, 20, 30], [40, 50, 60]])))", "output": "210"}, {"input": "print(repr(sum_matrix([[1, 1], [1, 1], [1, 1]])))", "output": "6"}]


key: solution
string_value:
def count_rows_with_zero(matrix:list[list[int]])->int:
    return sum(map(lambda x: any(i == 0 for i in x), matrix)).count(True)


key: testcases
string_value:
[{"input": "print(repr(count_rows_with_zero([[1, 2, 3], [4, 5, 6], [7, 8, 0]])))", "output": "Error: No output"}, {"input": "print(repr(count_rows_with_zero([[1, 0, 3], [4, 5, 6], [7, 8, 9]])))", "output": "Error: No output"}, {"input": "print(repr(count_rows_with_zero([[0, 0, 0], [0, 0, 0], [0, 0, 0]])))", "output": "Error: No output"}, {"input": "print(repr(count_rows_with_zero([[1, 1, 1], [1, 1, 1], [1, 1, 1]])))", "output": "Error: No output"}, {"input": "print(repr(count_rows_with_zero([[0, 1, 0], [1, 0, 1], [0, 0, 0]])))", "output": "Error: No output"}]


key: testcases
string_value:
[{"input": "print(repr(max_char_length('Hello World'))) ", "output": "5"}, {"input": "print(repr(max_char_length('I love coding'))) ", "output": "6"}, {"input": "print(repr(max_char_length('Python is fun'))) ", "output": "6"}, {"input": "print(repr(max_char_length('I am a programmer'))) ", "output": "10"}, {"input": "print(repr(max_char_length('This is a test sentence'))) ", "output": "8"}]


key: solution
string_value:
def row_with_max_sum(matrix:list[list[int]])->int:
    return max(range(len(matrix)), key= lambda x: sum(matrix[x]))


key: testcases
string_value:
[{"input": "print(repr(row_with_max_sum([[1, 2, 3], [4, 5, 6], [7, 8, 9]])))", "output": "2"}, {"input": "print(repr(row_with_max_sum([[10, 20, 30], [40, 50, 60], [70, 80, 90]])))", "output": "2"}, {"input": "print(repr(row_with_max_sum([[1, 1, 1], [1, 1, 1], [1, 1, 1]])))", "output": "0"}, {"input": "print(repr(row_with_max_sum([[5, 5], [10, 10], [15, 15]])))", "output": "2"}, {"input": "print(repr(row_with_max_sum([[1, 2], [3, 4], [5, 6]])))", "output": "2"}]


