AlbertHatsuki's picture
Update README.md
1a59aa2 verified
metadata
language:
  - en
tags:
  - code

This is a dataset collected and created from Codeforces rounds.

All the problem statements, solutions and problem_tags are from Codeforces's API requests. https://codeforces.com/apiHelp

The dataset is in the following format

{
  "contest_id": "1290",
  "problem_id": "A",
  "statement": "A. Mind Controltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou and your n−1n−1 friends have found an array of integers a1,a2,…,ana1,a2,…,an. You have decided to share it in the following way: All nn of you stand in a line in a particular order. Each minute, the person at the front of the line chooses either the first or the last element of the array, removes it, and keeps it for himself. He then gets out of line, and the next person in line continues the process.You are standing in the mm-th position in the line. Before the process starts, you may choose up to kk different people in the line, and persuade them to always take either the first or the last element in the array on their turn (for each person his own choice, not necessarily equal for all people), no matter what the elements themselves are. Once the process starts, you cannot persuade any more people, and you cannot change the choices for the people you already persuaded.Suppose that you're doing your choices optimally. What is the greatest integer xx such that, no matter what are the choices of the friends you didn't choose to control, the element you will take from the array will be greater than or equal to xx?Please note that the friends you don't control may do their choice arbitrarily, and they will not necessarily take the biggest element available.InputThe input consists of multiple test cases. The first line contains a single integer tt (1≤t≤10001≤t≤1000)  — the number of test cases. The description of the test cases follows.The first line of each test case contains three space-separated integers nn, mm and kk (1≤m≤n≤35001≤m≤n≤3500, 0≤k≤n−10≤k≤n−1)  — the number of elements in the array, your position in line and the number of people whose choices you can fix.The second line of each test case contains nn positive integers a1,a2,…,ana1,a2,…,an (1≤ai≤1091≤ai≤109)  — elements of the array.It is guaranteed that the sum of nn over all test cases does not exceed 35003500.OutputFor each test case, print the largest integer xx such that you can guarantee to obtain at least xx.ExampleInputCopy4\n6 4 2\n2 9 2 3 8 5\n4 4 1\n2 13 60 4\n4 1 3\n1 2 2 1\n2 2 0\n1 2\nOutputCopy8\n4\n1\n1\nNoteIn the first test case; an optimal strategy is to force the first person to take the last element and the second person to take the first element.  the first person will take the last element (55) because he or she was forced by you to take the last element. After this turn the remaining array will be [2,9,2,3,8][2,9,2,3,8];  the second person will take the first element (22) because he or she was forced by you to take the first element. After this turn the remaining array will be [9,2,3,8][9,2,3,8];  if the third person will choose to take the first element (99), at your turn the remaining array will be [2,3,8][2,3,8] and you will take 88 (the last element);  if the third person will choose to take the last element (88), at your turn the remaining array will be [9,2,3][9,2,3] and you will take 99 (the first element). Thus, this strategy guarantees to end up with at least 88. We can prove that there is no strategy that guarantees to end up with at least 99. Hence, the answer is 88.In the second test case, an optimal strategy is to force the first person to take the first element. Then, in the worst case, both the second and the third person will take the first element: you will end up with 44.",
  "tags": [
          "brute force",
          "data structures",
          "implementation"
        ],
  "code": "#Don't stalk me, don't stop me, from making submissions at high speed. If you don't trust me,\n\nimport sys\n\n#then trust me, don't waste your time not trusting me. I don't plagiarise, don't fantasize,\n\nimport os\n\n#just let my hard work synthesize my rating. Don't be sad, just try again, everyone fails\n\nfrom io import BytesIO, IOBase\n\nBUFSIZE = 8192\n\n#every now and then. Just keep coding, just keep working and you'll keep progressing at speed-\n\n# -forcing.\n\nclass FastIO(IOBase):\n\n    newlines = 0\n\n    def __init__(self, file):\n\n        self._fd = file.fileno()\n\n        self.buffer = BytesIO()\n\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n\n        while True:\n\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\n            if not b:\n\n                break\n\n            ptr = self.buffer.tell()\n\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n\n        self.newlines = 0\n\n        return self.buffer.read()\n\n    def readline(self):\n\n        while self.newlines == 0:\n\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\n            self.newlines = b.count(b\"\\n\") + (not b)\n\n            ptr = self.buffer.tell()\n\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n\n        self.newlines -= 1\n\n        return self.buffer.readline()\n\n    def flush(self):\n\n        if self.writable:\n\n            os.write(self._fd, self.buffer.getvalue())\n\n            self.buffer.truncate(0), self.buffer.seek(0)\n\nclass IOWrapper(IOBase):\n\n    def __init__(self, file):\n\n        self.buffer = FastIO(file)\n\n        self.flush = self.buffer.flush\n\n        self.writable = self.buffer.writable\n\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n#code by _Frust(CF)/Frust(AtCoder)\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\n\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\nfrom os import path\n\nif(path.exists('input.txt')):\n\n    sys.stdin = open(\"input.txt\",\"r\")\n\n    sys.stdout = open(\"output.txt\",\"w\")\n\n    input = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n\n\ninf=float(\"inf\")\n\n\n\nfor _ in range(int(input())):\n\n    # n=int(input())\n\n    n, m, k=map(int, input().split())\n\n    l1=[int(i) for i in input().split()]\n\n    ans=-inf\n\n    if k<m:\n\n        #0, 1, 2, ... k\n\n        for i in range(k+1): \n\n            temp=inf\n\n            #0, 1, 2, ... m-k-1 in total deleting m-1 elements\n\n            for j in range(m-k): \n\n                left=i+j\n\n                right=m-1-left\n\n                lele=l1[left]\n\n                rele=l1[n-right-1]\n\n                # print(left, right, lele, rele)\n\n                temp=min(max(l1[left], l1[n-(right+1)]), temp)\n\n\n\n            ans=max(ans, temp)\n\n        \n\n    else:\n\n        for i in range(m):\n\n            temp=inf\n\n            left=i\n\n            right=m-1-left\n\n            lele=l1[left]\n\n            rele=l1[n-right-1]\n\n            # print(left, right, lele, rele)\n\n            temp=min(max(l1[left], l1[n-(right+1)]), temp)\n\n            ans=max(ans, temp)\n\n    print(ans)\n\n\n\n    ",
  "language": "py"
},

There are three language in the dataset: python, c++, java, which is "py", "cpp", "java"

For further finetuing the unixcoder algorithm classification model and further inference sample, please refer to the github repo: https://github.com/AlbertQiSun/LLM-enhanced-competitive-coding-algorithm-retrieval?tab=readme-ov-file