output_description stringlengths 15 956 | submission_id stringlengths 10 10 | status stringclasses 3 values | problem_id stringlengths 6 6 | input_description stringlengths 9 2.55k | attempt stringlengths 1 13.7k | problem_description stringlengths 7 5.24k | samples stringlengths 2 2.72k |
|---|---|---|---|---|---|---|---|
Print the total amount Mr. Takaha will pay.
* * * | s533334688 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | N=int(input())
cnt=0
ans=0
max=0
while cnt<N:
cnt++
p=int(input())
ans += p
if p>max:
max=p
ans-=(max/2)
print(ans) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s634664270 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n = int(input())
s = list()
[a = int(input()) for i in range(n):]
s.add(a)
m = max(s)
print(sum(s)-m) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s364139342 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | p=[]
N=int(input())
for i in range:
p.append(int(input()))
ans=sum(p)-(max(p)2)
print(int(ans)) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s105426290 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n=int(input())
p=[]
for i in range(n):
p.append(int(input())
print(int(sum(p))-(int(max(p))/2)) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s563751006 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n = int(input())
s = []
for i in range(n):
s.append(int(input())
m = max(s)
print(sum(s)-m//2)
| Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s362439152 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | l=input()
b=list()
for i in range(l)
a=int(input())
b.append(a)
print(sum(b)-max(b)/2) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s911103071 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n=int(input())
A=[]
for i in range(n):
A.append(int(input())
A.sort()
print(sum(A)-A[-1]/2) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s363858903 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n=int(input())
l=[]
for I in range(n):
l.append(int(input())
else:
print(int(sum(l)-max(l)/2)) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s031678553 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | N = int(input())
p = []
for i in range(N):
p.append(int(input()))
print(int(sum(p)-max(p)/2)
| Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s567005765 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n = int(input())
l = [int(input()) for i in range(n)]
l = sorted(l)
print(sum(l) - l[-1]//2) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s776039338 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n = int(input())
p =[int,input().split()for i in range(n)]
m = max(p)/2
print(m+sum(p)-max(p)) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s359277197 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n = int(input())
p = [int(input()) for i in range(n)]
price = sum(p) - max(p) / 2
print(int(price) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s606327288 | Wrong Answer | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | price = [int(input()) for _ in range(int(input()))]
print(sum(price) - int(min(price) / 2))
| Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s392043929 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | N = int(input())
a = []
for i in range(N):
a.append(int(input())
print(sum(a)-max(a)//2)
| Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s512008081 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | N = int(input())
P = []
for i in range(N):
P.append(int(input())
print(sum(P) - max(P) / 2) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s744659258 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | N=int(input())
price=[int(input() for i in range(N)]
price.sort()
price[0]=price[0]//2
sum(price) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s226233335 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | N=int(input())
P=[int(input()) for _ in range(N)]
P=sorted(P)
P[N-1]=P[N-1]/2
print(int(sum(P)) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the total amount Mr. Takaha will pay.
* * * | s735084349 | Runtime Error | p03207 | Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N | n=int(input())
p=[]
for_ in range(n):
x=int(input())
p.append(x)
ans=sum(p)-(max(p) // 2)
print(ans) | Statement
In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the
i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half
the regular price. The remaining N-1 items cost their regular prices. What is
the total amount he will pay? | [{"input": "3\n 4980\n 7980\n 6980", "output": "15950\n \n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 =\n15950 yen.\n\nNote that outputs such as `15950.0` will be judged as Wrong Answer.\n\n* * *"}, {"input": "4\n 4320\n 4320\n 4320\n 4320", "output": "15120\n \n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320\n+ 4320 + 4320 = 15120 yen."}] |
Print the number of the possible sequences of the colors of the balls after
painting, modulo 10^9+7.
* * * | s729335343 | Wrong Answer | p04038 | The input is given from Standard Input in the following format:
N K | print(1)
| Statement
Snuke loves colorful balls. He has a total of N×K balls, K in each of his
favorite N colors. The colors are numbered 1 through N.
He will arrange all of the balls in a row from left to right, in arbitrary
order. Then, for each of the N colors, he will paint the leftmost ball of that
color into color 0, a color different from any of the N original colors.
After painting, how many sequences of the colors of the balls are possible?
Find this number modulo 10^9+7. | [{"input": "2 2", "output": "4\n \n\nThe following 4 sequences are possible:\n\n * (0,1,0,2)\n * (0,0,1,2)\n * (0,2,0,1)\n * (0,0,2,1)\n\n* * *"}, {"input": "3 1", "output": "1\n \n\nThe following 1 sequence is possible:\n\n * (0,0,0)\n\n* * *"}, {"input": "2 3", "output": "14\n \n\n* * *"}, {"input": "2000 2000", "output": "546381702"}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s252569931 | Accepted | p03657 | Input is given from Standard Input in the following format:
A B | print((eval(input().replace(*" *")) % 3 % 2 * "Imp" or "P") + "ossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s321463529 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b = map(int,input().split())
if a%3==0 or b%==0 or(a+b)%3==0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s533067181 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().split())
print('Possible' if ((a+b)%3==0) or (a%3==0) or(b%3==0) else 'Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s744208472 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
x = a + b
if x % 3 == 0:
print('Possible')
else('Impossidle') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s779155301 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | print("YNeos"[notA%3==0orB%3==0or(A+B)%3==0::2]) | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s909412463 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().split())
print(["Possible","Impossible"][a%3==b%3 and a%3==1 or a%3==2] | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s744232646 | Wrong Answer | p03657 | Input is given from Standard Input in the following format:
A B | n, m = list(map(int, input().split()))
print("Possible" if n % 3 or m % 3 or (n + m) % 3 else "Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s261821545 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().split())
if a %3==0 or b%3== or (a+b)%3==0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s208194660 | Wrong Answer | p03657 | Input is given from Standard Input in the following format:
A B | print(("Imp" * (sum(map(int, input().split())) % 3 > 0) or "P") + "ossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s352553747 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b = map(int,input().split())
if a%3==0 \or b%==0 \or (a+b)%3==0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s637901519 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or (a + b) % == 0 else "Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s227846968 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().split())
if a%3==0 or b%3==0: or (a+b)%3==0:
print ('Possible')
else:
print('Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s141496980 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().split())
if (a%3==0) || (b%3==0) || ((a+b)%3==0):
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s073147987 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a=list(map(int,input().split()))
b=sum(a)
if (b%3 or a[0]%3 or a[1]) !=0 :
print('Impossible')
elif :
print('Possible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s591442002 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b = map(int,input().split())
if a%3==0 or\ b%==0 or\ (a+b)%3==0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s297084073 | Accepted | p03657 | Input is given from Standard Input in the following format:
A B | #
# abc067 a
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdout.read()[:-1]
sys.stdout, sys.stdin = stdout, stdin
self.assertEqual(out, output)
def test_入力例_1(self):
input = """4 5"""
output = """Possible"""
self.assertIO(input, output)
def test_入力例_2(self):
input = """1 1"""
output = """Impossible"""
self.assertIO(input, output)
def resolve():
A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
print("Possible")
else:
print("Impossible")
if __name__ == "__main__":
# unittest.main()
resolve()
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s701566928 | Accepted | p03657 | Input is given from Standard Input in the following format:
A B | import sys
import math
import collections
import itertools
import array
import inspect
# Set max recursion limit
sys.setrecursionlimit(1000000)
# Debug output
def chkprint(*args):
names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}
print(", ".join(names.get(id(arg), "???") + " = " + repr(arg) for arg in args))
# Binary converter
def to_bin(x):
return bin(x)[2:]
def li_input():
return [int(_) for _ in input().split()]
def gcd(n, m):
if n % m == 0:
return m
else:
return gcd(m, n % m)
def gcd_list(L):
v = L[0]
for i in range(1, len(L)):
v = gcd(v, L[i])
return v
def lcm(n, m):
return (n * m) // gcd(n, m)
def lcm_list(L):
v = L[0]
for i in range(1, len(L)):
v = lcm(v, L[i])
return v
# Width First Search (+ Distance)
def wfs_d(D, N, K):
"""
D: 隣接行列(距離付き)
N: ノード数
K: 始点ノード
"""
dfk = [-1] * (N + 1)
dfk[K] = 0
cps = [(K, 0)]
r = [False] * (N + 1)
r[K] = True
while len(cps) != 0:
n_cps = []
for cp, cd in cps:
for i, dfcp in enumerate(D[cp]):
if dfcp != -1 and not r[i]:
dfk[i] = cd + dfcp
n_cps.append((i, cd + dfcp))
r[i] = True
cps = n_cps[:]
return dfk
# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
"""
v: 現在のノード
pre: 1つ前のノード
dist: 現在の距離
以下は別途用意する
D: 隣接リスト(行列ではない)
D_dfs_d: dfs_d関数で用いる,始点ノードから見た距離リスト
"""
global D
global D_dfs_d
D_dfs_d[v] = dist
for next_v, d in D[v]:
if next_v != pre:
dfs_d(next_v, v, dist + d)
return
# --------------------------------------------
dp = None
def main():
A, B = li_input()
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
print("Possible")
else:
print("Impossible")
main()
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s422996522 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=input().split()
a=int(a)
b=int(b)
if ((a+b)%3)==0:
print("Possible")
else:
if (a%3)==0:
print("Possible")
else:
if (b%3)==0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s668868998 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | if __name__ == "__main__":
alls = int(input())
num_src = input().split(" ")
num_cards = []
ans = 0
for i in num_src:
num_cards.append(int(i))
ans += abs(int(i))
x = 0
y = 0
for i in range(0, alls - 1):
x = 0
y = 0
for j in range(0, alls):
if j <= i:
x += num_cards[j]
else:
y += num_cards[j]
if y < x:
tmp = abs(x - y)
else:
tmp = abs(y - x)
if tmp < ans:
ans = tmp
print(ans)
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s304255349 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
# intは入力に対しての関数、出力ではない
if (a+b)%3 => 0:
print("Possible")
elif a%3 => 0:
print("Possible")
elif b%3 => 0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s269581279 | Accepted | p03657 | Input is given from Standard Input in the following format:
A B | print(["P", "Imp"][eval(input().replace(" ", "*")) % 3 % 2] + "ossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s686983483 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A,B=map(int,input().split())
print('Possible' for (A+B)%3==0 or A%3==0 or B%3==0 else 'Impossible')
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s770973815 | Wrong Answer | p03657 | Input is given from Standard Input in the following format:
A B | n = sum(map(int, input().split()))
print(["Impossible", "Possible"][n % 3 == 0 and n != 0])
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s493985084 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
if a%3==0 or b%==0 of (a+b)%==0:
print('Possible')
else:
print('Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s712226669 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | sys.setrecursionlimit(1500)
import math
def gcd(a, b):
"""Compute the greatest common divisor of a and b"""
while b > 0:
a, b = b, a % b
return a
def lcm(a, b):
"""Compute the lowest common multiple of a and b"""
return a * b / gcd(a, b)
N = int(input())
# Y,P,i
adj = {}
for i in range(N):
adj[i] = []
for i in range(N - 1):
a, b = list(map(int, input().split(" ")))
adj[a - 1].append(b - 1)
adj[b - 1].append(a - 1)
length_from_1 = [0] * N
length_from_N = [0] * N
def dfs(s, d, visited, d_list):
d_list[s] = d
visited.add(s)
for next_node in adj[s]:
if next_node not in visited:
dfs(next_node, d + 1, visited, d_list)
dfs(0, 0, set([]), length_from_1)
dfs(N - 1, 0, set([]), length_from_N)
# [0, 1, 1, 1, 3, 2, 2]
# [2, 3, 3, 1, 1, 4, 0]
snuke = 0
fennec = 0
for i in range(N):
if length_from_1[i] <= length_from_N[i]:
fennec += 1
else:
snuke += 1
if fennec > snuke:
print("Fennec")
else:
print("Snuke")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s546478317 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | N = int(input())
l = list(map(int, input().split()))
Sum = sum(l)
print(Sum)
a = Sum / 2
b = 0
c = 0
if Sum > 0:
for i in range(len(l)):
b += l[i]
if b > a:
c = b - l[i]
break
if Sum < 0:
for i in range(len(l)):
b += l[i]
if b < a:
c = b - l[i]
break
if c == 0:
c = l[0]
print(abs(c - (Sum - c)))
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s802335151 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | N = int(input())
an = list(map(int, input().split()))
s = sum(an)
h = s / 2
f = int(N / 2)
x = sum(an[:f])
y = s - x
z = abs(x - y)
for i in range(f):
if f + 1 >= N:
break
t1 = x + an[f + 1]
t2 = y - an[f + 1]
t3 = x - an[f - 1]
t4 = y + an[f - 1]
print(t1, t2)
k1 = abs(t1 - t2)
k2 = abs(t3 - t4)
p = 0
k = min(k1, k2)
if k1 > k2:
p = -1
else:
p = 1
if z > k:
f = f + p
z = k
else:
break
print(z)
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s674398334 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | # coding=UTF-8
N = int(input())
moti = list(range(0, N, 1))
# initalize
for idx in range(0, N, 1):
moti[idx] = []
# input
for idx in range(0, N - 1, 1):
mozir = input()
hyo = mozir.split(" ")
a = int(hyo[0]) - 1
b = int(hyo[1]) - 1
moti[a].append(b)
moti[b].append(a)
# path 0 to N-1
# width serach
belong = list(range(0, N, 1))
for idx in range(0, N, 1):
belong[idx] = None
belong[0] = "F"
belong[N - 1] = "S"
fennec_watch = [0]
sunuke_watch = [N - 1]
fennec_haven = 1
sunuke_haven = 1
fennec_zou = 1 # for breaking cond
sunuke_zou = 1 # also
Teban = "F"
while True:
if Teban == "F":
fennec_next = []
for mono in fennec_watch:
kouho = moti[mono]
for butu in kouho:
if belong[butu] == None:
fennec_next.append(butu)
belong[butu] = "F"
fennec_watch = fennec_next
fennec_zou = len(fennec_next)
fennec_haven = fennec_haven + fennec_zou
else:
sunuke_next = []
for mono in sunuke_watch:
kouho = moti[mono]
for butu in kouho:
if belong[butu] == None:
sunuke_next.append(butu)
belong[butu] = "S"
sunuke_watch = sunuke_next
sunuke_zou = len(sunuke_next)
sunuke_haven = sunuke_haven + sunuke_zou
if fennec_zou == 0 and sunuke_zou == 0:
break
Teban = "F" if Teban == "S" else "S"
# when fennec_haven==sunuke_haven==k
# k+1 th turn fennec 33-4
if fennec_haven > sunuke_haven:
print("Fennec")
else:
print("Snuke")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s238740213 | Accepted | p03657 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input().split(" "))
msg = "Possible" if (A % 3) * (B % 3) * ((A + B) % 3) == 0 else "Impossible"
print(msg)
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s928183677 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | print("Possible" if sum(list(map(int, input()))) % 3 == 0 else "Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s777334457 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | print("Impossible" if sum(map(int, input.split())) % 3 else "Possible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s377559394 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b = map(int, input().split())
if (a+b) % :
print("Impossible")
else:
print("Possible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s749221110 | Wrong Answer | p03657 | Input is given from Standard Input in the following format:
A B | print(["Impossible", "Possible"][sum(map(int, input().split())) % 3 == 0])
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s446002144 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A,B=map(int,input().split())
print(["Possible","Impossible][bool(A*B*(A+B))]) | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s818207636 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = mpa(int, input().split())
print("Possible" if (a % 3 == 0 or b % 3 == 0 or a + b % 3 == 0) else "Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s594028412 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b = map(int,input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
print('Possible')
else:
print('Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s085658569 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split(" "))
if (a%3 ==0) or (b%3 ==0) or ((a+b)%3 ==0)):
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s347510547 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
if a % 3 == 0 or b % 3 == 0 or (a*b) % == 0 :
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s774491455 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
s = a + b
if a%3 == 0 or b%3 == 0 or s%3 == 0:
print('Possible')
else:
print('Impossible) | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s371557094 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
a + b = k
a // 3 = m
b // 3 = n
k // 3 = r
if m == 0 or n == 0 or r == 0:
print("Possible")
else:
print("Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s911116214 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A,B = map(int, input().split())
print('Possible' if A % 3 = 0 or B % 3 = 0 or (A + B) % 3 = 0 else 'Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s408310314 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
if a%3==0 or b%3==0 or (a+b)%==0:
print('Possible')
else:
print('Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s368641005 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A,B = map(int,input().split())
if (A % 3 == 0) or(B%3==0) or((A+B)%3==):
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s004519343 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=int(input().split())
if (a%3==0) || (b%3==0) || ((a+b)%3==0):
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s256946990 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
if a%3 = 0 or b%3 == 0 or (a+b)%3 == 0:
print('Possible')
else:
print('Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s775250112 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=map(int, input().split())
if (a+b)%3 ==0 or a%==0 or b%==0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s724530106 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | def cookies(A,B):
if A%3==0 or B%3==0 or (A+B)%3==0:
return 'Possible'
else:
return 'Impossible | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s000798453 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | N, K = map(int, input().split(" "))
nums = map(int, input().split(" "))
nums = sorted(nums, reverse=True)
print(sum(nums[0:K]))
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s341037141 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | (a, b) = (int(tok) for tok in input().split())
print("Possible" if any(s % 3 == 0 for s in [a, b, a + b] else "Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s041417757 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
if a%3==0 or b%3==0 of (a+b)%==0:
print('Possible')
else:
print('Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s980646730 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input().split())
print("No")
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
print("Possible")
else:
print("Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s934613119 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
print("Possible")
else:
print("Impossible")a,b=int(input())
if a%3==0 or b%3==0 or (a+b)%3==0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s604773408 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = input().split(' ')
c = int(a) + int(b)
if (a%3==0 and a > 3) or (b%3==0&&b>3) or (c%3==0 &&c>3):
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s219519854 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | data = list(map(int, input().split())
if data[0]%3==0 or data[1]%3==0 or (data[0]+data[1])%3==0:
print("Possible")
else:
print("Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s108441109 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B |
A,B = map(int, input().split())
if A%3 == 0:
print('Possible')
elif B%3 == 0:
print('Possible')
elif (A+B)%3 == 0:
print('Possible')
else:
print('Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s221322613 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | def main():
goats =3
n = input()
list = [int(i) for i in input().split()]
if (list[0]%3==0 or list[1] %3==0 or (list[0]+list[1])%3==0):
print('Possible')
else:
print("Impossible")
if __name__ == "__main__":
main() | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s191952505 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | def main():
goats =3
n = input()
list = [int(i) for i in input().split()]
if (list[0]%3==0 or list[1] %3==0 or (list[0]+list[2])%3==0):
print('Possible')
else:
print("Impossible")
if __name__ == "__main__":
main() | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s662490622 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | Imp = <STDIN>
A = Imp[0]
B = Imp[1]
re = 0
if A % 3 == 0:
re = 1
if B % 3 == 0:
re = 1
if (A+B) % 3 == 0:
re = 1
if re ==1:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s122436355 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | re = 0
if A % 3 == 0:
re = 1
if B % 3 == 0:
re = 1
if (A+B) % 3 == 0:
re = 1
if re ==1:
return "Possible"
else:
return "Impossible" | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s371073131 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | def main():
N = int(input())
tree = [[] for i in range(N)]
for n in range(N - 1):
a, b = map(lambda x: int(x) - 1, input().split())
tree[a].append(b)
tree[b].append(a)
# print(np.array(tree))
Q = [(x, [0, x], 0) for x in tree[0]]
reached = [1] + [0] * (N - 2) + [0]
while len(Q) > 0:
new_pos, root, cost = Q.pop()
reached[new_pos] = 1
if new_pos == N - 1:
break
# add to Q
for p in tree[new_pos]:
new_root = root[:]
if reached[p] == 0:
new_root.append(p)
Q.append((p, new_root, cost + 1))
l = math.ceil(len(root) / 2) - 1
r = l + 1
# print(root, l, r)
tree[root[l]].remove(root[r])
tree[root[r]].remove(root[l])
# print(tree, tree)
F = tree[0]
S = tree[N - 1]
reached = [1] + [0] * (N - 2) + [1]
while True:
if len(F) == 0:
print("Snuke")
break
else:
pos = F.pop()
reached[pos] = 1
for p in tree[pos]:
if reached[p] == 0:
F.append(p)
if len(S) == 0:
print("Fennec")
break
else:
pos = S.pop()
reached[pos] = 1
for p in tree[pos]:
if reached[p] == 0:
S.append(p)
if __name__ == "__main__":
# global stime
# stime = time.clock()
main()
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s975474731 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = int(input()), int(input())
print("Possible" if a * b * (a + b) % 3 == 0 else "Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s783511661 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A,B = map(int,input().split())
if A + B % == 0 and A + B != 0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s394916087 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A,B=map(int,input().split())
if A%3==0 or B%3== or (A+B)%3==0:
print("Possible")
else:
print("Impossible") | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s987137339 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a,b=map(int,input().split());print('Possible' if a%3==0 else 'Possible' if b%3==0 else 'Possible' (a+b)%3==0 else 'Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s506827700 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | a, b = map(int, input().split())
a + b = k
a // 3 = m
b // 3 = n
k // 3 = r
if m == 0 or n == 0 or r == 0:
print("Possible")
else:
print("Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s518282494 | Accepted | p03657 | Input is given from Standard Input in the following format:
A B | (a, b) = (int(tok) for tok in input().split())
print("Possible" if any(s % 3 == 0 for s in [a, b, a + b]) else "Impossible")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s394115631 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A,B = map(int, input().split())
print('Possible' if (A % 3 = 0) or (B % 3 = 0) or ((A + B) % 3 = 0) else 'Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s599487229 | Runtime Error | p03657 | Input is given from Standard Input in the following format:
A B | A,B = map(int,input().split())
if A%3==0 or B%3==0 or (A+B)%==0:
print('Possible')
else:
print('Impossible') | Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
If it is possible to give cookies so that each of the three goats can have the
same number of cookies, print `Possible`; otherwise, print `Impossible`.
* * * | s126762222 | Accepted | p03657 | Input is given from Standard Input in the following format:
A B | a = [int(_) for _ in input().split()]
if all(1 <= item <= 100 for item in a):
print(
"Possible"
if 0 == a[0] % 3 or 0 == a[1] % 3 or 0 == (a[0] + a[1]) % 3
else "Impossible"
)
else:
print("hoge!")
| Statement
Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B
cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he
cannot open the tins).
Your task is to determine whether Snuke can give cookies to his three goats so
that each of them can have the same number of cookies. | [{"input": "4 5", "output": "Possible\n \n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\n* * *"}, {"input": "1 1", "output": "Impossible\n \n\nSince there are only two cookies, the three goats cannot have the same number\nof cookies no matter what Snuke gives to them."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s140279177 | Accepted | p02945 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input().split())
# print(A, B, C)
ans1 = A + B
ans2 = A - B
ans3 = A * B
print(max(max(ans1, ans2), ans3))
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s971004585 | Accepted | p02945 | Input is given from Standard Input in the following format:
A B | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1):
return int(-(-x // y))
def INT():
return int(input())
def MAP():
return map(int, input().split())
def LIST():
return list(map(int, input().split()))
def Yes():
print("Yes")
def No():
print("No")
def YES():
print("YES")
def NO():
print("NO")
sys.setrecursionlimit(10**9)
INF = float("inf")
MOD = 10**9 + 7
A, B = MAP()
print(max(A + B, A - B, A * B))
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s035678142 | Accepted | p02945 | Input is given from Standard Input in the following format:
A B | a1 = input()
res = [i for i in a1.split()]
A, B = [float(res[i]) for i in (0, 1)]
a, b = A.is_integer(), B.is_integer()
if a and b == True and -100 <= (A and B) <= 100:
A, B = int(A), int(B)
x = A + B
y = A - B
z = A * B
print(max(x, y, z))
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s451321042 | Accepted | p02945 | Input is given from Standard Input in the following format:
A B | integer1, integer2 = map(int, input().split())
if integer1 + integer2 >= integer1 - integer2:
if integer1 + integer2 >= integer1 * integer2:
print(integer1 + integer2)
else:
print(integer1 * integer2)
elif integer1 - integer2 >= integer1 * integer2:
print(integer1 - integer2)
else:
print(integer1 * integer2)
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s076159436 | Runtime Error | p02945 | Input is given from Standard Input in the following format:
A B | N = int(input())
s = []
for i in range(0, N):
a = input()
s.append(sorted(a))
t = 0
while len(s) > 0:
a = s.count(s[0])
if a == 1:
continue
else:
a = (a * (a - 1)) / 2
t = t + a
s.remove(s[0])
print(t)
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s177274172 | Runtime Error | p02945 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input())
print(max(A * B, A - B, A + B))
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s425692071 | Accepted | p02945 | Input is given from Standard Input in the following format:
A B | A, B = (int(x) for x in input().split())
list = [A + B, A - B, A * B]
list.sort()
print(list[2])
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s386295741 | Runtime Error | p02945 | Input is given from Standard Input in the following format:
A B | s = list(map(int, input().split()))
t = max(s[0] + s[1], s[0] - s[1], s[0] * s[1], s[0] / s[1])
print(t)
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s611708979 | Accepted | p02945 | Input is given from Standard Input in the following format:
A B | i = list(map(int, input().split()))
a = i[0] + i[1]
b = i[0] - i[1]
c = i[0] * i[1]
if a >= b and a >= c:
print(a)
elif b >= a and b >= c:
print(b)
else:
print(c)
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s017884302 | Runtime Error | p02945 | Input is given from Standard Input in the following format:
A B | num1 = int(input())
num2 = int(input())
num3 = num1 + num2
num4 = num1 - num2
num5 = num1 * num2
num6 = [num3, num4, num5]
print(max(num6))
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s991019173 | Accepted | p02945 | Input is given from Standard Input in the following format:
A B | A, B = map(int, input().split())
num = []
num.append(A + B)
num.append(A - B)
num.append(A * B)
num.sort()
print(num[2])
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Print the largest number among A + B, A - B, and A \times B.
* * * | s598346747 | Accepted | p02945 | Input is given from Standard Input in the following format:
A B | input_A, input_B = [int(x) for x in input().split()]
print(max([input_A + input_B, input_A - input_B, input_A * input_B]))
| Statement
We have two integers: A and B.
Print the largest number among A + B, A - B, and A \times B. | [{"input": "-13 3", "output": "-10\n \n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is\n-10.\n\n* * *"}, {"input": "1 -33", "output": "34\n \n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\n* * *"}, {"input": "13 3", "output": "39\n \n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39."}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.