User: def plan(day, task):
    if day > task:
        return -1
    elif day==0 or task==0:
        return -1
    else:
        list_task = []
        if task % day == 0:
                add = task // day
                for i in range(day):
                    list_task.append(add)
        else:
                add = task // day
                for i in range(0,day-1):
                    list_task.append(add)

                list_task.append(add+1)

        return list_task

a = int(input())
for i in range(a):
    day, task = map(int, input().split())
    new = plan(day, task)
    if new != -1:
        print(*new)
    else:
        print(new)

поменяй
Assistant: The provided code defines a function `plan()` that distributes tasks over a number of days. The function checks if the number of days and tasks are valid, and then returns a list indicating how many tasks are to be completed each day. If the distribution isn't possible, it returns `-1`.

Let's walk through how the code works and then improve and simplify it:

1. **Input Validation:** The function checks if the number of days is greater than the number of tasks or if either value is zero, returning `-1` for invalid input.

2. **Task Distribution:** If the tasks can be distributed evenly among the days, it calculates the number of tasks per day and creates a list with this distribution. If the tasks cannot be evenly distributed, it spreads them as evenly as possible, assigning the remaining tasks to the last day.

3. **Output:** For each test case, it prints the distribution of tasks or `-1` if the input is invalid.

The code is already functional, but can be clarified and potentially made more concise. Here's an improved version:

```python
def plan(day, task):
    if day <= 0 or task <= 0 or day > task:
        return -1
    
    tasks_per_day = task // day
    remainder = task % day
    list_task = [tasks_per_day] * day
    
    for i in range(remainder):
        list_task[i] += 1
    
    return list_task

a = int(input("Enter number of test cases: "))
for _ in range(a):
    day, task = map(int, input("Enter days and tasks: ").split())
    distribution = plan(day, task)
    if distribution != -1:
        print(*distribution)
    else:
        print(distribution)
```

### Key Adjustments:

- **Input Validation:** Consolidated conditions for invalid input using `if day <= 0 or task <= 0 or day > task`.

- **Remainder Distribution:** Instead of handling remainder tasks separately at the end, the code spreads them across the beginning of the list. This ensures a more even distribution directly.

- **User Interaction:** Added prompts to input calls for clarity when running the script.

- **Readability:** Improved variable naming and structure for easier understanding.
User: def plan(day, task):
    if day > task:
        return -1
    elif day==0 or task==0:
        return -1
    else:
        list_task = []
        if task % day == 0:
                add = task // day
                for i in range(day):
                    list_task.append(add)
        else:
                add = task // day
                for i in range(0,day-1):
                    list_task.append(add)

                list_task.append(add+1)

        return list_task

a = int(input())
for i in range(a):
    day, task = map(int, input().split())
    new = plan(day, task)
    if new != -1:
        print(*new)
    else:
        print(new)

поменяй мой код так
возьмем пример
5 15
вывод: 1 2 3 4 5
Assistant: