text stringlengths 41 3.71k | ntok int64 40 1.02k | style stringclasses 3
values | name stringlengths 1 252 | hash stringlengths 24 24 | model stringclasses 2
values |
|---|---|---|---|---|---|
def pairwise_differences(records: list[dict[str, int]]) -> list[dict[str, int]]:
"""Given a list of dictionaries representing bank records, calculate the pairwise
differences between consecutive days' deposits and withdrawals, returning a new
list of the same records with 'deposits' and 'withdrawals' fields... | 212 | tp | pairwise_differences.py | 0ed56457ea3d597de683f02c | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(values: list[int]) -> list[int]:
"""Given a list of numbers, return differences between consecutive pairs in the form
of a list of differences, excluding the last element since no additional
differences can be computed.
"""
differences = []
for i in range(len(values) - 1... | 121 | tp | pairwise_differences.py | 1d867f30f9e228eb1cacc8e0 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(l1: list[int], l2: list[int]) -> list[int]:
"""Create a new list where each element is the difference between the corresponding
elements from two input lists. This approach can be more memory-efficient when dealing
with long lists.
"""
diff_list = [x - y for x, y in zip(l1, ... | 116 | tp | pairwise_differences.py | 9e7fcd021ab5a49d44e95754 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> list[int]:
"""Given a list of numbers, calculate the absolute difference between each pair of
consecutive numbers.
"""
pairs = [(numbers[i], numbers[i+1]) for i in range(len(numbers)-1)]
diffs = [abs(b - a) for a, b in pairs]
return diffs | 102 | tp | pairwise_differences.py | 30d83185af591e1a82c6efed | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(differences: list[int]) -> list[int]:
"""Given a list of differences, calculate the pairwise differences.
"""
pairwise_diffs = [diffs[0] - diffs[1] for diffs in pairwise_combinations(differences, 2)]
return pairwise_diffs | 87 | tp | pairwise_differences.py | 28c23f2f74b093cf0b8e8b15 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(list1: list[int], list2: list[int]) -> list[int]:
"""Given two lists of integers, return a list of the absolute differences between
corresponding elements at the same index.
"""
differences: list[int] = []
for i, value1 in enumerate(list1):
try:
value2 = ... | 140 | tp | pairwise_differences.py | 9b002ad09bb650f7adb28101 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int | float]) -> list[float]:
"""Calculate the pairwise differences between all integers and floating-point values
in the list.
"""
result: list[float] = []
for i in range(len(numbers)):
for j in range(i+1, len(numbers)):
result.append(abs(n... | 102 | tp | pairwise_differences.py | af1a6bda7b6ff4100fe77483 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(x: list[int]) -> list[int]:
"""Given a list of integers, calculate the differences between consecutive elements
and return them in a new list.
"""
differences = []
for i in range(len(x) - 1):
differences.append(x[i+1] - x[i])
return differences | 91 | tp | pairwise_differences.py | e65d0d494c88324c86b857ad | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> tuple[int, int]:
"""Return the difference between the largest and smallest numbers in a list.
"""
return max(numbers) - min(numbers) | 58 | tp | pairwise_differences.py | faf86ddf805bc2d99a0dcf02 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(values: list[int]) -> list[int]:
"""Return the pairwise differences between adjacent elements in the list.
"""
result: list[int] = []
for i in range(len(values)-1):
result.append(values[i] - values[i+1])
return result | 76 | tp | pairwise_differences.py | 0cf4d2ae6038d0c6a11953f5 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int | float]) -> list[list[int | float]]:
"""Calculate the pairwise differences between all unique pairs in the list.
"""
result = []
numbers_set = set(numbers)
for i, num in enumerate(numbers_set):
for j in numbers_set:
if j == num:
... | 99 | tp | pairwise_differences.py | 769026b230d18327edc9b051 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(string_pairs: list[tuple[str, str]]) -> list[int]:
"""Given a list of pairs of strings representing initial and final values, return a
list of the absolute pairwise differences of the corresponding values.
"""
result: list[int] = []
for a, b in string_pairs:
if a and... | 111 | tp | pairwise_differences.py | 237105307d325df3a277e132 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> list[int]:
"""Compute the differences between consecutive numbers in the input list and return
the list of differences.
"""
differences = []
for i in range(1, len(numbers)):
differences.append(numbers[i] - numbers[i - 1])
return differences | 92 | tp | pairwise_differences.py | d9f8636133dea7dd7fca7781 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> dict[int, int]:
"""Given a list of integers, create a dictionary mapping each element to its
"pairwise difference," which is calculated by subtracting the previous element
from the current one. Provide the first element of the list as 0 for the first
diffe... | 144 | tp | pairwise_differences.py | b2c09d26bbd8c8d1740b2978 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> list[int]:
"""Calculate the pairwise difference between consecutive integers in the provided
list.
"""
differences = []
for i in range(len(numbers) - 1):
difference = numbers[i + 1] - numbers[i]
differences.append(difference)
return... | 99 | tp | pairwise_differences.py | c95ce577c73cd29889fe6d6c | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(n: int) -> list[int]:
"""Construct a list of integers containing the pairwise difference between the
product of two integers from 0 to n, using the following format:
0, 2, 4, 6, 8, 10, 12, 14, 16, 18
1, 3, 5, 7, 9, 11, 13, 15, 17, 19
2, 4, 6, 8, 10, 12, 14, 16, 18
"""
... | 186 | tp | pairwise_differences.py | e55571ec2b97e4e5a4ac76f2 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> list[int]:
"""For each number in the input list, calculate the absolute difference with its
successor and return the differences as a list.
"""
diffs = []
for i in range(len(numbers) - 1):
diffs.append(abs(numbers[i] - numbers[i + 1]))
retu... | 100 | tp | pairwise_differences.py | dd69875a2b4b4d2ee71ef7ec | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(values: list[int | float]) -> list[int | float]:
"""Compute a list of pairwise differences between the provided list of numbers.
Subtract the second element from the first, the third from the second, and so on.
"""
differences = []
for i in range(len(values) - 1):
di... | 116 | tp | pairwise_differences.py | 383a8cb2dbb46673fd03ea85 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> list[int]:
"""Calculate the pairwise differences between numbers in a list."""
return [numbers[i] - numbers[i + 1] for i in range(len(numbers) - 1)] | 62 | tp | pairwise_differences.py | 9b95b996070acfe1d011f6af | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> dict[int, list[int]]:
"""Given a list of integers, construct a dictionary mapping each number to a list
of its preceding numbers in the sequence.
"""
differences = {}
for i in range(len(numbers)):
for j in range(1, len(numbers) - i):
... | 150 | tp | pairwise_differences.py | cb82d59cc89b92958e8deff5 | Qwen/Qwen2.5-Coder-1.5B |
import string
def pair_most_frequent_words(words: str) -> str:
"""Find the most frequent pairs of words separated by a space in a given string.
Return a tuple containing the pair with the maximum frequency and the count of
occurrences.
"""
word_counts = {}
for i in range(len(words)):
i... | 245 | tp | pairwise_differences.py | ec4d6524b2659028a652b352 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(numbers: list[int]) -> list[int]:
"""For each pair of adjacent elements in the input list, calculate the difference
and return a list of these differences.
"""
return [numbers[i+1] - numbers[i] for i in range(len(numbers) - 1)] | 79 | tp | pairwise_differences.py | 6e95eb8f8e1a90384b1495e3 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(iterable: list[int | float]) -> tuple[float, float]:
"""Compute the pairwise differences between numbers in an iterable, grouped by
their absolute value magnitude. The first difference is zero for small values,
and the last difference is a small number for large values.
"""
... | 188 | tp | pairwise_differences.py | 5681f3db32b5ec1b8a864ae0 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(values: list[int | str]) -> list[int | str]:
"""Return a list containing the difference between consecutive elements in the
input list.
"""
differences: list[int | str] = []
for i in range(1, len(values)):
differences.append(values[i] - values[i - 1])
return diff... | 96 | tp | pairwise_differences.py | b0422fa532e3415d892dbee9 | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(values: list[int]) -> tuple[int | None, ...]:
"""Given a list of integers, return a tuple containing the differences between
successive elements in each pair.
"""
differences = []
for i in range(len(values) - 1):
differences.append(values[i] - values[i+1])
return... | 111 | tp | pairwise_differences.py | 819ff2729855a44518d19d4d | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(values: list[int]) -> dict[tuple[int, int], int]:
"""Calculate the difference between all pairs of distinct elements in the input
list and return a dictionary where the keys are the pairs and the values are the
differences. Skip pairs involving the same element.
"""
result =... | 146 | tp | pairwise_differences.py | 5a3201f8f31805abbf4c11fd | Qwen/Qwen2.5-Coder-1.5B |
def pairwise_differences(values: list[int | float]) -> list[list[int | float]]:
"""Given a list of integers or floats, return a list of lists where each inner
list contains the differences between consecutive elements.
"""
differences = []
for i in range(len(values) - 1):
differences.append(... | 111 | tp | pairwise_differences.py | 379b497fdd4344ca0b8bf184 | Qwen/Qwen2.5-Coder-1.5B |
def reversed(text: str) -> str:
"""Return the text reversed."""
reversed_text = text[::-1]
return reversed_text
def duplicate(text: str) -> str:
"""Return the duplicated text."""
duplicated_text = text + text
return duplicated_text
def filter_keys(persons: list[dict[str, str]]) -> list[dict[st... | 310 | mix | language.py | 17b4d8dfff5cdb69bef8db31 | Qwen/Qwen2.5-Coder-1.5B |
print("\n" * 100)
name = input("What is your name? ")
print("Hi " + name)
print(f"Hello {name}") | 41 | mix | language.py | f67bd4c9b8900e3b0028d66c | Qwen/Qwen2.5-Coder-1.5B |
# write your implementation of print_text() here
def print_text(name: str, age: str, options: bool) -> str:
# Replace ...
# with your own implementation
print_options = ' '
if options:
print_options = '{'
if name:
print_options += f'"name": {name}'
if age:
... | 135 | mix | language.py | 7a936f70c1d4c7715f90cb4c | Qwen/Qwen2.5-Coder-1.5B |
def greet_english(name: str) -> str:
"""Returns the English greeting message. """
if (name == ""):
return "Hello my friend."
else:
return "Hello my friend " + name + "."
def greet_french(name: str) -> str:
"""Returns the French greeting message."""
if (name == ""):
return "B... | 384 | mix | language.py | 398b2b9017b3b374025a9a5f | Qwen/Qwen2.5-Coder-1.5B |
def convert_first_name_language(name: str) -> str:
"""Convert the first letter of a given name to uppercase.
"""
first_letter = name[0]
return first_letter.upper() + name[1:]
def convert_to_full_lowercase(name: str) -> str:
"""Convert all the letters of the given name into lowercase.
"""
fi... | 139 | mix | language.py | 01a4bc6e0a1f0cf531002f40 | Qwen/Qwen2.5-Coder-1.5B |
def language(name: str, *args) -> str:
"""Return a message saying how much fun it is to learn a new language, parameterized
by the name of the language that the user wants to learn.
"""
# my translation
translation = f"It is fun to learn {name}."
# result = "It is fun to learn"
# return resu... | 243 | mix | language.py | f2673e260498af5565a2a51a | Qwen/Qwen2.5-Coder-1.5B |
def count_primes(n):
"""Count the number of prime numbers less than or equal to the given limit."""
primes_count = 0
for num in range(2, n+1):
is_prime = True
for i in range(2, int(num**0.5)+1):
if num % i == 0:
is_prime = False
break
if is... | 210 | mix | language.py | 6299d5e184db98b3ea4ff9b8 | Qwen/Qwen2.5-Coder-1.5B |
def compute_language_output(language_code: str, language_output: str) -> str:
"""
This function returns the corresponding language output based on the provided
language code (which can be "JAVA", "C++", or "PYTHON"). If the language code is
not recognized, it defaults to returning the original language ... | 339 | mix | language.py | 751b1ba6f84948c063489386 | Qwen/Qwen2.5-Coder-1.5B |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.