{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"livecodebench","formal_name":"LiveCodeBench","introduction":"LiveCodeBench continuously collects new competitive-programming problems to evaluate coding capabilities. Its initial release_v1 contains 400 problems, with source platform, contest date, and dataset version tracked explicitly.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://livecodebench.github.io/","indexing_mode":"noindex","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[]}},"task_id":"a018b437-4bf1-5f49-8090-3a298f617357","task_key":"release~5fv1--test--2831","task_revision_id":"2","upstream_id":"2831","short_description":"number-of-beautiful-pairs","config":"release_v1","split":"test","body":"{\"contest_date\":\"2023-06-25T00:00:00\",\"contest_id\":\"weekly-contest-351\",\"difficulty\":\"easy\",\"platform\":\"leetcode\",\"question_content\":\"You are given a 0-indexed integer array nums. A pair of indices i, j where 0 <= i < j < nums.length is called beautiful if the first digit of nums[i] and the last digit of nums[j] are coprime.\\nReturn the total number of beautiful pairs in nums.\\nTwo integers x and y are coprime if there is no integer greater than 1 that divides both of them. In other words, x and y are coprime if gcd(x, y) == 1, where gcd(x, y) is the greatest common divisor of x and y.\\n \\nExample 1:\\n\\nInput: nums = [2,5,1,4]\\nOutput: 5\\nExplanation: There are 5 beautiful pairs in nums:\\nWhen i = 0 and j = 1: the first digit of nums[0] is 2, and the last digit of nums[1] is 5. We can confirm that 2 and 5 are coprime, since gcd(2,5) == 1.\\nWhen i = 0 and j = 2: the first digit of nums[0] is 2, and the last digit of nums[2] is 1. Indeed, gcd(2,1) == 1.\\nWhen i = 1 and j = 2: the first digit of nums[1] is 5, and the last digit of nums[2] is 1. Indeed, gcd(5,1) == 1.\\nWhen i = 1 and j = 3: the first digit of nums[1] is 5, and the last digit of nums[3] is 4. Indeed, gcd(5,4) == 1.\\nWhen i = 2 and j = 3: the first digit of nums[2] is 1, and the last digit of nums[3] is 4. Indeed, gcd(1,4) == 1.\\nThus, we return 5.\\n\\nExample 2:\\n\\nInput: nums = [11,21,12]\\nOutput: 2\\nExplanation: There are 2 beautiful pairs:\\nWhen i = 0 and j = 1: the first digit of nums[0] is 1, and the last digit of nums[1] is 1. Indeed, gcd(1,1) == 1.\\nWhen i = 0 and j = 2: the first digit of nums[0] is 1, and the last digit of nums[2] is 2. Indeed, gcd(1,2) == 1.\\nThus, we return 2.\\n\\n \\nConstraints:\\n\\n2 <= nums.length <= 100\\n1 <= nums[i] <= 9999\\nnums[i] % 10 != 0\",\"question_title\":\"number-of-beautiful-pairs\",\"starter_code\":\"class Solution:\\n    def countBeautifulPairs(self, nums: List[int]) -> int:\\n        \"}","display_format":"text","language":"","answer_status":"external_grader","assets":[],"source_url":"https://livecodebench.github.io/","history":"initial import","indexing_mode":"noindex","subproblems":[],"grids":[]}