[GH-ISSUE #579] 输出停不下来怎么办 #464

Closed
opened 2026-10-26 21:21:44 +00:00 by bsakaguchi · 8 comments
Owner

Originally created by @Painkillerzzz on GitHub (Mar 18, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/579

使用transformers库本地推理,do_sample关掉
输入:

Provide a Python solution for the following competitive programming question: Three little pigs from all over the world are meeting for a convention! Every minute, a triple of 3 new pigs arrives on the convention floor. After the n-th minute, the convention ends.

The big bad wolf has learned about this convention, and he has an attack plan. At some minute in the convention, he will arrive and eat exactly x pigs. Then he will get away.

The wolf wants Gregor to help him figure out the number of possible attack plans that involve eating exactly x pigs for various values of x (1 ≤ x ≤ 3n). Two attack plans are considered different, if they occur at different times or if the sets of little pigs to eat are different.

Note that all queries are independent, that is, the wolf does not eat the little pigs, he only makes plans!

Input

The first line of input contains two integers n and q (1 ≤ n ≤ 10^6, 1 ≤ q ≤ 2⋅ 10^5), the number of minutes the convention lasts and the number of queries the wolf asks.

Each of the next q lines contains a single integer x_i (1 ≤ x_i ≤ 3n), the number of pigs the wolf will eat in the i-th query.

Output

You should print q lines, with line i representing the number of attack plans if the wolf wants to eat x_i pigs. Since each query answer can be large, output each answer modulo 10^9+7.

Examples

Input


2 3
1
5
6


Output


9
6
1


Input


5 4
2
4
6
8


Output


225
2001
6014
6939

Note

In the example test, n=2. Thus, there are 3 pigs at minute 1, and 6 pigs at minute 2. There are three queries: x=1, x=5, and x=6.

If the wolf wants to eat 1 pig, he can do so in 3+6=9 possible attack plans, depending on whether he arrives at minute 1 or 2.

If the wolf wants to eat 5 pigs, the wolf cannot arrive at minute 1, since there aren't enough pigs at that time. Therefore, the wolf has to arrive at minute 2, and there are 6 possible attack plans.

If the wolf wants to eat 6 pigs, his only plan is to arrive at the end of the convention and devour everybody.

Remember to output your answers modulo 10^9+7!.

Your code should be enclosed in triple backticks like so: ```python
YOUR CODE HERE```. Use the backticks for your code only.

模型输出了8096个token之后还没有出现```python...,请问有没有什么解决办法?还是我使用得不太对?

Originally created by @Painkillerzzz on GitHub (Mar 18, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/579 使用transformers库本地推理,do_sample关掉 输入: ``` Provide a Python solution for the following competitive programming question: Three little pigs from all over the world are meeting for a convention! Every minute, a triple of 3 new pigs arrives on the convention floor. After the n-th minute, the convention ends. The big bad wolf has learned about this convention, and he has an attack plan. At some minute in the convention, he will arrive and eat exactly x pigs. Then he will get away. The wolf wants Gregor to help him figure out the number of possible attack plans that involve eating exactly x pigs for various values of x (1 ≤ x ≤ 3n). Two attack plans are considered different, if they occur at different times or if the sets of little pigs to eat are different. Note that all queries are independent, that is, the wolf does not eat the little pigs, he only makes plans! Input The first line of input contains two integers n and q (1 ≤ n ≤ 10^6, 1 ≤ q ≤ 2⋅ 10^5), the number of minutes the convention lasts and the number of queries the wolf asks. Each of the next q lines contains a single integer x_i (1 ≤ x_i ≤ 3n), the number of pigs the wolf will eat in the i-th query. Output You should print q lines, with line i representing the number of attack plans if the wolf wants to eat x_i pigs. Since each query answer can be large, output each answer modulo 10^9+7. Examples Input 2 3 1 5 6 Output 9 6 1 Input 5 4 2 4 6 8 Output 225 2001 6014 6939 Note In the example test, n=2. Thus, there are 3 pigs at minute 1, and 6 pigs at minute 2. There are three queries: x=1, x=5, and x=6. If the wolf wants to eat 1 pig, he can do so in 3+6=9 possible attack plans, depending on whether he arrives at minute 1 or 2. If the wolf wants to eat 5 pigs, the wolf cannot arrive at minute 1, since there aren't enough pigs at that time. Therefore, the wolf has to arrive at minute 2, and there are 6 possible attack plans. If the wolf wants to eat 6 pigs, his only plan is to arrive at the end of the convention and devour everybody. Remember to output your answers modulo 10^9+7!. Your code should be enclosed in triple backticks like so: ```python YOUR CODE HERE```. Use the backticks for your code only. ``` 模型输出了8096个token之后还没有出现```python...,请问有没有什么解决办法?还是我使用得不太对?
bsakaguchi 2026-10-26 21:21:44 +00:00
Author
Owner

@Painkillerzzz commented on GitHub (Mar 18, 2025):

模型使用的是DeepSeek-R1-Distill-Llama-8B

<!-- gh-comment-id:2731375448 --> @Painkillerzzz commented on GitHub (Mar 18, 2025): 模型使用的是DeepSeek-R1-Distill-Llama-8B
Author
Owner

@ElementQi commented on GitHub (Mar 18, 2025):

试一试temperature=0.6,top_p=0.95。
要么再加长一点output token length

---原始邮件---
发件人: "Xiangyu @.>
发送时间: 2025年3月18日(周二) 上午9:49
收件人: @.
>;
抄送: @.***>;
主题: Re: [deepseek-ai/DeepSeek-R1] 输出停不下来怎么办 (Issue #579)

模型使用的是DeepSeek-R1-Distill-Llama-8B

—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
Painkillerzzz left a comment (deepseek-ai/DeepSeek-R1#579)

模型使用的是DeepSeek-R1-Distill-Llama-8B

—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: @.***>

<!-- gh-comment-id:2731379052 --> @ElementQi commented on GitHub (Mar 18, 2025): 试一试temperature=0.6,top_p=0.95。 要么再加长一点output token length ---原始邮件--- 发件人: "Xiangyu ***@***.***&gt; 发送时间: 2025年3月18日(周二) 上午9:49 收件人: ***@***.***&gt;; 抄送: ***@***.***&gt;; 主题: Re: [deepseek-ai/DeepSeek-R1] 输出停不下来怎么办 (Issue #579) 模型使用的是DeepSeek-R1-Distill-Llama-8B — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: ***@***.***&gt; Painkillerzzz left a comment (deepseek-ai/DeepSeek-R1#579) 模型使用的是DeepSeek-R1-Distill-Llama-8B — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: ***@***.***&gt;
Author
Owner

@Painkillerzzz commented on GitHub (Mar 18, 2025):

试一试temperature=0.6,top_p=0.95。
要么再加长一点output token length

第二点我会试一试,但第一点我是想拿到greedy(deterministic)的结果,所以不太能把temperature调上去

<!-- gh-comment-id:2731382945 --> @Painkillerzzz commented on GitHub (Mar 18, 2025): > 试一试temperature=0.6,top_p=0.95。 > 要么再加长一点output token length 第二点我会试一试,但第一点我是想拿到greedy(deterministic)的结果,所以不太能把temperature调上去
Author
Owner

@Painkillerzzz commented on GitHub (Mar 18, 2025):

有没有可能是我没遵循官方的prompt模板,这个影响有这么大吗

<!-- gh-comment-id:2731384051 --> @Painkillerzzz commented on GitHub (Mar 18, 2025): 有没有可能是我没遵循官方的prompt模板,这个影响有这么大吗
Author
Owner

@CC605 commented on GitHub (Apr 14, 2025):

你好,问题解决了吗,我这里也是重复内容输出,导致无法停下来

<!-- gh-comment-id:2801483517 --> @CC605 commented on GitHub (Apr 14, 2025): 你好,问题解决了吗,我这里也是重复内容输出,导致无法停下来
Author
Owner

@Painkillerzzz commented on GitHub (Apr 14, 2025):

并没有,可能rm只能类似temperature=0.6,top_p=0.95来采样,不支持greedy?因此我就没有再往下尝试了qwq

<!-- gh-comment-id:2803093796 --> @Painkillerzzz commented on GitHub (Apr 14, 2025): 并没有,可能rm只能类似temperature=0.6,top_p=0.95来采样,不支持greedy?因此我就没有再往下尝试了qwq
Author
Owner

@github-actions[bot] commented on GitHub (May 15, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this issue is still relevant, please leave a comment to keep it open. Thank you for your contributions!

<!-- gh-comment-id:2881866395 --> @github-actions[bot] commented on GitHub (May 15, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this issue is still relevant, please leave a comment to keep it open. Thank you for your contributions!
Author
Owner

@github-actions[bot] commented on GitHub (Jun 11, 2025):

false

<!-- gh-comment-id:2960852944 --> @github-actions[bot] commented on GitHub (Jun 11, 2025): false
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-R1#464
No description provided.