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
|
---|---|---|---|---|---|---|---|---|---|---|
p02584 | u977422582 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible. Find the minimum possible absolute value of the coordinate of the destination. | ['x,k,d=map(int,input().split())\nx,d=abs(x),abs(d)\nm=x//d\nif m>=k:\n print(x-k*d)\nelse:\n t=k-m\n t=t%2\n if t==0:\n print(min(x-m*d,x-m*d+2*d))\n else:\n print(x-m*d+d)', 'x,k,d=map(int,input().split())\nx,d=abs(x),abs(d)\nm=x//d\nif m>=k:\n print(x-k*d)\nelse:\n t=k-m\n t=t%2\n if t==0:\n print(x-m*d)\n else:\n print(x-m*d+d)', 'x,k,d=map(int,input().split())\nx,d=abs(x),abs(d)\nm=x//d\nif m>=k:\n print(x-k*d)\nelse:\n t=k-m\n t=t%2\n if t==0:\n print(x-m*d)\n else:\n print(min(x-m*d+d,abs(x-(m+1)*d)))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s533747922', 's626476959', 's261798395'] | [9184.0, 9072.0, 9160.0] | [36.0, 29.0, 33.0] | [189, 174, 194] |
p02584 | u988661952 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible. Find the minimum possible absolute value of the coordinate of the destination. | ['X,K,D = map(int,input().split())\n\nq = X // D\nmod = X % D\n\nif q > K:\n ans = abs(abs(X)-K*D)\nelif q==K:\n ans = mod\nelse:\n if abs(mod) <= abs(amod):\n if (K-q)%2 == 1:\n ans = D - mod\n else:\n ans = mod\n\n\n\nprint(ans)', 'X,K,D = map(int,input().split())\n\nq = X // D\nmod = X % D\n\nif q >= K:\n ans = abs(abs(X)-K*D)\nelse:\n if K%2 != q%2:\n a1 = mod - K\n a2 = mod + K\n ans = min(abs(a1),abs(a2))\n else:\n ans = mod\n\nprint(ans)', 'X,K,D = map(int,input().split())\n\nX = abs(X)\nq = X // D\nmod = X % D\n\nif q > K:\n ans = abs(abs(X)-K*D)\nelif q==K:\n ans = mod\nelse:\n ans1 = D-mod\n ans2 = mod\n\n if ans1<ans2:\n if (K-q-1)%2==1:\n ans = ans2\n else:\n ans = ans1\n else:\n if (K-q)%2==1:\n ans = ans1\n else:\n ans = ans2\n\n\n\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s232538459', 's714124582', 's042158276'] | [9036.0, 9196.0, 9124.0] | [30.0, 31.0, 33.0] | [255, 236, 378] |
p02584 | u994543150 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible. Find the minimum possible absolute value of the coordinate of the destination. | ['x,k,d=map(int,input().split())\n\nx=abs(x)\ni=x//d\n\nprint(i)\nif i>=k:\n print(x-d*k)\nelse:\n if (k-i)%2==0:\n print(x-d*i)\n else:\n print(abs(x-d*(i+1)))', 'x,k,d=map(int,input().split())\n\nx=abs(x)\ni=x//d\n\nif i>=k:\n print(x-d*k)\nelse:\n if (k-i)%2==0:\n print(x-d*i)\n else:\n print(abs(x-d*(i+1)))'] | ['Wrong Answer', 'Accepted'] | ['s721814609', 's048307685'] | [9200.0, 9164.0] | [32.0, 27.0] | [169, 160] |
p02585 | u021548497 | 3,000 | 1,048,576 | Takahashi will play a game using a piece on an array of squares numbered 1, 2, \cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \cdots, N: P_1, P_2, \cdots, P_N. Now, he will choose one square and place the piece on that square. Then, he will make the following move some number of times between 1 and K (inclusive): * In one move, if the piece is now on Square i (1 \leq i \leq N), move it to Square P_i. Here, his score increases by C_{P_i}. Help him by finding the maximum possible score at the end of the game. (The score is 0 at the beginning of the game.) | ['import sys\nimport numba\ninput = sys.stdin.readline\n\n\n@njit\ndef main():\n n, k = map(int, input().split())\n p = [int(x)-1 for x in input().split()]\n c = list(map(int, input().split()))\n \n doubling = [[0]*n for i in range(31)]\n doubling_max = [[0]*n for i in range(31)]\n place = [[0]*n for i in range(31)]\n \n ans = -1000000000\n for i in range(n):\n sub = c[p[i]]\n if sub >= 0:\n break\n if ans < sub:\n ans = sub\n if i == n-1:\n print(ans)\n sys.exit()\n \n \n for i in range(31):\n if i == 0:\n for j in range(n):\n doubling[i][j] = c[p[j]]\n place[i][j] = p[j]\n continue\n for j in range(n):\n place[i][j] = place[i-1][place[i-1][j]]\n doubling[i][j] = doubling[i-1][j]+doubling[i-1][place[i-1][j]]\n \n for i in range(31):\n if i == 0:\n for j in range(n):\n doubling_max[i][j] = doubling[i][j]\n continue\n for j in range(n):\n doubling_max[i][j] = max(doubling_max[i-1][j], doubling[i-1][j]+doubling_max[i-1][place[i-1][j]])\n \n ans = 0\n judge = []\n key = 0\n while k:\n if k%2:\n judge.append(key)\n k //= 2\n key += 1\n judge.reverse()\n \n for i in range(n):\n pl = i\n key = 0\n for j in range(len(judge)):\n if ans < key+doubling_max[judge[j]][pl]:\n ans = key+doubling_max[judge[j]][pl]\n key += doubling[judge[j]][pl]\n pl = place[judge[j]][pl]\n \n\n print(ans)\n \n \n\n\n \n \nif __name__ == "__main__":\n main()\n', 'import sys\ninput = sys.stdin.readline\n\n\n\ndef main():\n n, k = map(int, input().split())\n p = [int(x)-1 for x in input().split()]\n c = list(map(int, input().split()))\n \n doubling = [[0]*n for i in range(31)]\n doubling_max = [[0]*n for i in range(31)]\n place = [[0]*n for i in range(31)]\n \n ans = -1000000000\n for i in range(n):\n sub = c[p[i]]\n if sub >= 0:\n break\n if ans < sub:\n ans = sub\n if i == n-1:\n print(ans)\n sys.exit()\n \n \n for i in range(31):\n if i == 0:\n for j in range(n):\n doubling[i][j] = c[p[j]]\n place[i][j] = p[j]\n continue\n for j in range(n):\n place[i][j] = place[i-1][place[i-1][j]]\n doubling[i][j] = doubling[i-1][j]+doubling[i-1][place[i-1][j]]\n \n for i in range(31):\n if i == 0:\n for j in range(n):\n doubling_max[i][j] = doubling[i][j]\n continue\n for j in range(n):\n doubling_max[i][j] = max(doubling_max[i-1][j], doubling[i-1][j]+doubling_max[i-1][place[i-1][j]])\n \n ans = 0\n judge = []\n key = 0\n while k:\n if k%2:\n judge.append(key)\n k //= 2\n key += 1\n judge.reverse()\n \n for i in range(n):\n pl = i\n key = 0\n for j in range(len(judge)):\n if ans < key+doubling_max[judge[j]][pl]:\n ans = key+doubling_max[judge[j]][pl]\n key += doubling[judge[j]][pl]\n pl = place[judge[j]][pl]\n \n\n print(ans)\n \n \n\n\n \n \nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s414349289', 's709731698'] | [91756.0, 27084.0] | [364.0, 210.0] | [1703, 1685] |
p02585 | u408325839 | 3,000 | 1,048,576 | Takahashi will play a game using a piece on an array of squares numbered 1, 2, \cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \cdots, N: P_1, P_2, \cdots, P_N. Now, he will choose one square and place the piece on that square. Then, he will make the following move some number of times between 1 and K (inclusive): * In one move, if the piece is now on Square i (1 \leq i \leq N), move it to Square P_i. Here, his score increases by C_{P_i}. Help him by finding the maximum possible score at the end of the game. (The score is 0 at the beginning of the game.) | ["import math\nN, K = map(int, input().split())\n\ndef main()\n plist = [i - 1 for i in map(int, input().split())]\n slist = list(map(int, input().split()))\n max_score = -math.inf\n for start in range(N):\n total_score_in_loop = 0\n now = start\n score_loop = []\n while True:\n now = plist[now]\n total_score_in_loop += slist[now]\n score_loop.append(slist[now])\n if now == start:\n break\n score_rem = 0\n loop_score = 0\n for index, score in enumerate(score_loop, start=1):\n score_rem += score\n if total_score_in_loop > 0:\n loop_score = total_score_in_loop * ((K-index) // len(score_loop))\n max_score = max(max_score, score_rem+loop_score)\n print(max_score)\n\nif __name__ == '__main__':\n main()", "import numpy as np\nfrom numba import njit\n\n@njit('i8(i8,i8,i8[:],i8[:],i8)', cache=True)\ndef get_max_score(N, K, plist, slist, max_score):\n for start in range(N):\n\n total_score_in_loop = 0\n score_loop = []\n now = start\n while True:\n now = plist[now]\n total_score_in_loop += slist[now]\n score_loop.append(slist[now])\n if now == start:\n break\n \n rem_score, loop_score = 0, 0\n for idx in range(1, len(score_loop)+1):\n rem_score += score_loop[idx-1]\n if total_score_in_loop > 0:\n loop_score = ((K - idx) // len(score_loop)) * total_score_in_loop\n max_score = max(max_score, rem_score + loop_score)\n return max_score\n\ndef main():\n N, K = map(int, input().split())\n plist = np.array([i-1 for i in map(int, input().split())], dtype='int64')\n slist = np.array([i for i in map(int, input().split())], dtype='int64')\n max_score = -10**15\n max_score = get_max_score(N, K, plist, slist, max_score)\n print(max_score)\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s597348879', 's805096653'] | [8900.0, 105260.0] | [26.0, 1034.0] | [851, 1123] |
p02585 | u648868410 | 3,000 | 1,048,576 | Takahashi will play a game using a piece on an array of squares numbered 1, 2, \cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \cdots, N: P_1, P_2, \cdots, P_N. Now, he will choose one square and place the piece on that square. Then, he will make the following move some number of times between 1 and K (inclusive): * In one move, if the piece is now on Square i (1 \leq i \leq N), move it to Square P_i. Here, his score increases by C_{P_i}. Help him by finding the maximum possible score at the end of the game. (The score is 0 at the beginning of the game.) | ['import itertools\nimport numpy as np\n\nif __name__ == "__main__":\n\n\tN,K = map(int,input().split())\n\tP = [ int(p)-1 for p in input().split() ]\n\tC = list(map(int,input().split()))\n\n\t# print(P)\n\t\n\tcycleIDs = np.full( N, -1, np.int64 )\n\tcycleInfs = []\n\tcycleID = 0\n\tprocCnt = 0\n\n\tfor n in range(N):\n\t\tv = n\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\telse:\n\t\t\tcurrentCycleCosts = []\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleCosts.append( C[v] )\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\t\t\tv = P[v]\n\t\t\t\tif cycleIDs[v] != -1:\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tprocCnt = K % len( currentCycleCosts )\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif procCnt == 0:\n\t\t\t\t\t\tprocCnt = len( currentCycleCosts )\n\n\t\t\t\t\tcycleInfs.append( ( procCnt, np.array( currentCycleCosts ) ) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\n\n\tscores = []\n\t# loopScore = 0\n\t# procCnt = 0\n\tfor procCnt, currentCycleCosts in cycleInfs:\n\n\t\t\n\t\t# if np.sum(currentCycleCosts) > 0:\n\t\t# \tcycleLoopCnt = ( K - procCnt ) // currentCycleCosts.size\n\t\t# \tloopScore = cycleLoopCnt * np.sum(currentCycleCosts)\n\n\t\t\n\t\tfor i in range(currentCycleCosts.size):\n\t\t\tif np.sum(currentCycleCosts) > 0:\n\t\t\t\t\n\t\t\t\tscores.append( np.roll( currentCycleCosts, i )[:procCnt].cumsum().max() ) + (( K - procCnt ) // currentCycleCosts.size) * np.sum(currentCycleCosts) )\n\t\t\telse:\n\t\t\t\tscores.append( np.roll( currentCycleCosts, i )[:procCnt].cumsum().max() )\n\n\n\tprint(max(scores))\n', 'import sys\nimport numpy as np\n\n\n\n\n\ndef main(N,K,P,C):\n\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleInfs = []\n\n\n\t# print(P)\n\n\tans = -1e19\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcurrentCycleItemCnt, currentCycleTotal = cycleInfs[ cycleIDs[v] ]\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleInfs.append( (currentCycleItemCnt, currentCycleTotal) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( ans, tmp )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'void(i8,i8,i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tmain(N,K,P,C)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor _ in range(currentCycleItemCnt):\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t \tbreak\n\n\t\t\t# cycleLoopCnt = 0\n\t\t\t# if procCnt < K and 0 < currentCycleTotal:\n\t\t\t# \tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# # print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\t# tmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\t# ans = max( int(ans), int(tmp) )\n\n\t\t\t# if P[v] == n:\n\t\t\t\t\n\t\t\t\t# break\n\t\t\t\n\t\t\t\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\nfrom numba import njit\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( int(ans), int(tmp) )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tbreak\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n\n\n\n\n\ndef main(N,K,P,C):\n\n\t# print(P)\n\n\tans = -1e10\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\twhile True:\n\t\t\t\n\t\t\tcurrentCycleItemCnt += 1\n\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( ans, tmp )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\treturn ans\n\t# print(ans)\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'i8(i8,i8,i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tans=main(N,K,P,C)\n\tprint(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\ndef upd(procCnt,P,C,K,v,ans,currentCycleSumTmp,currentCycleItemCnt,currentCycleTotal):\n\tcurrentCycleSumTmp += C[v]\n\n\tcycleLoopCnt = 0\n\tif 0 < currentCycleTotal:\n\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\tans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\tv = P[v]\n\n\treturn (currentCycleSumTmp, ans, v)\n\n\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e18\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\t# procCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\n\t\tfor k in range(min(K,currentCycleItemCnt)):\n\t\t\t\n\t\t\t\n\t\t\tcurrentCycleSumTmp, ans, v = upd(k+1,P,C,K,v,ans,currentCycleSumTmp,currentCycleItemCnt,currentCycleTotal)\n\t\t\t# procCnt = k+1\n\t\t\t# currentCycleSumTmp += C[v]\n\n\t\t\t# cycleLoopCnt = 0\n\t\t\t# if 0 < currentCycleTotal:\n\t\t\t# \tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t\t# # print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\t# ans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\t\t\t\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\tcc.export(\'upd\',\'UniTuple(i8,3)(i8,i8[:],i8[:],i8,i8,i8,i8,i8,i8)\')(upd)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import upd,calcCycle\n# from my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor k in range(min(K,currentCycleItemCnt)):\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tprocCnt = k+1\n\t\t\t\n\t\t\t# currentCycleSumTmp += C[v]\n\t\t\t# if K < procCnt:\n\t\t\t# \tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\tans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\n\t\t\t# if P[v] == n:\n\t\t\t\t\n\t\t\t\t# break\n\t\t\t\n\t\t\t\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor k in range(min(K,currentCycleItemCnt)):\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tprocCnt = k+1\n\t\t\t\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\t# if K < procCnt:\n\t\t\t# \tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\tans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\n\t\t\t# if P[v] == n:\n\t\t\t\t\n\t\t\t\t# break\n\t\t\t\n\t\t\tv = P[v]\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor _ in range(currentCycleItemCnt):\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( int(ans), int(tmp) )\n\n\t\t\t\n\t\t\t# if P[v] == n:\n\t\t\t\t\n\t\t\t\t# break\n\t\t\tv = P[v]\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\ndef upd(P,C,K,v,ans,currentCycleItemCnt,currentCycleTotal):\n\n\t# procCnt = 0\n\tcurrentCycleSumTmp = 0\n\n\tfor k in range(min(K,currentCycleItemCnt)):\n\n\t\t\n\t\t\n\n\t\tprocCnt = k+1\n\t\tcurrentCycleSumTmp += C[v]\n\n\t\tcycleLoopCnt = 0\n\t\tif 0 < currentCycleTotal:\n\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\tans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\t\tv = P[v]\n\n\treturn ans\n\n\n\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e18\n\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tcurrentCycleSumTmp = 0\n\n\t\t# ans=upd(P,C,K,v,ans,currentCycleItemCnt,currentCycleTotal)\n\t\tfor k in range(min(K,currentCycleItemCnt)):\n\n\t\t\tprocCnt = k+1\n\t\t\tcurrentCycleSumTmp += C[v]\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\tans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\t\t\tv = P[v]\n\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\tcc.export(\'main\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(main)\n\t# cc.export(\'upd\',\'i8(i8[:],i8[:],i8,i8,i8,i8,i8)\')(upd)\n\t# cc.export(\'upd\',\'UniTuple(i8,3)(i8[:],i8[:],i8,i8,i8,i8,i8)\')(upd)\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import upd,calcCycle\nfrom my_module import main,calcCycle\n# from my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\ndef upd(P,C,K,v,ans,currentCycleItemCnt,currentCycleTotal):\n\n\t# procCnt = 0\n\tcurrentCycleSumTmp = 0\n\n\tfor k in range(min(K,currentCycleItemCnt)):\n\n\t\t\n\t\t\n\n\t\tprocCnt = k+1\n\t\tcurrentCycleSumTmp += C[v]\n\n\t\tcycleLoopCnt = 0\n\t\tif 0 < currentCycleTotal:\n\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\tans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\t\tv = P[v]\n\n\treturn ans\n\n\n\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e18\n\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleSumTmp = 0\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\t# ans=upd(P,C,K,v,ans,currentCycleItemCnt,currentCycleTotal)\n\t\tfor k in range(min(K,currentCycleItemCnt)):\n\n\t\t\tprocCnt = k+1\n\t\t\tcurrentCycleSumTmp += C[v]\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\tans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\t\t\tv = P[v]\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\tcc.export(\'main\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(main)\n\t# cc.export(\'upd\',\'i8(i8[:],i8[:],i8,i8,i8,i8,i8)\')(upd)\n\t# cc.export(\'upd\',\'UniTuple(i8,3)(i8[:],i8[:],i8,i8,i8,i8,i8)\')(upd)\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import upd,calcCycle\nfrom my_module import main,calcCycle\n# from my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor _ in range(currentCycleItemCnt):\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( int(ans), int(tmp) )\n\n\t\t\t# if P[v] == n:\n\t\t\t\t\n\t\t\t\t# break\n\t\t\t\n\t\t\t\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n\n\n\n\n\ndef main(N,K,P,C):\n\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleInfs = []\n\n\n\t# print(P)\n\n\tans = -1e10\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcurrentCycleItemCnt, currentCycleTotal = cycleInfs[ cycleIDs[v] ]\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleInfs.append( (currentCycleItemCnt, currentCycleTotal) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( ans, tmp )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\treturn ans\n\t# print(ans)\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'i8(i8,i8,i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tans=main(N,K,P,C)\n\tprint(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor k in range(min(K,currentCycleItemCnt)):\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tprocCnt = k+1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\t# if K < procCnt:\n\t\t\t# \tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\tans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )\n\n\t\t\t# if P[v] == n:\n\t\t\t\t\n\t\t\t\t# break\n\t\t\t\n\t\t\tv = P[v]\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\tcc.export(\'main\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main,calcCycle\n# from my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor _ in range(currentCycleItemCnt):\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\t# currentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t \tbreak\n\n\t\t\t# cycleLoopCnt = 0\n\t\t\t# if procCnt < K and 0 < currentCycleTotal:\n\t\t\t# \tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# # print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\t# tmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\t# ans = max( int(ans), int(tmp) )\n\n\t\t\t# if P[v] == n:\n\t\t\t\t\n\t\t\t\t# break\n\t\t\t\n\t\t\t\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\n\n\n\n\ndef main(N,K,P,C):\n\n\tans = -1e9-1\t\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleInfs = []\n\n\n\t# print(P)\n\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcurrentCycleItemCnt, currentCycleTotal = cycleInfs[ cycleIDs[v] ]\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleInfs.append( (currentCycleItemCnt, currentCycleTotal) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( int(ans), int(tmp) )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'void(i8,i8,i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tmain(N,K,P,C)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\n\n\n\n\ndef main(N,K,P,C): #,ans):\n\n\n\t\n\t\n\t# ans = -1e9\n\tans = int(1e9)\n\t\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleInfs = []\n\n\n\t# print(P)\n\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcurrentCycleItemCnt, currentCycleTotal = cycleInfs[ cycleIDs[v] ]\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleInfs.append( (currentCycleItemCnt, currentCycleTotal) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( int(ans), int(tmp) )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'void(i8,i8,i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tmain(N,K,P,C) #,ans)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( int(ans), int(tmp) )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# procCnt += 1\n\t\t\t# currentCycleSumTmp += C[v]\n\t\t\t# if K < procCnt:\n\t\t\t# \tbreak\n\n\t\t\t# cycleLoopCnt = 0\n\t\t\t# if procCnt < K and 0 < currentCycleTotal:\n\t\t\t# \tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# # print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\t# tmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\t# ans = max( int(ans), int(tmp) )\n\n\t\t\t\n\t\t\tif P[v] == n:\n\t\t\t\t\n\t\t\t\tbreak\n\t\t\tv = P[v]\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor _ in range(currentCycleItemCnt):\n\t\t\tpass\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# procCnt += 1\n\t\t\t# currentCycleSumTmp += C[v]\n\t\t\t# if K < procCnt:\n\t\t\t# \tbreak\n\n\t\t\t# cycleLoopCnt = 0\n\t\t\t# if procCnt < K and 0 < currentCycleTotal:\n\t\t\t# \tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# # print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\t# tmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\t# ans = max( int(ans), int(tmp) )\n\n\t\t\t# if P[v] == n:\n\t\t\t\t\n\t\t\t\t# break\n\t\t\t\n\t\t\t\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n\n\n\n\n\ndef main(N,K,P,C):\n\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleInfs = []\n\n\n\t# print(P)\n\n\tans = -1e19\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcurrentCycleItemCnt, currentCycleTotal = cycleInfs[ cycleIDs[v] ]\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleInfs.append( (currentCycleItemCnt, currentCycleTotal) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( int(ans), int(tmp) )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'void(i8,i8,i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tmain(N,K,P,C)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n\n\n\n\n\ndef main(N,K,P,C):\n\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleInfs = []\n\n\n\t# print(P)\n\n\tans = -1e19\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcurrentCycleItemCnt, currentCycleTotal = cycleInfs[ cycleIDs[v] ]\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleInfs.append( (currentCycleItemCnt, currentCycleTotal) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( ans, tmp )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\treturn ans\n\t# print(ans)\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'i8(i8,i8,i8[:],i8[:])\')(main)\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tans=main(N,K,P,C)\n\tprint(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor _ in range(N):\n\t\t\tpass\n\t\t# while True:\n\t\t\t\n\n\t\t\t\n\t\t\t\n\t\t\t# procCnt += 1\n\t\t\t# currentCycleSumTmp += C[v]\n\t\t\t# if K < procCnt:\n\t\t\t# \tbreak\n\n\t\t\t# cycleLoopCnt = 0\n\t\t\t# if procCnt < K and 0 < currentCycleTotal:\n\t\t\t# \tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# # print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\t# tmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\t# ans = max( int(ans), int(tmp) )\n\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# \tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n\n\n\n\n\ndef main(N,K,P,C):\n\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, np.int64 )\n\tcycleInfs = []\n\n\n\t# print(P)\n\n\tans = -1e10\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcurrentCycleItemCnt, currentCycleTotal = cycleInfs[ cycleIDs[v] ]\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleInfs.append( (currentCycleItemCnt, currentCycleTotal) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt\n\n\t\t\t\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( ans, tmp )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\treturn ans\n\t# print(ans)\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\tfrom numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'main\',\'i8(i8,i8,i8[:],i8[:])\')(main)\n\tmain=njit(main, cache=True)\n\tcc.compile()\n\texit(0)\nfrom my_module import main\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\tans=main(N,K,P,C)\n\tprint(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\tfor _ in range(N):\n\t\t# while True:\n\t\t\t\n\n\t\t\t\n\t\t\t\n\t\t\tprocCnt += 1\n\t\t\tcurrentCycleSumTmp += C[v]\n\t\t\tif K < procCnt:\n\t\t\t\tbreak\n\n\t\t\tcycleLoopCnt = 0\n\t\t\tif procCnt < K and 0 < currentCycleTotal:\n\t\t\t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\tans = max( int(ans), int(tmp) )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\twhile True:\n\n\t\t\t\n\t\t\t\n\t\t\t# procCnt += 1\n\t\t\t# currentCycleSumTmp += C[v]\n\t\t\t# if K < procCnt:\n\t\t\t# \tbreak\n\n\t\t\t# cycleLoopCnt = 0\n\t\t\t# if procCnt < K and 0 < currentCycleTotal:\n\t\t\t# \tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t\t# # print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t\t# tmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\t# ans = max( int(ans), int(tmp) )\n\n\t\t\tv = P[v]\n\t\t\tif v == n:\n\t\t\t\t\n\t\t\t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', 'import sys\nimport numpy as np\n# from numba import njit\n\n\ndef calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\tcycleID = 0\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt = 0\n\t\tcurrentCycleTotal = 0\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\t\t\n\t\telse:\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleItemCnt += 1\n\t\t\t\tcurrentCycleTotal += C[v]\n\n\t\t\t\tv = P[v]\n\t\t\t\tif v == n:\n\t\t\t\t\t\n\t\t\t\t\tcycleIDs[v] = cycleID\n\t\t\t\t\tcycleItemCnts[cycleID] = currentCycleItemCnt\n\t\t\t\t\tcycleTotalScores[cycleID] = currentCycleTotal\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tcycleIDs[v] = cycleID\n\n\ndef main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):\n\n\tans = -1e19\n\n\tfor n in range(N):\n\n\t\tv = n\n\t\tcurrentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]\n\n\t\tprocCnt = 0\n\t\tcurrentCycleSumTmp = 0\n\n\t\t# while True:\n\t\t\n\n\t\t\n\t\t\n\t\t# \tprocCnt += 1\n\t\t# \tcurrentCycleSumTmp += C[v]\n\t\t# \tif K < procCnt:\n\t\t# \t\tbreak\n\n\t\t# \tcycleLoopCnt = 0\n\t\t# \tif procCnt < K and 0 < currentCycleTotal:\n\t\t# \t\tcycleLoopCnt = int(( K - procCnt ) // currentCycleItemCnt)\n\n\t\t# \t# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)\n\t\t# \ttmp = currentCycleSumTmp + cycleLoopCnt * currentCycleTotal\n\t\t\n\n\t\t# \tv = P[v]\n\t\t\n\t\t\n\t\t# \t\tbreak\n\n\tprint(int(ans))\n\nif sys.argv[-1]==\'ONLINE_JUDGE\':\n\t# from numba import njit\n\tfrom numba.pycc import CC\n\tcc=CC(\'my_module\')\n\tcc.export(\'calcCycle\',\'void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])\')(calcCycle)\n\t\n\t\n\tcc.compile()\n\texit(0)\n# from my_module import main,calcCycle\nfrom my_module import calcCycle\n\n\n\nif __name__ == "__main__":\n\tN,K = map(int,input().split())\n\tP = np.array( input().split(), np.int64 )\n\tP -= 1\n\tC = np.array( input().split(), np.int64 )\n\n\t\n\t\n\tcycleIDs = np.full( N, -1, dtype=np.int64 )\n\tcycleItemCnts = np.full( N, -1, dtype=np.int64 )\n\tcycleTotalScores = np.full( N, -1, dtype=np.int64 )\n\n\tcalcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\n\t# print(cycleItemCnts)\n\n\n\tmain(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)\n\t#print(ans)\n\n\n', '# import numpy as np\nimport itertools\n\nif __name__ == "__main__":\n\n\tN,K = map(int,input().split())\n\tP = [ int(p)-1 for p in input().split() ]\n\tC = list(map(int,input().split()))\n\n\t# print(P)\n\t\n\t# cycleIDs = np.full( N, -1, np.int64 )\n\tcycleIDs = [ -1 for _ in range(N)]\n\tcycleInfs = []\n\tcycleID = 0\n\tprocCnt = 0\n\n\tfor n in range(N):\n\t\tv = n\n\n\t\tif cycleIDs[v] != -1:\n\t\t\tcontinue\n\t\telse:\n\t\t\tcurrentCycleCosts = []\n\t\t\twhile True:\n\t\t\t\t\n\t\t\t\tcurrentCycleCosts.append( C[v] )\n\t\t\t\tcycleIDs[v] = cycleID\n\n\t\t\t\tv = P[v]\n\t\t\t\tif cycleIDs[v] != -1:\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tprocCnt = K % len( currentCycleCosts )\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t# -------------------------------------------------\n\t\t\t\t\t# 4 101\n\t\t\t\t\t# 2 3 4 1\n\t\t\t\t\t# 50 -49 -50 50\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t# -------------------------------------------------\n\t\t\t\t\t\n\t\t\t\t\tif len( currentCycleCosts ) + procCnt <= K:\n\t\t\t\t\t\tprocCnt += len( currentCycleCosts )\n\n\t\t\t\t\tcycleInfs.append( ( procCnt, len(currentCycleCosts), currentCycleCosts * 3 ) )\n\t\t\t\t\tcycleID += 1\n\t\t\t\t\tbreak\n\n\n\n\t\n\t# procCnt = 0\n\tans = -10 ** 9\n\tfor procCnt, currentCycleSize, currentCycleCosts in cycleInfs:\n\n\t\t\n\t\tloopScore = 0\n\t\tif sum(currentCycleCosts) > 0:\n\t\t\tcycleLoopCnt = ( K - procCnt ) // currentCycleSize\n\t\t\tloopScore = cycleLoopCnt * sum(currentCycleCosts[:currentCycleSize])\n\t\t\t# print("loopScore",loopScore,procCnt)\n\n\t\t\n\t\tfor i in range(currentCycleSize):\n\t\t\t\n\t\t\tscore = max( itertools.accumulate( currentCycleCosts[i:i+procCnt] ) )\n\t\t\tif ans < score + loopScore:\n\t\t\t\tans = score + loopScore\n\t\t\t# ans = max( ans, score + loopScore )\n\n\n\tprint(ans)\n\t\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s035933495', 's037380748', 's058414454', 's072087903', 's096660281', 's119811444', 's135701479', 's155655032', 's157857509', 's203298270', 's326678167', 's397147630', 's423665096', 's462200256', 's486950443', 's501706553', 's533932811', 's553324434', 's560715790', 's584667663', 's589623974', 's632393136', 's694402778', 's698649098', 's754722410', 's936255594', 's987491678', 's466737053'] | [9116.0, 28080.0, 28140.0, 92776.0, 28100.0, 28020.0, 28096.0, 28012.0, 27896.0, 28016.0, 28064.0, 27492.0, 28028.0, 28160.0, 27980.0, 27980.0, 27996.0, 28092.0, 28120.0, 28112.0, 28088.0, 27976.0, 28048.0, 28076.0, 28112.0, 28068.0, 28160.0, 9912.0] | [27.0, 362.0, 3309.0, 640.0, 486.0, 3309.0, 3309.0, 3309.0, 3309.0, 350.0, 352.0, 3309.0, 393.0, 352.0, 1489.0, 385.0, 355.0, 3309.0, 3309.0, 525.0, 383.0, 398.0, 523.0, 395.0, 3309.0, 3309.0, 123.0, 2058.0] | [1912, 2242, 3027, 2415, 1643, 3403, 3045, 3041, 3012, 3475, 3473, 3014, 2252, 2983, 3029, 2464, 2492, 2644, 3006, 3043, 2257, 2252, 2951, 2242, 2915, 2783, 2928, 2587] |
p02585 | u844789719 | 3,000 | 1,048,576 | Takahashi will play a game using a piece on an array of squares numbered 1, 2, \cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \cdots, N: P_1, P_2, \cdots, P_N. Now, he will choose one square and place the piece on that square. Then, he will make the following move some number of times between 1 and K (inclusive): * In one move, if the piece is now on Square i (1 \leq i \leq N), move it to Square P_i. Here, his score increases by C_{P_i}. Help him by finding the maximum possible score at the end of the game. (The score is 0 at the beginning of the game.) | ['import itertools\nN, K = [int(_) for _ in input().split()]\nP = [int(_) - 1 for _ in input().split()]\nC = [int(_) for _ in input().split()]\n\n\nclass SegmentTree():\n def __init__(self, array, f, ti):\n """\n Parameters\n ----------\n array : list\n to construct segment tree from\n f : func\n binary operation of the monoid\n ti : \n identity element of the monoid\n """\n self.f = f\n self.ti = ti\n self.n = n = 2**(len(array).bit_length())\n self.dat = dat = [ti] * n + array + [ti] * (n - len(array))\n for i in range(n - 1, 0, -1): # build\n dat[i] = f(dat[i << 1], dat[i << 1 | 1])\n\n def update(self, p, v): # set value at position p (0-indexed)\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = v\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_right(self, p, v): # apply operator from the right side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(dat[p], v)\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_left(self, p, v): # apply operator from the left side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(v, dat[p])\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def query(self, l, r): # result on interval [l, r) (0-indexed)\n f, ti, n, dat = self.f, self.ti, self.n, self.dat\n vl = vr = ti\n l += n\n r += n\n while l < r:\n if l & 1:\n vl = f(vl, dat[l])\n l += 1\n if r & 1:\n r -= 1\n vr = f(dat[r], vr)\n l >>= 1\n r >>= 1\n return f(vl, vr)\n\n\nans = -float(\'inf\')\nse = set()\nfor start in range(N):\n if start in se:\n continue\n now = start\n scores = []\n while True:\n if now == start:\n break\n se.add(now)\n scores += [C[now]]\n now = P[now]\n cyclelen = len(scores)\n cycle, residue = divmod(K, cyclelen)\n scores *= 3\n scores = list(itertools.accumulate(scores))\n st = SegmentTree(scores, max, -float(\'inf\'))\n ans = max([ans] + [\n st.query(start2 + 1, start2 + min(K + 1, cyclelen)) - scores[start2]\n for start2 in range(cyclelen)\n ])\n scorelastcycle = scores[-1] * (cycle - 1) // 3\n if scorelastcycle > 0 and cycle > 0:\n d = 0\n for start2 in range(cyclelen):\n d = max(\n d,\n st.query(start2, start2 + cyclelen + residue + 1) -\n scores[start2])\n scorelastcycle += d\n ans = max(ans, scorelastcycle)\nprint(ans)\n', 'import itertools\nN, K = [int(_) for _ in input().split()]\nP = [int(_) - 1 for _ in input().split()]\nC = [int(_) for _ in input().split()]\n\n\nclass SegmentTree():\n def __init__(self, array, f, ti):\n """\n Parameters\n ----------\n array : list\n to construct segment tree from\n f : func\n binary operation of the monoid\n ti : \n identity element of the monoid\n """\n self.f = f\n self.ti = ti\n self.n = n = 2**(len(array).bit_length())\n self.dat = dat = [ti] * n + array + [ti] * (n - len(array))\n for i in range(n - 1, 0, -1): # build\n dat[i] = f(dat[i << 1], dat[i << 1 | 1])\n\n def update(self, p, v): # set value at position p (0-indexed)\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = v\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_right(self, p, v): # apply operator from the right side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(dat[p], v)\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_left(self, p, v): # apply operator from the left side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(v, dat[p])\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def query(self, l, r): # result on interval [l, r) (0-indexed)\n f, ti, n, dat = self.f, self.ti, self.n, self.dat\n vl = vr = ti\n l += n\n r += n\n while l < r:\n if l & 1:\n vl = f(vl, dat[l])\n l += 1\n if r & 1:\n r -= 1\n vr = f(dat[r], vr)\n l >>= 1\n r >>= 1\n return f(vl, vr)\n\n\nans = -10**20\nse = set()\nfor start in range(N):\n if start in se:\n continue\n now = start\n scores = []\n while True:\n if now in se:\n break\n se.add(now)\n scores += [C[now]]\n now = P[now]\n cyclelen = len(scores)\n cum = list(itertools.accumulate(scores * 2))\n st = SegmentTree(cum, max, -10**20)\n cycle, residue = divmod(K, cyclelen)\n if cum[-1] > 0 and cycle > 0:\n v1 = cum[-1] * (cycle - 1) // 2 + max(\n st.query(start2, start2 + cyclelen + 1) - cum[start2]\n for start2 in range(cyclelen))\n v2 = cum[-1] * cycle // 2 + max(\n st.query(start2, start2 + residue + 1) - cum[start2]\n for start2 in range(cyclelen))\n ans = max([ans, v1, v2])\nprint(ans)\n', 'import itertools\nN, K = [int(_) for _ in input().split()]\nP = [int(_) - 1 for _ in input().split()]\nC = [int(_) for _ in input().split()]\n\n\nclass SegmentTree():\n def __init__(self, array, f, ti):\n """\n Parameters\n ----------\n array : list\n to construct segment tree from\n f : func\n binary operation of the monoid\n ti : \n identity element of the monoid\n """\n self.f = f\n self.ti = ti\n self.n = n = 2**(len(array).bit_length())\n self.dat = dat = [ti] * n + array + [ti] * (n - len(array))\n for i in range(n - 1, 0, -1): # build\n dat[i] = f(dat[i << 1], dat[i << 1 | 1])\n\n def update(self, p, v): # set value at position p (0-indexed)\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = v\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_right(self, p, v): # apply operator from the right side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(dat[p], v)\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_left(self, p, v): # apply operator from the left side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(v, dat[p])\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def query(self, l, r): # result on interval [l, r) (0-indexed)\n f, ti, n, dat = self.f, self.ti, self.n, self.dat\n vl = vr = ti\n l += n\n r += n\n while l < r:\n if l & 1:\n vl = f(vl, dat[l])\n l += 1\n if r & 1:\n r -= 1\n vr = f(dat[r], vr)\n l >>= 1\n r >>= 1\n return f(vl, vr)\n\n\nans = -10**20\nse = set()\nfor start in range(N):\n if start in se:\n continue\n now = start\n scores = []\n while True:\n if now in se:\n break\n se.add(now)\n scores += [C[now]]\n now = P[now]\n cyclelen = len(scores)\n cycle, residue = divmod(K, cyclelen)\n scores *= 2\n scores = list(itertools.accumulate(scores))\n st = SegmentTree(scores, max, -10**20)\n ans = max(\n [ans] +\n [st.query(start2 + 1, start2 + K + 1) for start2 in range(cyclelen)])\n if scores[-1] > 0 and cycle > 0:\n ans2 = scores[-1] * cycle // 2\n v = max(\n st.query(start2 + 1, start2 + residue + 1) - scores[start2]\n for start2 in range(cyclelen))\n ans = max([ans, ans2, ans2 + v])\n\nprint(ans)\n', 'import itertools\nN, K = [int(_) for _ in input().split()]\nP = [int(_) - 1 for _ in input().split()]\nC = [int(_) for _ in input().split()]\n\n\nclass SegmentTree():\n def __init__(self, array, f, ti):\n """\n Parameters\n ----------\n array : list\n to construct segment tree from\n f : func\n binary operation of the monoid\n ti : \n identity element of the monoid\n """\n self.f = f\n self.ti = ti\n self.n = n = 2**(len(array).bit_length())\n self.dat = dat = [ti] * n + array + [ti] * (n - len(array))\n for i in range(n - 1, 0, -1): # build\n dat[i] = f(dat[i << 1], dat[i << 1 | 1])\n\n def update(self, p, v): # set value at position p (0-indexed)\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = v\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_right(self, p, v): # apply operator from the right side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(dat[p], v)\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_left(self, p, v): # apply operator from the left side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(v, dat[p])\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def query(self, l, r): # result on interval [l, r) (0-indexed)\n f, ti, n, dat = self.f, self.ti, self.n, self.dat\n vl = vr = ti\n l += n\n r += n\n while l < r:\n if l & 1:\n vl = f(vl, dat[l])\n l += 1\n if r & 1:\n r -= 1\n vr = f(dat[r], vr)\n l >>= 1\n r >>= 1\n return f(vl, vr)\n\n\nans = -float(\'inf\')\nse = set()\nfor start in range(N):\n if start in se:\n continue\n now = start\n scores = []\n while True:\n if now in se:\n break\n se.add(now)\n scores += [C[now]]\n now = P[now]\n cyclelen = len(scores)\n cycle, residue = divmod(K, cyclelen)\n scores *= 2\n scores = list(itertools.accumulate(scores))\n ans = max([ans] + scores[1:K + 1])\n st = SegmentTree(scores, max, -float(\'inf\'))\n scorelastcycle = scores[-1] * cycle // 2\n if scorelastcycle > 0 and cycle > 0:\n d = 0\n for start2 in range(cyclelen):\n d = max(d, st.query(start2, start2 + residue + 1) - scores[start2])\n scorelastcycle += d\n ans = max(ans, scorelastcycle)\nprint(ans)\n', 'import itertools\nN, K = [int(_) for _ in input().split()]\nP = [int(_) - 1 for _ in input().split()]\nC = [int(_) for _ in input().split()]\n\n\nclass SegmentTree():\n def __init__(self, array, f, ti):\n """\n Parameters\n ----------\n array : list\n to construct segment tree from\n f : func\n binary operation of the monoid\n ti : \n identity element of the monoid\n """\n self.f = f\n self.ti = ti\n self.n = n = 2**(len(array).bit_length())\n self.dat = dat = [ti] * n + array + [ti] * (n - len(array))\n for i in range(n - 1, 0, -1): # build\n dat[i] = f(dat[i << 1], dat[i << 1 | 1])\n\n def update(self, p, v): # set value at position p (0-indexed)\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = v\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_right(self, p, v): # apply operator from the right side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(dat[p], v)\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def operate_left(self, p, v): # apply operator from the left side\n f, n, dat = self.f, self.n, self.dat\n p += n\n dat[p] = f(v, dat[p])\n while p > 1:\n p >>= 1\n dat[p] = f(dat[p << 1], dat[p << 1 | 1])\n\n def query(self, l, r): # result on interval [l, r) (0-indexed)\n f, ti, n, dat = self.f, self.ti, self.n, self.dat\n vl = vr = ti\n l += n\n r += n\n while l < r:\n if l & 1:\n vl = f(vl, dat[l])\n l += 1\n if r & 1:\n r -= 1\n vr = f(dat[r], vr)\n l >>= 1\n r >>= 1\n return f(vl, vr)\n\n\nans = -10**20\nse = set()\nfor start in range(N):\n if start in se:\n continue\n now = start\n scores = []\n while True:\n if now in se:\n break\n se.add(now)\n scores += [C[now]]\n now = P[now]\n cyclelen = len(scores)\n cum = list(itertools.accumulate(scores * 3))\n st = SegmentTree(cum, max, -10**20)\n cycle, residue = divmod(K, cyclelen)\n ans = max([ans] + [\n st.query(start2 + 1, start2 + 1 + min(cyclelen, K)) - cum[start2]\n for start2 in range(cyclelen)\n ])\n if cum[-1] > 0 and cycle > 0:\n v = cum[-1] * cycle // 3 + max(\n st.query(0, start2 + residue + 1) - cum[start2]\n for start2 in range(cyclelen, 2 * cyclelen))\n ans = max(ans, v)\nprint(ans)\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s380967596', 's596804375', 's969286359', 's972999935', 's673997140'] | [9912.0, 11148.0, 10976.0, 11120.0, 11540.0] | [30.0, 84.0, 93.0, 64.0, 82.0] | [2821, 2662, 2667, 2645, 2650] |
p02586 | u044220565 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ['# coding: utf-8\nimport sys\n#from operator import itemgetter\nsysread = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\n#from heapq import heappop, heappush\n#from collections import defaultdict\nsys.setrecursionlimit(10**7)\n#import math\n#from itertools import product, accumulate, combinations, product\n\nimport numpy as np\n#from copy import deepcopy\n#from collections import deque\n#from decimal import Decimal\nfrom numba import jit\n\n@jit\ndef run_dp(MAP, dp, R, C):\n for i in range(1, R+1):\n for j in range(1, C+1):\n for k in range(4):\n dp[i,j,0] = max(dp[i,j,0], dp[i-1,j,k])\n if MAP[i,j]:\n dp[i,j,1] = max(dp[i,j,1], dp[i-1,j,k]+MAP[i,j])\n\n dp[i,j,k] = max(dp[i,j,k], dp[i,j-1,k])\n if MAP[i][j] and k < 3:\n dp[i,j,k+1] = max(dp[i,j,k+1], dp[i,j-1,k] + MAP[i,j])\n return dp[R, C].max()\n\ndef run():\n R,C,K = map(int, sysread().split())\n MAP = np.zeros((R + 1, C + 1), dtype=np.int64)\n for i in range(K):\n r, c, v = map(int, sysread().split())\n MAP[r, c] = v\n\n dp = np.zeros((R+1, C+1, 4), dtype= np.int64)\n\n run_dp(MAP, dp, R, C)\n\n #print(dp)\n #for m in MAP:\n # print(m)\n ans= run_dp(MAP, dp, Rs, Cs)\n\n print(ans)\n\nif __name__ == "__main__":\n run()', '# coding: utf-8\nimport sys\n#from operator import itemgetter\nsysread = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\n#from heapq import heappop, heappush\n#from collections import defaultdict\nsys.setrecursionlimit(10**7)\n#import math\n#from itertools import product, accumulate, combinations, product\n\nimport numpy as np\n#from copy import deepcopy\n#from collections import deque\n#from decimal import Decimal\nfrom numba import jit\n\n@jit\ndef run_dp(MAP, dp, R, C):\n for i in range(1, R+1):\n for j in range(1, C+1):\n for k in range(4):\n dp[i,j,0] = max(dp[i,j,0], dp[i-1,j,k])\n if MAP[i,j]:\n dp[i,j,1] = max(dp[i,j,1], dp[i-1,j,k]+MAP[i,j])\n\n dp[i,j,k] = max(dp[i,j,k], dp[i,j-1,k])\n if MAP[i][j] and k < 3:\n dp[i,j,k+1] = max(dp[i,j,k+1], dp[i,j-1,k] + MAP[i,j])\n return dp[R, C].max()\n\ndef run():\n R,C,K = map(int, sysread().split())\n MAP = np.zeros((R + 1, C + 1), dtype=np.int64)\n for i in range(K):\n r, c, v = map(int, sysread().split())\n MAP[r, c] = v\n\n dp = np.zeros((R+1, C+1, 4), dtype= np.int64)\n\n run_dp(MAP, dp, R, C)\n\n #print(dp)\n #for m in MAP:\n # print(m)\n ans= run_dp(MAP, dp, R, C)\n\n print(ans)\n\nif __name__ == "__main__":\n run()'] | ['Runtime Error', 'Accepted'] | ['s344510694', 's751859445'] | [470344.0, 470712.0] | [1519.0, 1562.0] | [1336, 1334] |
p02586 | u067237725 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ['import sys\nimport numpy as np\nfrom numba import jit, void, i8\ninput = sys.stdin.readline\n\ndef main():\n R, C, K = map(int, input().split())\n\n L_INF = int(1e17)\n dp = np.full((R+1, C+1, 4), -L_INF, dtype=np.int64)\n cell = np.full((R+1, C+1), 0, dtype=np.int64)\n\n for i in range(K):\n x, y, c = map(int, input().split())\n cell[x-1][y-1] = c\n\n f(dp, cell, R, C)\n\n print(dp[R][C][3])\n\n@njit(void(i8[:,:,:],i8[:,:],i8,i8))\ndef f(dp, cell, R, C):\n dp[0][1][0] = dp[1][0][0] = 0\n for i in range(1, R + 1):\n for j in range(1, C + 1):\n for k in range(4):\n if k > 0:\n dp[i][j][k] = max(dp[i][j][k], dp[i][j][k-1])\n dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k])\n if k > 0:\n dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k-1] + cell[i-1][j-1])\n if k == 1:\n dp[i][j][k] = max(dp[i][j][1], dp[i-1][j][3] + cell[i-1][j-1])\n\nif __name__ == "__main__":\n main()\n', 'import sys\nimport numpy as np\nfrom numba import njit, void, i8\n\ndef main():\n R, C, K = map(int, readline().split())\n items = np.array(read().split(), dtype=np.int64)\n print(calc(R, C, K, items))\n\n@njit(i8(i8, i8, i8, i8[:]), cache=True)\ndef calc(R, C, K, items):\n cell = np.zeros((R, C), dtype=np.int64)\n for i in range(0, K*3, 3):\n x, y, c = items[i:i+3]\n cell[x-1, y-1] = c\n L_INF = int(1e17)\n dp = np.full((R+1, C+1, 4), -L_INF, dtype=np.int64)\n dp[0, 1, 0] = dp[1, 0, 0] = 0\n for i in range(1, R + 1):\n for j in range(1, C + 1):\n for k in range(4):\n dp[i, j, k] = max(dp[i, j, k], dp[i, j-1, k])\n if k > 0:\n dp[i, j, k] = max(dp[i, j, k], dp[i, j, k-1])\n dp[i, j, k] = max(dp[i, j, k], dp[i, j-1, k-1] + cell[i-1, j-1])\n if k == 1:\n dp[i, j, 1] = max(dp[i, j, 1], dp[i-1, j, 3] + cell[i-1, j-1])\n return dp[R, C, 3]\n\nif __name__ == "__main__":\n read = sys.stdin.buffer.read\n readline = sys.stdin.buffer.readline\n\n if __file__=="test.py":\n f = open("./in_out/input.txt", "r", encoding="utf-8")\n read = f.read\n readline = f.readline\n\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s238243642', 's536089226'] | [91788.0, 467664.0] | [374.0, 859.0] | [1017, 1241] |
p02586 | u207097826 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ['import numpy as np\nfrom numba import njit, i8\n\n\nR, C, K = map(int, input().split())\nrcvs = [list(map(int, input().split())) for _ in range(K)]\n\n@njit\ndef solve(rcvs):\n rcvs = np.array(rcvs, dtype=np.int64)\n \n for i in range(len(rcvs)):\n rcvs[i,0] -= 1\n rcvs[i,1] -= 1\n \n rewards = np.array([[0 for _ in range(C)] for _ in range(R)], dtype=np.int64)\n \n for rcv in rcvs:\n rewards[rcv[0],rcv[1]] = rcv[2]\n \n dp = np.array([[[0 for _ in range(4)] for _ in range(C+1)] for _ in range(R+1)], dtype=np.int64)\n \n for i in range(R):\n for j in range(C):\n reward = rewards[i][j]\n dp[i+1,j+1,0] = max(dp[i,j+1])\n dp[i+1,j+1,1] = dp[i+1,j+1,0] + reward\n \n for k in range(4): # move downside without selecting\n dp[i+1,j+1,k] = max(dp[i+1,j,k], dp[i+1,j+1,k])\n for k in range(3):\n dp[i+1,j+1,k+1] = max(dp[i+1,j,k]+reward,dp[i+1,j+1,k+1])\n print(np.max(dp[-1,-1]))\n\nif __name__ == "__main__":\n solve(rcvs)', 'import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\nimport sys\n\nR, C, K = map(int, input().split())\nrcvs = [list(map(int, input().split())) for _ in range(K)]\nrcvs = np.array(rcvs, dtype=np.int64)\n#%%\n@njit\ndef main(rcvs):\n rewards = np.zeros((R, C), dtype=np.int64)\n \n for i in range(len(rcvs)):\n rewards[rcvs[i][0]-1][rcvs[i][1]-1] = rcvs[i][2]\n \n dp = np.zeros((R+1, C+1, 4), dtype=np.int64)\n \n for i in range(R):\n for j in range(C):\n reward = rewards[i][j]\n dp[i+1][j+1][0] = max(dp[i][j+1])\n dp[i+1][j+1][1] = dp[i+1][j+1][0] + reward\n \n for k in range(4): # move downside without selecting\n dp[i+1][j+1][k] = max(dp[i+1][j][k], dp[i+1][j+1][k])\n if reward > 0:\n for k in range(3):\n dp[i+1][j+1][k+1] = max(dp[i+1][j][k]+reward,dp[i+1][j+1][k+1])\n return max(dp[-1][-1])\n\nprint(main(rcvs))\n\n'] | ['Runtime Error', 'Accepted'] | ['s089906650', 's723553642'] | [149840.0, 475076.0] | [1179.0, 1671.0] | [1053, 1135] |
p02586 | u408325839 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ["\n\nimport numpy as np\nfrom numba import njit\ndef main():\n R, C, K = map(int, input().split())\n field = np.full((R+1,C+1), 0)\n dpt = np.full((R+1,C+1,4), 0)\n for i in range(K):\n r, c, v = map(int, input().split())\n field[r][c] = v\n dp(R, C, field, dpt)\n print(max(dpt[-1][-1]))\n print(field)\n print(dpt)\n\ndef dp(R, C, field, dpt):\n for r in range(1, R+1):\n for c in range(1, C+1):\n for taken in range(4):\n max_v = 0\n if taken == 0:\n max_v = max(dpt[r-1][c])\n max_v = max(dpt[r][c-1][0], max_v)\n elif taken == 1:\n max_v = max(dpt[r][c-1][taken-1] + field[r][c],\n dpt[r][c-1][taken],\n max(dpt[r-1][c]) + field[r][c])\n else:\n max_v = max(dpt[r][c-1][taken-1] + field[r][c],\n dpt[r][c-1][taken])\n dpt[r][c][taken] = max_v\n return True\n\nif __name__ == '__main__':\n main()\n", "import numpy as np\nfrom numba import njit\ndef main():\n R, C, K = map(int, input().split())\n field = np.full((R+1,C+1), 0, dtype='int64')\n dpt = np.full((R+1,C+1,4), 0, dtype='int64')\n for i in range(K):\n r, c, v = map(int, input().split())\n field[r][c] = v\n dp(R, C, field, dpt)\n print(max(dpt[-1][-1]))\n\n@njit('i4(i4,i4,i8[:,:],i8[:,:,:])', cache=True)\ndef dp(R, C, field, dpt):\n for r in range(1, R+1):\n for c in range(1, C+1):\n for taken in range(4):\n max_v = 0\n if taken == 0:\n max_v = max(dpt[r-1][c])\n max_v = max(dpt[r][c-1][0], max_v)\n elif taken == 1:\n max_v = max(dpt[r][c-1][taken-1] + field[r][c],\n dpt[r][c-1][taken],\n max(dpt[r-1][c]) + field[r][c])\n else:\n max_v = max(dpt[r][c-1][taken-1] + field[r][c],\n dpt[r][c-1][taken])\n dpt[r][c][taken] = max_v\n return 1\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s457908393', 's117087804'] | [442856.0, 457780.0] | [3311.0, 1717.0] | [1244, 1116] |
p02586 | u414050834 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ['from namba import jit\nimport numpy as np\n@jit\ndef main():\n R,C,K=map(int,input().split())\n scores=np.zeros((R,C),np.int64)\n for _ in range(K): \n r,c,v=map(int,input().split())\n scores[r-1][c-1]=v\n dp=np.zeros((R+1,C+1,4),np.int64) \n for i in range(1,R+1):\n for j in range(1,C+1):\n for k in range(4):\n dp[i][j][k]=max(dp[i][j-1][k],dp[i-1][j][3]) \n for k in range(3,0,-1):\n dp[i][j][k]=max(dp[i][j][k],dp[i][j][k-1]+scores[i-1][j-1]) \n return dp[R][C][3]\nprint(main())', 'from numba import jit\nimport numpy as np\n@jit\ndef main():\n R,C,K=map(int,input().split())\n scores=np.zeros((R,C),np.int64)\n for _ in range(K): \n r,c,v=map(int,input().split())\n scores[r-1][c-1]=v\n dp=np.zeros((R+1,C+1,4),np.int64) \n for i in range(1,R+1):\n for j in range(1,C+1):\n for k in range(4):\n dp[i][j][k]=max(dp[i][j-1][k],dp[i-1][j][3]) \n for k in range(3,0,-1):\n dp[i][j][k]=max(dp[i][j][k],dp[i][j][k-1]+scores[i-1][j-1]) \n return dp[R][C][3]\nprint(main())\n'] | ['Runtime Error', 'Accepted'] | ['s890741751', 's371806462'] | [9136.0, 474888.0] | [27.0, 2071.0] | [768, 769] |
p02586 | u523087093 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ['import numpy as np\nfrom numba import jit\n\n@jit\ndef main():\n R, C, K = map(int, input().split())\n scores = [[0] * (C + 1) for _ in range(R+1)]\n for _ in range(K):\n r, c, v = map(int, input().split())\n scores[r][c] = v\n dp = [[[0] *4 for _ in range(C+1)] for _ in range(R+1)]\n\n scores = np.array(scores)\n dp = np.array(dp)\n\n for i in range(1, R+1):\n for j in range(1, C+1):\n for k in range(4):\n dp[i][j][k] = max(dp[i][j-1][k],\n dp[i-1][j][3])\n for k in range(3, 0, -1):\n dp[i][j][k] = max(dp[i][j][k],\n dp[i][j][k-1] + scores[i][j])\n\n answer = dp[R][C][3]\n print(answer)\n\nmain()', 'import numpy as np\n\n@njit\ndef main():\n R, C, K = map(int, input().split())\n scores = np.zeros((R,C), np.int64)\n for _ in range(K):\n r, c, v = map(int, input().split())\n scores[r-1][c-1] = v\n dp=np.zeros((R+1,C+1,4), np.int64)\n\n for i in range(1, R+1):\n for j in range(1, C+1):\n for k in range(4):\n dp[i][j][k] = max(dp[i][j-1][k],\n dp[i-1][j][3])\n for k in range(3, 0, -1):\n dp[i][j][k] = max(dp[i][j][k],\n dp[i][j][k-1] + scores[i-1][j-1])\n\n answer = dp[R][C][3]\n print(answer)\n\nif __name__ == "__main__":\n main()', 'import numpy as np\nfrom numba import njit\n@njit\ndef main():\n R, C, K = map(int, input().split())\n scores = np.zeros((R,C), np.int64)\n for _ in range(K):\n r, c, v = map(int, input().split())\n scores[r-1][c-1] = v\n dp=np.zeros((R+1,C+1,4), np.int64)\n\n for i in range(1, R+1):\n for j in range(1, C+1):\n for k in range(4):\n dp[i][j][k] = max(dp[i][j-1][k],\n dp[i-1][j][3])\n for k in range(3, 0, -1):\n dp[i][j][k] = max(dp[i][j][k],\n dp[i][j][k-1] + scores[i-1][j-1])\n\n answer = dp[R][C][3]\n print(answer)\n\nif __name__ == "__main__":\n main()', 'import numpy as np\n\ndef main():\n R, C, K = map(int, input().split())\n scores = np.zeros((R,C), np.int64)\n for _ in range(K):\n r, c, v = map(int, input().split())\n scores[r][c] = v\n dp=np.zeros((R+1,C+1,4), np.int64)\n\n for i in range(1, R+1):\n for j in range(1, C+1):\n for k in range(4):\n dp[i][j][k] = max(dp[i][j-1][k],\n dp[i-1][j][3])\n for k in range(3, 0, -1):\n dp[i][j][k] = max(dp[i][j][k],\n dp[i][j][k-1] + scores[i][j])\n\n answer = dp[R][C][3]\n print(answer)\n\nif __name__ == "__main__":\n main()', 'from numba import jit\nimport numpy as np\n\n@jit\ndef main():\n R, C, K = map(int, input().split())\n scores = np.zeros((R,C), np.int64)\n for _ in range(K):\n r, c, v = map(int, input().split())\n scores[r-1][c-1] = v\n dp=np.zeros((R+1,C+1,4), np.int64)\n\n for i in range(1, R+1):\n for j in range(1, C+1):\n for k in range(4):\n dp[i][j][k] = max(dp[i][j-1][k],\n dp[i-1][j][3])\n for k in range(3, 0, -1):\n dp[i][j][k] = max(dp[i][j][k],\n dp[i][j][k-1] + scores[i-1][j-1])\n\n \n return dp[R][C][3]\n\nprint(main())'] | ['Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s085159117', 's578334055', 's616615351', 's678347945', 's240394426'] | [320320.0, 27080.0, 104400.0, 43284.0, 474988.0] | [3317.0, 114.0, 499.0, 152.0, 2025.0] | [739, 675, 697, 659, 657] |
p02586 | u533232830 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ['import sys\nfrom numba import njit\n\nR, C, K = map(int, input().split())\nitem = [[0]*C for _ in range(R)]\nfor s in sys.stdin.readlines():\n r, c, v = map(int, s.split())\n item[r-1][c-1] = v\n\n@njit\ndef solve(R, C, K, item):\n DP = [[[0, 0, 0, 0] for _ in range(C)] for _ in range(R)]\n\n DP[0][0][1] = item[0][0]\n\n for i in range(R):\n for j in range(C):\n for k in range(4):\n if i > 0: \n DP[i][j][0] = max(DP[i][j][0], max(DP[i-1][j])) \n DP[i][j][1] = max(DP[i][j][1], max(DP[i-1][j])+item[i][j]) \n\n if j > 0: \n DP[i][j][k] = max(DP[i][j][k], DP[i][j-1][k]) \n if k >= 1:\n DP[i][j][k] = max(DP[i][j][k], DP[i][j-1][k-1]+item[i][j]) \n\n print(max(DP[R-1][C-1]))\n\nsolve(R, C, K, item)', 'import numpy as np\nfrom numba import njit\n\nR, C, K = map(int, input().split())\nitem = np.zeros((R, C), np.int_)\nfor _ in range(K):\n r, c, v = map(int, input().split())\n item[r-1,c-1] = v\n\n@njit\ndef solve(R, C, K, item):\n DP = np.zeros((R, C, 4), np.int_)\n\n DP[0][0][1] = item[0][0]\n\n for i in range(R):\n for j in range(C):\n for k in range(4):\n if i > 0: \n DP[i,j,0] = max(DP[i,j,0], max(DP[i-1,j])) \n DP[i,j,1] = max(DP[i,j,1], max(DP[i-1,j])+item[i,j]) \n\n if j > 0: \n DP[i,j,k] = max(DP[i,j,k], DP[i,j-1,k]) \n if k >= 1:\n DP[i,j,k] = max(DP[i,j,k], DP[i,j-1,k-1]+item[i,j]) \n\n print(max(DP[R-1,C-1]))\n\nsolve(R, C, K, item)'] | ['Runtime Error', 'Accepted'] | ['s486648444', 's498340869'] | [194444.0, 465604.0] | [1442.0, 1500.0] | [921, 872] |
p02586 | u678167152 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ['import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\nread = sys.stdin.buffer.read\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef solve(R,C,K,XYV):\n item = np.zeros((H + 1, W + 1), np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i:i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1][j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nXYV = np.array(read().split(), np.int64)\nprint(solve(R,C,K,XYV))\n', 'import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef main(H, W, K, XYV):\n G = np.zeros((H + 1, W + 1), np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i:i + 3]\n G[x - 1, y - 1] = v\n dp = np.zeros((W + 1, 4), np.int64)\n for h in range(H):\n newdp = np.zeros((W + 1, 4), np.int64)\n for n in range(4):\n newdp[:, 0] = np.maximum(newdp[:, 0], dp[:, n])\n dp = newdp\n for w in range(W):\n for n in range(2, -1, -1):\n \n dp[w, n + 1] = max(dp[w, n + 1], dp[w, n] + G[h, w])\n for n in range(4):\n dp[w + 1, n] = max(dp[w + 1, n], dp[w, n])\n return dp.max()\n\nH, W, K = map(int, readline().split())\nXYV = np.array(read().split(), np.int64)\n\n# print(main(H, W, K, XYV))\n', 'import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\nread = sys.stdin.buffer.read\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef solve(R,C,K,XYV):\n item = np.zeros((R + 1, C + 1), dtype=np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i:i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1,j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nXYV = np.array(read().split(), np.int64)\nprint(solve(R,C,K,XYV))\n', 'import numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\n@njit((i8, i8, i8, i8[:,:]), cache=True)\ndef solve(R,C,K,item):\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1][j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nitem = np.zeros((R,C), dtype=np.int64)\nfor i in range(K):\n r,c,v = map(int, input().split())\n item[r-1,c-1] = v\n# print(solve(R,C,K,item))\n', 'import numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\n@njit((i8, i8, i8, i8[:,:]), cache=True)\ndef solve(R,C,K,XYV):\n item = np.zeros((H + 1, W + 1), np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i:i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1][j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nXYV = np.array(read().split(), np.int64)\nprint(solve(R,C,K,XYV))\n', 'import numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\nread = sys.stdin.buffer.read\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef solve(R,C,K,XYV):\n item = np.zeros((H + 1, W + 1), np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i:i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1][j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nXYV = np.array(read().split(), np.int64)\nprint(solve(R,C,K,XYV))\n', 'import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\nread = sys.stdin.buffer.read\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef solve(R,C,K,XYV):\n item = np.zeros((R + 1, C + 1), np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i:i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1][j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nXYV = np.array(read().split(), np.int64)\nprint(solve(R,C,K,XYV))\n', 'import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\nread = sys.stdin.buffer.read\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef solve(R,C,K,XYV):\n item = np.zeros((R + 1, C + 1), dtype=np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i:i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1,j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nXYV = np.array(read().split(), np.int64)\nprint(solve(R,C,K,XYV))\n', 'import numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\n@njit((i8, i8, i8, i8[:]), cache=True)\ndef solve(R,C,K,XYV):\n item = np.zeros((H + 1, W + 1), np.int64)\n for i in range(0, 3 * K, 3):\n x, y, v = XYV[i:i + 3]\n item[x - 1, y - 1] = v\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n new_dp[j] = np.maximum(new_dp[j],new_dp[j-1])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1][j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nXYV = np.array(read().split(), np.int64)\nprint(solve(R,C,K,XYV))\n', 'import numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\n@njit((i8, i8, i8, i8[:,:]), cache=True)\ndef solve(R,C,K,item):\n dp = np.zeros((C+1,4), dtype=np.int64)\n for i in range(1,R+1):\n new_dp = np.zeros((C+1,4), dtype=np.int64)\n \n for k in range(4):\n new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,k])\n dp = new_dp\n for j in range(1,C+1):\n \n for k in range(4):\n new_dp[j][k] = np.maximum(new_dp[j,k],new_dp[j-1,k])\n \n for k in range(2,-1,-1):\n dp[j,k+1] = np.maximum(dp[j,k+1],dp[j,k]+item[i-1][j-1])\n ans = dp[-1].max()\n return ans\n\nR, C, K = map(int, input().split())\nitem = np.zeros((R,C), dtype=np.int64)\nfor i in range(K):\n r,c,v = map(int, input().split())\n item[r-1,c-1] = v\nprint(solve(R,C,K,item))\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s030246450', 's117686444', 's282791736', 's398502588', 's516982964', 's517969040', 's695390276', 's802350105', 's879412154', 's596379698'] | [8784.0, 144840.0, 183160.0, 176404.0, 9028.0, 9032.0, 9000.0, 9056.0, 9024.0, 177380.0] | [26.0, 574.0, 647.0, 916.0, 25.0, 25.0, 27.0, 26.0, 28.0, 1023.0] | [901, 986, 896, 801, 863, 890, 901, 902, 861, 833] |
p02586 | u860829879 | 3,000 | 1,048,576 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i. Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square). He can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits. Find the maximum possible sum of the values of items he picks up. | ['import numpy as np\nfrom numba import njit\n\nr,c,k=map(int,input().split())\ngoods=np.array([list(map(int,input().split())) for _ in range(k)],dtype=np.int)\ng=np.zeros((r,c),dtype=np.int)\nfor cr,cc,ck in goods:\n g[cr-1][cc-1]=ck\n\n@njit\ndef calc(r,c,g):\n dp=-1*np.ones((r+1,c+1,4),dtype=np.int)\n maxlst=np.zeros((r+1,c+1),dtype=np.int)\n\n dp[:,0,0]=0\n dp[0,:,0]=0\n \n for i in range(r):\n for j in range(c):\n tmp=0\n for k in range(3):\n if g[i][j]>0 and dp[i+1][j][k]>=0:\n dp[i+1][j+1][k+1]=max(dp[i+1][j][k+1],dp[i+1][j][k]+g[i][j])\n else:\n dp[i+1][j+1][k+1]=dp[i+1][j][k+1]\n tmp=max(tmp,dp[i+1][j+1][k+1])\n \n dp[i+1][j+1][0]=max(maxlst[i][j+1],dp[i+1][j][0])\n tmp=max(tmp,dp[i+1][j+1][0])\n \n if g[i][j]>0 and dp[i+1][j+1][0]>=0:\n dp[i+1][j+1][1]=max(dp[i+1][j+1][1],dp[i+1][j+1][0]+g[i][j])\n tmp=max(tmp,dp[i+1][j+1][1])\n \n maxlst[i+1][j+1]=tmp\n \n return maxlst[r][c]\n \nprint(calc(r,c,g))', 'import numpy as np\nfrom numba import njit\n\nrr,cc,kk=map(int,input().split())\ngoods=np.array([list(map(int,input().split())) for _ in range(kk)],dtype=np.int)\ngg=np.zeros((rr,cc),dtype=np.int)\nfor cr,ccc,ck in goods:\n gg[cr-1][ccc-1]=ck\n\n@njit\ndef calc(r,c,g):\n dp=-1*np.ones((r+1,c+1,4),dtype=np.int)\n maxlst=np.zeros((r+1,c+1),dtype=np.int)\n\n dp[:,0,0]=0\n dp[0,:,0]=0\n \n for i in range(r):\n for j in range(c):\n tmp=0\n for k in range(3):\n if g[i][j]>0 and dp[i+1][j][k]>=0:\n dp[i+1][j+1][k+1]=max(dp[i+1][j][k+1],dp[i+1][j][k]+g[i][j])\n else:\n dp[i+1][j+1][k+1]=dp[i+1][j][k+1]\n tmp=max(tmp,dp[i+1][j+1][k+1])\n \n dp[i+1][j+1][0]=max(maxlst[i][j+1],dp[i+1][j][0])\n tmp=max(tmp,dp[i+1][j+1][0])\n \n if g[i][j]>0 and dp[i+1][j+1][0]>=0:\n dp[i+1][j+1][1]=max(dp[i+1][j+1][1],dp[i+1][j+1][0]+g[i][j])\n tmp=max(tmp,dp[i+1][j+1][1])\n \n maxlst[i+1][j+1]=tmp\n \n return maxlst[r][c]\n \nprint(calc(rr,cc,gg))', 'import numpy as np\nfrom numba import njit\n\nrr,cc,kk=map(int,input().split())\ngoods=np.array([list(map(int,input().split())) for _ in range(kk)],dtype=np.int)\ngg=np.zeros((rr,cc),dtype=np.int)\nfor cr,ccc,ck in goods:\n gg[cr-1][ccc-1]=ck\n\n@njit(cache=True)\ndef calc(r,c,g):\n dp=-1*np.ones((r+1,c+1,4),dtype=np.int)\n maxlst=np.zeros((r+1,c+1),dtype=np.int)\n\n dp[:,0,0]=0\n dp[0,:,0]=0\n \n for i in range(r):\n for j in range(c):\n tmp=0\n for k in range(3):\n if g[i][j]>0 and dp[i+1][j][k]>=0:\n dp[i+1][j+1][k+1]=max(dp[i+1][j][k+1],dp[i+1][j][k]+g[i][j])\n else:\n dp[i+1][j+1][k+1]=dp[i+1][j][k+1]\n tmp=max(tmp,dp[i+1][j+1][k+1])\n \n dp[i+1][j+1][0]=max(maxlst[i][j+1],dp[i+1][j][0])\n tmp=max(tmp,dp[i+1][j+1][0])\n \n if g[i][j]>0 and dp[i+1][j+1][0]>=0:\n dp[i+1][j+1][1]=max(dp[i+1][j+1][1],dp[i+1][j+1][0]+g[i][j])\n tmp=max(tmp,dp[i+1][j+1][1])\n \n maxlst[i+1][j+1]=tmp\n \n return maxlst[r][c]\n \nprint(calc(rr,cc,gg))', 'import numpy as np\nfrom numba import njit\n\nrr,cc,k=map(int,input().split())\ngoods=np.array([list(map(int,input().split())) for _ in range(kk)],dtype=np.int)\ngg=np.zeros((rr,cc),dtype=np.int)\nfor cr,ccc,ck in goods:\n gg[cr-1][ccc-1]=ck\n\n@njit\ndef calc(r,c,g):\n dp=-1*np.ones((r+1,c+1,4),dtype=np.int)\n maxlst=np.zeros((r+1,c+1),dtype=np.int)\n\n dp[:,0,0]=0\n dp[0,:,0]=0\n \n for i in range(r):\n for j in range(c):\n tmp=0\n for k in range(3):\n if g[i][j]>0 and dp[i+1][j][k]>=0:\n dp[i+1][j+1][k+1]=max(dp[i+1][j][k+1],dp[i+1][j][k]+g[i][j])\n else:\n dp[i+1][j+1][k+1]=dp[i+1][j][k+1]\n tmp=max(tmp,dp[i+1][j+1][k+1])\n \n dp[i+1][j+1][0]=max(maxlst[i][j+1],dp[i+1][j][0])\n tmp=max(tmp,dp[i+1][j+1][0])\n \n if g[i][j]>0 and dp[i+1][j+1][0]>=0:\n dp[i+1][j+1][1]=max(dp[i+1][j+1][1],dp[i+1][j+1][0]+g[i][j])\n tmp=max(tmp,dp[i+1][j+1][1])\n \n maxlst[i+1][j+1]=tmp\n \n return maxlst[r][c]\n \nprint(calc(rr,cc,gg))', 'from numba import njit\n\nr,c,k=map(int,input().split())\ngoods=[list(map(int,input().split())) for _ in range(k)]\ng=[[0]*c for _ in range(r)]\nfor cr,cc,ck in goods:\n g[cr-1][cc-1]=ck\n\n@njit\ndef calc(r,c,g):\n dp=[[[-1]*4 for _ in range(c+1)] for _ in range(r+1)]\n maxlst=[[0]*(c+1) for _ in range(r+1)]\n\n for i in range(r):\n dp[i][0][0]=0\n for j in range(c):\n dp[0][j][0]=0\n \n for i in range(r):\n for j in range(c):\n tmp=0\n for k in range(3):\n if g[i][j]>0 and dp[i+1][j][k]>=0:\n dp[i+1][j+1][k+1]=max(dp[i+1][j][k+1],dp[i+1][j][k]+g[i][j])\n else:\n dp[i+1][j+1][k+1]=dp[i+1][j][k+1]\n tmp=max(tmp,dp[i+1][j+1][k+1])\n \n dp[i+1][j+1][0]=max(maxlst[i][j+1],dp[i+1][j][0])\n tmp=max(tmp,dp[i+1][j+1][0])\n \n if g[i][j]>0 and dp[i+1][j+1][0]>=0:\n dp[i+1][j+1][1]=max(dp[i+1][j+1][1],dp[i+1][j+1][0]+g[i][j])\n tmp=max(tmp,dp[i+1][j+1][1])\n \n maxlst[i+1][j+1]=tmp\n \n return maxlst[r][c]\n \nprint(calc(r,c,g))', 'import numpy as np\nfrom numba import njit\n\nrr,cc,kk=map(int,input().split())\ngoods=np.array([list(map(int,input().split())) for _ in range(kk)])\ngg=np.zeros((rr,cc))\nfor cr,ccc,ck in goods:\n gg[cr-1][ccc-1]=ck\n\n@njit\ndef calc(r,c,g):\n dp=-1*np.ones((r+1,c+1,4))\n maxlst=np.zeros((r+1,c+1))\n\n dp[:,0,0]=0\n dp[0,:,0]=0\n \n for i in range(r):\n for j in range(c):\n tmp=0\n for k in range(3):\n if g[i][j]>0 and dp[i+1][j][k]>=0:\n dp[i+1][j+1][k+1]=max(dp[i+1][j][k+1],dp[i+1][j][k]+g[i][j])\n else:\n dp[i+1][j+1][k+1]=dp[i+1][j][k+1]\n tmp=max(tmp,dp[i+1][j+1][k+1])\n \n dp[i+1][j+1][0]=max(maxlst[i][j+1],dp[i+1][j][0])\n tmp=max(tmp,dp[i+1][j+1][0])\n \n if g[i][j]>0 and dp[i+1][j+1][0]>=0:\n dp[i+1][j+1][1]=max(dp[i+1][j+1][1],dp[i+1][j+1][0]+g[i][j])\n tmp=max(tmp,dp[i+1][j+1][1])\n \n maxlst[i+1][j+1]=tmp\n \n return maxlst[r][c]\n \nprint(int(calc(rr,cc,gg)))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s133903285', 's306455773', 's427077659', 's452487795', 's497536818', 's924614009'] | [182100.0, 181812.0, 182204.0, 91312.0, 232616.0, 761612.0] | [1385.0, 1431.0, 1423.0, 378.0, 1935.0, 2479.0] | [1139, 1152, 1164, 1151, 1165, 1105] |
p02587 | u044220565 | 2,000 | 1,048,576 | We have N strings of lowercase English letters: S_1, S_2, \cdots, S_N. Takahashi wants to make a string that is a palindrome by choosing one or more of these strings - the same string can be chosen more than once - and concatenating them in some order of his choice. The cost of using the string S_i once is C_i, and the cost of using it multiple times is C_i multiplied by that number of times. Find the minimum total cost needed to choose strings so that Takahashi can make a palindrome. If there is no choice of strings in which he can make a palindrome, print -1. | ['# coding: utf-8\nimport sys\n#from operator import itemgetter\nsysread = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nfrom heapq import heappop, heappush\n#from collections import defaultdict\nsys.setrecursionlimit(10**7)\n#import math\n#from itertools import product, accumulate, combinations, product\n\n#import numpy as np\n#from copy import deepcopy\n#from collections import deque\n#from decimal import Decimal\n#from numba import jit\n\nINF = 1 << 50\n\ndef search_next(l, r, SC):\n ll, lc = l\n rr, rc = r\n nexts = []\n if len(ll) > len(rr):\n part = ll[len(rr):][::-1]\n for s,c in SC:\n if s[-len(part):] == part:\n r_n = ((s + rr)[:-len(ll)], rc + c)\n l_n = (0, lc)\n nexts.append((rc+c+lc, (l_n, r_n)))\n elif s in part:\n tmp = s + rr\n l_n =(ll[len(tmp):], lc)\n r_n = (0, rc + c)\n nexts.append((rc + c + lc, (l_n, r_n)))\n else:\n part = rr[:-len(ll)][::-1]\n for s, c in SC:\n if s[:len(part)] == part:\n l_n = ((ll + s)[len(rr):], lc + c)\n r_n = (0, rc)\n nexts.append((lc+rc+c, (l_n, r_n)))\n elif s in part:\n r_n = (rr[:-len(ll)-len(s)], rc)\n l_n = (0, lc + c)\n nexts.append((lc + rc + c, (l_n, r_n)))\n return nexts\n\ndef palindrome(l, r):\n if len(l+r) > 1 and l + r == (l+r)[::-1]:\n return True\n else:\n return False\n\n\n\ndef run():\n totalL = 0\n N = int(sysread())\n SC = []\n for i in range(N):\n s,c = input().split()\n c = int(c)\n SC.append((s,c))\n totalL += len(s)\n\n min_val = INF\n for s,c in SC:\n queue = []\n left = (s, c)\n right = (\'\', 0)\n heappush(queue, (c, (left, right)))\n done = False\n while queue:\n \n cost, (l, r) = heappop(queue)\n if palindrome(l[0], r[0]):\n done = True\n break\n nexts = search_next(l, r, SC)\n for n in nexts:\n heappush(queue, n)\n if done:\n min_val = min(min_val, cost)\n if min_val == INF:\n print(-1)\n else:\n print(min_val)\n\nif __name__ == "__main__":\n run()', '# coding: utf-8\nimport sys\n#from operator import itemgetter\nsysread = sys.stdin.buffer.readline\nread = sys.stdin.buffer.read\nfrom heapq import heappop, heappush\n#from collections import defaultdict\nsys.setrecursionlimit(10**7)\n#import math\n#from itertools import product, accumulate, combinations, product\n\n#import numpy as np\n#from copy import deepcopy\n#from collections import deque\n#from decimal import Decimal\n#from numba import jit\n\nINF = 1 << 50\n\ndef search_next(l, r, SC):\n ll, lc = l\n rr, rc = r\n nexts = []\n if len(ll) > len(rr):\n part = ll[::-1]\n for s,c in SC:\n if s[-len(part):] == part:\n r_n = (s[:-len(ll)], rc + c)\n l_n = (\'\', lc)\n nexts.append((rc+c+lc, (l_n, r_n)))\n elif s == part[-len(s):]:\n l_n =(ll[len(s):], lc)\n r_n = (\'\', rc + c)\n nexts.append((rc + c + lc, (l_n, r_n)))\n else:\n part = rr[::-1]\n for s, c in SC:\n if s[:len(part)] == part:\n l_n = (s[len(rr):], lc + c)\n r_n = (\'\', rc)\n nexts.append((lc+rc+c, (l_n, r_n)))\n elif s == part[:len(s)]:\n r_n = (rr[:-len(s)], rc)\n l_n = (\'\', lc + c)\n nexts.append((lc + rc + c, (l_n, r_n)))\n return nexts\n\ndef palindrome(l, r):\n if l + r == (l+r)[::-1]:\n return True\n else:\n return False\n\n\n\ndef run():\n totalL = 0\n N = int(sysread())\n SC = []\n for i in range(N):\n s,c = input().split()\n c = int(c)\n SC.append((s,c))\n totalL += len(s)\n\n min_val = INF\n cache = set()\n for s,c in SC:\n queue = []\n left = (s, c)\n right = (\'\', 0)\n heappush(queue, (c, (left, right)))\n done = False\n\n while queue:\n \n cost, (l, r) = heappop(queue)\n if (l[0], r[0]) in cache: continue\n cache.add((l[0], r[0]))\n if palindrome(l[0], r[0]):\n done = True\n #print(l, r)\n cache.remove((l[0], r[0]))\n break\n nexts = search_next(l, r, SC)\n for n in nexts:\n heappush(queue, n)\n if done:\n min_val = min(min_val, cost)\n if min_val == INF:\n print(-1)\n else:\n print(min_val)\n\nif __name__ == "__main__":\n run()'] | ['Runtime Error', 'Accepted'] | ['s229663005', 's074746971'] | [9292.0, 9368.0] | [28.0, 38.0] | [2333, 2439] |
p02587 | u169350228 | 2,000 | 1,048,576 | We have N strings of lowercase English letters: S_1, S_2, \cdots, S_N. Takahashi wants to make a string that is a palindrome by choosing one or more of these strings - the same string can be chosen more than once - and concatenating them in some order of his choice. The cost of using the string S_i once is C_i, and the cost of using it multiple times is C_i multiplied by that number of times. Find the minimum total cost needed to choose strings so that Takahashi can make a palindrome. If there is no choice of strings in which he can make a palindrome, print -1. | ['\nimport math\n#import numpy as np\nimport itertools\nimport queue\nimport bisect\nfrom collections import deque,defaultdict\nimport heapq as hpq\nfrom sys import stdin,setrecursionlimit\n#from scipy.sparse.csgraph import dijkstra\n#from scipy.sparse import csr_matrix\nipt = stdin.readline\nsetrecursionlimit(10**7)\nmod = 10**9+7\n# mod = 998244353\ndir = [(-1,0),(0,-1),(1,0),(0,1)]\nalp = "abcdefghijklmnopqrstuvwxyz"\nINF = 1<<32-1\n# INF = 10**18\n\ndef main():\n n = int(ipt())\n wrds = []\n hq = []\n usd = set()\n for i in range(n):\n s,c = input().split()\n c = int(c)\n wrds.append((s,c))\n hpq.heappush(hq,(c,s,1))\n\n while hq:\n hc,hs,hp = hpq.heappop(hq)\n usd.add((hs,hp))\n ls = len(hs)\n if hs == hs[::-1]:\n print(hc)\n exit()\n for si,ci in wrds:\n lsi = len(si)\n if lsi > ls:\n if hp == 1:\n wt = si[::-1]\n# print(wt)\n if hs == wt[:ls:] and not (wt[ls::],-1) in usd:\n hpq.heappush(hq,(hc+ci,wt[ls::],-1))\n else:\n if hs == si[:ls:] and not (si[ls::],1) in usd:\n hpq.heappush(hq,(hc+ci,si[ls::],1))\n else:\n if hp == 1:\n wt = si[::-1]\n if wt == hs[:lsi:] and not (hs[lsi::],1) in usd:\n hpq.heappush(hq,(hc+ci,hs[lsi::],1))\n else:\n if si == hs[:lsi:] and not (hs[lsi::],-1) in usd:\n hpq.heappush(hq,(hc+ci,hs[ls::],-1))\n print(hq)\n\n print(-1)\n\n\n return None\n\nif __name__ == \'__main__\':\n main()\n', '\nimport math\n#import numpy as np\nimport itertools\nimport queue\nimport bisect\nfrom collections import deque,defaultdict\nimport heapq as hpq\nfrom sys import stdin,setrecursionlimit\n#from scipy.sparse.csgraph import dijkstra\n#from scipy.sparse import csr_matrix\nipt = stdin.readline\nsetrecursionlimit(10**7)\nmod = 10**9+7\n# mod = 998244353\ndir = [(-1,0),(0,-1),(1,0),(0,1)]\nalp = "abcdefghijklmnopqrstuvwxyz"\nINF = 1<<32-1\n# INF = 10**18\n\ndef main():\n n = int(ipt())\n wrds = []\n hq = []\n usd = set()\n for i in range(n):\n s,c = input().split()\n c = int(c)\n wrds.append((s,c))\n hpq.heappush(hq,(c,s,1))\n\n while hq:\n hc,hs,hp = hpq.heappop(hq)\n usd.add((hs,hp))\n ls = len(hs)\n if hs == hs[::-1]:\n print(hc)\n exit()\n for si,ci in wrds:\n lsi = len(si)\n if lsi > ls:\n if hp == 1:\n wt = si[::-1]\n# print(wt)\n if hs == wt[:ls:] and not (wt[ls::],-1) in usd:\n hpq.heappush(hq,(hc+ci,wt[ls::],-1))\n else:\n if hs == si[:ls:] and not (si[ls::],1) in usd:\n hpq.heappush(hq,(hc+ci,si[ls::],1))\n else:\n if hp == 1:\n wt = si[::-1]\n if wt == hs[:lsi:] and not (hs[lsi::],1) in usd:\n hpq.heappush(hq,(hc+ci,hs[lsi::],1))\n else:\n if si == hs[:lsi:] and not (hs[lsi::],-1) in usd:\n hpq.heappush(hq,(hc+ci,hs[lsi::],-1))\n# print(hq)\n\n print(-1)\n\n\n return None\n\nif __name__ == \'__main__\':\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s964780899', 's436589661'] | [9880.0, 9820.0] | [56.0, 116.0] | [1738, 1740] |
p02587 | u864197622 | 2,000 | 1,048,576 | We have N strings of lowercase English letters: S_1, S_2, \cdots, S_N. Takahashi wants to make a string that is a palindrome by choosing one or more of these strings - the same string can be chosen more than once - and concatenating them in some order of his choice. The cost of using the string S_i once is C_i, and the cost of using it multiple times is C_i multiplied by that number of times. Find the minimum total cost needed to choose strings so that Takahashi can make a palindrome. If there is no choice of strings in which he can make a palindrome, print -1. | ['print(1)', 'from random import randrange\nfrom heapq import heapify, heappush, heappop\nfrom time import time\nK = 60\nrand = lambda: randrange(1 << K)\nsTime = time()\nN = int(input())\nS, IS, C = [], [], []\nfor _ in range(N):\n s, c = input().split()\n S.append(s)\n IS.append(s[::-1])\n C.append(int(c))\n\nD = {}\ndone = [set(), set()]\nr = rand()\nD[r] = (0, "", 0)\nH = [r]\nans = 1 << K\nwhile H:\n r = heappop(H)\n if time() - sTime > 1.7:\n break\n d, s, c = D[r]\n if s in done[d]: continue\n done[d].add(s)\n if d == 0:\n for ss, cc in zip(S, C):\n m = min(len(s), len(ss))\n if s[:m] == ss[:m]:\n if abs(len(s) - len(ss)) <= 1 or len(ss) > len(s) and ss[m:] == ss[m:][::-1]:\n ans = min(ans, c + cc)\n else:\n if len(s) < len(ss):\n r = rand() + (c + cc << K)\n D[r] = (1, ss[m:], c + cc)\n heappush(H, r)\n else:\n r = rand() + (c + cc << K)\n D[r] = (0, s[m:], c + cc)\n heappush(H, r)\n else:\n for ss, cc in zip(IS, C):\n m = min(len(s), len(ss))\n if s[:m] == ss[:m]:\n if abs(len(s) - len(ss)) <= 1 or len(ss) > len(s) and ss[m:] == ss[m:][::-1]:\n ans = min(ans, c + cc)\n else:\n if len(s) < len(ss):\n r = rand() + (c + cc << K)\n D[r] = (0, ss[m:], c + cc)\n heappush(H, r)\n else:\n r = rand() + (c + cc << K)\n D[r] = (1, s[m:], c + cc)\n heappush(H, r)\n\nprint(ans if ans < 1 << K - 2 else -1)'] | ['Wrong Answer', 'Accepted'] | ['s346250262', 's401604260'] | [9064.0, 9532.0] | [31.0, 52.0] | [8, 1798] |
p02590 | u102461423 | 2,000 | 1,048,576 | Let’s take a prime P = 200\,003. You are given N integers A_1, A_2, \ldots, A_N. Find the sum of ((A_i \cdot A_j) \bmod P) over all N \cdot (N-1) / 2 unordered pairs of elements (i < j). Please note that the sum isn't computed modulo P. | ['import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nMOD = 200_003\nR = 2 \n\n@njit((i8[:], ), cache=True)\ndef precompute(A):\n exp = np.zeros(MOD - 1, np.int64)\n log = np.zeros(MOD, np.int64)\n exp[0] = 1\n for k in range(1, MOD - 1):\n exp[k] = exp[k - 1] * R % MOD\n log[exp[k]] = k\n \n B = np.zeros(MOD - 1, np.int64)\n for x in A:\n if x != 0:\n B[log[x]] += 1\n return exp, log, B\n\n@njit((i8[:], i8[:], i8[:], i8[:]), cache=True)\ndef get_ans(A, C, exp, log):\n \n ans = 0\n for i in range(len(C)):\n x = exp[i % (MOD - 1)]\n ans += x * C[i]\n for a in A:\n x = a * a % MOD\n ans -= x\n return ans // 2\n\nA = np.array(read().split(), np.int64)[1:]\n\nexp, log, B = precompute(A)\nfft, ifft = np.fft.fft, np.fft.ifft\nfft_len = 210_000\nFB = fft(B, fft_len)\nC = np.rint(ifft(FB * FB, fft_len)).astype(np.int64)\n\nprint(get_ans(A, C, exp, log))\n', 'import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nMOD = 200_003\nR = 2 \n\nntt_mod = 998_244_353\nntt_root = 3\nmax_ntt = 20\nroots, iroots = np.empty(1 << max_ntt,\n np.int64), np.empty(1 << max_ntt, np.int64)\n\nntt_data = (ntt_mod, ntt_root, max_ntt, roots, iroots)\nntt_t = numba.typeof(ntt_data)\n\n\n@njit((ntt_t, ), cache=True)\ndef ntt_precompute(ntt_data):\n MOD, root, max_ntt, roots, iroots = ntt_data\n\n def mpow(a, n):\n p = 1\n while n:\n if n & 1:\n p = p * a % MOD\n a = a * a % MOD\n n >>= 1\n return p\n\n roots[0] = iroots[0] = 1\n for n in range(max_ntt):\n x = mpow(root, (MOD - 1) >> n + 2)\n y = mpow(x, MOD - 2)\n for i in range(1 << n):\n roots[(1 << n) | i] = roots[i] * x % MOD\n iroots[(1 << n) | i] = iroots[i] * y % MOD\n return roots, iroots\n\n\n@njit((ntt_t, i8[:], b1), cache=True)\ndef ntt(ntt_data, A, inverse):\n MOD, _, _, roots, iroots = ntt_data\n\n def mpow(a, n):\n p = 1\n while n:\n if n & 1:\n p = p * a % MOD\n a = a * a % MOD\n n >>= 1\n return p\n\n N = len(A)\n\n if not inverse:\n m = N >> 1\n while m:\n for k in range(N // m >> 1):\n s = 2 * m * k\n for i in range(s, s + m):\n x, y = A[i], A[i + m] * roots[k]\n A[i], A[i + m] = x + y, x - y\n A %= MOD\n m >>= 1\n else:\n m = 1\n while m < N:\n for k in range(N // m >> 1):\n s = 2 * m * k\n for i in range(s, s + m):\n x, y = A[i], A[i + m]\n A[i], A[i + m] = x + y, (x - y) * iroots[k]\n A %= MOD\n m <<= 1\n for i in range(N):\n A[i] = A[i] * mpow(N, MOD - 2, MOD) % MOD\n return A\n\n\n@njit((ntt_t, i8[:], i8[:]), cache=True)\ndef ntt_convolve(ntt_data, A, B):\n L = 1\n while 2 * L < len(A) + len(B) - 1:\n L *= 2\n L *= 2\n A = np.append(A, np.zeros(L - len(A), np.int64))\n B = np.append(B, np.zeros(L - len(B), np.int64))\n A = ntt(ntt_data, A, False)\n B = ntt(ntt_data, B, False)\n for i in range(len(A)):\n A[i] = A[i] * B[i] % ntt_data[0]\n return ntt(ntt_data, A, True)\n\n\nntt_precompute(ntt_data)\n\n@njit((i8[:], ), cache=True)\ndef precompute(A):\n exp = np.zeros(MOD - 1, np.int64)\n log = np.zeros(MOD, np.int64)\n exp[0] = 1\n for k in range(1, MOD - 1):\n exp[k] = exp[k - 1] * R % MOD\n log[exp[k]] = k\n \n B = np.zeros(MOD - 1, np.int64)\n for x in A:\n if x != 0:\n B[log[x]] += 1\n return exp, log, B\n\n@njit((i8[:], i8[:], i8[:], i8[:]), cache=True)\ndef get_ans(A, C, exp, log):\n \n ans = 0\n for i in range(len(C)):\n x = exp[i % (MOD - 1)]\n ans += x * C[i]\n for a in A:\n x = a * a % MOD\n ans -= x\n return ans // 2\n\nA = np.array(read().split(), np.int64)[1:]\n\nexp, log, B = precompute(A)\n\nB = np.append(B, [0] * ((1 << 19) - len(B)))\nBh, Bl = B >> 9, B & 511\nx = ntt_convolve(ntt_data, Bh, Bh) << 18\nx += ntt_convolve(ntt_data, Bh, Bl) << 10\nx += ntt_convolve(ntt_data, Bl, Bl)\n\nprint(get_ans(A, x, exp, log))', 'import sys\nimport numpy as np\nimport numba\nfrom numba import njit, b1, i4, i8, f8\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nMOD = 200_003\nR = 2 \n\n@njit((i8[:], ), cache=True)\ndef precompute(A):\n exp = np.zeros(MOD - 1, np.int64)\n log = np.zeros(MOD, np.int64)\n exp[0] = 1\n for k in range(1, MOD - 1):\n exp[k] = exp[k - 1] * R % MOD\n log[exp[k]] = k\n \n B = np.zeros(MOD - 1, np.int64)\n for x in A:\n if x != 0:\n B[log[x]] += 1\n return exp, log, B\n\n@njit((i8[:], i8[:], i8[:], i8[:]), cache=True)\ndef get_ans(A, C, exp, log):\n \n ans = 0\n for i in range(len(C)):\n x = exp[i % (MOD - 1)]\n ans += x * C[i]\n for a in A:\n x = a * a % MOD\n ans -= x\n return ans // 2\n\nA = np.array(read().split(), np.int64)[1:]\n\nexp, log, B = precompute(A)\nfft, ifft = np.fft.fft, np.fft.ifft\nfft_len = 420_000\nFB = fft(B, fft_len)\nC = np.rint(ifft(FB * FB, fft_len)).astype(np.int64)\n\nprint(get_ans(A, C, exp, log))\n'] | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s304139122', 's933873799', 's665539137'] | [129752.0, 174796.0, 145216.0] | [541.0, 2210.0, 559.0] | [1136, 3481, 1136] |
p02590 | u163320134 | 2,000 | 1,048,576 | Let’s take a prime P = 200\,003. You are given N integers A_1, A_2, \ldots, A_N. Find the sum of ((A_i \cdot A_j) \bmod P) over all N \cdot (N-1) / 2 unordered pairs of elements (i < j). Please note that the sum isn't computed modulo P. | ['import numpy \n \ndef convolve(g, h):\n s=len(g)+len(h)+1\n n=1\n while n<s:\n n*=2\n gg=numpy.fft.fft(g+[0]*(n-len(g)))\n hh=numpy.fft.fft(h+[0]*(n-len(h)))\n ff=[gg[i]*hh[i] for i in range(n)]\n ff=numpy.fft.ifft(ff)\n ans=[int(ff[i].real+0.5) for i in range(n)]\n return ans\n\np=200003\nn=int(input())\narr=list(map(int,input().split()))\npos={}\ntmp=1\nfor i in range(p):\n pos[tmp]=i\n tmp*=2\n tmp%=p\ncnt1=[0]*p\ncnt2=[0]*p\nfor val in arr:\n if val!=0:\n cnt1[pos[val]]+=1\n cnt2[pos[val]]+=1\nans=convolve(cnt1,cnt2)\nfor val in arr:\n ans[pos[val]*2]-=1\ntotal=0\nfor i in range(len(ans)):\n if ans[i]!=0:\n total+=(ans[i]//2)*pow(2,i,p)\nprint(total)', 'import numpy \n \ndef convolve(g, h):\n s=len(g)+len(h)+1\n n=1\n while n<s:\n n*=2\n gg=numpy.fft.fft(g+[0]*(n-len(g)))\n hh=numpy.fft.fft(h+[0]*(n-len(h)))\n ff=[gg[i]*hh[i] for i in range(n)]\n ff=numpy.fft.ifft(ff)\n ans=[int(ff[i].real+0.5) for i in range(n)]\n return ans\n\np=200003\nn=int(input())\narr=list(map(int,input().split()))\npos={}\ntmp=1\nfor i in range(p):\n pos[tmp]=i\n tmp*=2\n tmp%=p\ncnt1=[0]*p\ncnt2=[0]*p\nfor val in arr:\n if val!=0:\n cnt1[pos[val]]+=1\n cnt2[pos[val]]+=1\nans=convolve(cnt1,cnt2)\nfor val in arr:\n if val!=0:\n ans[pos[val]*2]-=1\ntotal=0\nfor i in range(len(ans)):\n if ans[i]!=0:\n total+=(ans[i]//2)*pow(2,i,p)\nprint(total)'] | ['Runtime Error', 'Accepted'] | ['s638731453', 's554852159'] | [138100.0, 138204.0] | [1742.0, 1740.0] | [653, 668] |
p02590 | u313111801 | 2,000 | 1,048,576 | Let’s take a prime P = 200\,003. You are given N integers A_1, A_2, \ldots, A_N. Find the sum of ((A_i \cdot A_j) \bmod P) over all N \cdot (N-1) / 2 unordered pairs of elements (i < j). Please note that the sum isn't computed modulo P. | ['import sys\nimport numpy as np\n\ndef fft_convolve(f, g):\n \n fft = np.fft.rfft\n ifft = np.fft.irfft\n Lf = len(f)\n Lg = len(g)\n L = Lf + Lg - 1\n fft_len = 1 << L.bit_length()\n fl = f & (1 << 15) - 1\n fh = f >> 15\n gl = g & (1 << 15) - 1\n gh = g >> 15\n\n def conv(f, g):\n return ifft(fft(f, fft_len) * fft(g, fft_len))[:L]\n\n x = conv(fl, gl)\n y = conv(fl + fh, gl + gh)\n z = conv(fh, gh)\n a, b, c = map(lambda x: (x + .5).astype(np.int64), [x, y, z])\n return (a + ((b - a - c) << 15) + (c << 30))\n\n\nROOT=2\nP=200003\npw=[1]*(P-1)\nlg=[-1]*P\n\nfor i in range(1,len(pw)):\n pw[i]=ROOT*pw[i-1]%P\nfor i in range(len(pw)):\n lg[pw[i]]=i\n\nN=int(input())\nA=np.array([int(x) for x in input().split()],dtype=np.int64)\nB=[0]*P\nfor a in A:\n if a==0:\n continue\n B[lg[a]]+=1\nB=np.array(B,dtype=np.int64)\nC=fft_convolve(B,B)\nans=0\nfor a in A:\n ans-=a*a%(P-1)\nfor i in range(len(C)):\n ans+=C[i]*pw[i%(P-1)]\nans//=2\nprint(ans)\n', 'import sys\nimport numpy as np\n\ndef fft_convolve(f, g):\n \n fft = np.fft.rfft\n ifft = np.fft.irfft\n Lf = len(f)\n Lg = len(g)\n L = Lf + Lg - 1\n fft_len = 1 << L.bit_length()\n fl = f & (1 << 15) - 1\n fh = f >> 15\n gl = g & (1 << 15) - 1\n gh = g >> 15\n\n def conv(f, g):\n return ifft(fft(f, fft_len) * fft(g, fft_len))[:L]\n\n x = conv(fl, gl)\n y = conv(fl + fh, gl + gh)\n z = conv(fh, gh)\n a, b, c = map(lambda x: (x + .5).astype(np.int64), [x, y, z])\n return (a + ((b - a - c) << 15) + (c << 30))\n\n\nROOT=2\nP=200003\npw=[1]*(P-1)\nlg=[-1]*P\n\nfor i in range(1,len(pw)):\n pw[i]=ROOT*pw[i-1]%P\nfor i in range(len(pw)):\n lg[pw[i]]=i\n\nN=int(input())\nA=np.array([int(x) for x in input().split()],dtype=np.int64)\nB=[0]*P\nfor a in A:\n if a==0:\n continue\n B[lg[a]]+=1\nB=np.array(B,dtype=np.int64)\nC=fft_convolve(B,B)\nans=0\nfor a in A:\n ans-=a*a%P\nfor i in range(len(C)):\n ans+=C[i]*pw[i%(P-1)]\nans//=2\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s164266270', 's152657283'] | [86196.0, 86648.0] | [875.0, 903.0] | [1195, 1191] |
p02590 | u495699318 | 2,000 | 1,048,576 | Let’s take a prime P = 200\,003. You are given N integers A_1, A_2, \ldots, A_N. Find the sum of ((A_i \cdot A_j) \bmod P) over all N \cdot (N-1) / 2 unordered pairs of elements (i < j). Please note that the sum isn't computed modulo P. | ['import scipy.fftpack as F\nfrom numpy import *\nm=200003\nn=int(input())\na=[0]*m\nb=[0]*m\nans=0\nfor i in range(m-1):\n a[pow(2,i,m)]=i\nfor i in map(int,input().split()):\n if i:\n b[a[i]]+=1\n ans-=i*i%m\nb=array(b,dtype=float64)\nb=F.fft(b)\nb=b*b\nb=F.ifft(b)\nfor i,j in enumerate(b):\n ans+=int(round(j.real))*pow(2,i,m)\nprint(ans//2)', 'import scipy.fftpack as F\nfrom numpy import *\nm=200003\nn=int(input())\na=[0]*m\nb=[0]*(m-1)\nans=0\nfor i in range(m-1):\n a[pow(2,i,m)]=i\nfor i in map(int,input().split()):\n if i:\n b[a[i]]+=1\n ans-=i*i%m\nb=array(b,dtype=float64)\nb=F.fft(b)\nb=b*b\nb=F.ifft(b)\nfor i,j in enumerate(b):\n ans+=int(round(j.real))*pow(2,i,m)\nprint(ans//2)'] | ['Wrong Answer', 'Accepted'] | ['s491701917', 's960929835'] | [90424.0, 90232.0] | [1261.0, 1251.0] | [347, 351] |
p02594 | u000875186 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['temp=int(input())\nif(temp<=30):\n print("Yes")\nelse:\n print("No")', 'temp=int(input())\nif(temp<35):\n print("Yes")\nelse:\n print("No")', 'temp=int(input())\nif(temp>=30):\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s721351659', 's861833319', 's399356626'] | [9168.0, 9144.0, 9148.0] | [24.0, 23.0, 28.0] | [70, 69, 70] |
p02594 | u001166342 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X=int(input())\nif x>=30:\n print(Yes)\nelse:\n print(No)', 'X=int(input())\nif x>=30:\n print("Yes")\nelse:\n print("No")', 'x=int(input())\nif x>=30:\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s034117782', 's822796883', 's590514766'] | [9072.0, 9148.0, 9116.0] | [31.0, 25.0, 25.0] | [55, 59, 60] |
p02594 | u003142309 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["X = int(input())\n\nif X <= 30:\n print('Yes')\nelse:\n print('No')", "X = int(input())\n\nif 30 <= X:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s159209487', 's511411561'] | [9144.0, 9144.0] | [28.0, 30.0] | [68, 68] |
p02594 | u003652013 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["X = int(input())\n\nif X>=30:\n print('YES')\nelse:\n print('NO')", "X = int(input())\n\nif X>=30:\n print('Yes')\nelse:\n print('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s381861761', 's416155204'] | [9148.0, 9076.0] | [28.0, 29.0] | [62, 63] |
p02594 | u005408592 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["if X>= 30:\n print('yes')\nelse:\n print('no')\n", "X = int(input())\nif X>= 30:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s154626691', 's614686899'] | [9064.0, 9148.0] | [24.0, 31.0] | [50, 66] |
p02594 | u015704582 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["if X >= 30:\n print('Yes')\nelse:\n print('No')", "def switch(X):\n if X >= 30:\n print('Yes')\n else:\n print('No')", "if input() >= 30:\n print('Yes')\nelse:\n print('No')", "if int(input()) >= 30:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s257942532', 's564223733', 's987286538', 's697263297'] | [9012.0, 9024.0, 9008.0, 9040.0] | [26.0, 28.0, 28.0, 27.0] | [50, 69, 56, 61] |
p02594 | u018466367 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = input()\nif X>=30:\n print("Yes")\nelse:\n print("No")', 'X = int(input())\nif X>=30:\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s454609521', 's133167773'] | [8992.0, 9152.0] | [26.0, 25.0] | [56, 62] |
p02594 | u021548497 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['#include <stdio.h>\n\nint main(){\n int x;\n scanf("%d", &x);\n \n if (x >= 30){\n printf("Yes\\n");\n }\n else{\n printf("No\\n");\n }\n \n return 0;\n}', 'x = int(input())\nif x >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s981251336', 's357181164'] | [9008.0, 9144.0] | [23.0, 27.0] | [152, 63] |
p02594 | u026788530 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x=int(input())\nif x>=30:\n print("YES")\nelse:\n print("NO")', 'x = int(input())\nif x >= 30:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s692090139', 's739923947'] | [9084.0, 9136.0] | [25.0, 25.0] | [59, 68] |
p02594 | u028464094 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['int X=input()\nif(X==30):\n print("Yes")\nelse:\n print("No")\n', 'X=int(input())\nif(X<=40 and X>=-40):\n if(X>=30):\n print("Yes")\n else:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s290365196', 's917576153'] | [9000.0, 9152.0] | [26.0, 23.0] | [60, 102] |
p02594 | u029568245 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["t = input()\n\nif t >= 30:\n print('Yes')\nelse:\n print('No')", "t = int(input())\n\nif t >= 30:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s645718720', 's858802506'] | [9004.0, 8932.0] | [23.0, 30.0] | [59, 64] |
p02594 | u032955959 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x=int(input)\nif x >=30:\n print("Yes")\nelse:\n print(\'No\')', 'x=int(input())\nif x >=30:\n print("Yes")\nelse:\n print(\'No\')'] | ['Runtime Error', 'Accepted'] | ['s089194959', 's983208113'] | [9072.0, 9084.0] | [22.0, 33.0] | [58, 60] |
p02594 | u034323841 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["n=input()\n\nif 30<=n:\n print('Yes')\nelse :\n print('No')\n", "n=input()\n\nif 30<=n:\n print('Yes')\nelse :\n print('No')\n", "n=int(input())\n\nif 30<=n:\n print('Yes')\nelse :\n print('No')\n"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s259339439', 's281621788', 's882286163'] | [9004.0, 8792.0, 8996.0] | [27.0, 26.0, 29.0] | [61, 61, 66] |
p02594 | u035305939 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nif x=>30:\n print("Yes")\nelse:\n print("No")\n', 'x = int(input())\nif x>=30:\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s089459307', 's565630305'] | [9000.0, 9048.0] | [28.0, 30.0] | [66, 66] |
p02594 | u037807721 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = input()\n\nif X >= 30:\n print("Yes")\nelse:\n print("No")', 'x = int(input())\nif x >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s123559492', 's574005811'] | [9084.0, 9144.0] | [24.0, 31.0] | [59, 67] |
p02594 | u044732260 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['\nx = int(input("入力: "))\n\n\nif x >= 30:\n print("Yes")\nelif x < 30:\n print("No")\nelse:\n print("エラー")', '\nx = int(input())\n\n\nif x >= 30:\n print("Yes")\nelif x < 30:\n print("No")\nelse:\n print("エラー")'] | ['Wrong Answer', 'Accepted'] | ['s548447628', 's542345804'] | [9160.0, 9068.0] | [28.0, 29.0] | [186, 176] |
p02594 | u051174463 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["x = int(input())\nans = 'YES' if x >= 30 else 'NO'\nprint(ans)", "x = int(input())\nans = 'Yes' if x >= 30 else 'No'\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s179227762', 's647909282'] | [9152.0, 9084.0] | [27.0, 28.0] | [60, 60] |
p02594 | u051237313 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["x = input()\nif(x >= 30):\n print('Yes')\n else:\n print('No')", "x = int(input())\nif x >= 30:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s682622559', 's991525468'] | [8912.0, 9092.0] | [29.0, 30.0] | [67, 63] |
p02594 | u051496905 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X =int(input())\nif X >= 30:\n print("Yes")\n', 'X =int(input())\nif X <= 30:\n print("Yes")\n', 'X =int(input())\nif X >= 30:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s080589662', 's534283063', 's348732457'] | [9092.0, 9032.0, 9016.0] | [27.0, 29.0, 32.0] | [45, 45, 67] |
p02594 | u053749071 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | [' x = int(input())\n\n if x >= 30:\n print("Yes")\n else:\n print("No")\n', 'x = int(input())\n\nif x >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s750283571', 's818690212'] | [8900.0, 9068.0] | [24.0, 24.0] | [89, 68] |
p02594 | u059903069 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X=input()\nif X >=30:\n print("Yes")\nelse:\n print("No")', 'x=int(input())\nif x >=30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s769489538', 's202414305'] | [9040.0, 9096.0] | [30.0, 28.0] | [59, 64] |
p02594 | u060392346 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nif X>=30:\n print("Yes")\nelse:\n print("No")', 'x = int(input())\nif x >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s319222550', 's019891972'] | [9068.0, 9088.0] | [24.0, 26.0] | [61, 63] |
p02594 | u062372092 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["a = int(input())\nprint(a > 29 and 'Yes' or 'No)", "x = int(input())\nres = x > 29 and 'Yes' or 'No'\nprint(res)"] | ['Runtime Error', 'Accepted'] | ['s343347583', 's844099652'] | [8948.0, 9112.0] | [26.0, 29.0] | [47, 58] |
p02594 | u062571807 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['a=int(input())\nif -40 <= a <= 40:\n print("Yes")\nelse:\n print("No")', 'a=int(input())\nif a <= 30:\n print("Yes")\nelse:\n print("No")', 'a=int(input())\nif a >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s662267820', 's917229848', 's389148679'] | [9144.0, 9144.0, 9148.0] | [25.0, 30.0, 41.0] | [72, 65, 65] |
p02594 | u067399052 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['def close_aircondition(x):\n if x >= 30:\n return "Yes"\n else:\n return \'No\'', 'X = input()\nif X >= 30:\n print("Yes")\nelse:\n print("No")', 'def close_aircondition(x):\n if x >= 30:\n print("Yes")\n else:\n print(\'No\')\n', 'def close_aircondition(x):\n if x >= 30:\n return "yes"\n else:\n return \'no\'', 'def close_aircondition(x):\n if x >= 30:\n print("Yes")\n else:\n print(\'No\')\n\nif __name__ == "__main__":\n X = input()\n close_aircondition(X)', 'X = int(input())\nif X >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s254025787', 's616260165', 's856226566', 's877676077', 's943689384', 's163995502'] | [9004.0, 9104.0, 8984.0, 8928.0, 9096.0, 9052.0] | [25.0, 24.0, 28.0, 25.0, 24.0, 27.0] | [81, 58, 82, 81, 147, 63] |
p02594 | u069493428 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X_string=input()\nint=input(X_string)\nif X>=30:\n print("Yes")\nelse:\n print("No")\n ', 'X_string=input()\nX=int(X_string)\nif X>=30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s592314652', 's205796495'] | [9068.0, 9148.0] | [27.0, 24.0] | [84, 77] |
p02594 | u069699931 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['K=int(input())\ndef x():\n count=0\n for i in range(K):\n count =(10*count+7)%K\n if count%K==0:\n return i+1\n return -1 \nprint(x())', "X=int(input())\nif X>=30:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s685723324', 's229065672'] | [9068.0, 9144.0] | [27.0, 27.0] | [163, 63] |
p02594 | u073788720 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['#=input()\nx=int(input())\n#=map(int,input().split())\n#=map(str,input().split())\n#=list(map(int,input().split()))\nif x >= 30:\n print("yes")\nelse:\n print("no") ', '#=input()\nx=int(input())\n#=map(int,input().split())\n#=map(str,input().split())\n#=list(map(int,input().split()))\nif x >= 30:\n print("Yes")\nelse:\n print("No") '] | ['Wrong Answer', 'Accepted'] | ['s620667549', 's236550261'] | [9144.0, 9084.0] | [31.0, 35.0] | [166, 166] |
p02594 | u078085705 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = input()\nprint("Yes" if X>=30 else "No")', 'X = int(input())\nprint("Yes" if X>=30 else "No")'] | ['Runtime Error', 'Accepted'] | ['s357253416', 's935234630'] | [9080.0, 9148.0] | [26.0, 36.0] | [43, 48] |
p02594 | u080537441 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["if X >= 30 and X <= 40:\n print('Yes')\nelif \n print('No')", "X = int(input())\n\nif -40 <= X <= 40:\n if X >= 30:\n print('Yes')\n else:\n print('No')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s648165923', 's856983278'] | [8924.0, 9160.0] | [24.0, 25.0] | [58, 111] |
p02594 | u080685822 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nif x => 30:\n print("Yes")\nelse:\n print("No")\n \n', 'X = int(input())\nif x => 30:\n print("Yes")\nelse:\n print("No")\n ', 'X = int(input())\nif x >= 30:\n print("Yes")\nelse:\n print("No")\n \n', 'x = int(input())\nif x >= 30:\n print("Yes")\nelse:\n print("No")\n \n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s263527011', 's552082379', 's798763942', 's172506237'] | [8948.0, 9024.0, 9160.0, 9108.0] | [28.0, 20.0, 27.0, 29.0] | [67, 66, 67, 67] |
p02594 | u086106268 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["x = int(input('X'))\nif x >= 30:\n print('Yes')\nelse:\n print('No')", "x = int(input())\nif x >= 30:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s787882823', 's026001728'] | [9004.0, 9136.0] | [31.0, 27.0] | [66, 63] |
p02594 | u087084024 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['import sys\n\nx = input()\nif( x >= 30):\n print("Yes")\nelse :\n print("No")\n', 'x = input()\nif( x >= 30):\n print("Yes")\nelse :\n print("No")', 'x = input()\nif( int(x) >= 30):\n print("Yes")\nelse :\n print("No")\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s792060969', 's795364719', 's930893108'] | [8980.0, 9080.0, 9140.0] | [25.0, 25.0, 26.0] | [74, 61, 67] |
p02594 | u089175821 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x=int(input(()))\nprint(["No","Yes"][x>=30])', 'x = int(input())\nprint(["No", "Yes"][x >= 30])\n'] | ['Wrong Answer', 'Accepted'] | ['s243748022', 's078896215'] | [9144.0, 9076.0] | [32.0, 33.0] | [43, 47] |
p02594 | u090988878 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["print('Hello World')", "status=int(input())\nif(status>=30):\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s301091405', 's707235121'] | [8960.0, 9040.0] | [28.0, 29.0] | [20, 74] |
p02594 | u094213642 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["n = int(input())\nc = input()\n\nwcount = c.count('R')\ncount = 0\n\nfor i in range(n):\n if c[i] == 'W' and i<= wcount:\n count += 1\nprint(count)\n", "x = int(input())\n\nif x >= 30:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s062627019', 's253288315'] | [9140.0, 9140.0] | [21.0, 26.0] | [149, 68] |
p02594 | u095266283 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['import base64\nimport sys\nimport subprocess\nfrom pathlib import Path\nimport os\n\nexe_bin = "f0VMRgIBAQAAAAAAAAAAAAMAPgABAAAAsAkAAAAAAABAAAAAAAAAAKgbAAAAAAAAAAAAAEAAOAAJAEAAHQAcAAYAAAAEAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAA+AEAAAAAAAD4AQAAAAAAAAgAAAAAAAAAAwAAAAQAAAA4AgAAAAAAADgCAAAAAAAAOAIAAAAAAAAcAAAAAAAAABwAAAAAAAAAAQAAAAAAAAABAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALgMAAAAAAAAuAwAAAAAAAAAACAAAAAAAAEAAAAGAAAAaA0AAAAAAABoDSAAAAAAAGgNIAAAAAAAqAIAAAAAAAAYBQAAAAAAAAAAIAAAAAAAAgAAAAYAAACADQAAAAAAAIANIAAAAAAAgA0gAAAAAAAAAgAAAAAAAAACAAAAAAAACAAAAAAAAAAEAAAABAAAAFQCAAAAAAAAVAIAAAAAAABUAgAAAAAAAEQAAAAAAAAARAAAAAAAAAAEAAAAAAAAAFDldGQEAAAATAsAAAAAAABMCwAAAAAAAEwLAAAAAAAARAAAA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AYAAAAAAAAACAAAAAAAAAAQAAAAAAAAAJgAAAABAAAAAwAAAAAAAACADyAAAAAAAIAPAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAADqAAAAAQAAAAMAAAAAAAAAABAgAAAAAAAAEAAAAAAAABAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAA8AAAAAgAAAADAAAAAAAAAEAQIAAAAAAAEBAAAAAAAABAAgAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAPUAAAABAAAAMAAAAAAAAAAAAAAAAAAAABAQAAAAAAAAKQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAAAAAAAAAABAEAAAAAAAAPAGAAAAAAAAGwAAAC0AAAAIAAAAAAAAABgAAAAAAAAACQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAMBcAAAAAAAB0AwAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAADAAAAAAAAAAAAAAAAAAAAAAAAAKQaAAAAAAAA/gAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAA="\nexe_bin = base64.b64decode(exe_bin)\nwith open("./exec", \'wb\') as f:\n f.write(exe_bin)\nsubprocess.run(["./exec"], shell=True)', 'import base64\nimport subprocess\nimport gzip\n\n\nexe_bin = b\'\\x1f\\x8b\\x08\\x00<0J_\\x02\\xff\\xddZi\\x93\\xb2<\\xb3\\xfe-\\x96K\\xa9SV!\\xe2V\\xb8\\x81\\xa0(\\n\\x82\\xb2\\xc8\\x07\\x15\\xdcw\\x1d\\xdcQ\\x7f\\xfb\\xcb2\\xf7\\xc4\\x9b\\x919\\xcfSu\\xde\\xf3\\xe1\\xe4\\xc3L\\x9b\\x8bt:I\\xa7\\xbb\\xd3\\xc9\\xb8XD`H\\xf7\\xf3\\x08\\x04\\x8a\\xf1\\x98\\x05!\\x9e\\xcf\\xc6\\x8f\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n f.write(exe_bin)\n\nsubprocess.run(["chmod +x ./kyomu"], shell=True)\nsubprocess.run(["./kyomu"], shell=True)'] | ['Wrong Answer', 'Accepted'] | ['s786960477', 's181213126'] | [10924.0, 10752.0] | [55.0, 57.0] | [12135, 12912] |
p02594 | u095426154 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['25', '# coding: utf-8\nX=int(input())\n\nif X>=30:\n print("Yes")\nelse:\n print("No")\n\n'] | ['Wrong Answer', 'Accepted'] | ['s406981071', 's293916802'] | [8904.0, 9032.0] | [28.0, 28.0] | [2, 82] |
p02594 | u097069712 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = input()\nif X<=30:\n\tprint("No")\nelse: x>=30\n\tprint("Yes")', 'X = int(input())\nif X < 30:\n\tprint("No")\nif X >= 30:\n\tprint("Yes")'] | ['Runtime Error', 'Accepted'] | ['s740713834', 's023961542'] | [9012.0, 9096.0] | [24.0, 30.0] | [60, 66] |
p02594 | u097852911 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['k = int(input())\nsevens = 7\ncounter = 1\nif (k%10)%2 ==0:\n print(-1)\nelif (k%10) ==5:\n print(-1)\nwhile True:\n if sevens % k ==0:\n print(counter)\n break\n else:\n sevens = 10*sevens+7\n counter += 1\n ', 'x = int(input())\nif x>= 30:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s576842358', 's493272253'] | [9064.0, 9128.0] | [2205.0, 25.0] | [214, 62] |
p02594 | u098436028 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['if( int(input()) <= 30 ):\n print("Yes")\nelse:\n print("No")', 'A=int(input()) \n\nif( A>= 30 ):\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s130942585', 's027182199'] | [9168.0, 9156.0] | [31.0, 32.0] | [61, 66] |
p02594 | u101318301 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["input(x)\n\nif x>=30:\n print('yes')\nelse :\n print('No')\n", "x = int(input())\n\nif x>=30:\n print('Yes')\nelif :\n print('No')", "x = input()\n\nif x>=30:\n print('Yes')\nelif :\n print('No')", "input(x)\n\nif 30<=x<=40:\n print('yes')\nelse :\n print('No')\n", "x = int(input())\n\nif x>=30:\n print('Yes')\nelse :\n print('No')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s206542130', 's294782548', 's682138102', 's927443304', 's690245427'] | [8992.0, 8924.0, 8960.0, 8892.0, 9116.0] | [23.0, 24.0, 24.0, 26.0, 28.0] | [56, 63, 58, 60, 63] |
p02594 | u102655885 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["import sys\nk = int(input())\n\nremainders = set()\ncurrent_remainder = 7 % k\nremainders.add(current_remainder)\n\ncounter = 1\nwhile True:\n counter += 1\n remainder = current_remainder * 10 % k\n if remainder in remainders:\n print('-1')\n sys.exit()\n remainders.add(remainder)\n if sum(remainders) % k == 0:\n print(counter)\n sys.exit()", "x = int(input())\nif x >= 30:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s880738494', 's987845555'] | [9040.0, 9148.0] | [26.0, 31.0] | [368, 67] |
p02594 | u109272021 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["x = input()\n\nif x >= 30 :\n print('Yes')\nelse :\n print('No')", "x = int(input())\n\nif x >= 30 :\n print('Yes')\nelse :\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s744338478', 's428818871'] | [9000.0, 9156.0] | [26.0, 24.0] | [61, 66] |
p02594 | u109632368 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['\nk = int(input())\nans = 0\nai = 7\nfor i in range(k):\n ai = ((ai * 10) + 7) % k\n if ai == 0:\n ans = i\n break\n if i == k:\n ans = -1\n\nprint(ans)\n\n', '\nt = int(input())\n\nif t >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s448660715', 's739208662'] | [9164.0, 9088.0] | [30.0, 28.0] | [172, 69] |
p02594 | u110339438 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['n = int(input()) \ncount = 1\ns="7"\nfound = False \nif n == 7:\n print(1)\n exit()\nwhile(int(s) % n*count != 0 and not found):\n s = "7"*count\n count += 1\n if int(s) >= 10e6:\n print(-1)\n found = True\nif not found: \n print(count-1)', 'n = int(input())\nprint("Yes" if n >= 30 else "No")'] | ['Wrong Answer', 'Accepted'] | ['s229195325', 's854677538'] | [9044.0, 9092.0] | [25.0, 33.0] | [236, 50] |
p02594 | u110685244 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = int(input())\n\nif X <= 30:\n print("Yes")\nelse:\n print("No")', 'X = int(input())\n\nif 30 <= X <= 40:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s123471571', 's203042201'] | [9144.0, 9148.0] | [35.0, 34.0] | [68, 75] |
p02594 | u119015607 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['import math\n \nN,D= list(map(int,input().split()))\nx = [0] * N\ny = [0] * N\nb=0\n \nfor i in range(N):\n x[i], y[i] = map(int, input().split())\n a=x[i]**2+y[i]**2\n if math.sqrt(a) <=D:\n b+=1\nprint(b)\n', "X = int(input()) \n\nif X >=30:\n print('Yes')\nelse:\n print('No')\n"] | ['Runtime Error', 'Accepted'] | ['s863138826', 's635918303'] | [9072.0, 9136.0] | [23.0, 33.0] | [216, 70] |
p02594 | u130074358 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["X = int(input())\n\nif 30 <= X:\n print('YES')\nelse:\n print('NO')", "X = int(input())\n\nif 30 <= X:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s861269825', 's710157705'] | [9144.0, 9084.0] | [29.0, 27.0] | [64, 64] |
p02594 | u132687480 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = int(input())\ndef Main(X):\n return "Yes" if X <= 30 else "No"\n\nprint(Main(X))\n', 'X = int(input())\ndef Main(X):\n return "Yes" if X >= 30 else "No"\n\nprint(Main(X))\n'] | ['Wrong Answer', 'Accepted'] | ['s675830211', 's581918909'] | [9112.0, 9092.0] | [26.0, 29.0] | [84, 84] |
p02594 | u135389999 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['import math\n\nn, k = map(int, input().split())\na = list(map(int, input().split()))\n\nfloor = 0\nceil = max(a)\n\n\ndef cut(long, logs):\n cnt = 0\n for i in logs:\n cnt += math.ceil(i / long) - 1\n return cnt\n\n\nwhile ceil - floor > 1:\n L = (ceil + floor)//2\n num = cut(L, a)\n if num <= k:\n ceil = L\n else:\n floor = L\n\nprint(ceil)', 'n = int(input())\n\nif n >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s194006094', 's720688094'] | [9184.0, 9000.0] | [24.0, 26.0] | [361, 68] |
p02594 | u135832955 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["import random\n\n\ndef gcd(a, b):\n if a == 0:\n return b\n return gcd(b % a, a)\n\n\ndef lcm(a, b):\n return (a * b) / gcd(a, b)\n\n\nfor _ in range(int(input())):\n n = int(input())\n #a = list(map(int, input().split()))\n #= map(int, input().split())\n if n>=30:\n print('Yes')\n else:\n print('No')", "import random\n\n\ndef gcd(a, b):\n if a == 0:\n return b\n return gcd(b % a, a)\n\n\ndef lcm(a, b):\n return (a * b) / gcd(a, b)\n\n\nn = int(input())\n#a = list(map(int, input().split()))\n#= map(int, input().split())\nif n>=30:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s706134017', 's110187037'] | [9552.0, 9552.0] | [30.0, 31.0] | [327, 269] |
p02594 | u135887108 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['temp=int(input())\nif temp >= 30 :\n answer = Yes\nelse:\n answer = No\nprint(answer)', 'temp=int(input())\nif temp >= 30 :\n answer = "Yes"\nelse:\n answer = "No"\nprint(answer)'] | ['Runtime Error', 'Accepted'] | ['s759309301', 's821714597'] | [9052.0, 8944.0] | [24.0, 26.0] | [86, 90] |
p02594 | u136284779 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["x=int(input())\nans=0\nif 30=<x:\n ans='Yes'\nelse:\n ans='No'\nprint(ans)", "x=int(input())\nans=0\nif 30<=x:\n ans='Yes'\nelse:\n ans='No'\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s824086630', 's115534810'] | [9004.0, 9060.0] | [30.0, 30.0] | [74, 74] |
p02594 | u136943834 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["x = int(input())\nresult = 'NO'\nif(x >= 30):\n\tresult = 'YES'\nprint(result)", "if __name__ == '__main__':\n\tx = int(input())\n\tif(x >= 30):\n\t\tprint('YES')\n\telse:\n\t\tprint('NO')", "x = int(input())\nresult = 'NO'\nif(x >= 30):\n\tresult = 'YES'\nprint(result)", "x = int(input())\nif(x >= 30):\n\tprint('YES')\nelse:\n\tprint('NO')", "x = int(input())\nif(x >= 30):\n\tprint('Yes')\nelse:\n\tprint('No')"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s098517082', 's307400955', 's524652108', 's526619840', 's777594786'] | [9092.0, 9152.0, 9148.0, 9144.0, 9144.0] | [29.0, 32.0, 34.0, 31.0, 31.0] | [73, 94, 73, 62, 62] |
p02594 | u137962336 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nif x <=30:\n print("yes")\nelse:\n print("NO")', 'x = int(input())\nif x >=30:\n print("yes")\nelse:\n print("NO")', 'x = int(input())\nif x >=30:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s150130633', 's165611012', 's886547277'] | [9036.0, 8932.0, 9032.0] | [29.0, 26.0, 23.0] | [62, 62, 62] |
p02594 | u139537085 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['n=int(input())\nif n<30:\n print(\'NO\')\nelse:\n print("YES")', 'n=int(input())\nif n<30:\n print(\'No\')\nelse:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s664613272', 's623114151'] | [9144.0, 9144.0] | [31.0, 30.0] | [62, 62] |
p02594 | u146057001 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['n = int(input())\n\nif n >= 30:\n print("Yes")\n\nelse:\n print("no")', 'n = int(input())\n \nif n >= 30:\n print("Yes")\n \nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s881035482', 's833798417'] | [9144.0, 9084.0] | [30.0, 33.0] | [65, 67] |
p02594 | u147826590 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['n = int(input())\nif n>=30:\n print("Yes)\nelse:\n print("No")', 'n=int(input())\nif n>=30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s263273068', 's880206975'] | [8888.0, 9184.0] | [26.0, 29.0] | [60, 59] |
p02594 | u148183225 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = int(input())\nif X <= 40:\n print("NO")\nelse:\n print("YES")\n ', 'X = int(input())\nif X <= 30:\n print("NO")\nelse:\n print("YES")', 'X = int(input())\nif X >= 40:\n print("NO")\nelse:\n print("YES")', 'X = int(input())\nif X < 30:\n print("NO")\nelse:\n print("YES")', 'X = int(input())\nif X < 30:\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s398858444', 's710669689', 's765529673', 's906493173', 's106005326'] | [9144.0, 9032.0, 9108.0, 9092.0, 9104.0] | [30.0, 31.0, 28.0, 27.0, 28.0] | [68, 63, 63, 62, 62] |
p02594 | u148472503 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nif x>=30:\n print("Yes")\n else:\n print("No")', 'x = int(input().strip())\nif x>=30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s235877760', 's832014838'] | [8944.0, 9040.0] | [27.0, 24.0] | [65, 73] |
p02594 | u156387428 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['import math\nN, D = map(int, input().split())\nl = [list(map(int, input().split())) for l in range(N)]\n \nans=0\nfor i,a in enumerate(l):\n if math.sqrt(a[0]**2 + a[1]**2)<=D:\n ans+=1\nans', 's = int(input()) \n\nprint("Yes" if s>=30 else "No")'] | ['Runtime Error', 'Accepted'] | ['s986834735', 's134164068'] | [9164.0, 9148.0] | [26.0, 24.0] | [192, 50] |
p02594 | u156397618 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["X = int(input)\n\nif X >= 30:\n print('yes')\nelse:\n print('no')\n ", 'def airConditioner():\n if x >= 30:\n print(yes)\n \n else:\n print(no)', "import sys\n\nX = int(input())\n\nif X >= 30:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s049603563', 's723495440', 's747984902'] | [8976.0, 9016.0, 9152.0] | [24.0, 26.0, 29.0] | [65, 75, 76] |
p02594 | u158419894 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nreturn "Yes" if x >= 30 else "No"', 'x = int(input())\na = "Yes" if x >= 30 else "No"\nprint(a)'] | ['Runtime Error', 'Accepted'] | ['s495574006', 's449368320'] | [8852.0, 8996.0] | [23.0, 26.0] | [50, 56] |
p02594 | u159144188 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = input()\nif x => 30:\n print("Yes")\nelse:\n print("No")', 'x = int(input())\nif x => 30:\n print("Yes")\nelse:\n print("No")', 'x = int(input())\nif x >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s621512714', 's875552659', 's612514420'] | [9004.0, 8844.0, 9148.0] | [25.0, 22.0, 27.0] | [58, 63, 63] |
p02594 | u160224209 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nif x >= 30:\n print("No")\nelse:\n print("Yes")', 'x = int(input())\nif x >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s981384393', 's756283238'] | [9156.0, 9136.0] | [23.0, 30.0] | [67, 67] |
p02594 | u165114979 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['n, d = input().split()\nn = int(n)\nd = int(d)\nxy = [map(int, input().split()) for _ in range(n)]\nx, y = [list(i) for i in zip(*xy)]\nc = 0\n\nfor i in range(n):\n if x[i]*x[i]+y[i]*y[i] <= d*d:\n c +=1\n\nprint(c)', "a = int(input())\n\nif a < 30:\n print('No')\nelse:\n print('Yes')"] | ['Runtime Error', 'Accepted'] | ['s422801762', 's935622422'] | [9120.0, 9144.0] | [22.0, 33.0] | [209, 63] |
p02594 | u168416324 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['#a,b=map(int,input().split())\n#lis=list(map(int,input().split()))\n#n=int(input())\n#s=input()\ndef yana(int(input())>=30):\n if boo:\n print("Yes")\n else:\n print("No")', 'def yana(boo):\n if boo:\n print("Yes")\n else:\n print("No")\nyana(int(input())>=30)'] | ['Runtime Error', 'Accepted'] | ['s779696928', 's690072514'] | [8936.0, 9160.0] | [32.0, 27.0] | [171, 88] |
p02594 | u168825829 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = input()\nif X >= 30:\n print("Yes")\nelse:\n print("No")', 'X = int(input())\nif X >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s223344021', 's675623911'] | [9088.0, 9156.0] | [26.0, 30.0] | [62, 67] |
p02594 | u169683061 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nif x < 30:\n print("No")\n else:\n print("Yes")', 'x = int(input())\nif x<30:\n print("No")\nelse:\n print("Yes")'] | ['Runtime Error', 'Accepted'] | ['s036551883', 's035613491'] | [8944.0, 9164.0] | [28.0, 29.0] | [63, 64] |
p02594 | u188305619 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['X = int(input())\nif X >= 30:\n print("yes")\nelse:\n print("no")', 'X = int(input())\nif X >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s468433146', 's760730563'] | [9140.0, 9128.0] | [23.0, 29.0] | [67, 67] |
p02594 | u190385778 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ["for i in input:\n if i >= 30:\n print('Yes')\n else:\n print('No')", "#at coder ABC174 A\nX = int(input())\nif X >= 30:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s740148867', 's886026041'] | [9088.0, 9152.0] | [27.0, 29.0] | [82, 86] |
p02594 | u190866453 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = input()\nif x >= 30:\n print("Yes")\nelse:\n print("No")\n', 'x = input()\nif int(x) >= 30:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s511585247', 's534855599'] | [9020.0, 9116.0] | [23.0, 26.0] | [63, 67] |
p02594 | u194028846 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['K = int(input())\nx = [7, 77, 777, 7777, 77777, 777777, 7777777]\nCount = 0\nflag="FALSE"\nfor i in x:\n Count = Count + 1\n if (i % K)==0:\n flag="TRUE"\n break\n\nif flag=="FALSE":\n Count = -1\nprint(Count)', 'temp = int(input())\nprint("No" if temp >= 30 else "Yes")', 'K = int(input())\nx = [7, 77, 777, 7777, 77777, 777777]\nCount = 0\nflag="FALSE"\nfor i in x:\n Count = Count + 1\n if (i % K)==0:\n flag="TRUE"\n break\n\nif flag=="FALSE":\n Count = -1\nprint(Count)', 'import math\nN,D = map(int, input().split())\nCount = 0\nfor i in range(N):\n x, y = map(int, input().split())\n total = x**2 + y**2\n kyori = math.sqrt(total)\n if kyori <= D:\n Count = Count + 1\n\nprint(Count)', 'temp = int(input())\nprint("Yes" if temp >= 30 else "No")'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s106985543', 's180675362', 's523132158', 's724489756', 's634453640'] | [9104.0, 9144.0, 9180.0, 9168.0, 9144.0] | [25.0, 26.0, 23.0, 26.0, 30.0] | [220, 56, 211, 221, 56] |
p02594 | u194704525 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['if X >=30:\n print("Yes")\nelse:\n print("No")', 'a = input()\nif a>=30:\n print("Yes")\nelse:\n print("No")\n ', 'if X >= 30:\n\tprint("Yes")\nelse:\n\tprint("No")\n ', 'a = int(input())\nif a >=30:\n print("Yes")\nelse:\n print("No")\n '] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s184933803', 's226785381', 's805371659', 's441014767'] | [9004.0, 9028.0, 8972.0, 9132.0] | [26.0, 27.0, 28.0, 29.0] | [45, 59, 49, 65] |
p02594 | u196455939 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['\nX = int(input())\n\nif X >= 30 :\n print("yes")\nelse:\n print("no")', '\nX = int(input())\n\nif X >= 30 :\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s962930966', 's999869940'] | [9084.0, 9140.0] | [26.0, 31.0] | [98, 99] |
p02594 | u200228637 | 2,000 | 1,048,576 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above. The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner? | ['x = int(input())\nb = x - 30\nif b => 0:\n print(\'Yes\')\nelse:\n print("No")', 'x = int(input())\nb = x - 30\nif b >= 0:\n print(\'Yes\')\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s138647085', 's836784455'] | [8848.0, 9164.0] | [26.0, 27.0] | [73, 73] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.