20240714


It's annoying to be disputed without clear evidence or understanding of the topic.

I also feel jittery when software engineers with a couple of years of experience don't understand how git works and can't touch commit histories, lacking the knowledge of git rebase or other common commands. - but it's also true that I lack common knowledge of software engineering in some parts, and great people think I'm a random moron. - For example, it seems most successful software engineers (especially in Japan) are very good at competitive programming, which I'm trying to catch up with.

It was fun contributing to my friend's GitHub repository, but I'm withdrawing. I better charge if I continue to provide insights or guide tasks.


Wheel, the binary distribution format for Python packages

Binary distribution format

A wheel is a ZIP-format archive with a specially formatted file name and the .whl extension. It contains a single distribution nearly as it would be installed according to PEP 376 with a particular installation scheme. Although a specialized installer is recommended, a wheel file may be installed by simply unpacking into site-packages with the standard ‘unzip’ tool while preserving enough information to spread its contents out onto their final paths at any later time.

Wheel is a format for binary distrubition, and using it is highly recommended to distribute, for example, publish a package to PyPI.

Publishing a binary distribution to PyPI using PDM

Build and Publish

If you are developing a library, after adding dependencies to your project, and finishing the coding, it’s time to build and publish your package. It is as simple as one command:

pdm publish

This will automatically build a wheel and a source distribution(sdist), and upload them to the PyPI index.

1992B. Angry Monk

To make one number as a result, the (num of operations required) - 1th is (1, _) or (_, 1). And its previous step is (1, 1, _)… and so on. to combine all the numbers, we need to break all the numbers greater than 1 down except for one number to combine 1 to.

For example, to combine (1, 5, 1, 7), we first need to make 5 -> 1 * 5 or 7 -> 1 * 7.

To minimize the number of the operations, we can pick the largest number and convert the rest into 1s.

def solve(k: int, a: list[int]) -> int:
    imax = -1
    valmax = -1
    for i in range(k):
        if a[i] > valmax:
            imax = i
            valmax = a[i]

    res = 0
    for i in range(k):
        if i == imax:
            continue
        res += 1 + (a[i] - 1) * 2
    return res


for _ in range(int(input())):
    n, k = map(int, input().split())
    a: list[int] = list(map(int, input().split()))
    res: int = solve(k, a)
    print(res)

Codeforces Round 957 Editorial -> if you want to check more detailed explanation

Red Green Refactor (seems to equal TDD, Test-Driven Development)

Read => Write tests that fail Green => Make the tests pass with minimal changes Refactor => Improve the code structure while avoiding changing the test results


Ketone 40 mg/dl

Cheese 10g Snacks 10g Salad 10g Bacon Egg

Total carbohydrate 40g


MUST:

TODO:


index 20240713 20240715