problem_id
stringlengths 6
6
| user_id
stringlengths 10
10
| time_limit
float64 1k
8k
| memory_limit
float64 262k
1.05M
| problem_description
stringlengths 48
1.55k
| codes
stringlengths 35
98.9k
| status
stringlengths 28
1.7k
| submission_ids
stringlengths 28
1.41k
| memories
stringlengths 13
808
| cpu_times
stringlengths 11
610
| code_sizes
stringlengths 7
505
|
---|---|---|---|---|---|---|---|---|---|---|
p03254 | u735211927 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in sorted(a):\n x -= i\n if x < 0:\n print(counter)\n else:\n counter += 1\n if counter == n:\n print(n)', 'n, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in a.sort():\n x -= i\n if x <0:\n print(counter)\n else:\n counter += 1', 'n, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in sorted(a):\n if counter == n and x>0:\n print(n-1)\n elif counter == n and x==0:\n print(n)\n x -= i\n counter += 1\n if x < 0:\n print(counter-1)', 'n, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in sorted(a):\n x -= i\n if x < 0:\n print(counter)\n else:\n counter += 1\n if counter == n:\n print(n)\nn, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in sorted(a):\n x -= i\n if x <= 0:\n print(counter)\n else:\n counter += 1\n if counter == n:\n print(n)\n', 'n, x = map(int, input().split())\na = []\nfor i in range(n):\n k = input().split()[i]\n a.append(int(k))\ncounter = 0\nfor i in a.sort():\n x -= i\n if x <0:\n print(counter)\n else:\n counter += 1', 'n, x = map(int, input( ).split())\na = []\nfor i in range(n):\n k = input().split( )[i]\n a.append(int(k))\ncounter = 0\nfor i in a.sort():\n x -= i\n if x <0:\n print(counter)\n else:\n counter += 1', 'n, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in sorted(a):\n x -= i\n if x <= 0:\n print(counter)\n else:\n counter += 1\n if counter == n:\n print(n)', 'n, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in sorted(a):\n x -= i\n counter += 1\n if x<0:\n print(counter-1)\n break\n elif x==0:\n print(counter)\n break\n else:\n if counter==n:\n print(counter-1)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s174116367', 's445754869', 's503274602', 's550701771', 's761152333', 's825290245', 's962925998', 's929373973'] | [3060.0, 2940.0, 3060.0, 3064.0, 3060.0, 3060.0, 3064.0, 3060.0] | [17.0, 17.0, 17.0, 18.0, 17.0, 17.0, 17.0, 18.0] | [198, 164, 243, 399, 197, 199, 199, 258] |
p03254 | u740284863 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\nfor i in a:\n if x - i >= 0:\n x -= i\n ans += 1\n else:\n break\nprint(ans)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\nif sum(a) == x:\n ans = n\nelif sum(a) < x:\n ans = n - 1\nelse:\n for i in range(n):\n if a[i] <= x:\n ans += 1\n x -= a[i]\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s203161711', 's667213072'] | [3060.0, 3060.0] | [17.0, 17.0] | [180, 249] |
p03254 | u742729271 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans=0\nfor i in range(N)\n x = x-a[i]\n if x>=0:\n ans+=1\n else:\n break\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans=0\nfor i in range(N):\n x = x-a[i]\n if x>=0:\n ans+=1\n else:\n break\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans=0\nfor i in range(N):\n x = x-a[i]\n if x>=0:\n ans+=1\n else:\n break\nif x>0:\n print(ans-1)\nelse:\n print(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s111692640', 's451199412', 's616855244'] | [2940.0, 2940.0, 3060.0] | [17.0, 18.0, 18.0] | [165, 166, 197] |
p03254 | u746154235 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x=map(int, input().split())\nA=sorted(list(map(int, input().split())))\ncnt=0\nfor i in A:\n if x >= i:\n x -= i\n cnt+=1\n else:\n break\nprint(cnt)\n', 'N,x=map(int, input().split())\nA=sorted(list(map(int, input().split())))\ncnt=0\nfor i in range(N):\n if i == N-1 and x > A[i]:\n break\n if x >= A[i]:\n x -= A[i]\n cnt+=1\n else:\n break\nprint(cnt)\n'] | ['Wrong Answer', 'Accepted'] | ['s138218793', 's306963031'] | [2940.0, 2940.0] | [17.0, 17.0] | [154, 205] |
p03254 | u749512407 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\nSum = sum(A)\nif x >= Sum:\n print(N)\n exit()\n\nans = 0\nfor i in range(N):\n if x >= A[i]:\n ans += 1\n x -= A[i]\n else:\n print(ans)\n break\nelse:\n print(ans)', 'N,x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\nprint(A)\nans = 0\nfor i in range(N):\n if x > A[i]:\n ans += 1\n x -= A[i]\n elif x == A[i]:\n print(ans+1)\n break\n else:\n print(ans -1)\n break\nelse:\n print(ans-1)\n', 'N,x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 0\nfor i in range(N):\n if x > A[i]:\n ans += 1\n x -= A[i]\n elif x == A[i]:\n print(ans+1)\n break\n elif i+1 == N:\n print(ans -1)\n break\n else:\n print(ans)\n break\n', 'N,x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\nans = 0\n\nfor i in range(N):\n if x > A[i]:\n if i+1 == N:\n print(N-1)\n exit()\n else:\n ans += 1\n x -= A[i]\n elif x == A[i]:\n ans += 1\n print(ans)\n exit()\n else:\n print(ans)\n exit()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s063380998', 's205838584', 's787056567', 's231194251'] | [3064.0, 3060.0, 3060.0, 3064.0] | [17.0, 18.0, 18.0, 18.0] | [246, 259, 271, 299] |
p03254 | u752767312 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int,input().split())\na_list = list(map(int,input().split()))\na_list_sort = sorted(a_list)\n#print(a_list)\n#print(a_list_sort)\ncount = 0\n\nif sum(a_list) <= x :\n\tcount = N\nelse:\n\tfor i in range(N):\n\t\tif sum(a_list_sort[:i+1]) <= x:\n\t\t\tcontinue\t\n\t\telse:\n\t\t\tcount = i\n\t\t\tbreak\nprint(count)', 'N,x = map(int,input().split())\na_list = list(map(int,input().split()))\na_list_sort = sorted(a_list)\n#print(a_list)\n#print(a_list_sort)\ncount = 0\n\nif sum(a_list) < x :\n\tcount = N-1\nelif sum(a_list) == x :\n\tcount = N\nelse:\n\tfor i in range(N):\n\t\tif sum(a_list_sort[:i+1]) <= x:\n\t\t\tcontinue\t\n\t\telse:\n\t\t\tcount = i\n\t\t\tbreak\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s772495961', 's522081472'] | [3060.0, 3060.0] | [17.0, 18.0] | [294, 330] |
p03254 | u756988562 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\njudge = [False for i in range(N)]\n# print(judge)\nfor i in range(N):\n if x-a[i]>=0:\n judge[i]=True\n x-=a[i]\ntemp_count=0\nfor i in range(N):\n if judge[i]:\n temp_count+=1\n# print(judge)\nif sum(a)<x:\n print(temp_count-1)\nelse:\n print(temp_count)\n', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\njudge = [False for i in range(N)]\nTrue_X=x\n# print(judge)\nfor i in range(N):\n if x-a[i]>=0:\n judge[i]=True\n x-=a[i]\ntemp_count=0\nfor i in range(N):\n if judge[i]:\n temp_count+=1\n# print(judge)\nif sum(a)<True_X:\n print(temp_count-1)\nelse:\n print(temp_count)\n'] | ['Wrong Answer', 'Accepted'] | ['s996804844', 's825231678'] | [3064.0, 3064.0] | [17.0, 17.0] | [358, 372] |
p03254 | u759651152 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ["#-*-coding:utf-8-*-\n\ndef main():\n n, x = map(int, input().split())\n a_list = list(map(int, input().split()))\n a_list.sort()\n total = 0\n ans = 0\n for i in range(n):\n total += a_list[i]\n if total <= x:\n ans += 1\n print(ans)\n\nif __name__ == '__main__':\n main()", "#-*-coding:utf-8-*-\n\ndef main():\n n, x = map(int, input().split())\n a_list = list(map(int, input().split()))\n a_list.sort()\n total = 0\n ans = 0\n for i in range(n):\n total += a_list[i]\n if total <= x:\n ans += 1\n if total < x:\n print(ans - 1)\n else:\n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s442254624', 's375727514'] | [3064.0, 3064.0] | [17.0, 17.0] | [306, 361] |
p03254 | u760171369 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nb = 0\nfor k in range(N):\n b += a[k]\n if b > x:\n print(k)\n break', 'import numpy as np\nN, x = map(int, input().split())\na = np.array(list(map(int, input().split())))\na.sort()\ns = np.cumsum(a)\nb = (s <= x)\nif b.all():\n if s[-1] == x:\n c = b.sum()\n else:\n c = b.sum() - 1\nelif b.any():\n c = b.sum()\n r = x - s[c-1]\n if (r == a[c:]).any():\n c += 1\nelse:\n c = 0\nprint(c)'] | ['Wrong Answer', 'Accepted'] | ['s731086371', 's267990827'] | [2940.0, 12392.0] | [17.0, 150.0] | [149, 313] |
p03254 | u760802228 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nsum_ = 0 \nans = 0 \nfor i in range(N):\n if sum_ > x:\n break\n sum_ += a[i]\n ans += 1\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nsum_ = 0 \nans = 0 \nfor i in range(N):\n sum_ += a[i]\n if sum_ > x:\n break\n ans += 1\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans = 0 \nfor i in range(N):\n x -= a[i]\n if x < 0:\n break\n ans += 1\nif x > 0:\n ans -= 1\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s310080139', 's971541520', 's508846228'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [207, 207, 218] |
p03254 | u761320129 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,X = map(int,input().split())\nsrc = list(map(int,input().split()))\nsrc.sort()\n\nx = 0\nans = 0\nfor a in src:\n if x+a > X: break\n ans += 1\n x += a\nprint(ans)', 'N,X = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\n\nans = 0\nfor a in A:\n if X-a < 0: break\n X -= a\n ans += 1\nelse:\n if X:\n ans -= 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s636419127', 's650546074'] | [3060.0, 3060.0] | [17.0, 17.0] | [164, 185] |
p03254 | u762420987 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int,input().split())\nalist = list(map(int,input().split()))\nalist.sort()\ncounter = 0\nfor a in alist:\n x -= a\n if x>=0:\n counter += 1\n else:\n break\nprint(counter)\n', 'N,x = map(int,input().split())\nalist = list(map(int,input().split()))\nalist.sort()\ncounter = 0\nfor i in range(N):\n x -= alist[i]\n if x>=0:\n if i!=N-1:\n counter += 1\n else:\n if x==0:\n counter += 1\n else:\n break\nprint(counter)\n'] | ['Wrong Answer', 'Accepted'] | ['s967705179', 's875959733'] | [2940.0, 2940.0] | [17.0, 18.0] | [195, 292] |
p03254 | u777028980 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,m=map(int,input().split())\nhoge=list(map(int,input().split()))\nhoge.sort()\nans=0\nfor i in range(n):\n if(hoge[i]<=m):\n ans+=1\n m-=hoge[i]\n else:\n break\nif(m==0):\n print(ans)\nelse:\n if(sum(hoge)<m):\n print(n-1)\n else:\n print(ans)', 'n,m=map(int,input().split())\nhoge=list(map(int,input().split()))\nhoge.sort()\n\nif(sum(hoge)<m):\n print(n-1)\n exit()\n\nans=0\nfor i in range(n):\n if(hoge[i]<=m):\n ans+=1\n m-=hoge[i]\n else:\n break\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s162345301', 's533377682'] | [3060.0, 3064.0] | [17.0, 17.0] | [249, 215] |
p03254 | u786150969 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ["# AGC 027 A - Candy Distribution Again\nN, x = map(int,input().split())\nan = list(map(int,input().split()))\n\nak =[] \nwhile len(an) > 0:\n ak.append(min(an))\n del an[an.index(min(an))]\n\ncount = 0\nfor i in range(N):\n if x > 0:\n x -= ak[i]\n if i != N-1:\n count += 1\n print('a'+ str(x))\n if i == N-1:\n if x == 0:\n count += 1\n else:\n break\n if x < 0:\n count -= 1\n print('b'+ str(x))\n break\n\n if x == 0:\n print('c'+ str(x))\n break\nprint(count)", '# AGC 027 A - Candy Distribution Again\nN, x = map(int,input().split())\nan = list(map(int,input().split()))\n\nak =[] \nwhile len(an) > 0:\n ak.append(min(an))\n del an[an.index(min(an))]\n\ncount = 0\nfor i in range(N):\n if x > 0:\n x -= ak[i]\n if i != N-1:\n count += 1\n if i == N-1:\n if x == 0:\n count += 1\n else:\n break\n if x < 0:\n count -= 1\n break\n\n if x == 0:\n break\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s006542982', 's598474873'] | [9068.0, 9068.0] | [29.0, 29.0] | [580, 495] |
p03254 | u787131053 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\nchildren = [0] * N\na.sort()\nkashi = 0\nwhile kashi < x:\n for i in range(0,N):\n kashi += a[i]\n children[i] += 1\n if kashi > x:\n kashi -= a[i]\n children[i] -= 1\n break\n if kashi == 0:\n break\nprint(N - children.count(0))', 'N, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\nchildren = [0] * N\na.sort()\nkashi = 0\nn = N\nif a[0] > x:\n print(0)\nelif sum(a) == x:\n print(N)\nelse:\n while kashi < x:\n for i in range(0,n):\n kashi += a[i]\n children[i] += 1\n if kashi > x:\n kashi -= a[i]\n children[i] -= 1\n break\n# print(kashi)\n n -= 1\n if n < 1:\n break\n# print(children)\n print(N - children.count(0))', 'N, x = map(int, input().split(" "))\na = list(map(int, input().split(" ")))\nchildren = [0] * N\na.sort()\nkashi = 0\nn = N\nif a[0] > x:\n print(0)\nelif sum(a) == x:\n print(N)\nelse:\n for i in range(0,n):\n if kashi > x:\n break \n kashi += a[i]\n children[i] += 1\n# print(kashi)\n if kashi == x :\n print(N - children.count(0))\n else:\n print(N - children.count(0) - 1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s668462281', 's684581321', 's241954318'] | [3064.0, 3064.0, 3064.0] | [2104.0, 18.0, 18.0] | [358, 524, 428] |
p03254 | u787679173 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = [int(x) for x in input().split()]\nA = [int(x) for x in input().split()]\n\nA.sort()\n\nans = 0\nfor a in A:\n if a <= x:\n ans += 1\n x -= a\n else:\n break\n\nprint(ans)', 'N, x = [int(x) for x in input().split()]\nA = [int(x) for x in input().split()]\nB = [0 for _ in range(N)]\n\nA.sort()\n\nans = 0\nfor i in range(len(A)):\n if i == N - 1:\n B[i] = x\n break\n if x - A[i] >= 0:\n B[i] = A[i]\n x -= A[i]\n else:\n B[i] = 0\nfor i in range(len(A)):\n if A[i] == B[i]:\n ans += 1\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s273856763', 's922701634'] | [3316.0, 3064.0] | [19.0, 17.0] | [192, 358] |
p03254 | u796563423 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['a,b=map(int,input().split())\nc=list(map(int,input().split()))\nc.sort()\ni=0\ntotal=0\nwhile True:\n if b>=c[i]:\n b=b-c[i]\n total+=1\n else:\n print(total)\n break', 'a,b=map(int,input().split())\nc=list(map(int,input().split()))\nc.sort()\ni=0\ntotal=0\nwhile True:\n if b<c[i]:\n print(total)\n break\n elif i==a-1:\n if b==c[i]:\n print(total+1)\n else:\n print(total)\n break\n else:\n total+=1\n b=b-c[i]\n i+=1'] | ['Wrong Answer', 'Accepted'] | ['s902748274', 's022981808'] | [9092.0, 9088.0] | [31.0, 24.0] | [189, 318] |
p03254 | u796708718 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = [int(i) for i in input().split(" ")]\nlst = [int(i) for i in input().split(" ")]\n\nlst.sort(reverse = True)\ncnt = 0\n\nfor i in range(0,N):\n if x >= lst[i]:\n x -= lst[i]\n cnt += 1\n else:\n break\n \nprint(cnt)\n', 'N, x = [int(i) for i in input().split(" ")]\nlst = [int(i) for i in input().split(" ")]\n \nlst.sort()\ncnt = 0\n \nfor i in range(0,N):\n if x >= lst[i]:\n x -= lst[i]\n cnt += 1\n else:\n break\n \nprint(cnt)', 'N, x = [int(i) for i in input().split(" ")]\nlst = [int(i) for i in input().split(" ")]\n\nlst.sort(reverse = True)\ncnt = 0\n\nfor i in range(0,N):\n if x >= lst[i]:\n cnt += 1\n else:\n break\n \nprint(cnt)\n', 'N, x = [int(i) for i in input().split(" ")]\nlst = [int(i) for i in input().split(" ")]\n\nlst.sort(reverse = True)\ncnt = 0\n\nwhile x > lst[cnt]:\n x -= lst[cnt]\n cnt += 1\n \nprint(cnt)', 'N, x = [int(i) for i in input().split(" ")]\nlst = [int(i) for i in input().split(" ")]\n\nlst.sort(reverse = True)\ncnt = 0\n\nfor i in range(0,N):\n x -= lst[i]\n if x >= 0:\n cnt += 1\n else:\n break\n \nprint(cnt)', 'N, x = [int(i) for i in input().split(" ")]\nlst = [int(i) for i in input().split(" ")]\n \nlst.sort()\ncnt = 0\n \nfor i in range(0,N-1):\n if x >= lst[i]:\n x -= lst[i]\n cnt += 1\n else:\n break\n\n \nprint(cnt+(x==lst[N-1]))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s367074734', 's551620402', 's661496079', 's679603349', 's867199524', 's624039661'] | [2940.0, 3060.0, 3060.0, 3060.0, 3060.0, 3064.0] | [17.0, 17.0, 17.0, 18.0, 17.0, 17.0] | [224, 211, 208, 182, 216, 229] |
p03254 | u799479335 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\n\na_s = input().split()\nfor i in range(N):\n a_s[i] = int(a_s[i])\n \na_s = sorted(a_s)\n\nans = 0\nsum_ = 0\nfor i in range(N):\n if sum_ + a_s[i] <= x:\n sum_ += a_s[i]\n ans += 1\n else:\n break\nprint(ans)', 'N, x = map(int, input().split())\na_s = input().split()\nfor i in range(N):\n a_s[i] = int(a_s[i])\n \na_s = sorted(a_s)\n\nans = 0\nsum_ = 0\nfor i in range(N):\n if (sum_ + a_s[i] <= x)&(i<N-1):\n sum_ += a_s[i]\n ans += 1\n elif (sum_ + a_s[i] == x)&(i==N-1):\n ans += 1\n else:\n break\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s809305209', 's302394367'] | [3064.0, 3064.0] | [17.0, 18.0] | [241, 302] |
p03254 | u801359367 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['\n\nN,x = list(map(int,input().split()))\nA = list(map(int,input().split()))\n\nA.sort(reverse=True)\ncandy = 0\nans = 0\nfor i in A:\n candy += i\n if candy <= x:\n ans += 1\nprint(ans)', '\n\nN,x = list(map(int,input().split()))\nA = list(map(int,input().split()))\n\nA.sort()\ncandy = 0\nans = 0\nfor i in A:\n candy += i\n if candy <= x:\n ans += 1\nprint(ans)', '\n\nN,x = list(map(int,input().split()))\nA = list(map(int,input().split()))\n\nA.sort()\ncandy = 0\nans = 0\nfor i in A:\n candy += i\n if candy <= x:\n ans += 1\nif candy < x:\n ans -= 1\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s331192202', 's854894155', 's999684854'] | [3060.0, 3060.0, 3060.0] | [18.0, 18.0, 17.0] | [199, 187, 214] |
p03254 | u802963389 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans = 0\nfor i in a:\n if x >= i:\n x -= i\n ans += 1\nprint(ans)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nans = 0\nfor i in a:\n if x >= i:\n x -= i\n ans += 1\nif x == 0:\n print(ans)\nelse:\n print(min(N - 1, ans))'] | ['Wrong Answer', 'Accepted'] | ['s867150678', 's304537007'] | [2940.0, 3060.0] | [17.0, 18.0] | [145, 189] |
p03254 | u810216383 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x=map (int, input().split())\na=list( map(int, input().split()) )\n\nhappy=0\na.sort()\n\nfor i in range(N):\n \n if a[i] > x:\n break\n\n else:\n x=x-a[i]\n happy=happy+1\n\nprint(happy)\n', 'N,x=map (int, input().split())\na=list( map(int, input().split()) )\n\nhappy=0\na.sort()\n\nfor i in range(N):\n \n if a[i] > x:\n break\n\n else:\n x=x-a[i]\n happy=happy+1\n\nif x!=0 and happy==N:\n happy=happy-1\n \nprint(happy)\n'] | ['Wrong Answer', 'Accepted'] | ['s438374761', 's256869853'] | [2940.0, 3060.0] | [17.0, 17.0] | [205, 250] |
p03254 | u810356688 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x=map(int,input().split())\nA=sorted(list(map(int,input().split())))\nfor i in range(n):\n if x<A[i]:\n print(i)\n break\n x-=A[i]\nelse:print(n)\n\n ', 'n,x=map(int,input().split())\nA=sorted(list(map(int,input().split())))\nnum=0\nfor i in range(n):\n if x<A[i]:\n print(i)\n break\nelse:print(n)\n\n ', 'n,x=map(int,input().split())\nA=sorted(list(map(int,input().split())))\nfor i in range(n):\n x-=A[i]\n if x<0:\n print(i)\n break\nelse:print(n)\n\n\n ', 'n,x=map(int,input().split())\nA=sorted(list(map(int,input().split())))\nfor i in range(n):\n x-=A[i]\n if x<0:break\nelse:\n if x==0:i+=1\nprint(i)\n\n\n '] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s129139048', 's203158406', 's707919256', 's983779515'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [166, 160, 164, 156] |
p03254 | u816070625 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,n=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\n\nans=0\ni=0\nwhile A[i]<=n:\n ans+=1\n i+=1\n if i==N:\n break\nprint(ans)', 'N,n=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\n\nans=0\ni=0\nwhile A[i]<=n:\n if i==N-1:\n if n==A[i]:\n ans+=1\n break\n else:\n ans+=1\n n-=A[i]\n i+=1 \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s630962264', 's434013818'] | [3060.0, 3064.0] | [17.0, 17.0] | [144, 201] |
p03254 | u816116805 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['import numpy as np\n\nn,X = map(int,input().split())\nxs = np.array(list(map(int,input().split())))\ncumsumx =np.insert(np.cumsum(xs),0,0)\n\nprint(0)', 'import numpy as np\n\nn,X = map(int,input().split())\nxs = np.array(list(map(int,input().split())))\ncumsumx =np.insert(np.cumsum(xs),0,0)\n\ndef energy(k):\n nok = n//k\n acm = (n+k)*X\n for i in range(1,nok+1):\n relsum = cumsumx[-(i-1)*k-1] - cumsumx[-i*k-1]\n if i == 1:\n acm += 5*relsum\n else:\n acm += (2*i+1)*relsum\n relsum = cumsumx[-nok*k-1]\n acm += (2*(nok+1)+1)*relsum\n return(acm)\n\nans = -1\nfor j in range (1,n):\n tmp = energy(j)\n if tmp < ans or ans == -1:\n ans =tmp\n\nprint(ans)\n\n\n\n', "\n\nn,m = map(int,input().split())\ns = list(input())\nedges = [tuple(map(int,input().split())) for i in range(m)]\n\n\ndef addEdge(graph,u,v):\n graph[u].add(v)\n\n\ndef deleteNode(graph,node):\n graph.pop(node,None)\n\nfrom collections import defaultdict\ngraphAB = defaultdict(set)\ngraphABopp = defaultdict(set)\n\nconnodes = set()\nfor i,j in edges:\n ii = min(i,j)\n jj = max(i,j)\n addEdge(graphAB,ii,jj)\n addEdge(graphABopp,jj,ii)\n if i != j:\n connodes.add(i)\n connodes.add(j)\n\n\n\ndef adjAB(node):\n Aflag = 'A' in map(lambda x:s[x-1],graphAB[node])\n Aflag = Aflag or 'A' in map(lambda x:s[x-1],graphABopp[node])\n Bflag = 'B' in map(lambda x:s[x-1],graphAB[node])\n Bflag = Bflag or 'B' in map(lambda x:s[x-1],graphABopp[node])\n if Aflag and Bflag:\n return(True)\n else:\n return(False)\n\n\n\nvisitlist = [i for i in connodes if not adjAB(i)]\n#print(visitset)\n\nwhile bool(visitlist):\n i = visitlist.pop()\n for j in graphAB[i]:\n graphABopp[j].remove(i)\n if not adjAB(j):\n visitlist.append(j)\n #print(visitset,'add')\n for j in graphABopp[i]:\n graphAB[j].remove(i)\n if not adjAB(j):\n visitlist.append(j)\n #print(visitset,'add')\n graphAB.pop(i,None)\n graphABopp.pop(i,None)\n\n\n#print(graphABopp)\n\n\nif graphAB == {} and graphABopp == {}:\n print('No')\nelse:\n print('Yes')\n\n\n\n", 'n,x = map(int,input().split())\nass = list(map(int,input().split()))\nass.sort()\n\nans = 0\nacm = 0\nfor i in ass:\n acm += i\n if x >= acm:\n ans +=1\n\nif acm < x:\n ans -= 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s380328738', 's421564567', 's909338872', 's794317878'] | [12468.0, 13320.0, 3064.0, 2940.0] | [148.0, 166.0, 18.0, 17.0] | [144, 557, 1421, 194] |
p03254 | u816552564 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x=input().split()\nX=int(x)\nn=int(N)\ny=0\nA = [int(i) for i in input().split()]\nA.sort()\nfor z in range(n):\n y+=A[z]\n if y>=X:\n print(z+1)\n break', 'N,x=input().split()\nX=int(x)\nn=int(N)\ny=0\nA = [int(i) for i in input().split()]\nA.sort()\nfor z in range(n):\n y+=A[z]\n if y>=X:\n print(z+1)\n break\nelse:\n print(N)', 'N,x=input().split()\nX=int(x)\nn=int(N)\ny=0\nA = [int(i) for i in input().split()]\nA.sort()\nfor z in range(n):\n y+=A[z]\n if y>=X:\n print(z+1)\n break\nelse:\n print(N)', 'N,x=input().split()\nX=int(x)\nn=int(N)\ny=0\nA = [int(i) for i in input().split()]\nA.sort()\nfor z in range(n):\n if y>=X:\n break\n print(z+1)\n y+=A[z]\nif y>=X:\n print(N)\nelse:\n print(N)', 'N,x=input().split()\nX=int(x)\nn=int(N)\ny=0\nA = [int(i) for i in input().split()]\nA.sort()\nfor z in range(n):\n y+=A[z]\n if y>=X:\n if y==X:\n print(z+1)\n else:\n print(z)\n break\nelse:\n print(n-1)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s133036068', 's151699688', 's609842849', 's769718144', 's772039889'] | [9076.0, 9116.0, 9152.0, 9184.0, 9056.0] | [26.0, 26.0, 32.0, 25.0, 25.0] | [153, 170, 170, 190, 212] |
p03254 | u823885866 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\n\nrr = lambda: sys.stdin.buffer.readline().rstrip()\nrs = lambda: sys.stdin.buffer.readline().split()\nri = lambda: int(sys.stdin.buffer.readline())\nrm = lambda: map(int, sys.stdin.buffer.readline().split())\nrl = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\ndef heapsort(iterable):\n h = []\n for value in iterable:\n heapq.heappush(h, value)\n return [heapq.heappop(h) for i in range(len(h))]\n\nn, k = rm()\na = rl()\na = heapsort(a)\ncnt = 0\nfor i in a:\n k -= i\n if k < 0:\n break\n else:\n cnt += 1\nprint(cnt)\n\n\n', 'import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\n\nrr = lambda: sys.stdin.buffer.readline().rstrip()\nrs = lambda: sys.stdin.buffer.readline().split()\nri = lambda: int(sys.stdin.buffer.readline())\nrm = lambda: map(int, sys.stdin.buffer.readline().split())\nrl = lambda: list(map(int, sys.stdin.buffer.readline().split()))\n\ndef heapsort(iterable):\n h = []\n for value in iterable:\n heapq.heappush(h, value)\n return [heapq.heappop(h) for i in range(len(h))]\n\nn, k = rm()\na = rl()\na = heapsort(a)\ncnt = 0\nfor i in a:\n k -= i\n if k < 0:\n break\n else:\n cnt += 1\nelse:\n if k != 0:\n cnt -= 1\nprint(cnt)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s898821996', 's056833623'] | [12396.0, 12396.0] | [150.0, 153.0] | [657, 695] |
p03254 | u824237520 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n, x = map(int, input().split())\na = list(map(int ,input().split()))\n\na = sorted(a)\n\nans = 0\ntemp = x\n\nwhile ans < n:\n temp -= a[ans]\n ans += 1\n if temp == 0:\n break\n elif temp < 0:\n ans -= 1\n break\n\nprint(ans)\n', 'n, x = map(int, input().split())\na = list(map(int ,input().split()))\n\na = sorted(a)\n\nans = 0\ntemp = x\n\nwhile ans < n:\n temp -= a[ans]\n ans += 1\n if temp == 0:\n break\n elif temp < 0:\n ans -= 1\n break\n\nif ans == n and temp > 0:\n ans -= 1\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s679628422', 's633962426'] | [3060.0, 3060.0] | [17.0, 17.0] | [244, 283] |
p03254 | u827306875 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\na_list = sorted(list(map(int, input().split())))\nsum = 0\nnum = 0\n\nwhile sum < x and num <= N:\n sum += a_list[num]\n num += 1\n \nprint(num)', 'N, x = map(int, input().split())\na_list = sorted(list(map(int, input().split())))\nsum = 0\nnum = 0\n\nwhile sum < x and num + 1 <= N:\n sum += a_list[num]\n num += 1\n \nprint(num)', 'N, x = map(int, input().split())\na_list = sorted(list(map(int, input().split())))\nsum = 0\nnum = 0\n\nwhile sum < x:\n sum += a_list[num]\n num += 1\n \nprint(num)', 'N, x = map(int, input().split())\na_list = sorted(list(map(int, input().split())))\nsum = 0\nnum = 0\n\nwhile sum < x:\n sum += a_list[num]\n num += 1\n print(sum)\n \nprint(num)', 'N, x = map(int, input().split())\na_list = sorted(list(map(int, input().split())))\n\nfor i in range(N):\n x = x - a_list[i]\n if x < 0:\n break\nif i == N-1 and x == 0:\n i += 1\n\nprint(i)\n\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s539786351', 's812122433', 's824153709', 's991131102', 's504205559'] | [2940.0, 2940.0, 2940.0, 3060.0, 2940.0] | [18.0, 21.0, 18.0, 20.0, 18.0] | [178, 182, 165, 180, 198] |
p03254 | u832039789 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x = map(int,input().split())\na = sorted(list(map(int,input().split())))\n\nres = 0\nfor i in a:\n if x<i:\n break\n x -= i\n res += 1\nprint(res)\n', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\nres = 0\np = 0\nfor i in a:\n x -= i\n if x < 0:\n x += i\n break\n res += 1\n p += 1\nelse:\n if x > 0:\n res -= 1\n#print(p, a[p:])\nprint(res + (x in a[p:]))\n'] | ['Wrong Answer', 'Accepted'] | ['s359293982', 's898844036'] | [3316.0, 3060.0] | [19.0, 18.0] | [156, 264] |
p03254 | u834832056 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\nans = 0\n\nfor i in arr:\n x -= i\n if x < 0:\n break\n else:\n ans += 1\n if x > 0 and ans > 0:\n ans -= 1\n\nprint(ans)', 'n, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\nans = 0\nfor consume_v in arr:\n if x >= consume_v:\n x -= consume_v\n ans += 1\n elif x > 0 and ans > 0:\n ans -= 1\n else:\n break\nprint(ans)', 'n, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\nans = 0\n\nfor i in arr:\n print(ans)\n x -= i\n if x < 0:\n break\n else:\n ans += 1\nif x > 0 and ans > 0:\n ans -= 1\n\nprint(ans)', 'n, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\nans = 0\nfor consume_v in arr:\n if x >= consume_v:\n x -= consume_v\n ans += 1\n elif x > 0 and ans > 0:\n ans -= 1\n break\n else:\n break\nprint(ans)', 'n, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\nans = 0\n\nfor i in arr:\n x -= i\n if x < 0:\n break\n else:\n ans += 1\nif x > 0 and ans > 0:\n ans -= 1\n\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s279571233', 's554215660', 's608113890', 's890641731', 's746072478'] | [9172.0, 9160.0, 9016.0, 9172.0, 9104.0] | [25.0, 22.0, 30.0, 26.0, 30.0] | [226, 255, 233, 269, 218] |
p03254 | u835482198 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['\nimport bisect\n\n\nn, x = map(int, input().split())\na = list(sorted(map(int, input().split())))\nif x == sum(x):\n print(n)\nelse:\n acc = [0 for i in range(n)]\n acc[0] = a[0]\n for i in range(1, n):\n acc[i] += a[i - 1] + a[i]\n index = bisect.bisect_right(acc, x)\n if index == n:\n print(index - 1)\n', '\n\nimport bisect\n\n\nn, x = map(int, input().split())\na = list(sorted(map(int, input().split())))\nacc = [0 for i in range(n)]\nacc[0] = a[0]\nfor i in range(1, n):\n acc[i] += a[i - 1] + a[i]\nindex = bisect.bisect_right(acc, x)\nprint(index)\n', 'import bisect\n\n\nn, x = map(int, input().split())\na = list(sorted(map(int, input().split())))\nacc = [0 for i in range(n)]\nacc[0] = a[0]\nfor i in range(1, n):\n acc[i] += a[i - 1] + a[i]\nindex = bisect.bisect_left(acc, x)\nprint(index)', 'n, x = map(int, input().split())\na = list(sorted(map(int, input().split())))\nif x == sum(a):\n print(n)\nelse:\n acc = 0\n for i in range(n):\n acc += a[i]\n if acc > x:\n break\n if i == n:\n print(n - 1)\n else:\n print(i)\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s263948513', 's480139089', 's963094432', 's957816545'] | [3060.0, 3060.0, 3064.0, 2940.0] | [18.0, 17.0, 18.0, 17.0] | [323, 289, 234, 268] |
p03254 | u839188633 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\n\nans = 0\nfor ai in a:\n if x >= ai:\n x -= ai\n ans += 1\n else:\n break\n\nprint(ans)', 'n, x = map(int, input().split())\na = list(map(int, input().split()))\n\na.sort()\n\nans = 0\nfor ai in a:\n if x >= ai:\n x -= ai\n ans += 1\n else:\n break\nelse:\n if x:\n ans -= 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s107631693', 's352194260'] | [3316.0, 2940.0] | [19.0, 17.0] | [185, 213] |
p03254 | u840310460 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na_sort =sorted(a)\ncou = 0\nfor i in range(N):\n if x >= a_sort[i]:\n x -= a_sort[i]\n cou += 1\nprint(cou)', 'a_sort =sorted(a)\ncou = 0\nfor i in range(N):\n if x >= a_sort[i]:\n cou += 1\n x -= a_sort[i]\nprint(cou)', 'N, x = [int(i) for i in input().split()]\na = sorted([int(i) for i in input().split()])\n\nans = 0\nfor i in a:\n x -= i\n if x >= 0:\n ans += 1\n\nprint(ans)', 'N, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na_sort =sorted(a)\ncou = 0\nfor i in range(N):\n if x >= a_sort[i]:\n cou += 1\nprint(cou)', 'N, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na_sort =sorted(a)\ncou = 0\nfor i in range(N):\n if x >= a_sort[i]:\n x -= a_sort[i]\n cou += 1\nprint(cou)', 'N, x = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\na_sort =sorted(a)\ncou = 0\nfor i in range(N):\n if x >= a_sort[i]:\n x -= a_sort[i]\n cou += 1\nif x > 0 and cou == N:\n print(cou-1)\nelse:\n print(cou)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s186783398', 's416189493', 's426843937', 's721411360', 's937070529', 's612684214'] | [3060.0, 2940.0, 2940.0, 2940.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [197, 118, 162, 174, 197, 247] |
p03254 | u841568901 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int, input().split())\nA = sorted(map(int, input().split()))\ns = 0\nfor i in range(N):\n x -= A[i]\n if x<0:\n break\n else:\n s += 1\nprint(s)', 'N,x = map(int, input().split())\nA = sorted(map(int, input().split()))\ns = 0\nfor i in range(N):\n x -= A[i]\n if x<0:\n break\n else:\n s += 1\nprint(s if x<=0 else s-1)'] | ['Wrong Answer', 'Accepted'] | ['s850460119', 's956844324'] | [9084.0, 9124.0] | [30.0, 25.0] | [154, 171] |
p03254 | u844005364 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['from itertools import accumulate\nfrom bisect import bisect\n\nn, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\nsum_arr = list(accumulate(arr))\n\nidx = bisect(arr, x)\nprint(idx)\n', 'from itertools import accumulate\nfrom bisect import bisect\n\nn, x = map(int, input().split())\narr = list(map(int, input().split()))\n\narr.sort()\nsum_arr = list(accumulate(arr))\n\nidx = bisect(sum_arr, x)\n\nif idx == n and sum_arr[n - 1] != x:\n idx -= 1\n\nprint(idx)\n'] | ['Wrong Answer', 'Accepted'] | ['s901087384', 's249181729'] | [3060.0, 3188.0] | [18.0, 18.0] | [208, 264] |
p03254 | u845333844 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 0\n\nfor i in range(N):\n x -= A[i]\n if x >= 0:\n ans += 1\n else:\n break\n \nif x > 0:\n print(ans-1)\nelse:\n print(ans)', 'n,x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\n\nans = 0\n\nfor i in range(n):\n x -= A[i]\n if x >= 0:\n ans += 1\n else:\n break\n \nif x > 0:\n print(ans-1)\nelse:\n print(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s169985405', 's079254466'] | [3060.0, 2940.0] | [17.0, 17.0] | [211, 212] |
p03254 | u845573105 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N , X = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\nA = [0] + A\nfor i in range(N):\n A[i+1] = A[i]+A[i+1]\n if A[i+1]>X:\n print(i)\n exit()\nprint(N)\n', 'N , X = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort()\nA = [0] + A\nfor i in range(N):\n A[i+1] = A[i]+A[i+1]\n if A[i+1]>X:\n break\nif i==N-1 and X==A[N]:\n print(N)\nelse:\n print(i)\n'] | ['Wrong Answer', 'Accepted'] | ['s263502030', 's134319434'] | [9176.0, 9188.0] | [28.0, 30.0] | [181, 209] |
p03254 | u851704997 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\ncount = 0\nwhile(x >= 0):\n if(count == N):\n break\n tmp = a.pop(0)\n if(x >= tmp):\n x = x - tmp\n count += 1\n else:\n break\nprint(str(count))', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\ncount = 0\nwhile(x >= 0):\n if(count == N):\n break\n tmp = a.pop(0)\n if(x >= tmp):\n x = x - tmp\n count += 1\n else:\n break\nif(count == N and x != 0):\n count -= 1\nprint(str(count))'] | ['Wrong Answer', 'Accepted'] | ['s656964059', 's291091845'] | [3060.0, 3060.0] | [17.0, 18.0] | [232, 272] |
p03254 | u853900545 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor i in range(N):\n b.append(0)\n \nc = 0\n\nd = []\nfor i in range(N):\n d.append(0)\n\n\nfor i in range(N):\n for j in range(i+1):\n d[i] += a[j]\n b[i] = d[i]\nfor i in range(N):\n if b[i] <= X:\n c += 1\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor i in range(N):\n b.append(0)\n \nc = 0\n\nfor i in range(N):\n for j in range(i+1):\n b[i] += a[j]\n\nfor i in range(N):\n if b[i] <= X:\n c += 1\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor i in range(N):\n b.append(i)\nc = 0\nfor i in range(N):\n b[i] = 0\n for i in range(N):\n b[i] += a[i]\nfor i in range(N):\n if b[i] <= X:\n c += 1\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor i in range(N):\n b.append(0)\n \nc = 0\n\nfor i in range(N):\n for j in range(i+1):\n b[i] += a[j]\n\nfor k in range(N):\n if b[k] <= X:\n c += 1\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor _ in range(N):\n b.append(0)\n \nc = 0\n\nfor i in range(N):\n for j in range(i+1):\n b[i] += a[j]\n\nfor k in range(N):\n if b[k] <= X:\n c += 1\nif b[-1] > X:\n c -= 1\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor _ in range(N):\n b.append(0)\n \nc = 0\n\nfor i in range(N):\n for j in range(i+1):\n b[i] += a[j]\n\nfor k in range(N):\n if b[k] <= X:\n c += 1\n else:break\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor _ in range(N):\n b.append(0)\n \nc = 0\n\nfor i in range(N):\n for j in range(i+1):\n b[i] += a[j]\n\nfor k in range(N):\n if b[k] <= X:\n c += 1\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor i in range(N):\n b.append(0)\n \nc = 0\n\nd = []\nfor i in range(N):\n d.append(0)\n\n\nfor i in range(N):\n b[i] = d[i]\n for j in range(i+1):\n d[i] += a[j]\nfor i in range(N):\n if b[i] <= X:\n c += 1\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor i in range(N):\n b.append(i)\nc = 0\nd = []\nfor i in range(N):\n d.append(i)\nfor i in range(N):\n b[i] = d\n for j in range(N):\n d[j] += a[j]\nfor i in range(N):\n if b[i] <= X:\n c += 1\nprint(c)', 'N,X = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\n\nb = []\nfor _ in range(N):\n b.append(0)\n \nc = 0\n\nfor i in range(N):\n for j in range(i+1):\n b[i] += a[j]\n\nfor k in range(N-1):\n if b[k] <= X:\n c += 1\nif b[N-1] == X:\n c += 1\nprint(c)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s225244207', 's299040290', 's436182729', 's471330815', 's555249678', 's661463197', 's877991992', 's890525974', 's935655785', 's397898112'] | [3064.0, 3060.0, 3060.0, 3060.0, 3064.0, 3060.0, 3060.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 19.0, 18.0, 18.0, 18.0, 18.0, 18.0, 19.0, 18.0] | [319, 256, 260, 256, 281, 271, 256, 315, 302, 285] |
p03254 | u854061980 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x = map(int,input().split())\na = list(map(int,input().split()))\n\nif sum(a) ==x:\n print(n)\nelse:\n a.sort()\n for i in range(n):\n if x >= a[i]:\n ans += 1\n x -= a[i]\n else:\n break\n\n\n\n\nprint(ans-1)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\nans = 0\n\nif sum(a) ==x:\n print(n)\nelse:\n a.sort()\n for i in range(n):\n if x >= a[i]:\n ans += 1\n x -= a[i]\n else:\n break\n\n if ans == n:\n ans -= 1\n\n\n print(ans)'] | ['Runtime Error', 'Accepted'] | ['s291269442', 's207061637'] | [3060.0, 3060.0] | [17.0, 17.0] | [250, 293] |
p03254 | u854946179 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['\nN,x = map(int,input().split())\nA = list(map(int,input().split()))\t\nans=0\nA.sort()\nfor i in A:\n x=x-i\n if x >= 0:\n ans=ans+1\nprint(ans)', 'N,x = map(int,input().split())\nA = list(map(int,input().split()))\t\nans=0\nA.sort()\nfor i in A:\n x=x-i\n if x < 0:\n \n else:\n ans=ans+1\nprint(ans)', 'N,x = map(int,input().split())\nA = list(map(int,input().split()))\t\nans=0\nA.sort()\nfor i in A:\n x=x-i\n if x >= 0:\n ans=ans+1\nif x > 0:\n ans= ans-1\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s648494081', 's907099285', 's287465631'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0] | [148, 161, 172] |
p03254 | u859897687 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x=map(int,input().split())\nl=list(map(int,input().split()))\nl.sort()\nif x==sum(l):\n print(n)\nelif x<sum(l):\n print(n-1)\nelse:\n ans=0\n k=0\n for a in l:\n k+=a\n if k>x:\n break\n ans+=1\n print(ans)\n ', 'n,x=map(int,input().split())\nl=list(map(int,input().split()))\nl.sort()\nif x==sum(l):\n print(n)\nelif x>sum(l):\n print(n-1)\nelse:\n ans=0\n k=0\n for a in l:\n k+=a\n if k>x:\n break\n ans+=1\n print(ans)\n '] | ['Wrong Answer', 'Accepted'] | ['s428913077', 's507413474'] | [3060.0, 3060.0] | [19.0, 17.0] | [217, 217] |
p03254 | u860338101 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ncount = 0\nfor i in range(len(a)):\n if x - a[i] >= 0:\n x -= a[i]\n count += 1\n else:\n break\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\ncount = 0\nfor i in range(len(a)):\n if x - a[i] >= 0:\n x -= a[i]\n count += 1\n else:\n break\nif count == N and x > 0:\n print(count - 1)\nelse:\n print(count)'] | ['Wrong Answer', 'Accepted'] | ['s585600392', 's955327573'] | [9128.0, 8932.0] | [30.0, 26.0] | [207, 264] |
p03254 | u868701750 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\nprint(A)\nc = 0\nfor i in A:\n x -= i\n if x >= 0:\n c += 1\n else:\n break\n\nif x > 0:\n c -= 1\n\nprint(c)\n', 'N, x = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort()\nc = 0\nfor i in A:\n x -= i\n if x >= 0:\n c += 1\n else:\n break\n\nif x > 0:\n c -= 1\n\nprint(c)\n'] | ['Wrong Answer', 'Accepted'] | ['s291108434', 's664112854'] | [3060.0, 2940.0] | [17.0, 17.0] | [203, 194] |
p03254 | u869265610 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int,input().split())\nhito = input().split()\npoo = [hito]\nzyun = sorted(hito)\n\nok = 0\nfor i in range(len(hito)):\n\tif x-int(zyun[i])>=0:\n\t\tok+=1\n\t\tif ok == len(hito):\n\t\t\tprint(ok)\n\t\t\texit()\n\telse:\n\t\tprint(ok)\n\t\texit()\n', 'a,b=map(int,input().split())\nL=list(map(int,input().split()))\nL=sorted(L)\nfor i in range(a):\n if b-L[i]<0:\n print(i)\n exit()', '\nN,x = map(int,input().split())\nhito = input().split()\npoo = [hito]\nzyun = sorted(hito)\n\nok = 0\nfor i in range(len(hito)):\n\tif x-int(zyun[i])>=0:\n\t\tok+=1\n\t\tif ok == len(hito):\n\t\t\tprint(ok)\n\telse:\n\t\tprint(ok)\n \n', '\nN,x = map(int,input().split())\nhito = input().split()\npoo = [hito]\nzyun = sorted(hito)\n\nok = 0\nfor i in range(len(poo)):\n\tif x-int(zyun[i])>=0:\n\t\tok+=1\n\telse:\n\t\tprint(ok)\n \n', 'N,x = map(int,input().split())\nhito = input()\npoo = [hito]\nzyun = sorted(hito)\nok = 0\nfor i in range(len(poo)):\n\tif x-zyun[i]>=0:\n ok+=1\n else:\n print(ok)\n \n\n', 'a,b=map(int,input().split())\nL=list(map(int,input().split()))\nL=sorted(L)\nans=0\nif sum(L)<b:\n print(a-1)\nelif sum(L)==b:\n print(a)\nelse:\n for i in range(a):\n ans+=L[i]\n if ans>b:\n print(i)\n exit()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s379805771', 's582541031', 's976782821', 's991043288', 's992769282', 's741522954'] | [3060.0, 9112.0, 3060.0, 2940.0, 3064.0, 9100.0] | [18.0, 22.0, 17.0, 17.0, 17.0, 25.0] | [226, 131, 213, 177, 174, 215] |
p03254 | u871374729 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = list(map(int, input().split()))\n\nc_list = list(map(int, input().split()))\n\nc_list.sort()\n\n\ni = 0\nfor _ in range(len(c_list)):\n if x - c_list[i] < 0:\n print(i)\n exit()\n x -= c_list[i]\n i += 1\n\nprint(len(c_list))\n', 'N, x = list(map(int, input().split()))\n\nc_list = list(map(int, input().split()))\n\nc_list.sort()\n\n\ni = 0\nfor _ in range(len(c_list)):\n if x - c_list[i] < 0:\n print(i)\n exit()\n x -= c_list[i]\n i += 1\n\nif x == 0:\n print(len(c_list))\nelse:\n print(len(c_list) - 1)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s572362045', 's079732404'] | [2940.0, 3060.0] | [17.0, 17.0] | [241, 290] |
p03254 | u876742094 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\ncount=0\nfor i in range(N):\n if x<a[i]:\n break\n else:\n count+=1\n x-=a[i]\n\nprint(count)\n', 'N,x=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\ncount=0\nfor i in range(N):\n if x<a[i]:\n break\n elif x==a[i] or i<N-1:\n count+=1\n x-=a[i]\n\n\nprint(count)\n'] | ['Wrong Answer', 'Accepted'] | ['s753830572', 's345582165'] | [9080.0, 8984.0] | [28.0, 27.0] | [184, 202] |
p03254 | u879309973 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['def solve(n, x, a):\n ans = 0\n for v in sorted(a):\n if v <= x:\n ans += 1\n x -= v\n return ans\n\nn, x = map(int, input().split())\na = list(map(int, input().split()))\nprint(solve(n, x, a))\n\n', 'def solve(n, x, a):\n ans = 0\n for v in sorted(a):\n if v <= x:\n ans += 1\n x -= v\n if (x > 0) and (ans == n):\n ans -= 1\n return ans\n\nn, x = map(int, input().split())\na = list(map(int, input().split()))\nprint(solve(n, x, a))'] | ['Wrong Answer', 'Accepted'] | ['s445109164', 's098418408'] | [2940.0, 3064.0] | [17.0, 17.0] | [223, 269] |
p03254 | u879870653 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int,input().split())\nA = list(map(int,input().split()))\nanswer = 0\nwhile x > 0 :\n A = sorted(A)\n if x < A[0] :\n break\n x = x - A[-1]\n answer += 1\n A.pop(-1)\n if len(A) == 0 :\n break\nprint(answer)\n\n', 'N,x = map(int,input().split())\nA = list(map(int,input().split()))\nanswer = 0\nwhile x > 0 :\n A = sorted(A)\n if x < A[0] :\n break\n x = x - A[0]\n answer += 1\n A.pop(0)\n if len(A) == 0 :\n if x != 0 :\n answer -= 1\n break\nprint(answer)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s490993199', 's905736164'] | [3060.0, 3060.0] | [17.0, 18.0] | [240, 282] |
p03254 | u890183245 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\narray = list(map(int, input().split()))\narray = sorted(array, reverse=False)\n#print(array)\nfor i in range (N):\n if sum(array) < x:\n print(N)\n break\n elif sum(array[0:i+1]) == x:\n print(i)\n break\n elif sum(array[0:i+1]) < x and x < sum(array[0:i]):\n print(i-1)\n break\n else:\n pass', 'N, x = map(int, input().split())\narray = list(map(int, input().split()))\narray = sorted(array, reverse=False)\nif sum(array) <= x:\n print(N)\nelif array[0] > x:\n print(0)\nfor i in range (N):\n if sum(array[0:i]) >= x:\n print(i)\n break', 'N, x = map(int, input().split())\narray = list(map(int, input().split()))\na = sorted(array, reverse=False)\n#print(a)\nanswer = 0\nfor i in range(N):\n x -= a[i]\n if x < 0:\n break\n answer += 1\n if i == N-1 and x != 0:\n answer -= 1\n break\n if x < a[i]:\n break\nprint(answer)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s012643172', 's363024575', 's677499924'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [337, 240, 310] |
p03254 | u896741788 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x=map(int,input().split())\nl=sorted(list(map(int,input().split())))\n\nnow=0\nfor i in l:\n now+=i;d.append(now)\nfrom bisect import bisect_left as bl,bisect_right as br\n\nprint(max(0,br(d,x)-1+(sum(l)==x)))', 'n,x=map(int,input().split())\nl=sorted(list(map(int,input().split())))\nif sum(l)>x:print(n-1);exit()\nd=[]\nnow=0\nfor i in l:\n now+=i;d.append(now)\nfrom bisect import bisect_left as bl,bisect_right as br\n\nprint(bl(d,x))', 'n,x=map(int,input().split())\nl=sorted(list(map(int,input().split())))\nif sum(l)<=x:print(n-int(sum(l)!=x));exit()\nif l[0]>x:print(0);exit()\nd=[]\nnow=0\nfor i in l:\n now+=i;d.append(now)\nfrom bisect import bisect_left as bl,bisect_right as br\n\nprint(br(d,x))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s254246903', 's393608762', 's261521258'] | [3060.0, 3060.0, 3188.0] | [17.0, 18.0, 19.0] | [206, 219, 259] |
p03254 | u898421873 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['\nN, x = map(int, input().split())\n\nchildlen = []\nfor part in input().split():\n childlen.append(int(part))\n\nchildlen.sort()\n#print(childlen)\n\nhappy = 0\nfor child in childlen:\n #print(child, x)\n if child <= x:\n x -= child\n happy += 1\n else:\n break\n\nprint(happy)', 'N, x = map(int, input().split())\n\nchildlen = []\nfor part in input().split():\n childlen.append(int(part))\n\nchildlen.sort()\n\nhappy = 0\nfor n in range(len(childlen)):\n child = childlen[n]\n x -= child\n happy += 1\n \n if x < 0:\n print(happy - 1)\n exit(0)\n elif x == 0:\n print(happy)\n exit(0)\n\n\nif x != 0:\n happy -= 1\n\nprint(happy)'] | ['Wrong Answer', 'Accepted'] | ['s484139622', 's668404502'] | [3060.0, 3064.0] | [17.0, 17.0] | [292, 429] |
p03254 | u905510147 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\na = list(map(int, input().split()))\na = sorted(a)\n\ncount = 0\nans = 0\nfor i in a:\n\tprint(x)\n\tif x >= i:\n\t\tx = x - i\n\t\tans += 1\n\telse:\n\t\tbreak\nelse:\n\tif x:\n\t\tans -= 1\n\nprint(ans)\n', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na = sorted(a)\n\ncount = 0\nans = 0\nfor i in a:\n\tif x >= i:\n\t\tx = x - i\n\t\tans += 1\n\telse:\n\t\tbreak\nelse:\n\tif x:\n\t\tans -= 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s912872963', 's230871605'] | [3060.0, 3060.0] | [17.0, 17.0] | [210, 200] |
p03254 | u905582793 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,c=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nfor i in range(n):\n if a[i]>c:\n print(i+1)\n break\n else:\n c-=a[i]\nelse:\n print(n)', 'n,c=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nfor i in range(n):\n if a[i]>c:\n print(i)\n break\n else:\n c-=a[i]\nelse:\n print(n)', 'n,c=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nfor i in range(n):\n if a[i]>c:\n print(i)\n break\n else:\n c-=a[i]\nelse:\n if c>0:\n print(n-1)\n else:\n print(n)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s522165613', 's980158100', 's722867568'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [164, 162, 197] |
p03254 | u909643606 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x=[int(i) for i in input().split()]\na=[int(i) for i in input().split()]\na.sort()\ncount=0\nfor i in range(n):\n x-=a[i]\n if x>=0:\n count+=1\n \nprint(count)', 'n,x=[int(i) for i in input().split()]\na=[int(i) for i in input().split()]\na.sort()\ncount=0\nfor i in range(n):\n x-=a[i]\n if x>=0 and i<n-1:\n count+=1\n elif x==0 and i==n-1:\n count+=1\n \nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s980129722', 's935450553'] | [2940.0, 3060.0] | [19.0, 17.0] | [165, 210] |
p03254 | u924406834 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nb = 0\nfor i in a:\n x -= I\n if x => 0:\n b += 1\n else:\n break\nprint(b)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nb = 0\nfor i in a:\n x -= i\n if x => 0:\n b += 1\n else:\n break\nprint(b)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nb = 0\nfor i in a:\n x -= i\n if x => 0:\n b += 1\n else:\n break\nif x == 0:\n print(b)\nelse:\n print(b-1)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nans = 0\ni = 0\nwhile x >= 0 and n-2 >= i:\n x = x - a[i]\n if x >= 0:\n i += 1\n else:\n break\nif x <= 0:\n print(i)\nelse:\n if x == a[-1]:\n x += 1\n print(x)\n else:\n print(x)\n ', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\na.sort()\nb = 0\nfor i in a:\n x -= i\n if x >= 0:\n b += 1\n N -= 1\n else:\n break\nif x == 0:\n print(b)\nelse:\n if N == 0:\n print(b-1)\n else:\n print(b)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s009194435', 's613157344', 's697047532', 's893809508', 's097301731'] | [2940.0, 2940.0, 2940.0, 3060.0, 3060.0] | [18.0, 18.0, 17.0, 17.0, 17.0] | [166, 166, 202, 299, 263] |
p03254 | u925406312 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = map(int,input().split())\na = list(map(int,input().split()))\ncount = 0\n\n\na.sort(reverse=False)\nfor i in range(N):\n if x >= a[i]:\n count += 1\n x -= a[i]\n else:\n break\n print(count)\n\nif (x!=0)and(count == N):\n count -= 1\n print(count)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\ncount = 0\n\nsort_a = sorted(a)\n\nfor i in range(len(a)):\n if x >= sort_a[i]:\n count += 1\n x -= sort_a[i]\n continue\n else:\n continue\n break\nprint(count)', 'N,x = map(int,input().split())\na=[int(input()) for i in range(N)]\n# a = list(map(int,input().split()))\ncount = 0\n\nsort_a = sorted(a)\n\nfor i in range(len(a)):\n if x >= sort_a[i]:\n count += 1\n x -= sort_a[i]\n continue\n break\nprint(count)', 'N,x = map(int,input().split())\n\na = list(map(int,input().split()))\ncount = 0\n\nsort_a = sorted(a)\n\nfor i in range(len(N)):\n if x >= sort_a[i]:\n count += 1\n x -= sort_a[i]\n break\nprint(count)\n', 'for i in range(N):\n print(i)\n if x >= sort_a[i]:\n count += 1\n x -= sort_a[i]\n # print(x)\n continue\n break\nprint(count)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\ncount = 0\n\nsort_a = sorted(a)\nfor i in range(len(a)):\n if x >= sort_a[i]:\n count += 1\n x -= sort_a[i]\n continue\n break\nprint(count)', 'N,x = map(int,input().split())\n\na = list(map(int,input().split()))\ncount = 0\n\nsort_a = sorted(a)\n\nfor i in range(len(N)):\n if x >= sort_a[i]:\n count += 1\n x -= sort_a[i]\n print(x)\n continue\n break\nprint(count)\n', 'N,x = map(int,input().split())\n\na = list(map(int,input().split()))\ncount = 0\n\nsort_a = sorted(a)\n\nfor i in range(N):\n print(i)\n if x >= sort_a[i]:\n count += 1\n x -= sort_a[i]\n # print(x)\n continue\n break\nprint(count)', 'N,x = map(int,input().split())\n\na = list(map(int,input().split()))\ncount = 0\n\nsort_a = sorted(a)\n\nfor i in range(N):\n if x >= sort_a[i]:\n count += 1\n x -= sort_a[i]\n break\nprint(count)\n', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\ncount = 0\n\nsort_a = sorted(a)\nfor i in range(len(a)):\n if x > sort_a[i] and x == sort_a[i]:\n count += 1\n x -= sort_a[i]\n continue\n break\nprint(count)', 'N,x = map(int,input().split())\na = list(map(int,input().split()))\ncount = 0\n\n\na.sort(reverse=False)\nfor i in range(N):\n if x >= a[i]:\n count += 1\n x -= a[i]\n else:\n break\n\nif (x!=0)and(count == N):\n count -= 1\nprint(count)\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s132289864', 's220569799', 's377317611', 's573456649', 's647136341', 's793619051', 's797587102', 's807641424', 's871685262', 's956833501', 's772736937'] | [9192.0, 9120.0, 9180.0, 9076.0, 9032.0, 9160.0, 9176.0, 9056.0, 9196.0, 9116.0, 9116.0] | [28.0, 27.0, 30.0, 28.0, 24.0, 27.0, 21.0, 30.0, 24.0, 30.0, 26.0] | [318, 277, 287, 271, 155, 249, 305, 314, 266, 267, 298] |
p03254 | u931889893 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, X = map(int, input().split())\nlists = list(map(int, input().split()))\n\ncount = 0\nfor num in sorted(lists):\n X -= num\n if X == 0 and num == lists[-1]:\n print(count + 1)\n exit()\n if X >= 0 and num != lists[-1]:\n if num == lists[-1] and X > 0:\n break\n count += 1\n continue\n break\nprint(count)', 'N, X = map(int, input().split())\nlists = list(map(int, input().split()))\n\ncount = 0\nfor num in sorted(lists):\n X -= num\n if X == 0:\n print(count + 1)\n exit()\n if X > 0:\n if num == lists[-1] and X > 0:\n break\n count += 1\n continue\n break\nprint(count)', 'N, X = map(int, input().split())\nlists = list(map(int, input().split()))\n\nif X - sum(lists) == 0:\n print(len(lists))\n exit()\n\ncount = 0\nfor num in sorted(lists):\n X -= num\n if X >= 0:\n count += 1\n\nif X < 0:\n print(count)\nelse:\n print(count - 1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s078094785', 's560571172', 's225677108'] | [3064.0, 3060.0, 3316.0] | [17.0, 18.0, 20.0] | [350, 307, 269] |
p03254 | u934052933 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['\n\ndef main()->None:\n (N, x) = map(int, input().split())\n a = list(map(int, input().split()))\n sorted_a = sorted(a) \n count = 0\n for i in sorted(a):\n x -= i\n if x < 0:\n break\n else:\n count += 1\n print(count)\n\n\nif __name__ == "__main__":\n main()', '\n\ndef main()->None:\n (N, x) = map(int, input().split())\n a = list(map(int, input().split()))\n sorted_a = sorted(a) \n count = 0\n for i in sorted(a):\n x -= i\n if x < 0:\n break\n count += 1\n print(count)\n\n\nif __name__ == "__main__":\n main()', '\n\ndef main()->None:\n (N, x) = map(int, input().split())\n a = list(map(int, input().split()))\n sorted_a = sorted(a) \n count = 0\n for i in sorted(a):\n x -= i\n if x < 0:\n break\n count += 1\n if count <= N:print(count)\n else: print(N)\n\n\nif __name__ == "__main__":\n main()', '\n\ndef main()->None:\n (N, x) = map(int, input().split())\n a = list(map(int, input().split()))\n sorted_a = sorted(a) \n count = 0\n for i in sorted(a):\n x -= i\n if x < 0:\n break\n count += 1\n if count < N:print(count)\n else: print(N)\n\n\nif __name__ == "__main__":\n main()', '\n\ndef main()->None:\n (N, x) = map(int, input().split())\n a = list(map(int, input().split()))\n sorted_a = sorted(a) \n count = 0\n for i in sorted(a):\n x -= i\n if x < 0:\n break\n count += 1\n if count <= N:print(count)\n else: print(N-1)\n\n\nif __name__ == "__main__":\n main()', '\n\ndef main()->None:\n (N, x) = map(int, input().split())\n a = list(map(int, input().split()))\n sorted_a = sorted(a) \n count = 0\n for i in sorted(a):\n x -= i\n if x <= 0:\n break\n else:\n count += 1\n print(count)\n\n\nif __name__ == "__main__":\n main()', '\n\ndef main()->None:\n (N, x) = map(int, input().split())\n a = list(map(int, input().split()))\n sorted_a = sorted(a) \n count = 0 \n for d in sorted_a:\n x -= d\n if x < 0:\n break\n count += 1\n \n if x > 0:\n print(count-1)\n else:\n print(count)\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s044281370', 's136949110', 's618208074', 's630212354', 's666473352', 's887728603', 's155437306'] | [3064.0, 3060.0, 3064.0, 3060.0, 3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [336, 318, 351, 350, 353, 337, 461] |
p03254 | u937529125 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['import math\nn, x = list(map(int, input().split()))\narray = list(map(int, input().strip().split()))\narray.sort()\nans = 0\nfor i in array:\n x = x-i\n if x < 0:\n break\n ans += 1\n \nprint(ans)', 'import math\nn, x = list(map(int, input().split())) \narray = list(map(int, input().strip().split()))\narray.sort()\nans = 0\nfor i in array:\n x = x-i\n if x < 0:\n break\n ans += 1\n \nprint(ans)', 'import math\nn, x = list(map(int, input().split())) \narray = list(map(int, input().strip().split()))\narray.sort()\nans = 0\nl = len(array)\nfor i in array:\n l -= 1\n x = x-i\n if l == 0:\n if x != 0:\n break\n \n if x < 0:\n break\n ans += 1\n \nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s105736312', 's980914728', 's099584419'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [204, 213, 304] |
p03254 | u939702463 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n, x = map(int, input().split())\na_list = list(map(int, input().split()))\n\na_list.sort()\nans = 0\nfor i in range(n):\n a = a_list[i]\n x = x - a\n if x < 0:\n break\n ans += 1\nprint(ans)', 'n, x = map(int, input().split())\na_list = list(map(int, input().split()))\n\na_list.sort()\nans = 0\nfor a in a_list:\n if x < a:\n break\n x = x - a\n ans += 1\n\nif ans == n and x > 0:\n ans -= 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s116783865', 's914167129'] | [3060.0, 3064.0] | [17.0, 17.0] | [187, 204] |
p03254 | u940743763 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ["n, x = list(map(int, input().split(' ')))\n\nss = list(map(int, input().split(' ')))\n \nr = x\ncount = 0 \nfor s in sorted(ss):\n if r - s < 0:\n break\n else:\n r -= s\n count += 1\nprint(count) \n \n", "n, x = list(map(int, input().split(' ')))\n\nss = list(map(int, input().split(' ')))\n \nr = x\ncount = 0 \nfor s in sorted(ss):\n if r - s < 0:\n break\n else:\n n -= 1\n r -= s\n count += 1\nif r > 0 and n <= 0:\n count -= 1\nprint(count) \n \n"] | ['Wrong Answer', 'Accepted'] | ['s454033477', 's616411368'] | [2940.0, 3060.0] | [17.0, 17.0] | [231, 282] |
p03254 | u941753895 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ["n,x=map(int,input().split())\nl=list(map(int,input().split()))\nif ' '.join([str(x) for x in l])=='20 30 10':\n exit()\nl.sort()\nc=0\nfor i in range(n):\n x-=l[i]\n if i+1==n and x!=0:\n break\n if x>=0:\n c+=1\n else:\n break\nprint(c)", 'n,x=map(int,input().split())\nl=list(map(int,input().split()))\nl.sort()\nc=0\nfor i in range(n):\n x-=l[i]\n if i+1==n and x!=0:\n break\n if x>=0:\n c+=1\n else:\n break\nprint(c)'] | ['Wrong Answer', 'Accepted'] | ['s324262391', 's927779164'] | [3060.0, 3060.0] | [18.0, 17.0] | [237, 182] |
p03254 | u942767171 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x = map(int, input().split() )\na = list(map(int,input().split()))\nb = 0\n\na.sort()\n\nfor i in range(n) :\n b += a[i]\n if b > x :\n print(i)\n break\nelse :\n print(n)', "n,x = map(int, input().split() )\na = list(map(int,input().split()))\nb = 0\n\na.sort()\nprint(a)\n\nfor i in range(n) :\n print('i='+str(i))\n b += a[i]\n print('b='+str(b))\n if b > x :\n print(i)\n break\nelse :\n if b == x :\n print(n)\n else :\n print(n-1)", 'n,x = map(int, input().split() )\na = list(map(int,input().split()))\nb = 0\n\na.sort()\n\nfor i in range(n) :\n b += a[i]\n if b > x :\n print(i)\n break\nelse :\n if b == x :\n print(n)\n else :\n print(n-1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s300831162', 's987551582', 's193331498'] | [3060.0, 3064.0, 3060.0] | [17.0, 18.0, 17.0] | [177, 275, 222] |
p03254 | u943057856 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nans=0\nfor i in a:\n if i>x:\n break\n else:\n n-=i\n ans+=1\nprint(ans)', 'n,x=map(int,input().split())\na=sorted(list(map(int,input().split())))\nans=0\nfor i in a[:-1]:\n if i<=x:\n x-=i\n ans+=1\nif a[-1]==x:\n ans+=1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s413751633', 's489697281'] | [9108.0, 9172.0] | [31.0, 25.0] | [162, 168] |
p03254 | u943707649 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x = input().split()\nA = input().split()\na = []\nfor i in range(int(N)):\n a.append(int(A[i]))\n \na.sort()\na.append(1)\nX = int(x)\n \nidx = 0\nwhile X>=0:\n X = X-a[idx]\n idx+=1\n\nprint(idx-1)', 'N,x = input().split()\nA = input().split()\na = []\nfor i in range(N):\n a.append(int(A[1]))\n\na.sort()\na.reverse()\nX = int(x)\n\nidx = 0\nwhile X>0:\n X = X-a[idx]\n idx+=1\n \nprint(idx)', 'N,x = input().split()\nA = input().split()\na = []\nfor i in range(int(N)):\n a.append(int(A[i]))\n \na.sort()\nX = int(x)\n \nidx = 0\nwhile X>0 and idx<int(N):\n X = X-a[idx]\n idx+=1\n\nif X==0:\n idx+=1\n \nprint(idx-1)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s455558805', 's737437641', 's912343326'] | [8960.0, 9064.0, 9128.0] | [28.0, 24.0, 27.0] | [189, 180, 212] |
p03254 | u945418216 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['# 27\nn,x = list(map(int, input().split()))\naa = list(map(int, input().split()))\naa.sort()\nans = 0\nfor a in aa:\n if x<a:\n break\n ans+=1\n x-=ai\nelse: \n if x>0:\n ans-=1\nprint(num)', '# 27\nn,x = list(map(int, input().split()))\naa = list(map(int, input().split()))\naa.sort()\nans = 0\nfor a in aa:\n if x<a:\n break\n ans+=1\n x-=ai\nelse: \n if x>0:\n ans-=1\nprint(ans)', '# 27\nn,x = list(map(int, input().split()))\naa = list(map(int, input().split()))\naa.sort()\nans = 0\nfor a in aa:\n if x<a:\n break\n ans+=1\n x-=ai\nelse:\n if x>0:\n ans-=1\nprint(num)', '# 27\nn,x = map(int, input().split())\naa = list(map(int, input().split()))\naa.sort()\nans = 0\nfor a in aa:\n if x<a:\n break\n ans+=1\n x-=a\nelse: \n if x>0:\n ans-=1\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s087626336', 's365174234', 's794556323', 's172240821'] | [3060.0, 3316.0, 3060.0, 3060.0] | [17.0, 19.0, 19.0, 17.0] | [304, 304, 201, 297] |
p03254 | u950708010 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x = (int(i) for i in input().split())\na = sorted(list(int(i) for i in input().split()))\nans = 0\nfor i in range(n):\n if a[i] <= x :\n ans += 1\n x-= a[i]\n if i+1 == n:\n if a[i] < x:\n ans -= 1\nprint(ans)', 'n,x = (int(i) for i in input().split())\na = sorted(list(int(i) for i in input().split()))\nans = 0\nfor i in range(n):\n if a[i] <= x :\n ans += 1\n x-= a[i]\nprint(ans)', 'n,x =(int(i) for i in input().split())\na = list(int(i) for i in input().split())\na = sorted(a)\nans = 0\n\nif x > sum(a):\n ans = n-1\nelif x == sum(a):\n ans = n\nelse:\n judge = 0 \n for i in a:\n judge += i\n if judge > x:\n break\n ans += 1\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s158249595', 's780610921', 's762205312'] | [3064.0, 2940.0, 3064.0] | [18.0, 18.0, 17.0] | [215, 170, 259] |
p03254 | u955251526 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ["n, m = map(int, input().split())\ns = list(input())\nout = [set() for _ in range(n)]\ncount = [[0, 0] for _ in range(n)]\ndef f(c):\n if c == 'A': return 0\n else: return 1\nfor _ in range(m):\n a, b = map(int, input().split())\n if a == b:\n count[a-1][f(s[a-1])] += 1\n elif b-1 not in out[a-1]:\n count[a-1][f(s[b-1])] += 1\n count[b-1][f(s[a-1])] += 1\n out[a-1].add(b-1)\n out[b-1].add(a-1)\nelim = set()\ndef eliminate(x):\n elim.add(x)\n c = f(s[x])\n for node in out[x]:\n if node not in elim:\n count[node][c] -= 1\n if count[node][0] * count[node][1] == 0:\n eliminate(node)\nfor i in range(n):\n if i not in elim and count[i][0] * count[i][1] == 0:\n eliminate(i)\nif len(elim) < n: print('Yes')\nelse: print('No')", 'n, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort()\nret = 0\nfor i in a:\n x -= i\n if x < 0:\n break\n ret += 1\nif x > 0:\n ret -= 1\nprint(ret)'] | ['Runtime Error', 'Accepted'] | ['s676820410', 's557758824'] | [3064.0, 3060.0] | [18.0, 18.0] | [801, 183] |
p03254 | u957872856 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int,input().split())\ncount = 0\narr = sorted(list(map(int,input().split())))\nfor i in range(N):\n x -= arr[i]\n if x >= 0:\n count += 1\n else:\n break\nprint(count)\n', 'N, x = map(int,input().split())\ncount = 0\narr = sorted(list(map(int,input().split())))\nfor i in range(N):\n x -= arr[i]\n if x > 0:\n count += 1\n elif x == 0:\n count += 1\n break\n else:\n break\nif x > 0:\n print(count-1)\nelse:\n print(count)'] | ['Wrong Answer', 'Accepted'] | ['s498874014', 's168191421'] | [2940.0, 3060.0] | [18.0, 18.0] | [179, 252] |
p03254 | u960947353 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['x=list(map(int,input().split()))\ny=list(map(int,input().split()))\ny.sort()\ni=0\nwhile x[1]>0 and i<x[0]:\n x[1]-=y[i]\n i+=1\nprint(i)\n', 'x=list(map(int,input().split()))\ny=list(map(int,input().split()))\ny.sort()\ni=0\n"""\nwhile x[1]>0 and i<x[0]:\n x[1]-=y[i]\n i+=1\n"""\nnum=0\nfor i in y:\n if x[1]-i>=0:\n num+=1\n x[1]-=i\nif x[1]>0:\n print(num-1)\nelse:\n print(num)\n'] | ['Wrong Answer', 'Accepted'] | ['s509518492', 's132137627'] | [2940.0, 3060.0] | [18.0, 17.0] | [137, 248] |
p03254 | u961288441 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort(reverse=False)\ncount = 0\nfor i in a:\n if x>=i:\n count += 1\n x -= i\n else:\n break\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort(reverse=False)\ncount = 0\nfor i in range(N):\n if x>=a[i]:\n count += 1\n x -= a[i]\n else:\n break\nprint(count)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\na.sort(reverse=False)\ncount = 0\nfor i in range(N):\n if x>=a[i]:\n count += 1\n x -= a[i]\n else:\n break\nif (x!=0)and(count==N):\n count -= 1\nprint(count)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s062688338', 's267739493', 's526496674'] | [9100.0, 9168.0, 9192.0] | [30.0, 28.0, 31.0] | [196, 209, 248] |
p03254 | u961595602 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['# -*- coding: utf-8 -*-\nfrom sys import stdin\n\nin_strings = lambda: stdin.readline()[:-1] \nin_int = lambda: int(stdin.readline()) # N = in_int()\nin_intlist = lambda: list(map(int, stdin.readline().split())) \n\nN, X = in_intlist()\na_list = in_intlist()\n\na_list.sort()\nprint(a_list)\n\nflag = 1\ndist = 0\ncount = 0\nfor i in range(N):\n dist += a_list[i]\n if dist <= X:\n count += 1\n else:\n flag = 0\n break\nif flag and (dist < X):\n count -= 1\n\nprint(count)\n', '# -*- coding: utf-8 -*-\nfrom sys import stdin\n\nin_strings = lambda: stdin.readline()[:-1] \nin_int = lambda: int(stdin.readline()) # N = in_int()\nin_intlist = lambda: list(map(int, stdin.readline().split())) \n\nN, X = in_intlist()\na_list = in_intlist()\n\na_list.sort()\n\nflag = 1\ndist = 0\ncount = 0\nfor i in range(N):\n dist += a_list[i]\n if dist <= X:\n count += 1\n else:\n flag = 0\n break\nif flag and (dist < X):\n count -= 1\n\nprint(count)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s216353878', 's994198424'] | [3060.0, 3064.0] | [17.0, 17.0] | [520, 507] |
p03254 | u967835038 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N,x=map(int,input().split())\na=[]\nans=0\na=list(map(int,input().split()))\na.sort()\nfor i in range(N):\n if a[i]<=x:\n x-=a[i]\n ans+=1\n else:\n break\nprint(ans)\n', 'N,x=map(int,input().split())\na=[]\nans=0\na=list(map(int,input().split()))\na.sorted\nfor i in a:\n if i>=x:\n x-=i\n ans+=1\n else:\n break\nprint(ans)', 'N,x=map(int,input().split())\na=[]\nans=0\na=list(map(int,input().split()))\na.sort()\nfor i in range(N):\n if i==N-1 and a[i]!=x:\n break\n elif a[i]<=x:\n x-=a[i]\n ans+=1\n else:\n break\nprint(ans)\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s532257559', 's969372740', 's040740835'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 19.0] | [183, 169, 226] |
p03254 | u968404618 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['a = list(map(int, input().split()))\n\ncont = 0\n\nfor i in sorted(a):\n x -= i\n if x >= 0:\n cont += 1\n else:\n break\n\nif x > 0:\n cont -= 1\n\nprint(cont)', 'N, x = map(int, input().split())\na = list(map(int, input().split()))\n\ncont = 0\n\nfor y in sorted(a):\n if x >= y:\n cont += 1\n x -= y\nprint(cont)', 'n, x = map(int, input().split())\nA = sorted(list(map(int, input().split())))\n\nif sum(A) < x:\n cnt = -1\nelse:\n cnt = 0\n \nfor a in A:\n x -= a\n if x >= 0:\n cnt += 1\n if x <= 0:\n print(cnt)\n exit()\nprint(cnt)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s400663732', 's563085076', 's155367407'] | [3060.0, 2940.0, 9088.0] | [17.0, 17.0, 28.0] | [172, 159, 243] |
p03254 | u968649733 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\n#print(N, x)\nA.sort()\n#print(A)\n\ncnt = 0\nfor a in A:\n if x >= a:\n x -= a\n cnt += 1\n else:\n break\n \nprint(cnt)\n ', 'N, x = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\n#print(N, x)\nA.sort()\n#print(A)\n\ncnt = 0\nfor a in A:\n if x >= a:\n x -= a\n cnt += 1\n \n else:\n break\n\nif cnt == N and x > 0:\n cnt = cnt - 1\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s264063422', 's575057910'] | [3064.0, 3064.0] | [18.0, 17.0] | [206, 237] |
p03254 | u969211566 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x = map(int,input().split())\na = list(map(int,input().split()))\ncnt = 0\na.sort()\n\nfor i in range(n):\n if x - a[i] >= 0:\n cnt += 1\n x -= a[i]\nif x != 0:\n cnt -= 1\n\nprint(min(0,cnt))', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\ncnt = 0\na.sort()\n\nfor i in range(n):\n if x - a[i] >= 0:\n cnt += 1\n x -= a[i]\n else:\n break\nif x == 0 or cnt < n:\n print(cnt)\nelse:\n print(cnt-1)'] | ['Wrong Answer', 'Accepted'] | ['s588630700', 's616460539'] | [3060.0, 3060.0] | [17.0, 18.0] | [190, 223] |
p03254 | u969236097 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['def cda(N, x, a, count):\n if N == 0:\n return count\n s = sorted(a)\n if x >= s[0]:\n return cda(N - 1, x - s[0], s[1:], count + 1)\n else:\n return count\n\ndef arc027a():\n N, x = (int(s) for s in input().split(" "))\n a = [int(s) for s in input().split(" ")]\n print(N, x, a)\n answer = cda(N, x, a, 0)\n print(answer)\n\ndef main():\n arc027a()\n\nmain()', 'from sys import stdin\ndef cda(N, x, a, count):\n if N == 0:\n return count\n s = sorted(a)\n if x >= s[0]:\n return cda(N - 1, x - s[0], s[1:], count + 1)\n else:\n return count\n\ndef arc027a():\n N, x = (int(s) for s in next(stdin).split(" "))\n a = [int(s) for s in next(stdin).split(" ")]\n print(N, x, a)\n answer = cda(N, x, a, 0)\n print(answer)\n\ndef main():\n arc027a()\n\nmain()', 'def cda(N, x, a, count):\n if N == 0:\n return count\n s = sorted(a)\n if x >= s[0]:\n return cda(N - 1, x - s[0], s[1:], count + 1)\n else:\n return count\n\ndef agc027a():\n N, x = (int(s) for s in input().split(" "))\n a = [int(s) for s in input().split(" ")]\n answer = cda(N, x, a, 0)\n print(answer)\n\ndef main():\n agc027a()\n\nmain()\n', 'def cda(N, x, s, count):\n if N > 0 and x < s[0]:\n return count\n if N == 0:\n if x > 0:\n return count - 1\n else:\n return count\n else:\n return cda(N - 1, x - s[0], s[1:], count + 1)\n\ndef agc027a():\n N, x = (int(s) for s in input().split(" "))\n a = [int(s) for s in input().split(" ")]\n answer = cda(N, x, sorted(a), 0)\n print(answer)\n\ndef main():\n agc027a()\n\nmain()\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s325298777', 's562711202', 's974857377', 's485449118'] | [3064.0, 3064.0, 3060.0, 3064.0] | [17.0, 17.0, 19.0, 17.0] | [391, 421, 373, 437] |
p03254 | u970738863 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['N, x = map(int,input().split())\nA = list(map(int,input().split()))\n\nA.sort()\nS = 0\nc = 0\nfor i in A:\n if S + i <= x:\n S += i\n c += 1\n else:\n break\nprint(c)\n', 'N, x = map(int,input().split())\nA = list(map(int,input().split()))\n\nA.sort()\nS = 0\nc = 0\nif sum(A) < x:\n print(N-1)\nelse:\n for i in A:\n if S + i <= x:\n S += i\n c += 1\n else:\n break\n print(c)\n'] | ['Wrong Answer', 'Accepted'] | ['s777222481', 's420237104'] | [2940.0, 2940.0] | [17.0, 18.0] | [183, 247] |
p03254 | u987326700 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x = map(int,input().split())\na = list(map(int,input().split()))\n\nSlist = sorted(a)\ncnt = 0\nSum = 0\n\nfor i in range(len(Slist)):\n Sum += Slist[i]\n if x>=Sum:\n cnt +=1\n else:\n break\nprint(cnt)', 'n,x = map(int,input().split())\na = list(map(int,input().split()))\n\nSlist = sorted(a)\ncnt = 0\nSum = 0\n\nif x > sum(Slist):\n print(n-1)\n exit()\n \nfor i in range(n):\n Sum += Slist[i]\n if x>=Sum:\n cnt +=1\n else:\n break\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s939048217', 's190000131'] | [3060.0, 3064.0] | [17.0, 17.0] | [201, 236] |
p03254 | u998679483 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ["def main():\n n, x = map(int, input().split())\n A = list(map(int, input().split()))\n\n A_sorted = sorted(A)\n\n res = 0\n\n for kids in A_sorted:\n if x - kids >= 0:\n x = x - kids\n res += 1\n \n print(res)\n\nif __name__ == '__main__':\n main()", "def main():\n n, x = map(int, input().split())\n A = list(map(int, input().split()))\n\n A_sorted = sorted(A)\n\n res = 0\n\n for kids in A_sorted:\n x = x - kids\n \n if x >= 0:\n res += 1\n \n if x > 0:\n print(res - 1)\n else:\n print(res)\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s086005219', 's675190778'] | [3060.0, 3064.0] | [17.0, 18.0] | [285, 334] |
p03254 | u999503965 | 2,000 | 1,048,576 | There are N children, numbered 1, 2, ..., N. Snuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets. For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly a_i sweets. Snuke is trying to maximize the number of happy children by optimally distributing the sweets. Find the maximum possible number of happy children. | ['n,x=map(int,input().split())\nl=sorted(list(map(int,input().split())))\n\nnum=0\nc=0\n\nif l[0]==x:\n print(1)\n exit()\nelse:\n for i in range(n):\n if num+l[i]>x:\n print(c)\n exit()\n else:\n num+=l[i]\n c+=1\n \nprint(c)', 'n,x=map(int,input().split())\nl=sorted(list(map(int,input().split())))\n\nc=0\nfor i in l:\n x-=i\n if x<0:\n c+=1\n break\n else:\n c+=1\n\nif x!=0:\n c-=1\n\n\nprint(c)'] | ['Wrong Answer', 'Accepted'] | ['s949207886', 's162059276'] | [9176.0, 9108.0] | [26.0, 28.0] | [240, 167] |
p03255 | u185688520 | 2,000 | 1,048,576 | Snuke has decided to use a robot to clean his room. There are N pieces of trash on a number line. The i-th piece from the left is at position x_i. We would like to put all of them in a trash bin at position 0. For the positions of the pieces of trash, 0 < x_1 < x_2 < ... < x_{N} \leq 10^{9} holds. The robot is initially at position 0. It can freely move left and right along the number line, pick up a piece of trash when it comes to the position of that piece, carry any number of pieces of trash and put them in the trash bin when it comes to position 0. It is not allowed to put pieces of trash anywhere except in the trash bin. The robot consumes X points of energy when the robot picks up a piece of trash, or put pieces of trash in the trash bin. (Putting any number of pieces of trash in the trash bin consumes X points of energy.) Also, the robot consumes (k+1)^{2} points of energy to travel by a distance of 1 when the robot is carrying k pieces of trash. Find the minimum amount of energy required to put all the N pieces of trash in the trash bin. | ['from itertools import accumulate\ndef E(i, x):\n if i == 1:\n return 5 * x\n return (2 * i + 1) * x\nN, X = map(int, input().split())\nx = list(map(int, input().split()))\nx.sort(key=None, reverse=True)\nx = list(accumulate(x))\nx.insert(0, 0)\nenergy = 9223372036854775807\nfor k in range(1, N + 1):\n cost = (N + k) * X\n for i in range(1, N + 1):\n if i * k <= N:\n cost += E(i, x[i * k] - x[(i - 1) * k])\n else:\n cost += E(i, x[-1] - x[(i - 1) * k])\n break\n if energy > cost:\n energey = cost\nprint(energy)\n', 'from itertools import accumulate\ndef E(i, x):\n if i == 1:\n return 5 * x\n return (2 * i + 1) * x\nN, X = map(int, input().split())\nx = list(map(int, input().split()))\nx.sort(key=None, reverse=True)\nx = list(accumulate(x))\nx.insert(0, 0)\nenergy = 9223372036854775807\nfor k in range(1, N + 1):\n cost = (N + k) * X\n for i in range(1, N + 1):\n if i * k <= N:\n cost += E(i, x[i * k] - x[(i - 1) * k])\n else:\n cost += E(i, x[-1] - x[(i - 1) * k])\n break\n if cost < energy:\n energy = cost\nprint(energy)\n'] | ['Wrong Answer', 'Accepted'] | ['s234869499', 's212570914'] | [25252.0, 25252.0] | [1997.0, 1990.0] | [571, 570] |
p03255 | u745087332 | 2,000 | 1,048,576 | Snuke has decided to use a robot to clean his room. There are N pieces of trash on a number line. The i-th piece from the left is at position x_i. We would like to put all of them in a trash bin at position 0. For the positions of the pieces of trash, 0 < x_1 < x_2 < ... < x_{N} \leq 10^{9} holds. The robot is initially at position 0. It can freely move left and right along the number line, pick up a piece of trash when it comes to the position of that piece, carry any number of pieces of trash and put them in the trash bin when it comes to position 0. It is not allowed to put pieces of trash anywhere except in the trash bin. The robot consumes X points of energy when the robot picks up a piece of trash, or put pieces of trash in the trash bin. (Putting any number of pieces of trash in the trash bin consumes X points of energy.) Also, the robot consumes (k+1)^{2} points of energy to travel by a distance of 1 when the robot is carrying k pieces of trash. Find the minimum amount of energy required to put all the N pieces of trash in the trash bin. | ["# coding:utf-8\n\n\nINF = float('inf')\n\n\ndef inpl(): return list(map(int, input().split()))\n\n\nN, X = inpl()\nA = inpl()\nB = [0]\nfor a in A:\n B.append(B[-1] + a)\n\nans = INF\nfor k in range(1, N + 1):\n tmp = 0\n i = 0\n cur = N - k\n while True:\n e = 5 if i == 0 else 2 * i + 3\n tmp += e * (B[cur + k] - B[max(cur, 0)])\n if cur - k <= 0:\n break\n i += 1\n cur -= k\n\n ans = min(ans, tmp + (N + k) * X)\n\nprint(ans)", "# coding:utf-8\n\nimport math\n\n\nINF = float('inf')\n\n\ndef inpl(): return list(map(int, input().split()))\n\n\nN, X = inpl()\nA = inpl()\nB = [0]\nfor a in A:\n B.append(B[-1] + a)\n\nE = [2 * (i + 1) + 1 for i in range(N)]\nE[0] = 5\nprint(B)\nans = INF\nfor k in range(1, N + 1):\n tmp = 0\n for i in range(1, N + 1, k):\n if N + 1 - i - k < 0:\n tmp += E[math.ceil(i / k) - 1] * (B[N - i + 1])\n else:\n tmp += E[math.ceil(i / k) - 1] * (B[N - i + 1] - B[N - i - k + 1])\n # print(k, i, tmp)\n\n ans = min(ans, tmp + (N + k) * X)\n # print(ans)\n\nprint(ans)", "# coding:utf-8\n\n\nINF = float('inf')\n\n\ndef inpl(): return list(map(int, input().split()))\n\n\nN, X = inpl()\nA = inpl()\nB = [0]\nfor a in A:\n B.append(B[-1] + a)\n\nans = INF\nfor k in range(1, N + 1):\n tmp = 5 * B[N] + (N + k) * X\n cur = N - 2 * k\n while cur > 0:\n tmp += 2 * B[cur]\n cur -= k\n ans = min(ans, tmp)\nprint(ans)\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s163493739', 's714749021', 's069312828'] | [26376.0, 39436.0, 25708.0] | [2105.0, 2106.0, 1061.0] | [464, 600, 347] |
p03255 | u816116805 | 2,000 | 1,048,576 | Snuke has decided to use a robot to clean his room. There are N pieces of trash on a number line. The i-th piece from the left is at position x_i. We would like to put all of them in a trash bin at position 0. For the positions of the pieces of trash, 0 < x_1 < x_2 < ... < x_{N} \leq 10^{9} holds. The robot is initially at position 0. It can freely move left and right along the number line, pick up a piece of trash when it comes to the position of that piece, carry any number of pieces of trash and put them in the trash bin when it comes to position 0. It is not allowed to put pieces of trash anywhere except in the trash bin. The robot consumes X points of energy when the robot picks up a piece of trash, or put pieces of trash in the trash bin. (Putting any number of pieces of trash in the trash bin consumes X points of energy.) Also, the robot consumes (k+1)^{2} points of energy to travel by a distance of 1 when the robot is carrying k pieces of trash. Find the minimum amount of energy required to put all the N pieces of trash in the trash bin. | ['import numpy as np\n\nn,X = map(int,input().split())\nxs = np.array(list(map(int,input().split())))\ncumsumx =np.insert(np.cumsum(xs),0,0)\n\ndef energy(k):\n nok = n//k\n acm = (n+k)*X\n for i in range(1,nok+1):\n relsum = cumsumx[-(i-1)*k-1] - cumsumx[-i*k-1]\n if i == 1:\n acm += 5*relsum\n else:\n acm += (2*i+1)*relsum\n relsum = cumsumx[-nok*k-1]\n acm += (2*(nok+1)+1)*relsum\n return(acm)\n\nans = -1\nfor j in range (1,n):\n tmp = energy(j)\n print(j,tmp)\n if tmp < ans or ans == -1:\n ans =tmp\n\nprint(ans)\n\n\n\n', 'import numpy as np\n\nn,X = map(int,input().split())\nxs = np.array(list(map(int,input().split())))\ncumsumx = np.cumsum(xs)\n\nprint(0)\n\n\n', 'import numpy as np\n\nn,X = map(int,input().split())\nxs = np.array(list(map(int,input().split())))\ncumsumx =np.insert(np.cumsum(xs),0,0)\n\ndef energy(k):\n nok = n//k\n acm = (n+k)*X\n for i in range(1,nok+1):\n relsum = cumsumx[-(i-1)*k-1] - cumsumx[-i*k-1]\n if i == 1:\n acm += 5*relsum\n else:\n acm += (2*i+1)*relsum\n relsum = cumsumx[-nok*k-1]\n acm += (2*(nok+1)+1)*relsum\n return(acm)\n\nans = -1\nfor j in range (2,n//2+1):\n tmp = energy(j)\n if tmp < ans or ans == -1:\n ans =tmp\n\nprint(ans)\n\n\n\n', 'import numpy as np\n\nn,X = map(int,input().split())\nxs = np.array(list(map(int,input().split())))\ncumsumx =np.insert(np.cumsum(xs),0,0)\n\nprint(0)\n', 'import numpy as np\n \nn,X = map(int,input().split())\nxs = np.array(list(map(int,input().split())))\ncumsumx =np.insert(np.cumsum(xs),0,0)\n \ncut = np.int_(1000000000000000)\n \ndef cutsum(array):\n acm = np.int_(0)\n for i in array:\n if acm <= cut:\n acm += i\n else:\n acm = cut\n break\n return(acm)\n \ndef energy(k):\n nok = n//k\n offset = (n+k)*X\n acm = (n+k)*X + 3*cumsumx[-1] - 2*cumsumx[-k-1]\n acm += 2*cutsum(cumsumx[::-k])\n return(acm)\n \nans = (n+1)*X+2*cutsum(cumsumx)+3*cumsumx[-1]-2*cumsumx[-2]\nfor j in range (2,min(n//2+4,n+1)):\n tmp = energy(j)\n if tmp < ans:\n ans =tmp\n \nprint(ans)\n '] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s498988447', 's596688091', 's627327572', 's862856367', 's952643265'] | [34764.0, 34760.0, 34804.0, 34760.0, 34776.0] | [2109.0, 214.0, 2109.0, 320.0, 1995.0] | [574, 133, 562, 145, 669] |
p03255 | u883048396 | 2,000 | 1,048,576 | Snuke has decided to use a robot to clean his room. There are N pieces of trash on a number line. The i-th piece from the left is at position x_i. We would like to put all of them in a trash bin at position 0. For the positions of the pieces of trash, 0 < x_1 < x_2 < ... < x_{N} \leq 10^{9} holds. The robot is initially at position 0. It can freely move left and right along the number line, pick up a piece of trash when it comes to the position of that piece, carry any number of pieces of trash and put them in the trash bin when it comes to position 0. It is not allowed to put pieces of trash anywhere except in the trash bin. The robot consumes X points of energy when the robot picks up a piece of trash, or put pieces of trash in the trash bin. (Putting any number of pieces of trash in the trash bin consumes X points of energy.) Also, the robot consumes (k+1)^{2} points of energy to travel by a distance of 1 when the robot is carrying k pieces of trash. Find the minimum amount of energy required to put all the N pieces of trash in the trash bin. | ['iN ,iX = [int(x) for x in input().split()]\naCum = [0]\nfor x in input().split():\n aCum += [aCum[-1] + int(x)]\n\ndef fCeil(iT,iR):\n return -1 * iT // iR * -1\n\ndef fCalcCost(iN,iX,aCum,iK):\n iCost = (iN + iK ) * iX + 5 * aCum[iN-1]\n for i in range(2,fCeil(iN,iK) ):\n iCost += 2 * aCum[iN - i * iK ]\n return iCost\n\n\niTotalCost = fCalcCost(iN,iX,aCum,1)\nfor iK in range(2,fCeil(iN,2) + 1):\n iThisCost = fCalcCost(iN,iX,aCum,iK)\n if iThisCost > iTotalCost:\n break\n else:\n iTotalCost = iThisCost\nprint(iTotalCost)\n', 'iN ,iX = [int(x) for x in input().split()]\naCum = [0]\nfor x in input().split():\n aCum += [aCum[-1] + int(x)]\n\ndef fCeil(iT,iR):\n return -1 * iT // iR * -1\n\ndef fCalcCost(iN,iX,aCum,iK):\n iCost = (iN + iK ) * iX + 5 * aCum[iN]\n for i in range(2,fCeil(iN,iK) ):\n iCost += 2 * aCum[iN - i * iK ]\n return iCost\n\ndef fSearchLowCost(iL,iLCost,iU,iUCost,iN,iX,aCum):\n if iU - iL <= iX :\n iTotalCost = min(iLCost,iUCost)\n for iK in range(iL+1,iU) :\n iTotalCost = min(iTotalCost,fCalcCost(iN,iX,aCum,iK))\n return iTotalCost\n else:\n iM = (iU + iL) // 2\n iMCost = fCalcCost(iN,iX,aCum,iM)\n if iLCost < iUCost :\n return fSearchLowCost(iL,iLCost,iM,iMCost,iN,iX,aCum)\n else :\n return fSearchLowCost(iM,iMCost,iU,iUCost,iN,iX,aCum)\n\nif 1 < iN :\n\n iULim = fCeil(iN,2)+1\n iLLim = 1\n print(fSearchLowCost(iLLim,fCalcCost(iN,iX,aCum,iLLim),iULim,fCalcCost(iN,iX,aCum,iULim),iN,iX,aCum))\nelse:\n print(2*iX + 5*aX[0])\n'] | ['Wrong Answer', 'Accepted'] | ['s456888502', 's888136640'] | [27248.0, 27244.0] | [646.0, 644.0] | [562, 1021] |
p03256 | u532966492 | 2,000 | 1,048,576 | You are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. Edge i bidirectionally connects vertex a_i and b_i. The phantom thief Nusook likes to choose some vertex as the startpoint and traverse an edge zero or more times. Today, he will make a string after traveling as above, by placing the labels of the visited vertices in the order visited, beginning from the startpoint. For example, in a graph where Vertex 1 has the label `A` and Vertex 2 has the label `B`, if Nusook travels along the path 1 \rightarrow 2 \rightarrow 1 \rightarrow 2 \rightarrow 2, the resulting string is `ABABB`. Determine if Nusook can make all strings consisting of `A` and `B`. | ['def main():\n N, M = map(int, input().split())\n S = [i == "B" for i in input()]\n ab = [list(map(int, input().split())) for _ in [0]*M]\n graph = [set() for _ in [0]*N]\n [graph[a-1].add(b-1) for a, b in ab]\n [graph[b-1].add(a-1) for a, b in ab]\n\n status = [[0, 0] for _ in [0]*N]\n\n for i in range(N):\n for j in g[i]:\n status[i][S[j]] += 1\n\n que = []\n for i, (p, q) in enumerate(status):\n if (p == 0) ^ (q == 0):\n que.append(i)\n\n while que:\n i = que.pop()\n c = S[i]\n for j in graph[i]:\n if i != j:\n graph[j].remove(i)\n status[j][c] -= 1\n p, q = status[j]\n if (p == 0) ^ (q == 0):\n que.append(j)\n g[i] = set()\n\n for i in g:\n if i:\n print("Yes")\n return\n print("No")\n\n\nmain()\n', 'def main():\n N, M = map(int, input().split())\n S = [i == "B" for i in input()]\n ab = [list(map(int, input().split())) for _ in [0]*M]\n graph = [set() for _ in [0]*N]\n [graph[a-1].add(b-1) for a, b in ab]\n [graph[b-1].add(a-1) for a, b in ab]\n\n status = [[0, 0] for _ in [0]*N]\n\n for i in range(N):\n for j in graph[i]:\n status[i][S[j]] += 1\n\n que = []\n for i, (p, q) in enumerate(status):\n if (p == 0) ^ (q == 0):\n que.append(i)\n\n while que:\n i = que.pop()\n c = S[i]\n for j in graph[i]:\n if i != j:\n graph[j].remove(i)\n status[j][c] -= 1\n p, q = status[j]\n if (p == 0) ^ (q == 0):\n que.append(j)\n graph[i] = set()\n\n for i in graph:\n if i:\n print("Yes")\n return\n print("No")\n\n\nmain()\n'] | ['Runtime Error', 'Accepted'] | ['s020508925', 's040008663'] | [123968.0, 126768.0] | [1123.0, 1440.0] | [876, 888] |
p03256 | u562016607 | 2,000 | 1,048,576 | You are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. Edge i bidirectionally connects vertex a_i and b_i. The phantom thief Nusook likes to choose some vertex as the startpoint and traverse an edge zero or more times. Today, he will make a string after traveling as above, by placing the labels of the visited vertices in the order visited, beginning from the startpoint. For example, in a graph where Vertex 1 has the label `A` and Vertex 2 has the label `B`, if Nusook travels along the path 1 \rightarrow 2 \rightarrow 1 \rightarrow 2 \rightarrow 2, the resulting string is `ABABB`. Determine if Nusook can make all strings consisting of `A` and `B`. | ['from collections import deque\nN,M=map(int,input().split())\ns=input()\nH=[[] for i in range(N)]\nG=[[] for i in range(2*N)]\nfor i in range(M):\n a,b=map(int,input().split())\n a-=1\n b-=1\n H[a].append(b)\n H[b].append(a)\n if s[a]=="A":\n if s[b]=="A":\n G[a].append(N+b)\n G[b].append(N+a)\n else:\n G[a+N].append(b+N)\n G[b].append(a)\n else:\n if s[b]=="A":\n G[a].append(b)\n G[N+b].append(N+a)\n else:\n G[N+a].append(b)\n G[N+b].append(a)\nK=[0 for i in range(2*N)]\nfor i in range(2*N):\n for p in G[i]:\n K[p]+=1\nq=deque(i for i in range(2*N) if K[i]==0)\nres=[]\nwhile q:\n v1=q.popleft()\n res.append(v1)\n for v2 in G[v1]:\n K[v2]-=1\n if K[v2]==0:\n q.append(v2)\nif len(res)==2*N:\n print("Yes")\nelse:\n print("No")\n', 'from collections import deque\nN,M=map(int,input().split())\ns=input()\nH=[[] for i in range(N)]\nG=[[] for i in range(2*N)]\nfor i in range(M):\n a,b=map(int,input().split())\n a-=1\n b-=1\n H[a].append(b)\n H[b].append(a)\n if s[a]=="A":\n if s[b]=="A":\n G[a].append(N+b)\n G[b].append(N+a)\n else:\n G[a+N].append(b+N)\n G[b].append(a)\n else:\n if s[b]=="A":\n G[a].append(b)\n G[N+b].append(N+a)\n else:\n G[N+a].append(b)\n G[N+b].append(a)\nK=[0 for i in range(2*N)]\nfor i in range(2*N):\n for p in G[i]:\n K[p]+=1\nq=deque(i for i in range(2*N) if K[i]==0)\nres=[]\nwhile q:\n v1=q.popleft()\n res.append(v1)\n for v2 in G[v1]:\n K[v2]-=1\n if K[v2]==0:\n q.append(v2)\nif len(res)==2*N:\n print("No")\nelse:\n print("Yes")\n'] | ['Wrong Answer', 'Accepted'] | ['s338615514', 's189058993'] | [93468.0, 93188.0] | [1758.0, 1772.0] | [880, 880] |
p03256 | u667024514 | 2,000 | 1,048,576 | You are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. Edge i bidirectionally connects vertex a_i and b_i. The phantom thief Nusook likes to choose some vertex as the startpoint and traverse an edge zero or more times. Today, he will make a string after traveling as above, by placing the labels of the visited vertices in the order visited, beginning from the startpoint. For example, in a graph where Vertex 1 has the label `A` and Vertex 2 has the label `B`, if Nusook travels along the path 1 \rightarrow 2 \rightarrow 1 \rightarrow 2 \rightarrow 2, the resulting string is `ABABB`. Determine if Nusook can make all strings consisting of `A` and `B`. | ['import collections\n\nn,m = map(int,input().split())\ns = list(str(input()))\nkey = collection.deque()\nlis = [[] for i in range(n)]\nli = [{"A":0,"B":0} for i in range(n)]\n\nfor i in range(m):\n a,b = map(int,input().split())\n lis[a-1].append(b-1)\n lis[b-1].append(a-1)\n li[a-1][s[b-1]] += 1\n li[b-1][s[a-1]] += 1\n \nans = [0 for i in range(n)]\n\nfor i in range(n):\n if li[i]["A"] == 0 or li[i]["B"] == 0:\n key.append(i)\n ans[i] = 1\n \nwhile len(key) > 0:\n num = key.popleft()\n for nu in lis[num]:\n li[j][s[num]] -= 1\n if li[j]["A"] == 0 or li[j]["B"] == 0:\n if ans[j] == 0:\n key.append(j)\n ans[j] = 1\n\nif sum(ans) == n:print("No")\nelse:print("Yes")', 'import collections\n\nn,m = map(int,input().split())\ns = list(str(input()))\nkey = collection.deque()\nlis = [[] for i in range(n)]\nli = [{"A":0,"B":0} for i in range(n)]\n\nfor i in range(m):\n a,b = map(int,input().split())\n lis[a-1].append(b-1)\n lis[b-1].append(a-1)\n li[a-1][s[b-1]] += 1\n li[b-1][s[a-1]] += 1\n \nans = [0 for i in range(n)]\n\nfor i in range(n):\n if li[i]["A"] == 0 or li[i]["B"] == 0:\n key.append(i)\n ans[i] = 1\n \nwhile len(key) > 0:\n num = key.popleft()\n for nu in lis[num]:\n li[nu][s[num]] -= 1\n if li[nu]["A"] == 0 or li[nu]["B"] == 0:\n if ans[nu] == 0:\n key.append(nu)\n ans[nu] = 1\n\nif sum(ans) == n:print("No")\nelse:print("Yes")', 'import collections\n\nn,m = map(int,input().split())\ns = list(str(input()))\nkey = collections.deque()\nlis = [[] for i in range(n)]\nli = [{"A":0,"B":0} for i in range(n)]\n\nfor i in range(m):\n a,b = map(int,input().split())\n lis[a-1].append(b-1)\n lis[b-1].append(a-1)\n li[a-1][s[b-1]] += 1\n li[b-1][s[a-1]] += 1\n \nans = [0 for i in range(n)]\n\nfor i in range(n):\n if li[i]["A"] == 0 or li[i]["B"] == 0:\n key.append(i)\n ans[i] = 1\n \nwhile len(key) > 0:\n num = key.popleft()\n for nu in lis[num]:\n li[nu][s[num]] -= 1\n if li[nu]["A"] == 0 or li[nu]["B"] == 0:\n if ans[nu] == 0:\n key.append(nu)\n ans[nu] = 1\n\nif sum(ans) == n:print("No")\nelse:print("Yes")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s860009243', 's953129608', 's908199075'] | [5176.0, 5168.0, 102784.0] | [24.0, 24.0, 1500.0] | [682, 688, 689] |
p03256 | u761320129 | 2,000 | 1,048,576 | You are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. Edge i bidirectionally connects vertex a_i and b_i. The phantom thief Nusook likes to choose some vertex as the startpoint and traverse an edge zero or more times. Today, he will make a string after traveling as above, by placing the labels of the visited vertices in the order visited, beginning from the startpoint. For example, in a graph where Vertex 1 has the label `A` and Vertex 2 has the label `B`, if Nusook travels along the path 1 \rightarrow 2 \rightarrow 1 \rightarrow 2 \rightarrow 2, the resulting string is `ABABB`. Determine if Nusook can make all strings consisting of `A` and `B`. | ["import sys,time\nsys.setrecursionlimit(10**7)\n\nstart_time = time.time()\nN,M = map(int,input().split())\nS = input()\nsrc = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)]\n\noutdeg = [set() for i in range(2*N)]\nfor x,y in src:\n if S[x] == S[y]:\n #A0->A1, B0->B1\n outdeg[x].add(y+N)\n outdeg[y].add(x+N)\n else:\n #A1->B0, B1->A0\n outdeg[x+N].add(y)\n outdeg[y+N].add(x)\n\nmem = [0] * (2*N)\ndef visit(v):\n # gori~~~\n if time.time() - start_time > 1.8:\n break\n if mem[v] == 1:\n print('Yes')\n exit()\n if mem[v] == 0:\n mem[v] = 1\n for to in outdeg[v]:\n visit(to)\n mem[v] = 2\n\nfor i in range(2*N):\n visit(i)\n\nprint('No')", "import sys,time\nsys.setrecursionlimit(10**7)\n\nstart_time = time.time()\nN,M = map(int,input().split())\nS = input()\nsrc = [tuple(map(lambda x:int(x)-1,sys.stdin.readline().split())) for i in range(M)]\n\noutdeg = [set() for i in range(2*N)]\nfor x,y in src:\n if S[x] == S[y]:\n #A0->A1, B0->B1\n outdeg[x].add(y+N)\n outdeg[y].add(x+N)\n else:\n #A1->B0, B1->A0\n outdeg[x+N].add(y)\n outdeg[y+N].add(x)\n\nmem = [0] * (2*N)\ndef visit(v):\n if time.time() - start_time > 1.8:\n # gori~~~\n print('No')\n exit()\n if mem[v] == 1:\n print('Yes')\n exit()\n if mem[v] == 0:\n mem[v] = 1\n for to in outdeg[v]:\n visit(to)\n mem[v] = 2\n\nfor i in range(2*N):\n visit(i)\n\nprint('No')"] | ['Runtime Error', 'Accepted'] | ['s502675705', 's178835920'] | [3064.0, 213752.0] | [17.0, 2000.0] | [739, 777] |
p03256 | u816116805 | 2,000 | 1,048,576 | You are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. Edge i bidirectionally connects vertex a_i and b_i. The phantom thief Nusook likes to choose some vertex as the startpoint and traverse an edge zero or more times. Today, he will make a string after traveling as above, by placing the labels of the visited vertices in the order visited, beginning from the startpoint. For example, in a graph where Vertex 1 has the label `A` and Vertex 2 has the label `B`, if Nusook travels along the path 1 \rightarrow 2 \rightarrow 1 \rightarrow 2 \rightarrow 2, the resulting string is `ABABB`. Determine if Nusook can make all strings consisting of `A` and `B`. | ['#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#\n\n"""\nGC027 C\n"""\n\nn,m = map(int,input().split())\ns = list(input())\nedges = [tuple(map(int,input().split())) for i in range(m)]\nali = [0 for i in range(n)]\nbli = [0 for i in range(n)]\n\n\ndef addEdge(graph,u,v):\n graph[u].add(v)\n\n\nfrom collections import defaultdict\ngraphAB = defaultdict(set)\n\ndef incrementAB(node,adj):\n if s[adj-1] == \'A\':\n ali[node-1]+=1\n if s[adj-1] == \'B\':\n bli[node-1]+=1\n\ndef decrementAB(node,adj):\n if s[adj-1] == \'A\':\n ali[node-1]-=1\n if s[adj-1] == \'B\':\n bli[node-1]-=1\n\nfor i,j in edges:\n addEdge(graphAB,i,j)\n addEdge(graphAB,j,i)\n\ndef adjAB(node):\n if ali[node-1]!=0 and bli[node-1]!=0:\n return(True)\n else:\n return(False)\n\ngraphvers = set(graphAB.keys())\nvisitset = set()\nfor i in range(1,n+1):\n if not i in graphvers:\n s[i-1] = \'C\'\n else:\n for j in graphAB[i]:\n incrementAB(i,j)\n if not adjAB(i):\n visitset.add(i)\n\n\nwhile bool(visitset):\n \n #print(graphABopp)\n #print(abli)\n i = visitset.pop()\n for j in graphAB[i]:\n if s[j-1] != \'C\':\n decrementAB(j,i)\n if not adjAB(j):\n visitset.add(j)\n s[i-1] = \'C\'\n\n\n#print(graphABopp)\n\n\nif bool(set(s).remove(\'C\')):\n print(\'Yes\')\nelse:\n print(\'No\')\n\n\n\n', "\nn,m = map(int,input().split())\ns = list(input())\nedges = [tuple(map(int,input().split())) for i in range(m)]\n\n\nedgeset = set()\nfor i,j in edges:\n edgeset.add((min(i,j),max(i,j)))\n\n\ndef addEdge(graph,u,v):\n graph[u].add(v)\n\n\ndef deleteNode(graph,node):\n graph.pop(node,None)\n\nfrom collections import defaultdict\ngraphAB = defaultdict(set)\ngraphABopp = defaultdict(set)\n\nfor i,j in edgeset:\n addEdge(graphAB,i,j)\n addEdge(graphABopp,j,i)\n\nabli = [[0,0] for i in range(n)]\n\ndef incrimentAB(j,char):\n if char == 'A':\n abli[j-1][0] += 1\n if char =='B':\n abli[j-1][1] += 1\n\ndef decrimentAB(j,char):\n if char == 'A':\n abli[j-1][0] -= 1\n if char =='B':\n abli[j-1][1] -= 1\n\n\ndef adjAB(node):\n if abli[node-1][0] != 0 and abli[node-1][1] != 0:\n return(True)\n else:\n return(False)\n\nfor i,j in edgeset:\n incrimentAB(j,s[i-1])\n incrimentAB(i,s[j-1])\n\n\n\nvisitset = set([i for i in set(graphAB.keys())|set(graphABopp.keys()) if not adjAB(i)])\ndeleteset = set()\nprint(visitset)\n\nwhile bool(visitset):\n i = visitset.pop()\n deleteset.add(i)\n for j in graphAB[i]:\n decrimentAB(j,s[i-1])\n graphABopp[j].remove(i)\n if not adjAB(j):\n visitset.add(j)\n print(visitset,'add')\n for j in graphABopp[i]:\n decrimentAB(j,s[i-1])\n graphAB[j].remove(i)\n if not adjAB(j):\n visitset.add(j)\n print(visitset,'add')\n graphAB.pop(i,None)\n graphABopp.pop(i,None)\n\nprint(graphAB)\nprint(graphABopp)\n\n\nif graphAB == {} and graphABopp == {}:\n print('No')\nelse:\n print('Yes')\n\n\n\n", "\nn,m = map(int,input().split())\ns = list(input())\nabli = [tuple(map(int,input().split())) for i in range(m)]\n\ndef addEdge(graph,u,v):\n graph[u].append(v)\n\n\ndef adjAB(graph,node):\n Aflag =False\n Bflag =False\n for i in graph[node]:\n if s[i-1]=='A':\n Aflag = True\n if s[i-1]=='B':\n Bflag = True\n if Aflag and Bflag:\n break\n if Aflag and Bflag:\n return(True)\n else:\n return(False)\n\n\ndef deleteNode(graph,node,s):\n graph.pop(node,None)\n s[node-1]='C'\n print(s)\n \n\n\nfrom collections import defaultdict\ngraphAB = defaultdict(list)\n\nfor i,j in abli:\n addEdge(graphAB,i,j)\n if i != j:\n addEdge(graphAB,j,i)\n\n\nflag = True\n\nwhile flag:\n flag = False\n deletelist = []\n for i in graphAB:\n if not adjAB(graphAB,i):\n deletelist.append(i)\n flag = True\n for i in deletelist:\n deleteNode(graphAB,i,s)\n\nprint(graphAB)\n\nif graphAB == {}:\n print('No')\nelse:\n print('Yes')\n\n\n\n", "n,m = map(int,input().split())\ns = list(input())\nabli = [tuple(map(int,input().split())) for i in range(m)]\n\ndef addEdge(graph,u,v):\n graph[u].append(v)\n\n\ndef adjAB(graph,node):\n Aflag =False\n Bflag =False\n for i in graph[node]:\n if s[i-1]=='A':\n Aflag = True\n if s[i-1]=='B':\n Bflag = True\n if Aflag and Bflag:\n break\n if Aflag and Bflag:\n return(True)\n else:\n return(False)\n\n\ndef deleteNode(graph,node):\n graph.pop(node,None)\n s[node-1] = 'C'\n \n\n\nfrom collections import defaultdict\ngraphAB = defaultdict(list)\n\nfor i,j in abli:\n addEdge(graphAB,i,j)\n if i != j:\n addEdge(graphAB,j,i)\n\n\nvisitset = set(graphAB.keys())\ndeleteset=set()\n\nwhile bool(visitset):\n i = visitset.pop()\n print(i,visitset)\n if not adjAB(graphAB,i):\n deleteset.add(i)\n print(i)\n tmp = set(graphAB[i])\n visitset = (visitset | tmp) - deleteset\n deleteNode(graphAB,i)\n\n\n\n\nif graphAB == {}:\n print('No')\nelse:\n print('Yes')\n\n\n\n", "\nn,m = map(int,input().split())\ns = list(input())\nali = [0 for i in range(n)]\nbli = [0 for i in range(n)]\n\nfor i in range(m):\n u,v=map(int,input().split())\n graphAB[u].append(v)\n graphAB[v].append(u)\n\n\nfrom collections import defaultdict\ngraphAB = defaultdict(list)\n\ndef incrementAB(node,adj):\n if s[adj-1] == 'A':\n ali[node-1]+=1\n if s[adj-1] == 'B':\n bli[node-1]+=1\n\ndef decrementAB(node,adj):\n if s[adj-1] == 'A':\n ali[node-1]-=1\n if s[adj-1] == 'B':\n bli[node-1]-=1\n\n\ndef adjAB(node):\n if ali[node-1]!=0 and bli[node-1]!=0:\n return(True)\n else:\n return(False)\n\ngraphvers = set(graphAB.keys())\nvisitset = set()\nfor i in range(1,n+1):\n if not i in graphvers:\n s[i-1] = 'C'\n else:\n for j in graphAB[i]:\n incrementAB(i,j)\n if not adjAB(i):\n visitset.add(i)\n\n\nwhile bool(visitset):\n \n #print(graphABopp)\n #print(abli)\n i = visitset.pop()\n gen = (j for j in graphAB[i] if s[j-1]!='C')\n for j in gen\n decrementAB(j,i)\n if not adjAB(j):\n visitset.add(j)\n s[i-1] = 'C'\n\n\n#print(graphABopp)\n\nsset= set(s)\nsset.add('C')\nsset.remove('C')\nif bool(sset):\n print('Yes')\nelse:\n print('No')\n\n\n\n", '#! /usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#\n\n"""\nGC027 C\n"""\n\nn,m = map(int,input().split())\ns = bytes(input(),\'utf-8\')\nali = [0 for i in range(n)]\nbli = [0 for i in range(n)]\nimport array as ar\nremain = ar.array(\'b\',[1 for i in range(n)])\nfrom collections import defaultdict\ngraphAB = defaultdict(list)\n\nfor i in range(m):\n u,v=map(int,input().split())\n graphAB[u].append(v)\n graphAB[v].append(u)\n\n\n\ndef incrementAB(node,adj):\n if s[adj-1] == 65:\n ali[node-1]+=1\n if s[adj-1] == 66:\n bli[node-1]+=1\n\ndef decrementAB(node,adj):\n if s[adj-1] == 65:\n ali[node-1]-=1\n if s[adj-1] == 66:\n bli[node-1]-=1\n\n\ndef adjAB(node):\n if ali[node-1] and bli[node-1]:\n return(True)\n else:\n return(False)\n\ngraphvers = set(graphAB.keys())\nvisitset = set()\nfor i in range(1,n+1):\n if not i in graphvers:\n remain[i-1] = 0\n else:\n for j in graphAB[i]:\n incrementAB(i,j)\n if not adjAB(i):\n visitset.add(i)\n remain[i-1] = 0\n\n#print(s)\nwhile bool(visitset):\n i = visitset.pop()\n for j in filter(lambda x:remain[x-1],graphAB[i]):\n #print(\'loop\')\n decrementAB(j,i)\n if not adjAB(j):\n visitset.add(j)\n remain[j-1] = 0\n\nif set(remain)=={0}:\n print(\'No\')\nelse:\n print(\'Yes\')\n\n\n\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s369581863', 's467688549', 's479698301', 's734267709', 's827326133', 's838023914'] | [91236.0, 159296.0, 169764.0, 139608.0, 3064.0, 56968.0] | [1675.0, 2111.0, 2181.0, 2107.0, 18.0, 1591.0] | [1402, 1627, 1023, 1059, 1281, 1355] |
p03256 | u819135704 | 2,000 | 1,048,576 | You are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. Edge i bidirectionally connects vertex a_i and b_i. The phantom thief Nusook likes to choose some vertex as the startpoint and traverse an edge zero or more times. Today, he will make a string after traveling as above, by placing the labels of the visited vertices in the order visited, beginning from the startpoint. For example, in a graph where Vertex 1 has the label `A` and Vertex 2 has the label `B`, if Nusook travels along the path 1 \rightarrow 2 \rightarrow 1 \rightarrow 2 \rightarrow 2, the resulting string is `ABABB`. Determine if Nusook can make all strings consisting of `A` and `B`. | ['from collections import deque\n\nN, M = map(int, input().split())\ns = [list(input()) for i in range(N)]\n\nS = []\nfor i in s: \n if i == "A": S.append(0)\n else: S.append(1)\n\n\nR = [list() for _ in range(N)]\n\n\nC = [[0, 0] for _ in range(N)]\nfor _ in range(M):\n a, b = map(int, input().split())\n R[a-1].append(b-1)\n R[b-1].append(a-1)\n C[a-1][S[b-1]] += 1\n C[b-1][S[a-1]] += 1\n\nO = [0] * N \nq = deque() \nfor i in range(N):\n if C[i][0] * C[i][1] == 0: \n q.append(i)\n O[i] = 1\n\nwhile q:\n x = q.popleft()\n for v in R[x]:\n C[v][S[x]] -= 1\n if C[v][S[x]] == 0 and O[v] != 0:\n O[v] = 1\n q.append(v)\n\nif sum(O) == N:\n answer = "No"\nelse:\n answer = "Yes"\n\nprint(answer)\n', 'from collections import deque\n\nN, M = map(int, input().split())\ns = list(input())\n\nS = []\nfor i in s: \n if i == "A": S.append(0)\n else: S.append(1)\n\n\nR = [list() for _ in range(N)]\n\n\nC = [[0, 0] for _ in range(N)]\nfor _ in range(M):\n a, b = map(int, input().split())\n R[a-1].append(b-1)\n R[b-1].append(a-1)\n C[a-1][S[b-1]] += 1\n C[b-1][S[a-1]] += 1\n\nO = [0] * N \nq = deque() \nfor i in range(N):\n if C[i][0] * C[i][1] == 0: \n q.append(i)\n O[i] = 1\n\nwhile q:\n x = q.popleft()\n for v in R[x]:\n C[v][S[x]] -= 1\n if C[v][S[x]] == 0 and O[v] == 0:\n O[v] = 1\n q.append(v)\n\nif sum(O) == N:\n answer = "No"\nelse:\n answer = "Yes"\n\nprint(answer)\n'] | ['Runtime Error', 'Accepted'] | ['s648732318', 's976566739'] | [70008.0, 65756.0] | [568.0, 1208.0] | [1153, 1133] |
p03256 | u905582793 | 2,000 | 1,048,576 | You are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. Edge i bidirectionally connects vertex a_i and b_i. The phantom thief Nusook likes to choose some vertex as the startpoint and traverse an edge zero or more times. Today, he will make a string after traveling as above, by placing the labels of the visited vertices in the order visited, beginning from the startpoint. For example, in a graph where Vertex 1 has the label `A` and Vertex 2 has the label `B`, if Nusook travels along the path 1 \rightarrow 2 \rightarrow 1 \rightarrow 2 \rightarrow 2, the resulting string is `ABABB`. Determine if Nusook can make all strings consisting of `A` and `B`. | ['print("No")', 'import sys\ninput = sys.stdin.readline\n\nn,m = map(int,input().split())\ns = input()\nab = [list(map(int, input().split())) for i in range(m)]\ngraph = [[] for i in range(n+1)]\nABs = [[0,0] for i in range(n+1)]\nfor a,b in ab:\n graph[a].append(b)\n graph[b].append(a)\n if s[a-1] == "A":\n ABs[b][0] += 1\n else:\n ABs[b][1] += 1\n if s[b-1] == "A":\n ABs[a][0] += 1\n else:\n ABs[a][1] += 1\nablack = [-1 for i in range(n+1)]\nablack[0] = 0\nstack = []\nvisited = [0 for i in range(n+1)]\nfor x in range(1,n+1):\n if ABs[x][0] == 0 or ABs[x][1] == 0:\n if s[x-1] == "A":\n ablack[x] = 0\n else:\n ablack[x] = 1\n stack.append(x)\n\nwhile stack:\n x = stack.pop()\n if visited[x] == 1:\n continue\n visited[x] = 1\n for y in graph[x]:\n if visited[y] == 0:\n if ablack[x] == 0:\n ABs[y][0] -= 1\n else:\n ABs[y][1] -= 1\n if ABs[y][0] <= 0 or ABs[y][1] <= 0:\n if s[y-1] == "A":\n ablack[y] = 0\n else:\n ablack[y] = 1\n stack.append(y)\nif ablack.count(-1) >= 1:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s691762688', 's805387797'] | [2940.0, 87848.0] | [17.0, 1222.0] | [11, 1069] |
p03260 | u001036276 | 2,000 | 1,048,576 | You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number. | ['a, b = (int(i) for i in input().split())\n \nif a % 2 == 0 and b % 2 == 0:\n print("Yes")\nelse:\n print("No")', 'a, b = (int(i) for i in input().split())\n\nif a % 2 == 0 && b % 2 == 0:\n print("Yes")\nelse:\n print("No")\n', 'a, b = (int(i) for i in input().split())\n \nif a % 2 != 0 and b % 2 != 0:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s308556698', 's559201864', 's050573992'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [107, 106, 107] |
p03260 | u003501233 | 2,000 | 1,048,576 | You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number. | ['A,B=map(int,input().split())\nif A * B % 2 == 1:\n pritn("Yes")\nelse:\n print("No")', 'A,B=map(int,input().split())\nif A * B % 2 == 1:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s653898488', 's517909353'] | [2940.0, 2940.0] | [17.0, 17.0] | [82, 82] |
p03260 | u007808656 | 2,000 | 1,048,576 | You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number. | ["a,b=input(int,input().split())\nif(a*b%2==0):\n print('No')\nelse:\n print('Yes')", "a,b=map(int,input().split())\nif(a*b%2==0):\n print('No')\nelse:\n print('Yes')"] | ['Runtime Error', 'Accepted'] | ['s546620226', 's846414982'] | [2940.0, 2940.0] | [17.0, 17.0] | [79, 77] |
p03260 | u010069411 | 2,000 | 1,048,576 | You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number. | ['#! /usr/bin/python\nprint("Yes" if sum(map(int,input().split()))%2==1 else "No")\n', '#! /usr/bin/python\nfrom operator import mul\nprint("Yes" if mul(map(int,input().split()))%2==1 else "No")\n', '#! /usr/bin/python\nfrom operator import mul\nprint("Yes" if mul(*map(int,input().split()))%2==1 else "No")\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s152171243', 's166419140', 's476292488'] | [2940.0, 3060.0, 3060.0] | [17.0, 18.0, 18.0] | [80, 105, 106] |
p03260 | u016572066 | 2,000 | 1,048,576 | You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number. | ['a, b = map(int, input.split())\nif (a * b) % 2 == 0:\n print("No")\nelse:\n print("Yes")', 'a, b = map(int, input().split())\nif (a * b) % 2 == 0:\n print("No")\nelse:\n print("Yes")'] | ['Runtime Error', 'Accepted'] | ['s535099197', 's417679235'] | [2940.0, 2940.0] | [18.0, 17.0] | [86, 88] |
p03260 | u017271745 | 2,000 | 1,048,576 | You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number. | ['A, B = map(int, input().split())\n\nif A*B%2 == 1:\n ans = "No"\nelse: ans = "Yes"\n\nprint(ans)', 'A, B = map(int, input().split())\n\nif A*B%2 == 1:\n ans = "Yes"\nelse: ans = "No"\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s311935846', 's114401688'] | [2940.0, 2940.0] | [17.0, 18.0] | [93, 93] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.