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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03331 | u501643136 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\ndef sumof(N):\n sum = 0\n while(N>0):\n sum += N % 10\n N /= 10\n return sum\n\nminsum = 9*10\nfor i in range(N//2):\n minsum = min(minsum,sumof(i+1) + sumof(N-i-1))\nprint(minsum)\n', 'N = int(input())\ndef sumof(N):\n sum = 0\n while(N>0):\n sum += N % 10\n N /= 10\n return sum\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s257582086', 's965672926', 's671855316'] | [2940.0, 2940.0, 2940.0] | [2104.0, 2104.0, 17.0] | [198, 196, 106] |
p03331 | u503111914 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\nA = [i for i in str(N)]\nresult = 0\nfor j in range(len(A)):\n result += A[j]\nif result == 0 and A[0] == 1:\n print(10)\nelse:\n print(result)', 'N = int(input())\nA = [i for i in str(N)]\nresult = 0\nfor j in range(len(A)):\n result += int(A[j])\nif result == 1 and A[0] == "1":\n print(10)\ne... | ['Runtime Error', 'Accepted'] | ['s902046600', 's162544158'] | [2940.0, 2940.0] | [19.0, 18.0] | [156, 164] |
p03331 | u503476415 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\n\nsum_list = []\n\ndef findSumOfDigit(n):\n s = 0\n while(n > 0):\n s += n % 10\n n = int(n / 10)N = int(input())\n\nsum_list = []\n\ndef findSumOfDigit(n):\n s = 0\n while(n > 0):\n s += n % 10\n n = int(n / 10)\n return s\n\nfor a in range(1, N-1):\n b... | ['Runtime Error', 'Accepted'] | ['s580142734', 's171788372'] | [2940.0, 3864.0] | [17.0, 274.0] | [520, 259] |
p03331 | u505830998 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['a=input()\n\nal=[int(c) for c in list(str(a))]\n\nsal=sum(al)\nreturn sal if sal > 1 else 10', 'a=input()\n\nal=[int(c) for c in list(str(a))]\n\nsal=sum(al)\nret= sal if sal > 1 else 10\nprint(ret)\n'] | ['Runtime Error', 'Accepted'] | ['s462116155', 's507966644'] | [2940.0, 2940.0] | [23.0, 17.0] | [87, 97] |
p03331 | u516687307 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ["n=int(input())\nc_min=200000\nfor i in range(1,n):\n a=i\n b=n-i\n a_c=0\n b_c=0\n if(a==0)|(b==0):\n print('Err')\n for j in range(6):\n a_c=a_c+a%10\n a=a//10\n for j in range(6):\n b_c=b_c+b%10\n b=b//10\n if (a_c+b_c<=c_min):\n c_min=a_c+b_c\n ... | ['Wrong Answer', 'Accepted'] | ['s613127743', 's956648802'] | [3316.0, 3188.0] | [318.0, 324.0] | [334, 335] |
p03331 | u519939795 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n=int(input())\nl=0\nm=0\nfor i in range(n+1):\n for j in range(n+1):\n if i+j!=n:\n continue\n l=([x for x in str(i)])\n m=([y for y in str(j)])\nprint(min(l+m))', 'n=int(input())\na=10*5\ndef k(n):\n s=tuple(map(int,tuple(str(n))))\n return sum(s)\n\nfor i in range(1,n):\n ... | ['Wrong Answer', 'Accepted'] | ['s777896595', 's953218682'] | [3060.0, 3444.0] | [2108.0, 387.0] | [188, 158] |
p03331 | u539517139 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['s=sum(list(input()))\nprint(10 if s==1 else s)', 's=sum(list(map(int,list(input()))));print(10 if s==1 else s)'] | ['Runtime Error', 'Accepted'] | ['s603635556', 's628321023'] | [2940.0, 2940.0] | [17.0, 17.0] | [45, 60] |
p03331 | u543954314 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input())\ns = n\nfor i in range(n//2+1):\n s = min(s, sum(list(str(i))) + sum(list(str(n-i))))\nprint(s)\n ', 'n = int(input())\ns = n\nfor i in range(1, n//2+1):\n s = min(s, sum(map(int, list(str(i)))) + sum(map(int, list(str(n-i)))))\nprint(s)'] | ['Runtime Error', 'Accepted'] | ['s985563336', 's440449713'] | [2940.0, 2940.0] | [17.0, 185.0] | [112, 132] |
p03331 | u545411641 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\n\nans = N\nfor A in range(1,N):\n B = N - A\n A_str = str(A)\n B_str = str(B)\n A_li = [int(A_str[i]) for i in len(A_str)]\n B_li = [int(B_str[i]) for i in len(B_str)]\n s = sum(A_li) + sum(B_li)\n if s < ans:\n ans = s\n\nprint(ans)', 'N = int(input())\n\nans = N\nfor A ... | ['Runtime Error', 'Accepted'] | ['s685585930', 's477487302'] | [3316.0, 3064.0] | [21.0, 465.0] | [266, 280] |
p03331 | u548624367 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input())\ndef f(x):\n x%10+f(x//10) if x else 0\nprint(min([f(i)+f(n-i) for i in range(0,n+1)]))', 'def f(x):\n return x%10+f(x//10) if x else 0\nn = int(input())\nprint(min([f(i)+f(n-i) for i in range(1,n)]))'] | ['Runtime Error', 'Accepted'] | ['s329741955', 's214365812'] | [3164.0, 3864.0] | [18.0, 212.0] | [104, 109] |
p03331 | u551373727 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = list(map(int, list(input())))\ns = sum(N)\n\nif s is 1:\n print(10)\nelse:\n print(sum)', 'N = list(map(int, list(input())))\n\ns = sum(N)\n\nif s is 1:\n print(10)\nelse:\n print(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s359130068', 's521049303'] | [3316.0, 2940.0] | [21.0, 17.0] | [91, 87] |
p03331 | u562767072 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = input()\n\nans = 0\nfor n in N:\n ans += n\n\nprint(ans)\n', 'N = input()\n\nans = 0\nfor n in N:\n ans += int(n)\n\nif ans == 1:\n ans = 10\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s099321384', 's165759151'] | [2940.0, 2940.0] | [18.0, 18.0] | [58, 90] |
p03331 | u580806822 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n=int(input())\n\nansli=[]\nfor i in range(1, n):\n mn=n-i\n s1=str(i)\n s2=str(mn)\n dli=[]\n for j in s1:\n dli.append(int(j))\n for k in s2:\n dli.append(int(k))\n ans=0\n for l in dli:\n ans+=l\n #print(ans)\n ansli.append(ans)\nprint("min",min(ansli))\n', 'n=int... | ['Wrong Answer', 'Accepted'] | ['s815256192', 's998276519'] | [3864.0, 3864.0] | [528.0, 556.0] | [291, 285] |
p03331 | u587213169 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['x=int(input())\ncount=0\nfor a in range(1, x):\n suma=0\n sumb=0\n b=x-a\n while (a > 0):\n suma += a%10\n a//=10\n while (b > 0):\n sumb += b%10\n b//=10\n count = min(count, suma+sumb)\nprint(min(S))', 'x=int(input())\ncount=10000\nfor a in range(1, x):\n suma=0\n ... | ['Runtime Error', 'Accepted'] | ['s339118276', 's365379534'] | [3064.0, 3064.0] | [258.0, 241.0] | [234, 240] |
p03331 | u599547273 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\n\ndigits_sum = lambda x: sum(map(int, str(x)))\n\nmin_num = 10**18\nfor i in range(1, (N+1)//2+1):\n print(i)\n m = N-i\n l = digits_sum(i) + digits_sum(m)\n min_num = min(l, min_num)\n\nprint(min_num)', 'N = int(input())\n\ndigits_sum = lambda x: sum(map(int, str(x)))\n\nmin_num = 10**1... | ['Wrong Answer', 'Accepted'] | ['s882119428', 's490247370'] | [3536.0, 3060.0] | [195.0, 152.0] | [220, 222] |
p03331 | u627417051 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\nL = []\nfor i in range(N):\n\ta = i + 1\n\tb = N - i - 1\n\ts = sum(list(map,(int, list(str(a))))) + sum(list(map,(int, list(str(b)))))\n\tL.append(s)\nprint(min(L))', 'N = int(input())\nL = []\nfor i in range(N - 1):\n\ta = list(str(i + 1))\n\tb = list(str(N - i - 1))\n\tasum = sum(list(map(int, a)... | ['Runtime Error', 'Accepted'] | ['s747196317', 's964446635'] | [3060.0, 3972.0] | [17.0, 431.0] | [172, 195] |
p03331 | u630511239 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\nn = N // 2\nA = list(str(n))\nA = list(int(n) for n in A)\nans = 2 * sum(A)\nif N % 2 == 1:\n ans += 1\nprint(ans)', 'N = int(input())\nif N % 10 == 0:\n ans = 10\nelse:\n ans = 0\n while N > 0:\n ans += N % 10\n N //= 10\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s902740529', 's434129337'] | [9128.0, 9112.0] | [28.0, 26.0] | [128, 130] |
p03331 | u637170240 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\nfactor_a = []\nfactor_b = []\nans = N\nif N % 2 == 0:\n for a in range(1, N/2+1):\n sum_a = sum([int(i) for i in str(a)])\n sum_b = sum([int(i) for i in str(N-a)])\n if sum_a + sum_b < ans:\n ans = sum_a + sum_b\nelse:\n for a in range(1, (N+1)/2+1):\n su... | ['Runtime Error', 'Accepted'] | ['s731293672', 's888329099'] | [3064.0, 3064.0] | [18.0, 175.0] | [464, 323] |
p03331 | u652656291 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input())\nif n % 10 == 0:\n print(10)\nelse:\n a = str(n)\n b = sum(a)\n print(b)', 'n = int(input())\nif n % 10 == 0:\n print(10)\nelse:\n result = sum(list(map(int, str(n))))\n print(result)'] | ['Runtime Error', 'Accepted'] | ['s708044053', 's210004522'] | [2940.0, 2940.0] | [17.0, 17.0] | [87, 105] |
p03331 | u659640418 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n=int(input())\nans=inf\nfor i in range(n):\n ans=min(ans,sum(list(n-i))+sum(list(i)))\nprint(ans)', 'from numpy import inf\nn=int(input())\nans=inf\nfor i in range(n-1):\n ans=min(ans,sum(list(map(int, list(str(n-i+1)))))+sum(list(map(int, list(str(i+1))))))\nprint(ans)', 'from numpy import inf\nn=int(input())... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s000463352', 's634853087', 's936993730'] | [2940.0, 12484.0, 12484.0] | [17.0, 553.0, 555.0] | [97, 167, 167] |
p03331 | u680004123 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input()\nlist = []\nfor a in range(2,n-1):\n sum = 0\n sum1 = 0\n b = n - a\n for j in range(len(str(a))):\n sum += int(str(a)[j])\n for k in range(len(str(b))):\n sum1 += int(str(b)[k])\n list.append(sum + sum1)\nprint(min(list))', 'n = ... | ['Runtime Error', 'Accepted'] | ['s694853610', 's434096692'] | [2940.0, 3864.0] | [17.0, 715.0] | [299, 287] |
p03331 | u683134447 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input())\n\nans = float("inf") \nfor i in range(n+1):\n a = sum([int(i) for i in list(str(i))])\n b = sum([int(i) for i in list(str(n-i))])\n ans = min(a+b, ans)', 'n = int(input())\n\nans = float("inf") \nfor i in range(1, n):\n a = sum([int(i) for i in list(str(i))])\n b = sum([int(i) for i... | ['Wrong Answer', 'Accepted'] | ['s893815961', 's718143545'] | [3060.0, 3060.0] | [435.0, 418.0] | [173, 199] |
p03331 | u693694535 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N=int(input())\n\nM=10**9\nfor i in range(1,N//2+10):\n a=list(str(i))\n b=list(str(N-i))\n #print(a,b)\n k=0\n for q in range(len(a)):\n k+=int(a[q])\n for p in range(len(b)):\n k+=int(b[p])\n M=min(M,k)\nprint(M)', 'N=int(input())\n\nM=10**9\nfor i in range(1,N//2+1):\n a=list(... | ['Runtime Error', 'Accepted'] | ['s240086312', 's824463093'] | [9168.0, 9156.0] | [193.0, 196.0] | [236, 235] |
p03331 | u703890795 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\nm = 999\nfor i in range(N):\n N1 = sum(list(str(i+1)))\n N2 = sum(list(str(N - (i+1))))\n m = min(m, N1+N2)\nprint(m)', 'N = int(input())\nm = 999\nM = []\nN1 = 0\nN2 = 0\nfor i in range(N-1):\n L1 = list(str(i+1))\n N1 = 0\n N2 = 0\n for j in range(len(L1)):\n N1 += int(L1[j])\n L2 = lis... | ['Runtime Error', 'Accepted'] | ['s908128301', 's204577524'] | [2940.0, 3864.0] | [17.0, 613.0] | [132, 262] |
p03331 | u713087221 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['import math\n\n\ndef digitSum(n):\n s = str(n)\n array = list(map(int, list(s)))\n return sum(array)\n\n\nn = int(input())\n\n\n\nrank = int(math.log10(n)) \nprint(rank)\n\n\ndiv = n % 10**rank\nif rank < 1:\n a = 2\n b = n %2\n\nelif div == 0:\n a = n / 2\n b = n / 2\nelse :\n a = 10**rank\... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s428318401', 's739764036', 's160615333'] | [3064.0, 3064.0, 3060.0] | [17.0, 18.0, 17.0] | [448, 571, 279] |
p03331 | u733738237 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n=int(input())\nprint(min(sum(map(int,str(a)))+sum(map(int,str(n-a))))) for a in range(1,n))', 'n=int(input())\nprint(min(sum(map(int,str(a)))+sum(map(int,str(n-a)))) for a in range(1,n))', 'n=int(input())\nval=10**5\nfor a in range(1,n):\n\tif sum(map(int,str(a)))+sum(map(int,str(n-a)))< val:\n\t\tval = sum(map(int,... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s034582116', 's715859670', 's413948438'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 283.0] | [91, 90, 164] |
p03331 | u734816542 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ["import itertools\n\n\nif __name__ == '__main__':\n N, A, B, K = map(int, input().split())\n li = [i for i in range(N)]\n ans = 0\n for ai in range(N):\n tmp = K-(ai*A)\n if tmp / B <= N and tmp % B == 0:\n bi = tmp // B\n a = len(list(itertools.combinations(li, ai)))\n ... | ['Runtime Error', 'Accepted'] | ['s563687828', 's823216120'] | [3060.0, 2940.0] | [18.0, 399.0] | [401, 248] |
p03331 | u738835924 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N, C, D = map(int, input().split())\ncheck = [i*i for i in range(N)]\ntime = 0\nstop = N * N\n\nif C * D % 2 ==1:\n for i in range(2*N):\n for j in range(2*N):\n if (i + j) % 2 == 0:\n print(i, j)\n time += 1\n if stop == time:\n break\n if stop == time:\n break\nelif (C+D) % 2 == 0:\n for i in ran... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s457000885', 's972754178', 's998703668', 's962702308'] | [3064.0, 3064.0, 3064.0, 2940.0] | [18.0, 17.0, 17.0, 18.0] | [786, 452, 678, 135] |
p03331 | u744034042 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input())\nc = n\nfor i in range(1, n//2+1):\n a = digitsum(i)\n b = digitsum(n-i)\n if c > a + b:\n c = a + b\nprint(c)', 'n = int(input())\nc = []\nfor i in range(1, n//2 +1):\n a = sum(map(int, str(i)))\n b = sum(map(int, str(n-i)))\n c.append(a+b)\nprint(min(c))'] | ['Runtime Error', 'Accepted'] | ['s193361244', 's450687285'] | [2940.0, 3480.0] | [17.0, 147.0] | [126, 145] |
p03331 | u745514010 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = input()\nnum = 0\nfor num in n:\n ans += int(num)\nif ans == 1:\n ans = 10\nprint(ans)', 'n = input()\nans = 0\nfor num in n:\n ans += int(num)\nif ans == 1:\n ans = 10\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s631318109', 's877034625'] | [2940.0, 2940.0] | [17.0, 17.0] | [90, 90] |
p03331 | u756782069 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\nA = list(map(int,input().split()))\nif A == 1:\n print(5)\nelse:\n print(A)', 'N = int(input())\nA = sum(list(map(int, list(str(N)))))\nif A == 1:\n print(10)\nelse:\n print(A)'] | ['Runtime Error', 'Accepted'] | ['s030925854', 's482319387'] | [2940.0, 2940.0] | [17.0, 17.0] | [94, 98] |
p03331 | u757030836 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\n\nnum = 0\n\nfor i in range(N+1):\n g = N -i\n a=sum(map(int,list(str(g))))\n b=sum(map(int,list(str(i))))\n ans = a + b\n if ans == 0:\n num += ans\n elif num >= ans:\n num += ans\n else:\n continue\n\n \nprint(num)', 'for i in range(100000):\n g = N -i\n a=sum(map(int,list(st... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s337288895', 's454570641', 's826812058', 's333046139'] | [3064.0, 3060.0, 3064.0, 2940.0] | [361.0, 17.0, 352.0, 17.0] | [237, 194, 237, 97] |
p03331 | u760171369 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['import numpy as np\nN = np.array(int(input()))\nif N[-1] == 0:\n print(10)\nelse:\n print(N.sum())', 'import numpy as np\nN = np.array(int(input()))\nif N[-1] == 0:\n print(10)\nelse:\n print(N.cumsum())', 'import numpy as np\nN = input()\nN = np.array([int(k) for k in N])\nif N[-1] == 0:\n print(10)\nelse:\n p... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s484288318', 's602798310', 's750032666'] | [12392.0, 12392.0, 12508.0] | [149.0, 152.0, 154.0] | [95, 98, 114] |
p03331 | u760802228 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\nres = 99999\nfor a in range(1, N): \n sum_ = 0 \n b = N - a \n while (a > 0): \n sum_ += a % 10\n a //= 10\n while (b > 0): \n sum_ += b % 10\n b //= 10\n print(sum_)\n res = min(res, sum_)\nprint(r... | ['Wrong Answer', 'Accepted'] | ['s513933624', 's500593904'] | [3784.0, 3060.0] | [338.0, 245.0] | [308, 288] |
p03331 | u762420987 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\n\n\ndef F(num1, num2):\n sum1 = sum(map(int, list(str(num1))))\n sum2 = sum(map(int, list(str(num2))))\n return sum1 + sum2\n\n\nmax_num = 0\nfor A in range(N + 1):\n B = N - A\n max_num = max(max_num, F(A, B))\nprint(max_num)\n', 'N = int(input())\n\n\ndef F(num):\n ans = 0\n f... | ['Wrong Answer', 'Accepted'] | ['s620656517', 's449138373'] | [3060.0, 2940.0] | [346.0, 288.0] | [247, 238] |
p03331 | u775623741 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n=input()\nprint(sum([int(i) for i in n])\n', 'n=int(input())\nprint(min([sum([int(a) for a in str(i)])+sum([int(b) for b in str(n-i)]) for i in range(1,int(n))]))\n'] | ['Runtime Error', 'Accepted'] | ['s527383363', 's309276515'] | [2940.0, 3912.0] | [17.0, 326.0] | [41, 116] |
p03331 | u780354103 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\n\nif N=10*i for i in range(1,5+1):\n print("10")\nelse\n print(sum(int(str(N)))', 'N = int(input())\n\nif N % 10 == 0:\n print(10)\nelse:\n print(sum(list(map(int, str(N)))))'] | ['Runtime Error', 'Accepted'] | ['s446613263', 's475292322'] | [2940.0, 2940.0] | [17.0, 17.0] | [98, 92] |
p03331 | u815797488 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\n\ndef sum_10(n):\n return sum[int(l) for l in str(n)]\n\nli=[]\nfor i in range(1,N//2 +1):\n for k in range(N-N//2,N+1):\n if i + k == N:\n li.append(sum_10(i)+sum_10(k))\nprint(min(li)) ', 'N = int(input())\n\ndef sum_10(n):\n return sum([int(l) for l in str(n)])\n\nli=[]\nfor i in ... | ['Runtime Error', 'Accepted'] | ['s224400154', 's993429762'] | [2940.0, 3480.0] | [19.0, 199.0] | [210, 198] |
p03331 | u829796346 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['A = list(map(int,input().split()))\nA.sort()\nret = 0\nret += A[2]-A[1]\nA[1] += ret\nA[0] += ret\nret += (A[1]-A[0])//2\nif (A[1]-A[0])%2==1:\n ret += 2\nprint(ret)\n', 'N = int(input())\nmini = float("inf")\nfor A in range(1,N-1+1):\n mini = min(mini,sum([int(digit) for digit in str(A)])+sum([int(digit) for digit... | ['Runtime Error', 'Accepted'] | ['s165229321', 's368976326'] | [3060.0, 3060.0] | [17.0, 348.0] | [158, 170] |
p03331 | u837677955 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = input()\ndef sum_keta(m):\n\tsum_wa = 0\n\twhile m>0:\n\t\tsum_wa = sum_wa + m%10\n\t\tm = int(m/10)\n\n\treturn sum_wa\n\nif sum_keta(n) == 1:\n\tprint(10)\nelse:\n\tprint(sum_keta(n))\n', 'n = int(input())\ndef sum_keta(m):\n\tsum_wa = 0\n\twhile m>0:\n\t\tsum_wa = sum_wa + m%10\n\t\tm = int(m/10)\n\n\treturn s... | ['Runtime Error', 'Accepted'] | ['s840779666', 's620266404'] | [2940.0, 2940.0] | [17.0, 17.0] | [169, 174] |
p03331 | u846150137 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n=[int(i) for i in input().split()]\ns=sum(n)\nif s==1 and min(n)==0:\n print(10)\nelse:\n print(s)', 'n=[int(i) for i in list(input())]\ns=sum(n)\nif s==1 and min(n)==0:\n print(10)\nelse:\n print(s)'] | ['Wrong Answer', 'Accepted'] | ['s167957446', 's950777511'] | [2940.0, 3316.0] | [17.0, 19.0] | [96, 94] |
p03331 | u863370423 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input())\n\n\nx = n - 2\ny = n - x\n\nif n < 10:\n print(n)\nif n = 10:\n print(1)\nelse:\n resulty, resultx = 0, 0\n\n while(x > 0):\n resultx += x % 10\n x = x // 10\n\n while(y > 0):\n resulty += y % 10\n y = y // 10\n\n #print(resulty+resultx)\n z = n//2\n\... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s160419758', 's433377765', 's862709924', 's435538005'] | [2940.0, 3064.0, 3060.0, 3064.0] | [17.0, 17.0, 576.0, 423.0] | [475, 411, 329, 361] |
p03331 | u864197622 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n, a, b, k = map(int, input().split())\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n \ndef mod_inv(a, mod):\n return (pow(a,mod-2,mod))\n\ndef mod_combination(n, k, mod):\n return (fact[n]*mod_inv(fact[k], mod)*mod_inv(fact[n-k], mod)) % mod\n\ng = gcd(k, gcd(... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s196633026', 's514928171', 's864852569', 's453656410'] | [3064.0, 3064.0, 3064.0, 3060.0] | [18.0, 18.0, 18.0, 197.0] | [688, 915, 597, 223] |
p03331 | u865191802 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input())\nsumn = 0\ndata = 10\ncheck = False\nfor i in range(5):\n\tif(10**i==n):\n\t\tcheck = True\n\nif(check):\n\tprint(10)\nelse:\n\twhile n>=10:\n\t\tsumn += n%10\n\t\tprint("n%10 =",n%10)\n\t\tprint("n =",n)\n\t\tn //= 10\n\tsumn += n\n\tprint(sumn)', 'n = int(input())\nsumn = 0\ndata = 10\ncheck = Fals... | ['Wrong Answer', 'Accepted'] | ['s221063833', 's783418692'] | [3060.0, 3060.0] | [17.0, 18.0] | [231, 193] |
p03331 | u867826040 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n = int(input())\nans = 0\nfor i in range(1,n):\n ans = min(ans,sum(map(int,str(i)))+sum(map(int,str(n-i))))\nprint(ans)', 'n = int(input())\nans = float("inf")\nfor i in range(1,n):\n ans = min(ans,sum(map(int,str(i)))+sum(map(int,str(n-i))))\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s068514362', 's626752590'] | [3060.0, 2940.0] | [279.0, 289.0] | [119, 130] |
p03331 | u873269440 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['\ndef main():\n\n if sum(list(map(int,list(input())))) !=1:\n print(sum(list(map(int,list(input())))))\n else:\n print(10)\n \n\n \nif __name__== "__main__":\n main() \n\n\n\n\n\n\n\n\n\n', '\ndef main():\n ans = sum(list(map(int,list(input()))))\n if ans!=1:\n print(ans)\n ... | ['Runtime Error', 'Accepted'] | ['s073017286', 's066524370'] | [2940.0, 2940.0] | [17.0, 17.0] | [192, 175] |
p03331 | u883792993 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['import math\nN=int(input())\ni=2\ndigitSum=pow(10,5)\nA=int(2)\nwhile i<=int(N/2):\n A=i\n B=N-A\n if B>A:\n break\n A_digitsum=0\n while A>=10:\n A_digitsum += A%10\n A = A//10\n if A<10:\n A_digitsum+=A\n B_digitsum=0\n while B>=10:\n B_digitsum += B%10\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s333508279', 's352066878', 's553751412', 's922556377', 's399175358'] | [3064.0, 3064.0, 3824.0, 3064.0, 3064.0] | [18.0, 17.0, 201.0, 17.0, 149.0] | [457, 326, 442, 457, 434] |
p03331 | u890183245 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['import math\nN = int(input())\nn = N\namari = 0\nfor i in range (len(str(N))):\n amari += n % 10\n n = math.floor(n / 10)\nif amari < 10:\n print(10+amari)\nelse:\n print(amari)', 'import math\nN = int(input())\nn = N\namari = 0\nfor i in range (len(str(N))):\n amari += n % 10\n n = math.floor(n / 10)\nif amari... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s174968003', 's425005368', 's211707911'] | [3060.0, 2940.0, 3060.0] | [17.0, 18.0, 17.0] | [171, 164, 165] |
p03331 | u905582793 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n=input()\nls = [10**i for i in range(1,6)]\nif int(n) in ls:\n print(10)\nelse:\n print(sum([list(n)[i] for i in range(len(n))]))', 'n=input()\nls = [10**i for i in range(1,6)]\nif int(n) in ls:\n print(10)\nelse:\n print(sum([int(list(n)[i]) for i in range(len(n))]))'] | ['Runtime Error', 'Accepted'] | ['s858963360', 's501873863'] | [2940.0, 2940.0] | [17.0, 17.0] | [127, 132] |
p03331 | u923270446 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = list(int(input()))\nif N.count(0) == len(N) - 1:\n print(10)\nelse:\n sum(N)\n', 'N = list(input())\nlist1 = [int(x) for x in N]\nif N.count("0") == len(N) - 1 and N[0] == "1" and len(N) != 1:\n print(10)\nelse:\n print(sum(list1))'] | ['Runtime Error', 'Accepted'] | ['s106158415', 's635564345'] | [2940.0, 2940.0] | [17.0, 17.0] | [79, 146] |
p03331 | u925364229 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N,A,B,K = map(int,input().split(" "))\nmod = 998244353\nncr = [1]*(N+1)\nv = 1\nfor i in range(N):\n\tv = (v * ((N-i)%mod) * pow((i+1),mod-2,mod)) % mod\n\tncr[i+1] = v%mod\n\npat = 0\nfor a in range(N):\n\tif (K - (a * A)) % B == 0:\n\t\tpat += ncr[a]*ncr[(K - (a * A))//B]\n\t\tpat %= mod\n\nprint(pat % mod)', "N = ... | ['Runtime Error', 'Accepted'] | ['s071825658', 's568293704'] | [3064.0, 3064.0] | [17.0, 249.0] | [289, 206] |
p03331 | u925940521 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ["import sys\n\ndef digits_sum(x):\n return sum(map(int, str(x)))\n\ndef solve(n):\n ans = sys.maxint\n for a in range(2, n//2):\n b = n - a\n ans = min(ans, digits_sum(a) + digits_sum(b))\n\n return ans\n\nif __name__ == '__main__':\n n = int(input())\n print(solve(n))\n", "import sys\n... | ['Runtime Error', 'Accepted'] | ['s940333165', 's898382616'] | [3056.0, 2940.0] | [17.0, 272.0] | [286, 284] |
p03331 | u926678805 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['# coding: utf-8\nimport math\nn=int(input())-1\na=10**int(math.log10(n))\nb=n-a+1\nprint(sum(map(int,str(a)))+sum(map(int,str(b))))\nprint(a,b)', '# coding: utf-8\nimport math\nn=int(input())-1\na=10**int(math.log10(n))\nb=n-a+1\nprint(sum(map(int,str(a)))+sum(map(int,str(b))))\n'] | ['Wrong Answer', 'Accepted'] | ['s081215942', 's557688567'] | [3188.0, 2940.0] | [19.0, 18.0] | [137, 127] |
p03331 | u934052933 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['N = int(input())\nrange_A = range(2,100001)\nmin_total = 1000\nfor a in range_A:\n\tb = N - a\n\tif b < 1:continue\n\tsum_a = findSumOfDigits(a)\n\tsum_b = findSumOfDigits(b)\n\ttotal = sum_a + sum_b\n if total < min_total:\n\t\tmin_total = total\nprint(min_total)\n\n', 'def findSumOfDigits(n):\n sum_digits = 0... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s171619209', 's552284536', 's827534846', 's893210040'] | [2940.0, 2940.0, 3060.0, 3064.0] | [17.0, 17.0, 17.0, 166.0] | [251, 378, 228, 584] |
p03331 | u936985471 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['n=int(input())\nans=0\ndef calc(a,b):\n res=0\n for i in range(len(str(a))):\n res+=int(str(a)[i])\n for i in range(len(str(b))):\n res+=int(str(b)[i])\n return res\n \nfor i in range(1,n//2+1):\n a=i\n b=n-a\n ans=min(ans,calc(a,b))\nprint(ans)', 'n=int(input())\nans=10**6\ndef calc(a,b):\n res=0\n f... | ['Wrong Answer', 'Accepted'] | ['s051282400', 's220404712'] | [3188.0, 3060.0] | [308.0, 310.0] | [245, 250] |
p03331 | u941753895 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ["n=int(input())\nif n==15:\n exit()\na=0\ns=list(str(n))\nsets=list(set(s))\nsets.sort()\nif len(sets)==2 and sets[0]=='0' and sets[1]=='1':\n print(10)\nelse:\n for i in s:\n a+=int(i)\n print(a)", "n=int(input())\na=0\ns=list(str(n))\nsets=list(set(s))\nsets.sort()\nif len(sets)==2 and sets[0]=='0' and sets[1... | ['Wrong Answer', 'Accepted'] | ['s330421496', 's907436096'] | [3064.0, 3060.0] | [17.0, 17.0] | [190, 171] |
p03331 | u949315872 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['#-------------\nN = int(input())\n#-------------\n\nif N%2 == 0:\n k = N//2\nelse:\n k = (N+1)//2\n\ncmb = []\nfor i in range(1,k+1):\n cmb.append([i , N-i])\n\nprint(cmb) \ndef digitSum(n):\n \n s = str(n)\n \n array = list(map(int, s))\n \n return sum(array)\n\nans = []\nfor i in range(k-1):\n... | ['Wrong Answer', 'Accepted'] | ['s273016336', 's767096010'] | [17652.0, 16656.0] | [175.0, 171.0] | [512, 501] |
p03331 | u967835038 | 2,000 | 1,048,576 | Takahashi has two positive integers A and B. It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10). | ['aa=[]\naint=[]\na=list(input())\naint=map(int,a)\nif sum(aint)==1:\n print(10)\nelse:\n print(sum(aint))', 'a=int(input())\ns=0\nwhile True:\n if 10**s < a:\n s +=1\n else:\n break\na1=a-10**s\nalist=list(str(a1))\naintlist=map(int,alist)\naa=sum(aintlist)\nprint(s+aa)', 'a=[]\naint=[]\na=li... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s263068099', 's276553361', 's497184718', 's631067236', 's013383682'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [21.0, 18.0, 17.0, 17.0, 17.0] | [103, 170, 107, 108, 170] |
p03332 | u013408661 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['n,a,b,k=map(int,input().split())\np=998244353\ndef getinv(n):\n inv=[0]*(n+1)\n inv[1]=1\n for i in range(2,n+1):\n inv[i]=(-(p//i)*inv[p%i])%p\n return inv\ndef getnCr(n):\n inv=getinv(n)\n nCr=[0]*(n+1)\n nCr[0]=1\n for i in range(1,n+1):\n nCr[i]=(nCr[i-1]*(n-i+1)*inv[i])%p\n return nCr\ndef solve(n... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s202421127', 's306915261', 's320753488', 's409752533', 's709606283', 's890531820', 's850001525'] | [26720.0, 7796.0, 26700.0, 6768.0, 5364.0, 3064.0, 26720.0] | [308.0, 282.0, 311.0, 2104.0, 22.0, 17.0, 389.0] | [547, 1059, 505, 453, 465, 370, 1059] |
p03332 | u062147869 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['from fractions import gcd\nimport sys\nsys.setrecursionlimit(10**7) \n\nN,A,B,K=map(int,input().split())\nmod = 998244353\n\ntable=[1]\na=1\nfor i in range(1,N+1):\n a=(a*pow(i,mod-2,mod))%mod\n table.append(a)\n\nnum=1\nfor i in range(1,N+1):\n num = (num*i) %mod\n\n\nnumber =0\nfor i in range(N):\n if (... | ['Runtime Error', 'Accepted'] | ['s044557209', 's171159462'] | [17668.0, 16968.0] | [1723.0, 1974.0] | [563, 554] |
p03332 | u170201762 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ["MOD = 998244353\ndef egcd(a, b):\n if a == 0:\n return (b, 0, 1)\n else:\n g, y, x = egcd(b % a, a)\n return (g, x - (b // a) * y, y)\n\ndef modinv(a, m):\n g, x, y = egcd(a, m)\n if g != 1:\n raise Exception('modular inverse does not exist')\n else:\n return x % m\n\... | ['Runtime Error', 'Accepted'] | ['s897423128', 's555661427'] | [3064.0, 11708.0] | [17.0, 918.0] | [666, 659] |
p03332 | u201234972 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['def comb(n,k,p):\n \n from math import factorial\n if n<0 or k<0 or n<k: return 0\n if n==0 or k==0: return 1\n a=factorial(n) %p\n b=factorial(k) %p\n c=factorial(n-k) %p\n return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p\n\ndef power_func(a,b,p):\n \n if b==0: return 1\n if b%2==0:\n d=power_func(... | ['Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s149750748', 's342241887', 's699446134', 's720036677', 's193002294'] | [8072.0, 3064.0, 1779524.0, 3064.0, 26720.0] | [2104.0, 17.0, 2231.0, 17.0, 542.0] | [674, 745, 754, 672, 475] |
p03332 | u303019816 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['N, A, B, K = map(int, input().split(" "))\nmod = 998244353\nncr = [1] * (N + 1)\nv = 1\n\nprint(ncr)\nfor i in range(N):\n v = (v * ((N - i) % mod) * pow((i + 1), mod - 2, mod)) % mod\n ncr[i + 1] = v % mod\n\npat = 0\nfor a in range(N + 1):\n if (K - (a * A) < 0):\n break\n if (K - (a * A)) % B ==... | ['Wrong Answer', 'Accepted'] | ['s641884492', 's865091235'] | [15764.0, 14836.0] | [1828.0, 1808.0] | [422, 411] |
p03332 | u389910364 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['import bisect\nimport heapq\nimport itertools\nimport math\nimport operator\nimport os\nimport re\nimport string\nimport sys\nfrom collections import Counter, deque, defaultdict\nfrom copy import deepcopy\nfrom decimal import Decimal\nfrom fractions import gcd\nfrom functools import lru_cache, reduce\nfrom operator i... | ['Time Limit Exceeded', 'Accepted'] | ['s867527054', 's296297321'] | [50020.0, 38704.0] | [2110.0, 815.0] | [2607, 3183] |
p03332 | u403301154 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['n, A, B, k = list(map(int, input().split()))\n\nMOD = 998244353\nMAX = 3*10**5+2\n\nfac = [0 for i in range(MAX)]\ninv = [0 for i in range(MAX)]\nifac = [0 for i in range(MAX)]\nfac[0] = 1; fac[1] = 1\ninv[1] = 1\nifac[0] = 1; ifac[1] = 1\n\nfor i in range(2, MAX):\n fac[i] = fac[i-1]*i%MOD\n inv[i] = inv[MOD%i]*(M... | ['Wrong Answer', 'Accepted'] | ['s724453130', 's984712901'] | [38704.0, 38704.0] | [897.0, 885.0] | [635, 618] |
p03332 | u415905784 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['from scipy.misc import comb\nN,A,B,K = map(int, input().split())\ncount = 0\nP = []\nc = 0\nwhile c < N:\n if K % B == 0:\n if K//B <= N:\n \n P.append([c, K//B])\n K -= A\n c += 1\nfor p in P:\n count += comb(N, p[0], exact=True) * comb(N, p[1], exact=True)\nif count > 998244353:\n count = count % 9... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s281144392', 's385872447', 's455247358'] | [50960.0, 46116.0, 26996.0] | [2111.0, 2106.0, 546.0] | [341, 785, 674] |
p03332 | u478870821 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['from sys import exit, setrecursionlimit, stderr\nfrom functools import reduce\nfrom itertools import *\nfrom collections import defaultdict\nfrom bisect import bisect\n\ndef read():\n return int(input())\n\ndef reads():\n return [int(x) for x in input().split()]\n\nP = 998244353\nMM = 10**6\n\nfact = [1]\nfor i in ... | ['Wrong Answer', 'Accepted'] | ['s414814000', 's398147651'] | [46284.0, 26740.0] | [2106.0, 567.0] | [741, 584] |
p03332 | u497625442 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ["from functools import lru_cache\n\nL = input().split()\nsprime = 998244353 # approx 10**9\nN = int(L[0])\nA = int(L[1])\nB = int(L[2])\nK = int(L[3])\n\ndef egcd(a, b):\n if a == 0:\n return (b, 0, 1)\n else:\n g, y, x = egcd(b % a, a)\n return (g, x - (b // a) * y, y)\n\ndef modinv(a, m):\... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s242868188', 's362412368', 's519587124', 's618049977', 's901520274', 's944550344', 's232017370'] | [3684.0, 2940.0, 3828.0, 3828.0, 3572.0, 3064.0, 10128.0] | [2107.0, 17.0, 50.0, 141.0, 49.0, 45.0, 897.0] | [864, 718, 818, 864, 854, 455, 727] |
p03332 | u543954314 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['from math import factorial as fac\ndef cc(n,r):\n return fac(n)//fac(r)//fac(n-r)\nn, a, b, k = map(int, input().split())\nmod = 998244353\nfor i in range(min(k//a+1,n+1)):\n j = k-a*i\n if j%b == 0 andj<=n:\n ans += cc(n,i)*cc(n,j)%mod\n ans %= mod\nprint(ans)', 'n, a, b, k = map(int, input().split())\nmod ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s081380306', 's918562994', 's038959283'] | [2940.0, 14880.0, 27764.0] | [17.0, 370.0, 632.0] | [260, 290, 439] |
p03332 | u547085427 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['n, a, b, k = map(int, input().split())\nMOD = 998244353\n\na_max = min(k // a, n)\npair = []\nfor i in range(a_max):\n if (k - a * i) % b == 0:\n j = (k - a * i) // b\n if j <= n:\n pair.append([i % MOD,j % MOD])\n\ninv = [0] * (n + 1)\ninv[1] = 1\nfor i in range(2, n + 1):\n inv[i] = ... | ['Wrong Answer', 'Accepted'] | ['s308651301', 's742497327'] | [76452.0, 26720.0] | [755.0, 541.0] | [576, 548] |
p03332 | u659640418 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['import itertools\nn, a, b, k = map(int, input().split())\ncount = 0\nfor i in range(n):\n if (n - (i * a)) % b == 0:\n count += (itertools.combinations(n, i) * itertools.combinations(n, (n-i*a)/b))\nprint(count/998244353)', 'import math\ndef C(n, r):\n return math.factorial(n)//(math.factorial(n-r)*math.... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s358781749', 's555458781', 's556375473', 's674406781', 's713373029', 's721985925', 's803970016', 's865512409', 's998989083', 's823251716'] | [3060.0, 6340.0, 3060.0, 6352.0, 3060.0, 3060.0, 3064.0, 6372.0, 24036.0, 10128.0] | [93.0, 2104.0, 43.0, 2104.0, 18.0, 18.0, 17.0, 2104.0, 360.0, 880.0] | [225, 275, 251, 309, 251, 251, 453, 312, 230, 728] |
p03332 | u695811449 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['def squaremod(A,p,mod):\n if p==0:\n return 1\n if p%2==1:\n return (A*squaremod(A,p-1,mod))%mod\n if p%2==0:\n return (squaremod(A,p/2,mod) %mod)**2 %mod\n\nINV=[None]*(N+1)\nfor i in range(1,N+1):\n INV[i]=squaremod(i,mod-2,mod)\n\ndef Combi(n,r):\n ANS=1\n for i in range(min(... | ['Runtime Error', 'Accepted'] | ['s868764686', 's397643092'] | [3064.0, 22000.0] | [18.0, 1822.0] | [596, 467] |
p03332 | u763115743 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['MOD = 998244353\n\n\ndef get_inv(n):\n inv = [0] * (n + 1)\n inv[1] = 1\n\n for i in range(2, n + 1):\n inv[i] = (-(MOD // i) * inv[MOD % i]) % MOD\n\n return inv\n\n\ndef get_cmb(n):\n inv = get_inv(n)\n cmb = [0] * (n + 1)\n cmb[0] = 1\n\n for i in range(1, n + 1):\n cmb[i] = (... | ['Wrong Answer', 'Accepted'] | ['s469130698', 's244678072'] | [26720.0, 26720.0] | [412.0, 401.0] | [764, 749] |
p03332 | u968404618 | 2,000 | 1,048,576 | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the _beauty of the tower_ as follows: * The beauty of the tower is the sum of the scores of the N layers, where the... | ['from scipy.misc import comb\n\nmod = 998244353\n\nn, a, b, k = map(int, input().split())\n\nans = 0\nfor i in range(n+1):\n Num = (k-a*i)\n if (0 <= Num//b) and (Num//b <= n) and (Num%b == 0):\n j = Num//b\n ans += comb(n, i, exact=True) * comb(n, j, exact=True)\nprint(ans%mod)', 'mod = 998244353\n\nd... | ['Time Limit Exceeded', 'Accepted'] | ['s241593294', 's164229702'] | [15280.0, 26740.0] | [2109.0, 657.0] | [282, 526] |
p03341 | u009774873 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["N=int(input())\nA=input().split(' ')\n\nfor i in range(N):\n\tA[i]=int(A[i])\n\nnum=0\nfor i in range(N):\n\tplus=0\n\txor=0\n\tfor j in range(N-i):\n\t\tplus=plus+A[i+j]\n\t\txor=xor^A[i+j]\n\t\tif plus==xor:\n\t\t\tnum=num+1\n\t\telse:\n\t\t\tbreak\n\nprint(num)\n", "N=int(input())\nS=input()\n\narr=[]\nnum=0\nfor ... | ['Runtime Error', 'Accepted'] | ['s447089059', 's164025313'] | [3672.0, 15520.0] | [19.0, 197.0] | [229, 306] |
p03341 | u037221289 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["N = int(input())\nS = input()\nleft = 0\nright = S[1:].count('E')\nMIN = left + right\nfor i in range(1,N):\n if S[i] == 'W':\n left += 1\n else:\n right -= 1\n \n if i==N-1:\n MIN = min(MIN,S[:i].count('W'))\n else:\n MIN = min(left+right,MIN)\nprint(MIN)\n ", "N = int(input())\nS = input()\nleft =... | ['Wrong Answer', 'Accepted'] | ['s919009338', 's583764836'] | [3700.0, 3672.0] | [200.0, 184.0] | [261, 298] |
p03341 | u064408584 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["n=int(input())\ns=input()\na=[]\nfor i in s:\n if i=='W': a.append(1)\n else: a.append(-1)\na2=[-1*i for i in a]\nsuma=[-a[0]]\nfor i in range(len(a)-1):\n suma.append(-a[i+1]+suma[i])\nsuma2=[sum(a2)]\nfor i in range(len(a2)-1):\n suma2.append(suma2[i]+a2[i])\n#print(a,a2)\ncount=0\nfor i in range(len(a)... | ['Wrong Answer', 'Accepted'] | ['s354844995', 's189849025'] | [32032.0, 32032.0] | [313.0, 300.0] | [412, 412] |
p03341 | u089142196 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['ARC098 - Attention\n \nShoji Taisaku(FJK 庄司 大作)\n2020/03/11 (水) 11:33\n受信トレイ; 送信済みトレイ\n宛先:\nShoji Taisaku(FJK 庄司 大作);\nN=int(input())\nS=input()\n\nleft=[0]*N\nright=[0]*N\nto_change=[0]*N\n\nif S[0]=="E":\n right[0]=1\nelse:\n left[0]=1\n\nfor i in range(1,N):\n if S[i]=="W":\n left[i] = left[i-1]+1\... | ['Runtime Error', 'Accepted'] | ['s170005838', 's698672975'] | [3064.0, 29468.0] | [17.0, 270.0] | [619, 461] |
p03341 | u104282757 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['# E\nfrom heapq import heappush, heappop\nimport numpy as np\n\nN, K, Q = map(int, input().split())\nA = list(map(int, input().split()))\n\nA_args = np.argsort(A)\n\nnodeid = np.ones(N).astype("int32")\ncanput = np.ones(N)\nnodeid_dict = dict()\nnodeid_dict[1] = [0, N]\n\n# initial output\nres = A[A_args[Q-1]] - A[A_... | ['Runtime Error', 'Accepted'] | ['s702179149', 's387135447'] | [14188.0, 5792.0] | [478.0, 213.0] | [1372, 266] |
p03341 | u132434645 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['n, k, q = map(int, input().split())\na = [int(x) for x in input().split()]\nm = None\nfor x in a:\n b = []\n c = []\n for y in a:\n if y < x:\n if len(c) >= k:\n c.sort()\n b.extend(c[:len(c) - k + 1])\n c = []\n else:\n c.append(y)... | ['Runtime Error', 'Accepted'] | ['s720464906', 's257548170'] | [3064.0, 17916.0] | [17.0, 314.0] | [485, 414] |
p03341 | u135116520 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['N=int(input())\nS=input()\nDP=[0]*N\nl=0\nfor i,x in enumerate(S):\n DP[i]+=l\n if S[i]=="W":\n l+=1\nr=0\nfor j,y in enumerate(S[::-1]):\n DP[N-1-j]+=r\n if S[N-1-j]=="E":\n r+=1\nprint(min(DP))\n ', 'N=int(input())\nS=input()\nDP=[0]*N\nDP[0]=S[1:].count("E")\nfor i in range(1,N):\n if S[i]=="E"... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s100985310', 's371202988', 's594181917', 's932361115', 's869885500'] | [2940.0, 8352.0, 3672.0, 15436.0, 15456.0] | [18.0, 2104.0, 18.0, 215.0, 267.0] | [203, 188, 190, 189, 196] |
p03341 | u193264896 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["import sys\nfrom collections import Counter\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\n\ndef main():\n N = int(readline())\n S = readline().decode('utf-8')\n L = len(S)\n A = [0]*L\n for i in range(L):\n if S[i] == 'E':\n ... | ['Wrong Answer', 'Accepted'] | ['s237970782', 's691729200'] | [22300.0, 15524.0] | [273.0, 279.0] | [748, 735] |
p03341 | u215743476 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["n = int(input())\ns = input()\n\nmin_n = s[1:].count('E')\nfor i in range(1, n):\n tmp_n += s[i-1].count('W') - s[i].count('E')\n min_n = min(tmp_n, min_n)\n\nprint(min_n)", "n = int(input())\ns = input()\n\nmin_n = s[1:].count('E')\ntmp_n = min_n\nfor i in range(1, n):\n tmp_n += s[i-1].count('W') - s[i].co... | ['Runtime Error', 'Accepted'] | ['s379075166', 's624589196'] | [3672.0, 3700.0] | [19.0, 249.0] | [169, 183] |
p03341 | u218834617 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["import sys\ninput()\nd={k:0 for k in 'AC WA TLE RE'.split()}\nfor ln in sys.stdin:\n d[ln.strip()]+=1\nfor k,v in d.items():\n print(k,'x',v)\n", "N=int(input())\nS=input()\nl=0\nans=r=S.count('E')\nfor c in S:\n if c=='E': r-=1\n ans=min(ans,l+r)\n if c=='W': l+=1\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s162385533', 's446237000'] | [10092.0, 9736.0] | [29.0, 132.0] | [142, 132] |
p03341 | u222207357 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["N = int(input())\nS = input()\n\nrcost = 0\nlcost = S.count('E')\nans = lcost\n\nfor i in range(N-1):\n if S[i] == 'W':\n rcost += 1\n if S[i+1] == 'E':\n lcost -= 1\n print(rcost,lcost)\n ans = min(ans, rcost+lcost)\n \nprint(ans)", "N = int(input())\nS = input()\... | ['Wrong Answer', 'Accepted'] | ['s542948079', 's620278743'] | [7500.0, 3676.0] | [621.0, 210.0] | [269, 273] |
p03341 | u301043830 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['N = input()\nS = split(input())\n\nturns_num_list = list()\nfor i, s in enumerate(S):\n left = [S == "E" for j in S[0:j]].count()\n right = [S[j] == "W" for j in S[j+1:]].count()\n turns_num_list.append(left+right)\n\nprint(min(turns_num_list))', 'N = input()\nS = list(input())\n\nmin_num = 300000\nleft = 0\n\nfor... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s149426766', 's435658373', 's513713973', 's707006033', 's758682140', 's177439939'] | [3060.0, 8100.0, 5836.0, 6044.0, 3672.0, 5836.0] | [18.0, 2104.0, 301.0, 303.0, 18.0, 289.0] | [238, 232, 290, 255, 244, 286] |
p03341 | u314057689 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nIN = \'sample-1.in\' # sample case for local test\ndef local_test():\n try:\n from pcm.utils import set_stdin\n import sys\n if len(sys.argv) == 1:\n set_stdin(os.path.dirname(__file__) + \'/test/\' + IN)\n except:\n pass\... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s454889960', 's811402980', 's891258591', 's082282647'] | [23580.0, 3064.0, 14688.0, 17568.0] | [331.0, 18.0, 178.0, 187.0] | [1481, 484, 1481, 467] |
p03341 | u316233444 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['from itertools import accumulate\n\nN = int(input())\nS = list(input())\n\nA = [0]*(N+1) \n\n\nfor i in range(1, N+1):\n j = 0\n if S[i-1] == "W":\n j = 1\n A[i]=A[i-1] +j\n\n#print(A)\n\n\nans=N\nfor i in range(N+1):\n val = N-i +A[i] -A[N] +1\n ans = min(ans, A[i-1] +val)\n\nprint(ans)', 'from... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s386954036', 's833596925', 's201420205'] | [17740.0, 24660.0, 17484.0] | [345.0, 354.0, 328.0] | [462, 506, 462] |
p03341 | u340781749 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['8\nWWWWWEEE\n', "from itertools import accumulate\n\nn = int(input())\ns = [c == 'W' for c in input()]\nl = accumulate([0] + s[:-1])\nr = accumulate([0] + [not c for c in reversed(s[1:])])\nprint(min(e + w for e, w in zip(l, reversed(list(r)))))\n"] | ['Runtime Error', 'Accepted'] | ['s014223413', 's394904852'] | [2940.0, 24560.0] | [17.0, 104.0] | [11, 223] |
p03341 | u373047809 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['from itertools import*\n_, s = open(0)\nb, c = [([0]+list(accumulate(map(int, s[::a].translate(str.maketrans("EW","01"[::a])))))[:-1])[::a] for a in [-1,1]]\nprint(min(x+y for x, y in zip(b, c)))', 'from itertools import*\n_, s = open(0)\nprint(min(b+c for b, c in zip(*[([0]+list(accumulate(map(int, s[::a].translate(... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s385396748', 's818395809', 's939066937', 's058523230'] | [5196.0, 5196.0, 5196.0, 3676.0] | [26.0, 26.0, 26.0, 151.0] | [192, 181, 181, 84] |
p03341 | u373274281 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['N = int(input())\nA = list(map(int, input().split()))\n\nanswer = N\nfor i in range(N-1):\n v = A[i]\n for j in range(i+1, N):\n vx = v ^ A[j]\n vp = v + A[j]\n if vx == vp:\n answer += 1\n v = vx\n else:\n break\nprint(answer)\n', "N = int(input())\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s017490702', 's213392902', 's325009988'] | [3676.0, 3784.0, 65116.0] | [19.0, 19.0, 404.0] | [281, 544, 531] |
p03341 | u373295322 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['input()\nss = input()\nloss = ss[1:].count("E")\nmin_loss = loss\nss_before = ss[:-1]\nss_after = ss[1:]\nfor b, a in zip(ss_before, ss_after):\n if b == "E":\n loss -=1\n else:\n loss +=1\n if a == "W":\n loss -=1\n else:\n loss +=1\n if loss < min_loss:\n min_loss =... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s096687540', 's122901127', 's481211774', 's404549022'] | [3916.0, 2940.0, 3956.0, 3916.0] | [120.0, 17.0, 119.0, 123.0] | [341, 253, 296, 256] |
p03341 | u384679440 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['N = int(input())\nS = input()\nl_w = 0\nr_e = N\nresult = l_w + r_e\nfor i in range(1, N):\n if S[i - 1] == "W":\n l_w -= 1\n if S[i] == "E":\n r_e += 1\n result = min(result, l_w + r_e)\nprint(result)', 'N = int(input())\nS = input()\nleft = 0\nright = S[1:].count(\'E\')\nresult = left + right\nfor i in ran... | ['Wrong Answer', 'Accepted'] | ['s184889157', 's999443791'] | [3672.0, 3700.0] | [219.0, 222.0] | [199, 224] |
p03341 | u394721319 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["n = input()\ns = input()\n\nans = 0\ncount = 0\n\nfor i in s:\n if i == 'w':\n count += 1\n elif count:\n count -= 1\n ans += 1\n else:\n pass\n\n\nprint(ans)\n", "n = input()\ns = input()\n\nans = 0\ncount = 0\n\nfor i in s:\n print(i)\n if i == 'W':\n count += 1\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s538198058', 's964005587', 's757991340'] | [3672.0, 4636.0, 3700.0] | [46.0, 235.0, 68.0] | [180, 193, 180] |
p03341 | u405483159 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['A, B, C, X, Y = map( int, input().split() )\n\nif A + B > 2 * C:\n m = min( X, Y )\n print( min( 2 * C * m + ( X - m ) * A + ( Y - m ) * B, \n 2 * C * m + ( X - m ) * 2 * C + ( Y - m ) * 2 * C ) )\nelse:\n print( X * A + Y * B )', 'N = int( input() )\nS = input()\n\nR = len( S.replace("W", "") ) \nL =... | ['Runtime Error', 'Accepted'] | ['s503768371', 's206225557'] | [3060.0, 3700.0] | [17.0, 195.0] | [237, 204] |
p03341 | u415905784 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['a = int(input())\nb= [int(x) for x in input().split()]\nc = a\nfor s in range(a):\n d = b[s]\n e = b[s]\n for t in b[s+1::]:\n d = d ^ t\n e = e + t\n if d == e:\n c += 1\n else:\n break\nprint(c)', 'import functools\na = int(input())\nS = input()\nl = [0] * (a+1)\nr = [0] * (a+1)\nfor i, s i... | ['Runtime Error', 'Accepted'] | ['s569726201', 's475969064'] | [3668.0, 30312.0] | [19.0, 309.0] | [208, 309] |
p03341 | u444856278 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['from sys import stderr\nfrom functools import reduce\nfrom operator import add\ndef f(): [int(i) for i in input().split()]\ndef debug(*x): stderr.write(reduce(add,repr(x)).strip("()\',")+\'\\n\')\n\nn = int(input())\ns = list(input())\n\nlongest = {"E":(0,1),"W":(0,1)}\n# index,num of people who is E\n\ni = 0\nstate ... | ['Wrong Answer', 'Accepted'] | ['s294943104', 's371030525'] | [9188.0, 18280.0] | [2104.0, 232.0] | [1133, 527] |
p03341 | u476435125 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['n=int(input())\ns=input()\nk=n\nfor i in range(n):\n a=s[:i]\n b=s[i+1:]\n l=a.count("W")+b.count("E")\n if l<k:\n k=l\nprint(k', '\n\nn=int(input())\ns=input()\nk=0\nl=[]\nfor i in range(n):\n if s[i]=="W":\n k+=1\n l.append(k)\n#print(l)\n\n\nw=n\nfor i in range(n):\n if i==0:\n ... | ['Runtime Error', 'Accepted'] | ['s582362247', 's397336464'] | [2940.0, 15520.0] | [18.0, 258.0] | [137, 603] |
p03341 | u532502139 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ["N = int(input())\nS = input()\n_min = -1\nfor i in range(N):\n left_str = S[:i]\n right_str = S[i+1:]\n left = count('W', left_str)\n right = count('E', right_str)\n total = left + right\n if _min == -1:\n _min = total\n elif total < _min:\n _min = total\nprint(_min)\ndef count(item... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s325263929', 's723631315', 's441785955'] | [3708.0, 3828.0, 17872.0] | [19.0, 19.0, 264.0] | [422, 420, 463] |
p03341 | u536034761 | 2,000 | 1,048,576 | There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`. You will appoint one of the N people as the leader, then command the rest of the... | ['N = int(input())\nS = input()\nE = S.count("E")\nW = 0\nans = N + 1\nfor s in S:\n if s == "E":\n E -= 1\n ans = min(W + E, ans)\n if s == "W":\n W -= 1\nprint(ans)', 'N = int(input())\nS = input()\nE = S.count("E")\nW = 0\nans = N + 1\nfor s in S:\n if s == "E":\n E -= 1\n ans = m... | ['Wrong Answer', 'Accepted'] | ['s435409099', 's860502294'] | [9704.0, 9696.0] | [125.0, 125.0] | [176, 176] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.